summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@epfl.ch>2009-11-13 12:17:50 +0000
committerAdriaan Moors <adriaan.moors@epfl.ch>2009-11-13 12:17:50 +0000
commit261a8076558d98dbf1311ec6b1db6dbb10f8e9c9 (patch)
treee01c066f1e436eaae94e4ed72775c1af243332dd
parentd47dbcf17b45bb9efc28c2171a06a9c835595122 (diff)
downloadscala-261a8076558d98dbf1311ec6b1db6dbb10f8e9c9.tar.gz
scala-261a8076558d98dbf1311ec6b1db6dbb10f8e9c9.tar.bz2
scala-261a8076558d98dbf1311ec6b1db6dbb10f8e9c9.zip
fixed #1236
another Symbol::tpe bites the dust (should'be been tpeHK)
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Types.scala21
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Infer.scala2
-rw-r--r--test/files/pos/t1236.scala14
3 files changed, 26 insertions, 11 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/Types.scala b/src/compiler/scala/tools/nsc/symtab/Types.scala
index 6145c4a0d7..35afe7cf5f 100644
--- a/src/compiler/scala/tools/nsc/symtab/Types.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Types.scala
@@ -1988,16 +1988,17 @@ A type's typeSymbol should never be inspected directly.
case class AntiPolyType(pre: Type, targs: List[Type]) extends Type {
override def safeToString =
pre.toString + targs.mkString("(with type arguments ", ",", ")");
- override def memberType(sym: Symbol) = pre.memberType(sym) match {
- case PolyType(tparams, restp) =>
- restp.subst(tparams, targs)
-/* I don't think this is needed, as existential types close only over value types
- case ExistentialType(tparams, qtpe) =>
- existentialAbstraction(tparams, qtpe.memberType(sym))
-*/
- case ErrorType =>
- ErrorType
- }
+ override def memberType(sym: Symbol) = appliedType(pre.memberType(sym), targs)
+// override def memberType(sym: Symbol) = pre.memberType(sym) match {
+// case PolyType(tparams, restp) =>
+// restp.subst(tparams, targs)
+// /* I don't think this is needed, as existential types close only over value types
+// case ExistentialType(tparams, qtpe) =>
+// existentialAbstraction(tparams, qtpe.memberType(sym))
+// */
+// case ErrorType =>
+// ErrorType
+// }
override def kind = "AntiPolyType"
}
diff --git a/src/compiler/scala/tools/nsc/typechecker/Infer.scala b/src/compiler/scala/tools/nsc/typechecker/Infer.scala
index 0c3e34f8c5..69407ef0f1 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Infer.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Infer.scala
@@ -1736,7 +1736,7 @@ trait Infer {
if (sym.hasFlag(OVERLOADED)) {
val tparams = new AsSeenFromMap(pre, sym.alternatives.head.owner).mapOver(
sym.alternatives.head.typeParams)
- val bounds = tparams map (_.tpe) //@M TODO: might be affected by change to tpe in Symbol
+ val bounds = tparams map (_.tpeHK) // see e.g., #1236
val tpe =
PolyType(tparams,
OverloadedType(AntiPolyType(pre, bounds), sym.alternatives))
diff --git a/test/files/pos/t1236.scala b/test/files/pos/t1236.scala
new file mode 100644
index 0000000000..5e221ce411
--- /dev/null
+++ b/test/files/pos/t1236.scala
@@ -0,0 +1,14 @@
+trait Empty[E[_]] {
+ def e[A]: E[A]
+}
+
+object T {
+ val ListEmpty = new Empty[List] {
+ def e[A] = Nil
+ }
+
+ def foo[F[_]](q:(String,String)) = "hello"
+ def foo[F[_]](e: Empty[F]) = "world"
+
+ val x = foo[List](ListEmpty)
+} \ No newline at end of file