summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@epfl.ch>2008-11-25 13:20:52 +0000
committerAdriaan Moors <adriaan.moors@epfl.ch>2008-11-25 13:20:52 +0000
commit8aee69cc9d2253c55a86b4ca648479d878eca83a (patch)
treebfb729e8459aee7c05563dc08cd0a24680c08bb0 /src
parentdb642a40daa4c262965ddfa9aa7f8f0a47a5fc13 (diff)
downloadscala-8aee69cc9d2253c55a86b4ca648479d878eca83a.tar.gz
scala-8aee69cc9d2253c55a86b4ca648479d878eca83a.tar.bz2
scala-8aee69cc9d2253c55a86b4ca648479d878eca83a.zip
fixed #1438
solution: removed old cruft that caused problems
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index c1b58b822b..3ca63f55d9 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -2560,17 +2560,13 @@ trait Typers { self: Analyzer =>
if (phase.id <= currentRun.typerPhase.id &&
fun.symbol == Any_isInstanceOf && !targs.isEmpty)
checkCheckable(tree.pos, targs.head, "")
- val resultpe0 = restpe.instantiateTypeParams(tparams, targs)
- //println("instantiating type params "+restpe+" "+tparams+" "+targs+" = "+resultpe0)
- //@M TODO -- probably ok
- //@M example why asSeenFrom is necessary: class Foo[a] { def foo[m[x]]: m[a] } (new Foo[Int]).foo[List] : List[Int]
- //@M however, asSeenFrom widens a singleton type, thus cannot use it for those types
- // Martin to Adriaan: This is a mess in need of cleanup. For now I have simply speacial treated HK types, bit this is still wrong.
- val resultpe =
- if (resultpe0.isInstanceOf[SingletonType] || !targs.exists(_.isHigherKinded))
- resultpe0
- else
- resultpe0.asSeenFrom(prefixType(fun), fun.symbol.owner)
+ val resultpe = restpe.instantiateTypeParams(tparams, targs)
+ //@M substitution in instantiateParams needs to be careful!
+ //@M example: class Foo[a] { def foo[m[x]]: m[a] = error("") } (new Foo[Int]).foo[List] : List[Int]
+ //@M --> first, m[a] gets changed to m[Int], then m gets substituted for List,
+ // this must preserve m's type argument, so that we end up with List[Int], and not List[a]
+ //@M related bug: #1438
+ //println("instantiating type params "+restpe+" "+tparams+" "+targs+" = "+resultpe)
copy.TypeApply(tree, fun, args) setType resultpe
}
} else {