summaryrefslogtreecommitdiff
path: root/test/pending/pos/t6891.scala
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2013-01-20 01:12:58 +0100
committerJason Zaugg <jzaugg@gmail.com>2013-01-26 14:29:08 +0100
commitcff09340327ddcfd3d39aca69dfb719e7a501b5f (patch)
treeb4adee0ca1dbe08b72587656ab814ff0f4f32412 /test/pending/pos/t6891.scala
parent05ad68203a2a54973f77e8dc03757a3d0812182c (diff)
downloadscala-cff09340327ddcfd3d39aca69dfb719e7a501b5f.tar.gz
scala-cff09340327ddcfd3d39aca69dfb719e7a501b5f.tar.bz2
scala-cff09340327ddcfd3d39aca69dfb719e7a501b5f.zip
Ill-scoped reference checking in TreeCheckers
Find trees which have an info referring to an out-of-scope type parameter or local symbol, as could happen in the test for SI-6981, in which tree transplanting did not substitute symbols in symbol infos. The enclosed, pending test for that bug that will now fail under -Ycheck:extmethods -Xfatal-warnings. [Now checking: extmethods] [check: extmethods] The symbol, tpe or info of tree `(@scala.annotation.tailrec def loop(x: A): Unit = loop(x)) : (x: A)Unit` refers to a out-of-scope symbol, type A in class Foo. tree.symbol.ownerChain: method loop, method bippy$extension, object Foo, object O, package <empty>, package <root> [check: extmethods] The symbol, tpe or info of tree `(val x: A = _) : A` refers to a out-of-scope symbol, type A in class Foo. tree.symbol.ownerChain: value x, method loop, method bippy$extension, object Foo, object O, package <empty>, package <root> [check: extmethods] The symbol, tpe or info of tree `(loop(x)) : (x: A)Unit` refers to a out-of-scope symbol, type A in class Foo. tree.symbol.ownerChain: method loop, method bippy$extension, object Foo, object O, package <empty>, package <root> [check: extmethods] The symbol, tpe or info of tree `(loop) : (x: A)Unit` refers to a out-of-scope symbol, type A in class Foo. tree.symbol.ownerChain: method loop, method bippy$extension, object Foo, object O, package <empty>, package <root> [check: extmethods] The symbol, tpe or info of tree `(x) : A` refers to a out-of-scope symbol, type A in class Foo. tree.symbol.ownerChain: value x, method loop, method bippy$extension, object Foo, object O, package <empty>, package <root> [check: extmethods] The symbol, tpe or info of tree `(<synthetic> val x2: O.Foo[A] = (x1.asInstanceOf[O.Foo[A]]: O.Foo[A])) : O.Foo[A]` refers to a out-of-scope symbol, type A in class Foo. tree.symbol.ownerChain: value x2, method equals$extension, object Foo, object O, package <empty>, package <root> [check: extmethods] The symbol, tpe or info of tree `(<synthetic> val Foo$1: O.Foo[A] = x$1.asInstanceOf[O.Foo[A]]) : O.Foo[A]` refers to a out-of-scope symbol, type A in class Foo. tree.symbol.ownerChain: value Foo$1, method equals$extension, object Foo, object O, package <empty>, package <root> [check: extmethods] The symbol, tpe or info of tree `(Foo$1) : O.Foo[A]` refers to a out-of-scope symbol, type A in class Foo. tree.symbol.ownerChain: value Foo$1, method equals$extension, object Foo, object O, package <empty>, package <root> error: TreeCheckers detected non-compliant trees in t6891.scala one error found
Diffstat (limited to 'test/pending/pos/t6891.scala')
-rw-r--r--test/pending/pos/t6891.scala19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/pending/pos/t6891.scala b/test/pending/pos/t6891.scala
new file mode 100644
index 0000000000..bf79c2d293
--- /dev/null
+++ b/test/pending/pos/t6891.scala
@@ -0,0 +1,19 @@
+object O {
+ implicit class Foo[A](val value: String) extends AnyVal {
+ def bippy() = {
+ @annotation.tailrec def loop(x: A): Unit = loop(x)
+ ()
+ }
+
+ def boppy() = {
+ @annotation.tailrec def loop(x: value.type): Unit = loop(x)
+ ()
+ }
+ }
+ // uncaught exception during compilation: Types$TypeError("type mismatch;
+ // found : A(in method bippy$extension)
+ // required: A(in class Foo)") @ scala.tools.nsc.typechecker.Contexts$Context.issueCommon(Contexts.scala:396)
+ // error: scala.reflect.internal.Types$TypeError: type mismatch;
+ // found : A(in method bippy$extension)
+ // required: A(in class Foo)
+}