summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@epfl.ch>2010-07-08 15:59:23 +0000
committerAdriaan Moors <adriaan.moors@epfl.ch>2010-07-08 15:59:23 +0000
commitb54e41621999d14ba52cbe40062a624e98e47066 (patch)
tree3461fe1c531b53fa480bea257115f640561f999e
parentc9827c4a98a4d937c8e2c90efefe3059bf27366f (diff)
downloadscala-b54e41621999d14ba52cbe40062a624e98e47066.tar.gz
scala-b54e41621999d14ba52cbe40062a624e98e47066.tar.bz2
scala-b54e41621999d14ba52cbe40062a624e98e47066.zip
closes #3507: don't generate manifests where we...
closes #3507: don't generate manifests where we can't refer to the existentially bound value
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Implicits.scala2
-rw-r--r--test/files/neg/t3507.check4
-rw-r--r--test/files/neg/t3507.scala15
3 files changed, 20 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
index 3abaf4f337..4f1db5604a 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
@@ -810,7 +810,7 @@ self: Analyzer =>
def mot(tp0: Type): Tree = {
val tp1 = tp0.normalize
tp1 match {
- case ThisType(_) | SingleType(_, _) =>
+ case ThisType(_) | SingleType(_, _) if !(tp1 exists {tp => tp.typeSymbol.isExistentiallyBound}) => // can't generate a reference to a value that's abstracted over by an existential
manifestFactoryCall("singleType", tp, gen.mkAttributedQualifier(tp1))
case ConstantType(value) =>
manifestOfType(tp1.deconst, full)
diff --git a/test/files/neg/t3507.check b/test/files/neg/t3507.check
new file mode 100644
index 0000000000..1246a20d09
--- /dev/null
+++ b/test/files/neg/t3507.check
@@ -0,0 +1,4 @@
+t3507.scala:13: error: could not find implicit value for evidence parameter of type Manifest[object _1.b.c]
+ mani/*[object _1.b.c]*/(c) // kaboom in manifestOfType / TreeGen.mkAttributedQualifier
+ ^
+one error found
diff --git a/test/files/neg/t3507.scala b/test/files/neg/t3507.scala
new file mode 100644
index 0000000000..9a8c7c5462
--- /dev/null
+++ b/test/files/neg/t3507.scala
@@ -0,0 +1,15 @@
+class A {
+ object b {
+ object c
+ }
+ def m = b.c
+}
+
+object Test {
+ var a: A = new A // mutable
+ val c /*: object _1.b.c forSome { val _1: A } */ = a.m // widening using existential
+
+ def mani[T: Manifest](x: T) = ()
+ mani/*[object _1.b.c]*/(c) // kaboom in manifestOfType / TreeGen.mkAttributedQualifier
+ // --> _1 is not in scope here
+} \ No newline at end of file