summaryrefslogtreecommitdiff
path: root/test/checker-tests
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2010-09-27 19:51:27 +0000
committerPaul Phillips <paulp@improving.org>2010-09-27 19:51:27 +0000
commita56c33b6a470939a1396015972f09e19dc493245 (patch)
tree4c38946754440c8860180ccda2b1bb83eb938a3a /test/checker-tests
parentb40f4ba3221f1091f4821423f18c157907e9a3c7 (diff)
downloadscala-a56c33b6a470939a1396015972f09e19dc493245.tar.gz
scala-a56c33b6a470939a1396015972f09e19dc493245.tar.bz2
scala-a56c33b6a470939a1396015972f09e19dc493245.zip
Bringing the tree and icode checkers back to life.
build/pack/bin/scalac -d /tmp -Ycheck-debug -Ycheck:all \ src/compiler/scala/tools/nsc/Global.scala That blows up in constructors as most files do, so also try it with -Ycheck:icode to see the pretty icode output (for a little while anyway, after which it will again blow up.) Our work has only just begun! See test/checker-tests/fail*.scala for 11 examples of places where the checker cries foul. Many of them are telling us about real issues and we should listen, but I will need help to figure out which are legitimate and which should be eliminated by altering the checkers. This patch also hacks on some territory the checkers drew me into, especially TypeKinds, where I figured anything which had been commented out since 2005 was fair game. (Optional) review by dragos. (The one place I know I could use a look is in Checkers.scala, because I had to relax some checks and add at least one newer opcode.)
Diffstat (limited to 'test/checker-tests')
-rw-r--r--test/checker-tests/fail1.scala17
-rw-r--r--test/checker-tests/fail10.scala23
-rw-r--r--test/checker-tests/fail11.scala71
-rw-r--r--test/checker-tests/fail2.scala50
-rw-r--r--test/checker-tests/fail3.scala54
-rw-r--r--test/checker-tests/fail4.scala136
-rw-r--r--test/checker-tests/fail5.scala197
-rw-r--r--test/checker-tests/fail6.scala61
-rw-r--r--test/checker-tests/fail7.scala70
-rw-r--r--test/checker-tests/fail8.scala145
-rw-r--r--test/checker-tests/fail9.scala145
11 files changed, 969 insertions, 0 deletions
diff --git a/test/checker-tests/fail1.scala b/test/checker-tests/fail1.scala
new file mode 100644
index 0000000000..b70a37d9cd
--- /dev/null
+++ b/test/checker-tests/fail1.scala
@@ -0,0 +1,17 @@
+case class DebugParam[T](param: T)
+
+// TypeStack init: REFERENCE(type AnyRef)
+// [Now checking: typer]
+// [check: typer] work/fail1.scala:1: trees differ
+// old: T [Trees$Ident] (tpe = T)
+// new: T [Trees$TypeTree] (tpe = T)
+// [check: typer] work/fail1.scala:1: trees differ
+// old: DebugParam[T] [Trees$AppliedTypeTree] (tpe = null)
+// new: DebugParam[T] [Trees$TypeTree] (tpe = DebugParam[T])
+// Exception in thread "main" java.lang.NullPointerException
+// at scala.tools.nsc.typechecker.Typers$Typer.typedTypeConstructor(Typers.scala:4337)
+// at scala.tools.nsc.typechecker.Typers$Typer.typedTypeConstructor(Typers.scala:4358)
+// at scala.tools.nsc.typechecker.Typers$Typer.typedNew$1(Typers.scala:3240)
+// at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:3994)
+// at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4223)
+// at scala.tools.nsc.typechecker.TreeCheckers$TreeChecker.scala$tools$nsc$typechecker$TreeCheckers$TreeChecker$$super$typed(TreeCheckers.scala:101)
diff --git a/test/checker-tests/fail10.scala b/test/checker-tests/fail10.scala
new file mode 100644
index 0000000000..6d4e6c27c9
--- /dev/null
+++ b/test/checker-tests/fail10.scala
@@ -0,0 +1,23 @@
+class ClassCounts extends scala.collection.mutable.HashMap[Class[_], Int] { }
+
+class A {
+ def f(xs: ClassCounts) {
+ // ok
+ xs(getClass) = xs(getClass) + 1
+ // not ok
+ xs(getClass) += 1
+ }
+}
+
+// [Not checkable: parser]
+// [Not checkable: namer]
+// [Not checkable: packageobjects]
+// [Now checking: typer]
+// test/checker-tests/fail10.scala:8: error:
+// **** ERROR DURING INTERNAL CHECKING ****
+// type mismatch;
+// found : java.lang.Class[?0(in value ev$1)] where type ?0(in value ev$1)
+// required: java.lang.Class[?0(in method f)] where type ?0(in method f)
+// xs(getClass) += 1
+// ^
+// one error found
diff --git a/test/checker-tests/fail11.scala b/test/checker-tests/fail11.scala
new file mode 100644
index 0000000000..d5f619c674
--- /dev/null
+++ b/test/checker-tests/fail11.scala
@@ -0,0 +1,71 @@
+// Constructor rewriting does not preserve ordering.
+// Oddly the error is not issued without the thrown exception, even
+// though the same reordering takes place.
+class Foo(x: Int) {
+ def this(x1: Int, x2: Int) = {
+ this(x1 + x2)
+ throw new Exception
+ }
+}
+
+// Here it is at lambda lift:
+//
+// [[syntax trees at end of lambdalift]]// Scala source: fail11.scala
+// package <empty> {
+// class Foo extends java.lang.Object with ScalaObject {
+// <paramaccessor> private[this] val x: Int = _;
+// def this(x: Int): Foo = {
+// Foo.super.this();
+// ()
+// };
+// def this(x1: Int, x2: Int): Foo = {
+// Foo.this.this(x1.+(x2));
+// throw new java.lang.Exception();
+// ()
+// }
+// }
+// }
+
+//
+// % scalac -d /tmp -Xprint:constr -Ycheck-debug -Ycheck:all test/checker-tests/fail11.scala
+//
+// TypeStack init: REFERENCE(type AnyRef)
+// [Not checkable: parser]
+// [Not checkable: namer]
+// [Not checkable: packageobjects]
+// [Now checking: typer]
+// [Now checking: superaccessors]
+// [Now checking: pickler]
+// [Now checking: refchecks]
+// [Now checking: selectiveanf]
+// [Now checking: liftcode]
+// [Now checking: selectivecps]
+// [Now checking: uncurry]
+// [Now checking: tailcalls]
+// [Not checkable: specialize]
+// [Not checkable: explicitouter]
+// [Now checking: erasure]
+// [Now checking: lazyvals]
+// [Now checking: lambdalift]
+// [[syntax trees at end of constructors]]// Scala source: fail11.scala
+// package <empty> {
+// class Foo extends java.lang.Object with ScalaObject {
+// def this(x1: Int, x2: Int): Foo = {
+// Foo.this.this(x1.+(x2));
+// throw new java.lang.Exception();
+// ()
+// };
+// def this(x: Int): Foo = {
+// Foo.super.this();
+// ()
+// }
+// }
+// }
+//
+// [Now checking: constructors]
+// test/checker-tests/fail11.scala:4: error:
+// **** ERROR DURING INTERNAL CHECKING ****
+// called constructor's definition must precede calling constructor's definition
+// this(x1 + x2)
+// ^
+// one error found
diff --git a/test/checker-tests/fail2.scala b/test/checker-tests/fail2.scala
new file mode 100644
index 0000000000..0f0d83aeb2
--- /dev/null
+++ b/test/checker-tests/fail2.scala
@@ -0,0 +1,50 @@
+// CC#9248 is conspicuously absent from the printed trees at every phase.
+class A {
+ def f[A, CC[X] <: Traversable[X]](): Unit = ()
+}
+
+// % work/check all -uniqid -Xprint:typer work/fail2.scala
+//
+// TypeStack init: REFERENCE(type AnyRef#2783)
+// [Not checkable: parser]
+// [Not checkable: namer]
+// [Not checkable: packageobjects]
+// [[syntax trees at end of typer]]// Scala source: fail2.scala
+// package <empty>#3 {
+// class A#9239 extends java.lang.Object#2488 with ScalaObject#1481 {
+// def this#9243(): A#9239 = {
+// A#9239.super.this#5850();
+// ()
+// };
+// def f#9244[A#9245 >: Nothing#5846 <: Any#46, CC#9246[X#11055 >: Nothing#5846 <: Any#46] >: [X#11055]Nothing#5846 <: [X#11055]Traversable#3199[X#11055]](): Unit#3819 = ()
+// }
+// }
+//
+// [Now checking: typer]
+// [check: typer] work/fail2.scala:3: Expected owner type CC#9248, found type CC#9246: Trees$TypeDef / type X#11055>: Nothing#5846 <: Any#46
+// [Now checking: superaccessors]
+// [check: superaccessors] work/fail2.scala:3: Expected owner type CC#9248, found type CC#9246: Trees$TypeDef / type X#11055>: Nothing#5846 <: Any#46
+// [Now checking: pickler]
+// [check: pickler] work/fail2.scala:3: Expected owner type CC#9248, found type CC#9246: Trees$TypeDef / type X#11055>: Nothing#5846 <: Any#46
+// [Now checking: refchecks]
+// [check: refchecks] work/fail2.scala:3: Expected owner type CC#9248, found type CC#9246: Trees$TypeDef / type X#11055>: Nothing#5846 <: Any#46
+// [Now checking: selectiveanf]
+// [check: selectiveanf] work/fail2.scala:3: Expected owner type CC#9248, found type CC#9246: Trees$TypeDef / type X#11055>: Nothing#5846 <: Any#46
+// [Now checking: liftcode]
+// [check: liftcode] work/fail2.scala:3: Expected owner type CC#9248, found type CC#9246: Trees$TypeDef / type X#11055>: Nothing#5846 <: Any#46
+// [Now checking: selectivecps]
+// [check: selectivecps] work/fail2.scala:3: Expected owner type CC#9248, found type CC#9246: Trees$TypeDef / type X#11055>: Nothing#5846 <: Any#46
+// [Now checking: uncurry]
+// [check: uncurry] work/fail2.scala:3: Expected owner type CC#9248, found type CC#9246: Trees$TypeDef / type X#11055>: Nothing#5846 <: Any#46
+// [Now checking: tailcalls]
+// [check: tailcalls] work/fail2.scala:3: Expected owner type CC#9248, found type CC#9246: Trees$TypeDef / type X#11055>: Nothing#5846 <: Any#46
+// [Not checkable: specialize]
+// [Not checkable: explicitouter]
+// [Now checking: erasure]
+// [Now checking: lazyvals]
+// [Now checking: lambdalift]
+// [Now checking: constructors]
+// [Now checking: flatten]
+// [Now checking: mixin]
+// [Now checking: cleanup]
+// ... \ No newline at end of file
diff --git a/test/checker-tests/fail3.scala b/test/checker-tests/fail3.scala
new file mode 100644
index 0000000000..8eacc25473
--- /dev/null
+++ b/test/checker-tests/fail3.scala
@@ -0,0 +1,54 @@
+object Obby {
+ val Set = scala.collection.immutable.Set
+}
+
+// % work/check all -uniqid -Xprint:constructors work/fail3.scala
+// TypeStack init: REFERENCE(type AnyRef#2783)
+// [Not checkable: parser]
+// [Not checkable: namer]
+// [Not checkable: packageobjects]
+// [Now checking: typer]
+// [Now checking: superaccessors]
+// [Now checking: pickler]
+// [Now checking: refchecks]
+// [Now checking: selectiveanf]
+// [Now checking: liftcode]
+// [Now checking: selectivecps]
+// [Now checking: uncurry]
+// [Now checking: tailcalls]
+// [Not checkable: specialize]
+// [Not checkable: explicitouter]
+// [Now checking: erasure]
+// [Now checking: lazyvals]
+// [Now checking: lambdalift]
+// [[syntax trees at end of constructors]]// Scala source: fail3.scala
+// package <empty>#3 {
+// final class Obby#9240 extends java.lang.Object#2488 with ScalaObject#1481 {
+// private[this] val Set#9246: object scala.collection.immutable.Set#9713 = _;
+// <stable> <accessor> def Set#9245(): object scala.collection.immutable.Set#9713 = Obby#9240.this.Set#9246;
+// def this#9244(): object Obby#9240 = {
+// Obby#9240.super.this#5850();
+// Obby#9240.this.Set#9246 = scala#23.collection#2221.immutable#8875.Set#9712;
+// ()
+// }
+// }
+// }
+//
+// [Now checking: constructors]
+// work/fail3.scala:2: error:
+// **** ERROR DURING INTERNAL CHECKING ****
+// value Set#9246 in object Obby#9240 cannot be accessed in object Obby#9240
+// because of an internal error (no accessible symbol):
+// sym = value Set#9246
+// underlying(sym) = value Set#9246
+// pre = object Obby#9240
+// site = Obby#9240.this
+// tree = Obby#9240.this.Set#9246
+// sym.accessBoundary(sym.owner) = object Obby#9240
+// sym.ownerChain = List(value Set#9246, object Obby#9240, package <empty>#4, package <root>#2)
+// sym.owner.thisType = object Obby#9240
+// context.owner = package <empty>#4
+// context.outer.enclClass.owner = package <empty>#4
+// val Set = scala.collection.immutable.Set
+// ^
+// one error found
diff --git a/test/checker-tests/fail4.scala b/test/checker-tests/fail4.scala
new file mode 100644
index 0000000000..7bf44617f9
--- /dev/null
+++ b/test/checker-tests/fail4.scala
@@ -0,0 +1,136 @@
+// Incompatible stacks in icode: BoxedUnit vs. empty.
+class Classy {
+ def f(b: Boolean): Unit = synchronized {
+ if (b) ()
+ }
+}
+
+// % work/check all -Xprint:icode work/fail4.scala
+// TypeStack init: REFERENCE(type AnyRef)
+// [Not checkable: parser]
+// [Not checkable: namer]
+// [Not checkable: packageobjects]
+// [Now checking: typer]
+// [Now checking: superaccessors]
+// [Now checking: pickler]
+// [Now checking: refchecks]
+// [Now checking: selectiveanf]
+// [Now checking: liftcode]
+// [Now checking: selectivecps]
+// [Now checking: uncurry]
+// [Now checking: tailcalls]
+// [Not checkable: specialize]
+// [Not checkable: explicitouter]
+// [Now checking: erasure]
+// [Now checking: lazyvals]
+// [Now checking: lambdalift]
+// [Now checking: constructors]
+// [Now checking: flatten]
+// [Now checking: mixin]
+// [Now checking: cleanup]
+// [[syntax trees at end of icode]]// Scala source: fail4.scala
+// package <empty> {
+// class Classy extends java.lang.Object with ScalaObject {
+// def f(b: Boolean): Unit = {
+// Classy.this.synchronized(if (b)
+// scala.runtime.BoxedUnit.UNIT
+// else
+// scala.runtime.BoxedUnit.UNIT);
+// ()
+// };
+// def this(): Classy = {
+// Classy.super.this();
+// ()
+// }
+// }
+// }
+//
+// [Now checking: icode]
+//
+// ** Checking class Classy
+//
+// ** Checking method Classy.f
+// ** Checking Block 1 [S: 4, 3] [P: N/A]
+// 1-> REFERENCE(class Classy)
+// 0<- REFERENCE(class Classy)
+// 1-> REFERENCE(class Classy)
+// 2-> REFERENCE(class Classy)
+// 1<- REFERENCE(class Classy)
+// 0<- REFERENCE(class Classy)
+// Output changed for Block 1 [S: 4, 3] [P: N/A]
+// ** Checking Block 4 [S: 3, 6, 5] [P: 1]
+// 1-> BOOL
+// 0<- BOOL
+// Output changed for Block 4 [S: 3, 6, 5] [P: 1]
+// ** Checking Block 3 [S: N/A] [P: 1, 4, 5, 6, 7]
+// 1-> REFERENCE(class Throwable)
+// 2-> REFERENCE(class Object)
+// 1<- REFERENCE(class Object)
+// 0<- REFERENCE(class Throwable)
+// 1-> REFERENCE(trait Nothing)
+// ** Checking Block 6 [S: 3, 7] [P: 4]
+// 1-> REFERENCE(class BoxedUnit)
+// Output changed for Block 6 [S: 3, 7] [P: 4]
+// ** Checking Block 5 [S: 3, 7] [P: 4]
+// 1-> REFERENCE(class BoxedUnit)
+// Output changed for Block 5 [S: 3, 7] [P: 4]
+// Checker created new stack: (List(REFERENCE(class BoxedUnit)), List(REFERENCE(class BoxedUnit))) => List(REFERENCE(class BoxedUnit))
+// TypeStack init: REFERENCE(class BoxedUnit)
+// Checker created new stack: (List(REFERENCE(class BoxedUnit)), List(REFERENCE(class BoxedUnit))) => List(REFERENCE(class BoxedUnit))
+// TypeStack init: REFERENCE(class BoxedUnit)
+// Checker created new stack: (List(REFERENCE(class BoxedUnit)), List(REFERENCE(class BoxedUnit))) => List(REFERENCE(class BoxedUnit))
+// TypeStack init: REFERENCE(class BoxedUnit)
+// ** Checking Block 3 [S: N/A] [P: 1, 4, 5, 6, 7] with initial stack [REFERENCE(class BoxedUnit)]
+// TypeStack init: REFERENCE(class BoxedUnit)
+// 0<- REFERENCE(class BoxedUnit)
+// 1-> REFERENCE(class Throwable)
+// 2-> REFERENCE(class Object)
+// 1<- REFERENCE(class Object)
+// 0<- REFERENCE(class Throwable)
+// 1-> REFERENCE(trait Nothing)
+// ** Checking Block 7 [S: 3, 2] [P: 5, 6] with initial stack [REFERENCE(class BoxedUnit)]
+// TypeStack init: REFERENCE(class BoxedUnit)
+// 0<- REFERENCE(class BoxedUnit)
+// 1-> REFERENCE(class Object)
+// 0<- REFERENCE(class Object)
+// Output changed for Block 7 [S: 3, 2] [P: 5, 6]
+// Checker created new stack: (List(REFERENCE(class BoxedUnit)), List(REFERENCE(class BoxedUnit))) => List(REFERENCE(class BoxedUnit))
+// TypeStack init: REFERENCE(class BoxedUnit)
+// Exception in thread "main" scala.tools.nsc.backend.icode.CheckerException: Incompatible stacks: TypeStack(1 elems) {
+// REFERENCE(class BoxedUnit)
+// } and TypeStack() in Classy.f at entry to block: 3
+// at scala.tools.nsc.backend.icode.Checkers$ICodeChecker.meet2$1(Checkers.scala:165)
+// at scala.tools.nsc.backend.icode.Checkers$ICodeChecker$$anonfun$meet$2.apply(Checkers.scala:174)
+// at scala.tools.nsc.backend.icode.Checkers$ICodeChecker$$anonfun$meet$2.apply(Checkers.scala:174)
+// at scala.collection.LinearSeqOptimized$class.foldLeft(LinearSeqOptimized.scala:123)
+// at scala.collection.immutable.List.foldLeft(List.scala:45)
+// at scala.collection.LinearSeqOptimized$class.reduceLeft(LinearSeqOptimized.scala:137)
+// at scala.collection.immutable.List.reduceLeft(List.scala:45)
+// at scala.tools.nsc.backend.icode.Checkers$ICodeChecker.meet(Checkers.scala:174)
+// at scala.tools.nsc.backend.icode.Checkers$ICodeChecker$$anonfun$check$5.apply(Checkers.scala:140)
+// at scala.tools.nsc.backend.icode.Checkers$ICodeChecker$$anonfun$check$5.apply(Checkers.scala:140)
+// at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:61)
+// at scala.collection.immutable.List.foreach(List.scala:45)
+// at scala.tools.nsc.backend.icode.Checkers$ICodeChecker.check(Checkers.scala:140)
+// at scala.tools.nsc.backend.icode.Checkers$ICodeChecker.check(Checkers.scala:110)
+// at scala.tools.nsc.backend.icode.Checkers$ICodeChecker$$anonfun$check$3.apply(Checkers.scala:103)
+// at scala.tools.nsc.backend.icode.Checkers$ICodeChecker$$anonfun$check$3.apply(Checkers.scala:103)
+// at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:61)
+// at scala.collection.immutable.List.foreach(List.scala:45)
+// at scala.tools.nsc.backend.icode.Checkers$ICodeChecker.check(Checkers.scala:103)
+// at scala.tools.nsc.backend.icode.Checkers$ICodeChecker$$anonfun$checkICodes$1.apply(Checkers.scala:81)
+// at scala.tools.nsc.backend.icode.Checkers$ICodeChecker$$anonfun$checkICodes$1.apply(Checkers.scala:81)
+// at scala.collection.mutable.HashMap$$anon$2$$anonfun$foreach$3.apply(HashMap.scala:89)
+// at scala.collection.mutable.HashMap$$anon$2$$anonfun$foreach$3.apply(HashMap.scala:89)
+// at scala.collection.Iterator$class.foreach(Iterator.scala:631)
+// at scala.collection.mutable.HashTable$$anon$1.foreach(HashTable.scala:161)
+// at scala.collection.mutable.HashTable$class.foreachEntry(HashTable.scala:194)
+// at scala.collection.mutable.HashMap.foreachEntry(HashMap.scala:39)
+// at scala.collection.mutable.HashMap$$anon$2.foreach(HashMap.scala:89)
+// at scala.tools.nsc.backend.icode.Checkers$ICodeChecker.checkICodes(Checkers.scala:81)
+// at scala.tools.nsc.Global$Run.compileSources(Global.scala:759)
+// at scala.tools.nsc.Global$Run.compile(Global.scala:823)
+// at scala.tools.nsc.Main$.process(Main.scala:106)
+// at scala.tools.nsc.Main$.main(Main.scala:120)
+// at scala.tools.nsc.Main.main(Main.scala)
+// [paulp@leaf trunk (check-all)]$
diff --git a/test/checker-tests/fail5.scala b/test/checker-tests/fail5.scala
new file mode 100644
index 0000000000..b821dc79f9
--- /dev/null
+++ b/test/checker-tests/fail5.scala
@@ -0,0 +1,197 @@
+// Incompatible stacks in icode: BooleanRef vs. empty.
+// This may be the same issue as fail4.scala, with the synchronized
+// block being introduced in the rewriting.
+class Crashy {
+ def go(x1: Int) = {
+ lazy val x2 = x1 < 0
+
+ x2
+ }
+}
+
+// % work/check all -Xprint:icode work/fail5.scala
+// TypeStack init: REFERENCE(type AnyRef)
+// [Not checkable: parser]
+// [Not checkable: namer]
+// [Not checkable: packageobjects]
+// [Now checking: typer]
+// [Now checking: superaccessors]
+// [Now checking: pickler]
+// [Now checking: refchecks]
+// [Now checking: selectiveanf]
+// [Now checking: liftcode]
+// [Now checking: selectivecps]
+// [Now checking: uncurry]
+// [Now checking: tailcalls]
+// [Not checkable: specialize]
+// [Not checkable: explicitouter]
+// [Now checking: erasure]
+// [Now checking: lazyvals]
+// [Now checking: lambdalift]
+// [check: lambdalift] NoPosition: Apply arguments to new scala.runtime.BooleanRef contains an empty tree: List(<empty>)
+// [Now checking: constructors]
+// [check: constructors] NoPosition: Apply arguments to new scala.runtime.BooleanRef contains an empty tree: List(<empty>)
+// [Now checking: flatten]
+// [check: flatten] NoPosition: Apply arguments to new scala.runtime.BooleanRef contains an empty tree: List(<empty>)
+// [Now checking: mixin]
+// [check: mixin] NoPosition: Apply arguments to new scala.runtime.BooleanRef contains an empty tree: List(<empty>)
+// [Now checking: cleanup]
+// [[syntax trees at end of icode]]// Scala source: fail5.scala
+// package <empty> {
+// class Crashy extends java.lang.Object with ScalaObject {
+// def go(x1$1: Int): Boolean = {
+// @volatile var bitmap$0$1: scala.runtime.VolatileIntRef = new scala.runtime.VolatileIntRef(0);
+// lazy var x2$lzy$1: scala.runtime.BooleanRef = new scala.runtime.BooleanRef(<empty>);
+// Crashy.this.x2$1(x1$1, x2$lzy$1, bitmap$0$1)
+// };
+// final <stable> private[this] def x2$1(x1$1: Int, x2$lzy$1: scala.runtime.BooleanRef, bitmap$0$1: scala.runtime.VolatileIntRef): Boolean = {
+// if (bitmap$0$1.elem.&(1).==(0))
+// {
+// Crashy.this.synchronized({
+// if (bitmap$0$1.elem.&(1).==(0))
+// {
+// x2$lzy$1.elem = x1$1.<(0);
+// bitmap$0$1.elem = bitmap$0$1.elem.|(1);
+// ()
+// };
+// scala.runtime.BoxedUnit.UNIT
+// });
+// ()
+// };
+// x2$lzy$1.elem
+// };
+// def this(): Crashy = {
+// Crashy.super.this();
+// ()
+// }
+// }
+// }
+//
+// [Now checking: icode]
+//
+// ** Checking class Crashy
+//
+// ** Checking method Crashy.go
+// ** Checking Block 1 [S: N/A] [P: N/A]
+// 1-> REFERENCE(class VolatileIntRef)
+// 0<- REFERENCE(class VolatileIntRef)
+// 1-> REFERENCE(class VolatileIntRef)
+// 2-> REFERENCE(class VolatileIntRef)
+// 3-> INT
+// 2<- INT
+// 1<- REFERENCE(class VolatileIntRef)
+// 0<- REFERENCE(class VolatileIntRef)
+// 1-> REFERENCE(class BooleanRef)
+// 0<- REFERENCE(class BooleanRef)
+// 1-> REFERENCE(class BooleanRef)
+// 2-> REFERENCE(class BooleanRef)
+// 3-> BOOL
+// 2<- BOOL
+// 1<- REFERENCE(class BooleanRef)
+// 0<- REFERENCE(class BooleanRef)
+// 1-> REFERENCE(class Crashy)
+// 2-> INT
+// 3-> REFERENCE(class BooleanRef)
+// 4-> REFERENCE(class VolatileIntRef)
+// 3<- REFERENCE(class VolatileIntRef)
+// 2<- REFERENCE(class BooleanRef)
+// 1<- INT
+// 0<- REFERENCE(class Crashy)
+// 1-> BOOL
+// 0<- BOOL
+//
+// ** Checking method Crashy.x2$1
+// ** Checking Block 1 [S: 4, 2] [P: N/A]
+// 1-> REFERENCE(class VolatileIntRef)
+// 0<- REFERENCE(class VolatileIntRef)
+// 1-> INT
+// 2-> INT
+// 1<- INT
+// 0<- INT
+// 1-> INT
+// 2-> INT
+// 1<- INT
+// 0<- INT
+// Output changed for Block 1 [S: 4, 2] [P: N/A]
+// ** Checking Block 4 [S: N/A] [P: 1, 10]
+// 1-> REFERENCE(class BooleanRef)
+// 0<- REFERENCE(class BooleanRef)
+// 1-> BOOL
+// 0<- BOOL
+// ** Checking Block 2 [S: 7, 6] [P: 1]
+// 1-> REFERENCE(class Crashy)
+// 0<- REFERENCE(class Crashy)
+// 1-> REFERENCE(class Crashy)
+// 2-> REFERENCE(class Crashy)
+// 1<- REFERENCE(class Crashy)
+// 0<- REFERENCE(class Crashy)
+// Output changed for Block 2 [S: 7, 6] [P: 1]
+// ** Checking Block 7 [S: 6, 10, 8] [P: 2]
+// 1-> REFERENCE(class VolatileIntRef)
+// 0<- REFERENCE(class VolatileIntRef)
+// 1-> INT
+// 2-> INT
+// 1<- INT
+// 0<- INT
+// 1-> INT
+// 2-> INT
+// 1<- INT
+// 0<- INT
+// Output changed for Block 7 [S: 6, 10, 8] [P: 2]
+// ** Checking Block 6 [S: N/A] [P: 2, 7, 8, 10, 11, 12, 13]
+// 1-> REFERENCE(class Throwable)
+// 2-> REFERENCE(class Object)
+// 1<- REFERENCE(class Object)
+// 0<- REFERENCE(class Throwable)
+// 1-> REFERENCE(trait Nothing)
+// ** Checking Block 10 [S: 6, 4] [P: 7, 13]
+// 1-> REFERENCE(class BoxedUnit)
+// 0<- REFERENCE(class BoxedUnit)
+// 1-> REFERENCE(class Object)
+// 0<- REFERENCE(class Object)
+// Output changed for Block 10 [S: 6, 4] [P: 7, 13]
+// ** Checking Block 8 [S: 6, 12, 11] [P: 7]
+// 1-> REFERENCE(class BooleanRef)
+// 2-> INT
+// 3-> INT
+// 2<- INT
+// 1<- INT
+// Output changed for Block 8 [S: 6, 12, 11] [P: 7]
+// Exception in thread "main" scala.tools.nsc.backend.icode.CheckerException: Incompatible stacks: TypeStack(1 elems) {
+// REFERENCE(class BooleanRef)
+// } and TypeStack() in Crashy.x2$1 at entry to block: 6
+// at scala.tools.nsc.backend.icode.Checkers$ICodeChecker.meet2$1(Checkers.scala:165)
+// at scala.tools.nsc.backend.icode.Checkers$ICodeChecker$$anonfun$meet$2.apply(Checkers.scala:174)
+// at scala.tools.nsc.backend.icode.Checkers$ICodeChecker$$anonfun$meet$2.apply(Checkers.scala:174)
+// at scala.collection.LinearSeqOptimized$class.foldLeft(LinearSeqOptimized.scala:123)
+// at scala.collection.immutable.List.foldLeft(List.scala:45)
+// at scala.collection.LinearSeqOptimized$class.reduceLeft(LinearSeqOptimized.scala:137)
+// at scala.collection.immutable.List.reduceLeft(List.scala:45)
+// at scala.tools.nsc.backend.icode.Checkers$ICodeChecker.meet(Checkers.scala:174)
+// at scala.tools.nsc.backend.icode.Checkers$ICodeChecker$$anonfun$check$5.apply(Checkers.scala:140)
+// at scala.tools.nsc.backend.icode.Checkers$ICodeChecker$$anonfun$check$5.apply(Checkers.scala:140)
+// at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:61)
+// at scala.collection.immutable.List.foreach(List.scala:45)
+// at scala.tools.nsc.backend.icode.Checkers$ICodeChecker.check(Checkers.scala:140)
+// at scala.tools.nsc.backend.icode.Checkers$ICodeChecker.check(Checkers.scala:110)
+// at scala.tools.nsc.backend.icode.Checkers$ICodeChecker$$anonfun$check$3.apply(Checkers.scala:103)
+// at scala.tools.nsc.backend.icode.Checkers$ICodeChecker$$anonfun$check$3.apply(Checkers.scala:103)
+// at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:61)
+// at scala.collection.immutable.List.foreach(List.scala:45)
+// at scala.tools.nsc.backend.icode.Checkers$ICodeChecker.check(Checkers.scala:103)
+// at scala.tools.nsc.backend.icode.Checkers$ICodeChecker$$anonfun$checkICodes$1.apply(Checkers.scala:81)
+// at scala.tools.nsc.backend.icode.Checkers$ICodeChecker$$anonfun$checkICodes$1.apply(Checkers.scala:81)
+// at scala.collection.mutable.HashMap$$anon$2$$anonfun$foreach$3.apply(HashMap.scala:89)
+// at scala.collection.mutable.HashMap$$anon$2$$anonfun$foreach$3.apply(HashMap.scala:89)
+// at scala.collection.Iterator$class.foreach(Iterator.scala:631)
+// at scala.collection.mutable.HashTable$$anon$1.foreach(HashTable.scala:161)
+// at scala.collection.mutable.HashTable$class.foreachEntry(HashTable.scala:194)
+// at scala.collection.mutable.HashMap.foreachEntry(HashMap.scala:39)
+// at scala.collection.mutable.HashMap$$anon$2.foreach(HashMap.scala:89)
+// at scala.tools.nsc.backend.icode.Checkers$ICodeChecker.checkICodes(Checkers.scala:81)
+// at scala.tools.nsc.Global$Run.compileSources(Global.scala:759)
+// at scala.tools.nsc.Global$Run.compile(Global.scala:823)
+// at scala.tools.nsc.Main$.process(Main.scala:106)
+// at scala.tools.nsc.Main$.main(Main.scala:120)
+// at scala.tools.nsc.Main.main(Main.scala)
+// [paulp@leaf trunk (check-all)]$
diff --git a/test/checker-tests/fail6.scala b/test/checker-tests/fail6.scala
new file mode 100644
index 0000000000..c59be55c4e
--- /dev/null
+++ b/test/checker-tests/fail6.scala
@@ -0,0 +1,61 @@
+// BoxedUnit/Unit confusion involving while.
+//
+// Apply( // sym=method while$1, tpe=Unit, tpe.sym=class Unit, tpe.sym.owner=package scala
+// Ident("while$1"), // sym=method while$1, sym.owner=method f, sym.tpe=()Unit, tpe=()Unit, tpe.sym=<none>,
+class Erasure {
+ def f(b: Boolean) = {
+ if (b) "abc"
+ else while (b) ()
+ }
+}
+
+// % work/check all -Xprint:erasure work/fail6.scala
+// TypeStack init: REFERENCE(type AnyRef)
+// [Not checkable: parser]
+// [Not checkable: namer]
+// [Not checkable: packageobjects]
+// [Now checking: typer]
+// [Now checking: superaccessors]
+// [Now checking: pickler]
+// [Now checking: refchecks]
+// [Now checking: selectiveanf]
+// [Now checking: liftcode]
+// [Now checking: selectivecps]
+// [Now checking: uncurry]
+// [Now checking: tailcalls]
+// [Not checkable: specialize]
+// [Not checkable: explicitouter]
+// [[syntax trees at end of erasure]]// Scala source: fail6.scala
+// package <empty> {
+// class Erasure extends java.lang.Object with ScalaObject {
+// def this(): Erasure = {
+// Erasure.super.this();
+// ()
+// };
+// def f(b: Boolean): java.lang.Object = if (b)
+// "abc"
+// else
+// while$1(){
+// if (b)
+// {
+// ();
+// while$1()
+// }
+// else
+// ();
+// scala.runtime.BoxedUnit.UNIT
+// }
+// }
+// }
+//
+// [Now checking: erasure]
+// work/fail6.scala:4: error:
+// **** ERROR DURING INTERNAL CHECKING ****
+// type mismatch;
+// found : scala.runtime.BoxedUnit
+// required: Unit
+// else while (b) ()
+// ^
+// one error found
+//
+//
diff --git a/test/checker-tests/fail7.scala b/test/checker-tests/fail7.scala
new file mode 100644
index 0000000000..1ffb745e0b
--- /dev/null
+++ b/test/checker-tests/fail7.scala
@@ -0,0 +1,70 @@
+case class Foo(x: Int)
+
+// 1) Checking typer specifically:
+//
+// [Now checking: typer]
+// work/fail7.scala:1: error: double definition:
+// method canEqual:(x$1: Any)Boolean and
+// method canEqual:(x$1: Any)Boolean at line 1
+// have same type
+// case class Foo(x: Int)
+// ^
+//
+// 2) Checking all, which somehow misses it until superaccessors:
+//
+// [Not checkable: parser]
+// [Not checkable: namer]
+// [Not checkable: packageobjects]
+// [Now checking: typer]
+// [Now checking: superaccessors]
+// work/fail7.scala:1: error:
+// **** ERROR DURING INTERNAL CHECKING ****
+// method canEqual is defined twice
+// case class Foo(x: Int)
+// ^
+// one error found
+//
+// 3) Checking uncurry:
+//
+// [Now checking: uncurry]
+// work/fail7.scala:1: error: double definition:
+// method canEqual:(x$1: Any)Boolean and
+// method canEqual:(x$1: Any)Boolean at line 1
+// have same type
+// case class Foo(x: Int)
+// ^
+// exception when typing Foo.this.productArity()
+// Foo.this.productArity of type Int does not take parameters in file work/fail7.scala
+// scala.tools.nsc.symtab.Types$TypeError: Foo.this.productArity of type Int does not take parameters
+// at scala.tools.nsc.typechecker.Contexts$Context.error(Contexts.scala:277)
+// at scala.tools.nsc.typechecker.Infer$Inferencer.error(Infer.scala:205)
+// at scala.tools.nsc.typechecker.Infer$Inferencer.errorTree(Infer.scala:209)
+// at scala.tools.nsc.typechecker.Typers$Typer.doTypedApply(Typers.scala:2632)
+// at scala.tools.nsc.typechecker.Typers$Typer.typedApply$1(Typers.scala:3400)
+// at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:4069)
+// at scala.tools.nsc.transform.Erasure$Eraser.liftedTree1$1(Erasure.scala:663)
+// at scala.tools.nsc.transform.Erasure$Eraser.typed1(Erasure.scala:662)
+// at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4223)
+// at scala.tools.nsc.typechecker.Typers$Typer.transformedOrTyped(Typers.scala:4368)
+// at scala.tools.nsc.typechecker.Typers$Typer.typedDefDef(Typers.scala:1796)
+//
+// 4) Checking constructors:
+//
+// [Now checking: constructors]
+// work/fail7.scala:1: error:
+// **** ERROR DURING INTERNAL CHECKING ****
+// value x in class Foo cannot be accessed in Foo
+// because of an internal error (no accessible symbol):
+// sym = value x
+// underlying(sym) = value x
+// pre = Foo
+// site = Foo.this
+// tree = Foo.this.x
+// sym.accessBoundary(sym.owner) = class Foo
+// sym.ownerChain = List(value x, class Foo, package <empty>, package <root>)
+// sym.owner.thisType = Foo
+// context.owner = package <empty>
+// context.outer.enclClass.owner = package <empty>
+// case class Foo(x: Int)
+// ^
+// one error found
diff --git a/test/checker-tests/fail8.scala b/test/checker-tests/fail8.scala
new file mode 100644
index 0000000000..d64e6e7bcc
--- /dev/null
+++ b/test/checker-tests/fail8.scala
@@ -0,0 +1,145 @@
+// reverse of fail9
+class Ding {
+ private val x1 = 1
+ private def x2 = 2
+ private lazy val x3 = 3
+ private[Ding] val x4 = 4
+ private[Ding] val x5 = 5
+ private[Ding] val x6 = 6
+}
+
+object Ding {
+ def y1 = new Ding x1
+ def y2 = new Ding x2
+ def y3 = new Ding x3
+ def y4 = new Ding x4
+ def y5 = new Ding x5
+ def y6 = new Ding x6
+}
+
+// % work/check all -Xprint:constru work/fail8.scala
+//
+// TypeStack init: REFERENCE(type AnyRef)
+// [Not checkable: parser]
+// [Not checkable: namer]
+// [Not checkable: packageobjects]
+// [Now checking: typer]
+// [Now checking: superaccessors]
+// [Now checking: pickler]
+// [Now checking: refchecks]
+// [Now checking: selectiveanf]
+// [Now checking: liftcode]
+// [Now checking: selectivecps]
+// [Now checking: uncurry]
+// [Now checking: tailcalls]
+// [Not checkable: specialize]
+// [Not checkable: explicitouter]
+// [Now checking: erasure]
+// [Now checking: lazyvals]
+// [Now checking: lambdalift]
+// [[syntax trees at end of constructors]]// Scala source: fail8.scala
+// package <empty> {
+// class Ding extends java.lang.Object with ScalaObject {
+// private[this] val Ding$$x1: Int = _;
+// final <stable> <accessor> def Ding$$x1(): Int = Ding.this.Ding$$x1;
+// final def Ding$$x2(): Int = 2;
+// lazy private[this] var Ding$$x3: Int = _;
+// final <stable> <accessor> lazy def Ding$$x3(): Int = {
+// Ding.this.Ding$$x3 = 3;
+// Ding.this.Ding$$x3
+// };
+// private[this] val Ding$$x4: Int = _;
+// <stable> <accessor> private[Ding] def Ding$$x4(): Int = Ding.this.Ding$$x4;
+// private[this] val Ding$$x5: Int = _;
+// <stable> <accessor> private[Ding] def Ding$$x5(): Int = Ding.this.Ding$$x5;
+// private[this] val Ding$$x6: Int = _;
+// <stable> <accessor> private[Ding] def Ding$$x6(): Int = Ding.this.Ding$$x6;
+// def this(): Ding = {
+// Ding.super.this();
+// Ding.this.Ding$$x1 = 1;
+// Ding.this.Ding$$x4 = 4;
+// Ding.this.Ding$$x5 = 5;
+// Ding.this.Ding$$x6 = 6;
+// ()
+// }
+// };
+// final class Ding extends java.lang.Object with ScalaObject {
+// def y1(): Int = new Ding().Ding$$x1();
+// def y2(): Int = new Ding().Ding$$x2();
+// def y3(): Int = new Ding().Ding$$x3();
+// def y4(): Int = new Ding().Ding$$x4();
+// def y5(): Int = new Ding().Ding$$x5();
+// def y6(): Int = new Ding().Ding$$x6();
+// def this(): object Ding = {
+// Ding.super.this();
+// ()
+// }
+// }
+// }
+//
+// [Now checking: constructors]
+// work/fail8.scala:3: error:
+// **** ERROR DURING INTERNAL CHECKING ****
+// value Ding$$x1 in class Ding cannot be accessed in Ding
+// because of an internal error (no accessible symbol):
+// sym = value Ding$$x1
+// underlying(sym) = value Ding$$x1
+// pre = Ding
+// site = Ding.this
+// tree = Ding.this.Ding$$x1
+// sym.accessBoundary(sym.owner) = class Ding
+// sym.ownerChain = List(value Ding$$x1, class Ding, package <empty>, package <root>)
+// sym.owner.thisType = Ding
+// context.owner = package <empty>
+// context.outer.enclClass.owner = package <empty>
+// private val x1 = 1
+// ^
+// work/fail8.scala:6: error:
+// **** ERROR DURING INTERNAL CHECKING ****
+// value Ding$$x4 in class Ding cannot be accessed in Ding
+// because of an internal error (no accessible symbol):
+// sym = value Ding$$x4
+// underlying(sym) = value Ding$$x4
+// pre = Ding
+// site = Ding.this
+// tree = Ding.this.Ding$$x4
+// sym.accessBoundary(sym.owner) = class Ding
+// sym.ownerChain = List(value Ding$$x4, class Ding, package <empty>, package <root>)
+// sym.owner.thisType = Ding
+// context.owner = package <empty>
+// context.outer.enclClass.owner = package <empty>
+// private[Ding] val x4 = 4
+// ^
+// work/fail8.scala:7: error:
+// **** ERROR DURING INTERNAL CHECKING ****
+// value Ding$$x5 in class Ding cannot be accessed in Ding
+// because of an internal error (no accessible symbol):
+// sym = value Ding$$x5
+// underlying(sym) = value Ding$$x5
+// pre = Ding
+// site = Ding.this
+// tree = Ding.this.Ding$$x5
+// sym.accessBoundary(sym.owner) = class Ding
+// sym.ownerChain = List(value Ding$$x5, class Ding, package <empty>, package <root>)
+// sym.owner.thisType = Ding
+// context.owner = package <empty>
+// context.outer.enclClass.owner = package <empty>
+// private[Ding] val x5 = 5
+// ^
+// work/fail8.scala:8: error:
+// **** ERROR DURING INTERNAL CHECKING ****
+// value Ding$$x6 in class Ding cannot be accessed in Ding
+// because of an internal error (no accessible symbol):
+// sym = value Ding$$x6
+// underlying(sym) = value Ding$$x6
+// pre = Ding
+// site = Ding.this
+// tree = Ding.this.Ding$$x6
+// sym.accessBoundary(sym.owner) = class Ding
+// sym.ownerChain = List(value Ding$$x6, class Ding, package <empty>, package <root>)
+// sym.owner.thisType = Ding
+// context.owner = package <empty>
+// context.outer.enclClass.owner = package <empty>
+// private[Ding] val x6 = 6
+// ^
+// four errors found
diff --git a/test/checker-tests/fail9.scala b/test/checker-tests/fail9.scala
new file mode 100644
index 0000000000..54cf0fc01e
--- /dev/null
+++ b/test/checker-tests/fail9.scala
@@ -0,0 +1,145 @@
+// More from constructors
+class Dong {
+ def y1 = Dong.x1
+ def y2 = Dong.x2
+ def y3 = Dong.x3
+ def y4 = Dong.x4
+ def y5 = Dong.x5
+ def y6 = Dong.x6
+}
+
+object Dong {
+ private val x1 = 1
+ private def x2 = 2
+ private lazy val x3 = 3
+ private[Dong] val x4 = 4
+ private[Dong] val x5 = 5
+ private[Dong] val x6 = 6
+}
+
+// % work/check all -Xprint:constru work/fail9.scala
+//
+// TypeStack init: REFERENCE(type AnyRef)
+// [Not checkable: parser]
+// [Not checkable: namer]
+// [Not checkable: packageobjects]
+// [Now checking: typer]
+// [Now checking: superaccessors]
+// [Now checking: pickler]
+// [Now checking: refchecks]
+// [Now checking: selectiveanf]
+// [Now checking: liftcode]
+// [Now checking: selectivecps]
+// [Now checking: uncurry]
+// [Now checking: tailcalls]
+// [Not checkable: specialize]
+// [Not checkable: explicitouter]
+// [Now checking: erasure]
+// [Now checking: lazyvals]
+// [Now checking: lambdalift]
+// [[syntax trees at end of constructors]]// Scala source: fail9.scala
+// package <empty> {
+// class Dong extends java.lang.Object with ScalaObject {
+// def y1(): Int = Dong.Dong$$x1();
+// def y2(): Int = Dong.Dong$$x2();
+// def y3(): Int = Dong.Dong$$x3();
+// def y4(): Int = Dong.x4();
+// def y5(): Int = Dong.x5();
+// def y6(): Int = Dong.x6();
+// def this(): Dong = {
+// Dong.super.this();
+// ()
+// }
+// };
+// final class Dong extends java.lang.Object with ScalaObject {
+// private[this] val Dong$$x1: Int = _;
+// final <stable> <accessor> def Dong$$x1(): Int = Dong.this.Dong$$x1;
+// final def Dong$$x2(): Int = 2;
+// lazy private[this] var Dong$$x3: Int = _;
+// final <stable> <accessor> lazy def Dong$$x3(): Int = {
+// Dong.this.Dong$$x3 = 3;
+// Dong.this.Dong$$x3
+// };
+// private[this] val x4: Int = _;
+// <stable> <accessor> private[Dong] def x4(): Int = Dong.this.x4;
+// private[this] val x5: Int = _;
+// <stable> <accessor> private[Dong] def x5(): Int = Dong.this.x5;
+// private[this] val x6: Int = _;
+// <stable> <accessor> private[Dong] def x6(): Int = Dong.this.x6;
+// def this(): object Dong = {
+// Dong.super.this();
+// Dong.this.Dong$$x1 = 1;
+// Dong.this.x4 = 4;
+// Dong.this.x5 = 5;
+// Dong.this.x6 = 6;
+// ()
+// }
+// }
+// }
+//
+// [Now checking: constructors]
+// work/fail9.scala:12: error:
+// **** ERROR DURING INTERNAL CHECKING ****
+// value Dong$$x1 in object Dong cannot be accessed in object Dong
+// because of an internal error (no accessible symbol):
+// sym = value Dong$$x1
+// underlying(sym) = value Dong$$x1
+// pre = object Dong
+// site = Dong.this
+// tree = Dong.this.Dong$$x1
+// sym.accessBoundary(sym.owner) = object Dong
+// sym.ownerChain = List(value Dong$$x1, object Dong, package <empty>, package <root>)
+// sym.owner.thisType = object Dong
+// context.owner = package <empty>
+// context.outer.enclClass.owner = package <empty>
+// private val x1 = 1
+// ^
+// work/fail9.scala:15: error:
+// **** ERROR DURING INTERNAL CHECKING ****
+// value x4 in object Dong cannot be accessed in object Dong
+// because of an internal error (no accessible symbol):
+// sym = value x4
+// underlying(sym) = value x4
+// pre = object Dong
+// site = Dong.this
+// tree = Dong.this.x4
+// sym.accessBoundary(sym.owner) = object Dong
+// sym.ownerChain = List(value x4, object Dong, package <empty>, package <root>)
+// sym.owner.thisType = object Dong
+// context.owner = package <empty>
+// context.outer.enclClass.owner = package <empty>
+// private[Dong] val x4 = 4
+// ^
+// work/fail9.scala:16: error:
+// **** ERROR DURING INTERNAL CHECKING ****
+// value x5 in object Dong cannot be accessed in object Dong
+// because of an internal error (no accessible symbol):
+// sym = value x5
+// underlying(sym) = value x5
+// pre = object Dong
+// site = Dong.this
+// tree = Dong.this.x5
+// sym.accessBoundary(sym.owner) = object Dong
+// sym.ownerChain = List(value x5, object Dong, package <empty>, package <root>)
+// sym.owner.thisType = object Dong
+// context.owner = package <empty>
+// context.outer.enclClass.owner = package <empty>
+// private[Dong] val x5 = 5
+// ^
+// work/fail9.scala:17: error:
+// **** ERROR DURING INTERNAL CHECKING ****
+// value x6 in object Dong cannot be accessed in object Dong
+// because of an internal error (no accessible symbol):
+// sym = value x6
+// underlying(sym) = value x6
+// pre = object Dong
+// site = Dong.this
+// tree = Dong.this.x6
+// sym.accessBoundary(sym.owner) = object Dong
+// sym.ownerChain = List(value x6, object Dong, package <empty>, package <root>)
+// sym.owner.thisType = object Dong
+// context.owner = package <empty>
+// context.outer.enclClass.owner = package <empty>
+// private[Dong] val x6 = 6
+// ^
+// four errors found