diff options
author | Paul Phillips <paulp@improving.org> | 2010-12-01 21:16:28 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2010-12-01 21:16:28 +0000 |
commit | 1660cfc41e6e58d19db6cfdb6a768831c57033f8 (patch) | |
tree | 1d88c2c16d85cc909f90b15c552c98e95e186ad2 | |
parent | a37284fdf7e2b2917c9e894a9b93c02d1defc983 (diff) | |
download | scala-1660cfc41e6e58d19db6cfdb6a768831c57033f8.tar.gz scala-1660cfc41e6e58d19db6cfdb6a768831c57033f8.tar.bz2 scala-1660cfc41e6e58d19db6cfdb6a768831c57033f8.zip |
A patch authored by martin to fix one of the bi...
A patch authored by martin to fix one of the big outstanding issues with
-Ycheck. The typer had a vision of the world which fell to pieces if
presented with a tree from after phase constructors. Now it is wiser:
perhaps a bit sadder as well, but every typer must face this day sooner
or later.
Also removed the various passing tests from test/checker-tests, but
still plenty of fascinating failures in there for anyone interested in
helping push to the finish line! No review.
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 10 | ||||
-rw-r--r-- | test/checker-tests/fail11.scala | 71 | ||||
-rw-r--r-- | test/checker-tests/fail3.scala | 54 | ||||
-rw-r--r-- | test/checker-tests/fail4.scala | 136 | ||||
-rw-r--r-- | test/checker-tests/fail5.scala | 197 | ||||
-rw-r--r-- | test/checker-tests/fail8.scala | 145 | ||||
-rw-r--r-- | test/checker-tests/fail9.scala | 145 |
7 files changed, 7 insertions, 751 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 03c5d2958c..b6e45fe58c 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -1150,8 +1150,11 @@ trait Typers { self: Analyzer => treeInfo.firstConstructor(templ.body) match { case constr @ DefDef(_, _, _, vparamss, _, cbody @ Block(cstats, cunit)) => // Convert constructor body to block in environment and typecheck it - val cstats1: List[Tree] = cstats map (_.duplicate) - val scall = if (cstats.isEmpty) EmptyTree else cstats.last + val (preSuperStats, rest) = cstats span (!treeInfo.isSuperConstrCall(_)) + val (scall, upToSuperStats) = + if (rest.isEmpty) (EmptyTree, preSuperStats) + else (rest.head, preSuperStats :+ rest.head) + val cstats1: List[Tree] = upToSuperStats map (_.duplicate) val cbody1 = scall match { case Apply(_, _) => treeCopy.Block(cbody, cstats1.init, @@ -4158,7 +4161,7 @@ trait Typers { self: Analyzer => tree.tpe = null if (tree.hasSymbol) tree.symbol = NoSymbol } - printTyping("typing "+tree+", pt = "+pt+", undetparams = "+context.undetparams+", implicits-enabled = "+context.implicitsEnabled+", silent = "+context.reportGeneralErrors) //DEBUG + printTyping("typing "+tree+", pt = "+pt+", undetparams = "+context.undetparams+", implicits-enabled = "+context.implicitsEnabled+", silent = "+context.reportGeneralErrors+", context.owner = "+context.owner) //DEBUG var tree1 = if (tree.tpe ne null) tree else typed1(tree, mode, dropExistential(pt)) printTyping("typed "+tree1+":"+tree1.tpe+(if (isSingleType(tree1.tpe)) " with underlying "+tree1.tpe.widen else "")+", undetparams = "+context.undetparams+", pt = "+pt) //DEBUG @@ -4332,3 +4335,4 @@ trait Typers { self: Analyzer => */ } } + diff --git a/test/checker-tests/fail11.scala b/test/checker-tests/fail11.scala deleted file mode 100644 index d5f619c674..0000000000 --- a/test/checker-tests/fail11.scala +++ /dev/null @@ -1,71 +0,0 @@ -// 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/fail3.scala b/test/checker-tests/fail3.scala deleted file mode 100644 index 8eacc25473..0000000000 --- a/test/checker-tests/fail3.scala +++ /dev/null @@ -1,54 +0,0 @@ -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 deleted file mode 100644 index 7bf44617f9..0000000000 --- a/test/checker-tests/fail4.scala +++ /dev/null @@ -1,136 +0,0 @@ -// 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 deleted file mode 100644 index b821dc79f9..0000000000 --- a/test/checker-tests/fail5.scala +++ /dev/null @@ -1,197 +0,0 @@ -// 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/fail8.scala b/test/checker-tests/fail8.scala deleted file mode 100644 index d64e6e7bcc..0000000000 --- a/test/checker-tests/fail8.scala +++ /dev/null @@ -1,145 +0,0 @@ -// 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 deleted file mode 100644 index 54cf0fc01e..0000000000 --- a/test/checker-tests/fail9.scala +++ /dev/null @@ -1,145 +0,0 @@ -// 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 |