diff options
Diffstat (limited to 'test/files')
156 files changed, 1887 insertions, 537 deletions
diff --git a/test/files/jvm/t7253.check b/test/files/jvm/t7253.check new file mode 100644 index 0000000000..43f53aba12 --- /dev/null +++ b/test/files/jvm/t7253.check @@ -0,0 +1 @@ +bytecode identical diff --git a/test/files/jvm/t7253/Base_1.scala b/test/files/jvm/t7253/Base_1.scala new file mode 100644 index 0000000000..a531ebb69d --- /dev/null +++ b/test/files/jvm/t7253/Base_1.scala @@ -0,0 +1,5 @@ +trait A { def f(): Int } +trait B1 extends A +abstract class B2 extends A +class B3 extends A { def f(): Int = 1 } +class B4 extends B3 diff --git a/test/files/jvm/t7253/JavaClient_1.java b/test/files/jvm/t7253/JavaClient_1.java new file mode 100644 index 0000000000..43475de2f5 --- /dev/null +++ b/test/files/jvm/t7253/JavaClient_1.java @@ -0,0 +1,9 @@ +public class JavaClient_1 { + int foo() { + ((A) null).f(); + ((B1) null).f(); + ((B2) null).f(); + ((B3) null).f(); + return ((B4) null).f(); + } +} diff --git a/test/files/jvm/t7253/ScalaClient_1.scala b/test/files/jvm/t7253/ScalaClient_1.scala new file mode 100644 index 0000000000..d244b326a8 --- /dev/null +++ b/test/files/jvm/t7253/ScalaClient_1.scala @@ -0,0 +1,9 @@ +class ScalaClient_1 { + def foo() = { + (null: A).f() + (null: B1).f() + (null: B2).f() + (null: B3).f() + (null: B4).f() + } +} diff --git a/test/files/jvm/t7253/test.scala b/test/files/jvm/t7253/test.scala new file mode 100644 index 0000000000..7fe08e8813 --- /dev/null +++ b/test/files/jvm/t7253/test.scala @@ -0,0 +1,28 @@ +import scala.tools.partest.BytecodeTest + +import scala.tools.nsc.util.JavaClassPath +import java.io.InputStream +import scala.tools.asm +import asm.ClassReader +import asm.tree.{ClassNode, InsnList} +import scala.collection.JavaConverters._ + +object Test extends BytecodeTest { + import instructions._ + + def show: Unit = { + val instrBaseSeqs = Seq("ScalaClient_1", "JavaClient_1") map (name => instructions.fromMethod(getMethod(loadClassNode(name), "foo"))) + val instrSeqs = instrBaseSeqs map (_ filter isInvoke) + cmpInstructions(instrSeqs(0), instrSeqs(1)) + } + + def cmpInstructions(isa: List[Instruction], isb: List[Instruction]) = { + if (isa == isb) println("bytecode identical") + else diffInstructions(isa, isb) + } + + def isInvoke(node: Instruction): Boolean = { + val opcode = node.opcode + (opcode == "INVOKEVIRTUAL") || (opcode == "INVOKEINTERFACE") + } +} diff --git a/test/files/neg/choices.check b/test/files/neg/choices.check index 3e63f9999d..b114394e96 100644 --- a/test/files/neg/choices.check +++ b/test/files/neg/choices.check @@ -1,2 +1,2 @@ -partest error: bad flags: -Ylinearizer +error: bad options: -Yresolve-term-conflict one error found diff --git a/test/files/neg/choices.flags b/test/files/neg/choices.flags index 5464a18c5d..9718467d4c 100644 --- a/test/files/neg/choices.flags +++ b/test/files/neg/choices.flags @@ -1 +1 @@ --Ylinearizer
\ No newline at end of file +-Yresolve-term-conflict diff --git a/test/files/neg/javac-error.check b/test/files/neg/javac-error.check new file mode 100644 index 0000000000..e7d1ccc1a1 --- /dev/null +++ b/test/files/neg/javac-error.check @@ -0,0 +1,10 @@ +#partest java6 +javac-error/J.java:2: method does not override or implement a method from a supertype + @Override public void foo() { } + ^ +1 error +#partest java7 +javac-error/J.java:2: error: method does not override or implement a method from a supertype + @Override public void foo() { } + ^ +1 error diff --git a/test/files/neg/javac-error.flags b/test/files/neg/javac-error.flags new file mode 100644 index 0000000000..85d8eb2ba2 --- /dev/null +++ b/test/files/neg/javac-error.flags @@ -0,0 +1 @@ +-Xfatal-warnings diff --git a/test/files/neg/javac-error/J.java b/test/files/neg/javac-error/J.java new file mode 100644 index 0000000000..83f50c9ae2 --- /dev/null +++ b/test/files/neg/javac-error/J.java @@ -0,0 +1,5 @@ +public class J { + @Override public void foo() { } + + public void bar() { foo(); } +} diff --git a/test/files/neg/javac-error/SUT_5.scala b/test/files/neg/javac-error/SUT_5.scala new file mode 100644 index 0000000000..0a996352c0 --- /dev/null +++ b/test/files/neg/javac-error/SUT_5.scala @@ -0,0 +1,5 @@ + +/** The System Under Test. + * We bail on the earlier round that generates the first error. + */ +class SUT extends J diff --git a/test/files/neg/t5580b.check b/test/files/neg/t5580b.check new file mode 100644 index 0000000000..45fde46ff9 --- /dev/null +++ b/test/files/neg/t5580b.check @@ -0,0 +1,6 @@ +t5580b.scala:11: error: polymorphic expression cannot be instantiated to expected type; + found : [A]scala.collection.mutable.Set[A] + required: scala.collection.mutable.Map[bar,scala.collection.mutable.Set[bar]] + if (map.get(tmp).isEmpty) map.put(tmp,collection.mutable.Set()) + ^ +one error found diff --git a/test/files/pos/t5580b.scala b/test/files/neg/t5580b.scala index d5a4a0a2b2..2161da4584 100644 --- a/test/files/pos/t5580b.scala +++ b/test/files/neg/t5580b.scala @@ -1,9 +1,3 @@ -/** It's a pos test because it does indeed compile, - * not so much because I'm glad it does. Testing - * that error messages created and discarded during - * implicit search don't blow it up. - */ - import scala.collection.mutable.WeakHashMap import scala.collection.JavaConversions._ diff --git a/test/files/neg/t7110.check b/test/files/neg/t7110.check new file mode 100644 index 0000000000..e484dc4325 --- /dev/null +++ b/test/files/neg/t7110.check @@ -0,0 +1,6 @@ +t7110.scala:2: warning: A try without a catch or finally is equivalent to putting its body in a block; no exceptions are handled. + try { ??? } // warn + ^ +error: No warnings can be incurred under -Xfatal-warnings. +one warning found +one error found diff --git a/test/files/neg/t7110.flags b/test/files/neg/t7110.flags new file mode 100644 index 0000000000..e8fb65d50c --- /dev/null +++ b/test/files/neg/t7110.flags @@ -0,0 +1 @@ +-Xfatal-warnings
\ No newline at end of file diff --git a/test/files/neg/t7110.scala b/test/files/neg/t7110.scala new file mode 100644 index 0000000000..79ac325216 --- /dev/null +++ b/test/files/neg/t7110.scala @@ -0,0 +1,6 @@ +object Test { + try { ??? } // warn + + try { ??? } finally ??? // no warn + try { ??? } catch { case _: Throwable => } // no warn +} diff --git a/test/files/neg/t7259.check b/test/files/neg/t7259.check new file mode 100644 index 0000000000..0ad627fc3b --- /dev/null +++ b/test/files/neg/t7259.check @@ -0,0 +1,7 @@ +t7259.scala:1: error: not found: type xxxxx +@xxxxx // error: not found: type xxxx + ^ +t7259.scala:8: error: type xxxxx is not a member of package annotation +@annotation.xxxxx // error: not found: type scala + ^ +two errors found diff --git a/test/files/neg/t7259.scala b/test/files/neg/t7259.scala new file mode 100644 index 0000000000..0fdfe18822 --- /dev/null +++ b/test/files/neg/t7259.scala @@ -0,0 +1,9 @@ +@xxxxx // error: not found: type xxxx +class Ok + +// +// This had the wrong error message in 2.9 and 2.10. +// + +@annotation.xxxxx // error: not found: type scala +class WrongErrorMessage diff --git a/test/files/neg/t7285.check b/test/files/neg/t7285.check new file mode 100644 index 0000000000..a38772bead --- /dev/null +++ b/test/files/neg/t7285.check @@ -0,0 +1,15 @@ +t7285.scala:15: warning: match may not be exhaustive. +It would fail on the following input: (Up, Down) + (d1, d2) match { + ^ +t7285.scala:33: warning: match may not be exhaustive. +It would fail on the following input: Down + (d1) match { + ^ +t7285.scala:51: warning: match may not be exhaustive. +It would fail on the following input: (Up, Down) + (d1, d2) match { + ^ +error: No warnings can be incurred under -Xfatal-warnings. +three warnings found +one error found diff --git a/test/files/neg/t7285.flags b/test/files/neg/t7285.flags new file mode 100644 index 0000000000..e8fb65d50c --- /dev/null +++ b/test/files/neg/t7285.flags @@ -0,0 +1 @@ +-Xfatal-warnings
\ No newline at end of file diff --git a/test/files/neg/t7285.scala b/test/files/neg/t7285.scala new file mode 100644 index 0000000000..14121d92b1 --- /dev/null +++ b/test/files/neg/t7285.scala @@ -0,0 +1,55 @@ +sealed abstract class Base + + +object Test1 { + sealed abstract class Base + + object Base { + case object Down extends Base { + } + + case object Up extends Base { + } + + (d1: Base, d2: Base) => + (d1, d2) match { + case (Up, Up) | (Down, Down) => false + case (Down, Up) => true + } + } +} + +object Test2 { + sealed abstract class Base + + object Base { + case object Down extends Base { + } + + case object Up extends Base { + } + + (d1: Base, d2: Base) => + (d1) match { + case Test2.Base.Up => false + } + } +} + + +object Test4 { + sealed abstract class Base + + object Base { + case object Down extends Base + + case object Up extends Base + } + + import Test4.Base._ + (d1: Base, d2: Base) => + (d1, d2) match { + case (Up, Up) | (Down, Down) => false + case (Down, Test4.Base.Up) => true + } +} diff --git a/test/files/neg/t7289.check b/test/files/neg/t7289.check new file mode 100644 index 0000000000..e4aeebbc6c --- /dev/null +++ b/test/files/neg/t7289.check @@ -0,0 +1,4 @@ +t7289.scala:8: error: could not find implicit value for parameter e: Test.Schtroumpf[scala.collection.immutable.Nil.type] + implicitly[Schtroumpf[Nil.type]] + ^ +one error found diff --git a/test/files/neg/t7289.scala b/test/files/neg/t7289.scala new file mode 100644 index 0000000000..f4ed3daf76 --- /dev/null +++ b/test/files/neg/t7289.scala @@ -0,0 +1,39 @@ +object Test extends App { + trait Schtroumpf[T] + + implicit def schtroumpf[T, U <: Coll[T], Coll[X] <: Traversable[X]] + (implicit minorSchtroumpf: Schtroumpf[T]): Schtroumpf[U] = ??? + + implicit val qoo: Schtroumpf[Int] = new Schtroumpf[Int]{} + implicitly[Schtroumpf[Nil.type]] +} + +/* +info1 = {scala.tools.nsc.typechecker.Implicits$ImplicitInfo@3468}"qoo: => Test.Schtroumpf[Int]" +info2 = {scala.tools.nsc.typechecker.Implicits$ImplicitInfo@3469}"schtroumpf: [T, U <: Coll[T], Coll[_] <: Traversable[_]](implicit minorSchtroumpf: Test.Schtroumpf[T])Test.Schtroumpf[U]" +isStrictlyMoreSpecific(info1, info2) + isSubType(Test.Schtroumpf[Int], Test.Schtroumpf[U] forSome { T; U <: Coll[T]; Coll[_] <: Traversable[_] }) + isAsSpecificValueType(Test.Schtroumpf[Int], Test.Schtroumpf[U], undef2 = List(type T, type U, type Coll)) + + val et: ExistentialType = Test.Schtroumpf[U] forSome { T; U <: Coll[T]; Coll[_] <: Traversable[_] } + val tp1 = Test.Schtroumpf[Int] + et.withTypeVars(isSubType(tp1, _, depth)) + solve() + tvars = tList(=?Nothing, =?Int, =?=?Int) + + +[ create] ?T ( In Test#schtroumpf[T,U <: Coll[T],Coll[_] <: Traversable[_]] ) +[ create] ?U ( In Test#schtroumpf[T,U <: Coll[T],Coll[_] <: Traversable[_]] ) +[ create] ?Coll ( In Test#schtroumpf[T,U <: Coll[T],Coll[_] <: Traversable[_]] ) +[ setInst] Nothing ( In Test#schtroumpf[T,U <: Coll[T],Coll[_] <: Traversable[_]], T=Nothing ) +[ setInst] scala.collection.immutable.Nil.type( In Test#schtroumpf[T,U <: Coll[T],Coll[_] <: Traversable[_]], U=scala.collection.immutable.Nil.type ) +[ setInst] =?scala.collection.immutable.Nil.type( In Test#schtroumpf[T,U <: Coll[T],Coll[_] <: Traversable[_]], Coll==?scala.collection.immutable.Nil.type ) +[ create] ?T ( In Test#schtroumpf[T,U <: Coll[T],Coll[_] <: Traversable[_]] ) +[ setInst] Int ( In Test#schtroumpf[T,U <: Coll[T],Coll[_] <: Traversable[_]], T=Int ) +[ create] ?T ( In Test#schtroumpf[T,U <: Coll[T],Coll[_] <: Traversable[_]] ) +[ create] ?U ( In Test#schtroumpf[T,U <: Coll[T],Coll[_] <: Traversable[_]] ) +[ create] ?Coll ( In Test#schtroumpf[T,U <: Coll[T],Coll[_] <: Traversable[_]] ) +[ setInst] Nothing ( In Test#schtroumpf[T,U <: Coll[T],Coll[_] <: Traversable[_]], T=Nothing ) +[ setInst] Int ( In Test#schtroumpf[T,U <: Coll[T],Coll[_] <: Traversable[_]], U=Int ) +[ setInst] =?Int ( In Test#schtroumpf[T,U <: Coll[T],Coll[_] <: Traversable[_]], Coll==?Int ) +*/
\ No newline at end of file diff --git a/test/files/neg/t7289_status_quo.check b/test/files/neg/t7289_status_quo.check new file mode 100644 index 0000000000..31c072e969 --- /dev/null +++ b/test/files/neg/t7289_status_quo.check @@ -0,0 +1,22 @@ +t7289_status_quo.scala:9: error: could not find implicit value for parameter e: Test1.Ext[List[Int]] + implicitly[Ext[List[Int]]] // fails - not found + ^ +t7289_status_quo.scala:11: error: could not find implicit value for parameter e: Test1.Ext[List[List[List[Int]]]] + implicitly[Ext[List[List[List[Int]]]]] // fails - not found + ^ +t7289_status_quo.scala:15: error: ambiguous implicit values: + both method f in object Test1 of type [A, Coll <: CC[A], CC[X] <: Traversable[X]](implicit xi: Test1.Ext[A])Test1.Ext[Coll] + and value m in object Test1 of type => Test1.Ext[List[List[Int]]] + match expected type Test1.Ext[_ <: List[List[Int]]] + implicitly[Ext[_ <: List[List[Int]]]] // fails - ambiguous + ^ +t7289_status_quo.scala:20: error: could not find implicit value for parameter e: Test1.ExtCov[List[Int]] + implicitly[ExtCov[List[Int]]] // fails - not found + ^ +t7289_status_quo.scala:21: error: could not find implicit value for parameter e: Test1.ExtCov[List[List[Int]]] + implicitly[ExtCov[List[List[Int]]]] // fails - not found + ^ +t7289_status_quo.scala:22: error: could not find implicit value for parameter e: Test1.ExtCov[List[List[List[Int]]]] + implicitly[ExtCov[List[List[List[Int]]]]] // fails - not found + ^ +6 errors found diff --git a/test/files/neg/t7289_status_quo.scala b/test/files/neg/t7289_status_quo.scala new file mode 100644 index 0000000000..39621429a1 --- /dev/null +++ b/test/files/neg/t7289_status_quo.scala @@ -0,0 +1,23 @@ +// record the status quo after this fix +// not clear to @adriaanm why an upper-bounded existential in an invariant position +// is different from putting that upper bound in a covariant position +object Test1 { + trait Ext[T] + implicit def f[A, Coll <: CC[A], CC[X] <: Traversable[X]](implicit xi: Ext[A]): Ext[Coll] = ??? + implicit val m: Ext[List[List[Int]]] = new Ext[List[List[Int]]]{} + + implicitly[Ext[List[Int]]] // fails - not found + implicitly[Ext[List[List[Int]]]] // compiles + implicitly[Ext[List[List[List[Int]]]]] // fails - not found + + // Making Ext[+T] should incur the same behavior as these. (so says @paulp) + implicitly[Ext[_ <: List[Int]]] // compiles + implicitly[Ext[_ <: List[List[Int]]]] // fails - ambiguous + implicitly[Ext[_ <: List[List[List[Int]]]]] // compiles + + // But, we currently get: + trait ExtCov[+T] + implicitly[ExtCov[List[Int]]] // fails - not found + implicitly[ExtCov[List[List[Int]]]] // fails - not found + implicitly[ExtCov[List[List[List[Int]]]]] // fails - not found +}
\ No newline at end of file diff --git a/test/files/neg/t7290.check b/test/files/neg/t7290.check new file mode 100644 index 0000000000..ad2d0e25b0 --- /dev/null +++ b/test/files/neg/t7290.check @@ -0,0 +1,12 @@ +t7290.scala:4: warning: Pattern contains duplicate alternatives: 0 + case 0 | 0 => 0 + ^ +t7290.scala:5: warning: Pattern contains duplicate alternatives: 2, 3 + case 2 | 2 | 2 | 3 | 2 | 3 => 0 + ^ +t7290.scala:6: warning: Pattern contains duplicate alternatives: 4 + case 4 | (_ @ 4) => 0 + ^ +error: No warnings can be incurred under -Xfatal-warnings. +three warnings found +one error found diff --git a/test/files/neg/t7290.flags b/test/files/neg/t7290.flags new file mode 100644 index 0000000000..e8fb65d50c --- /dev/null +++ b/test/files/neg/t7290.flags @@ -0,0 +1 @@ +-Xfatal-warnings
\ No newline at end of file diff --git a/test/files/neg/t7290.scala b/test/files/neg/t7290.scala new file mode 100644 index 0000000000..b9db7f7e8a --- /dev/null +++ b/test/files/neg/t7290.scala @@ -0,0 +1,10 @@ +object Test extends App { + val y = (0: Int) match { + case 1 => 1 + case 0 | 0 => 0 + case 2 | 2 | 2 | 3 | 2 | 3 => 0 + case 4 | (_ @ 4) => 0 + case _ => -1 + } + assert(y == 0, y) +} diff --git a/test/files/neg/t7299.check b/test/files/neg/t7299.check new file mode 100644 index 0000000000..74340c4841 --- /dev/null +++ b/test/files/neg/t7299.check @@ -0,0 +1,7 @@ +t7299.scala:4: error: implementation restricts functions to 22 parameters + val eta1 = f _ + ^ +t7299.scala:5: error: implementation restricts functions to 22 parameters + val eta2 = g[Any] _ + ^ +two errors found diff --git a/test/files/neg/t7299.scala b/test/files/neg/t7299.scala new file mode 100644 index 0000000000..f3aae5ce5d --- /dev/null +++ b/test/files/neg/t7299.scala @@ -0,0 +1,6 @@ +object Test { + def f(a1: Int, a2: Int, a3: Int, a4: Int, a5: Int, a6: Int, a7: Int, a8: Int, a9: Int, a10: Int, a11: Int, a12: Int, a13: Int, a14: Int, a15: Int, a16: Int, a17: Int, a18: Int, a19: Int, a20: Int, a21: Int, a22: Int, a23: Int) = 0 + def g[A](a1: Int, a2: Int, a3: Int, a4: Int, a5: Int, a6: Int, a7: Int, a8: Int, a9: Int, a10: Int, a11: Int, a12: Int, a13: Int, a14: Int, a15: Int, a16: Int, a17: Int, a18: Int, a19: Int, a20: Int, a21: Int, a22: Int, a23: Int) = 0 + val eta1 = f _ + val eta2 = g[Any] _ +} diff --git a/test/files/pos/spec-t6286.scala b/test/files/pos/spec-t6286.scala new file mode 100755 index 0000000000..4d87998ec6 --- /dev/null +++ b/test/files/pos/spec-t6286.scala @@ -0,0 +1,10 @@ +trait Foo[@specialized(Int) A] { + def fun[@specialized(Int) B](init: B)(f: (B, A) => B): B +} + +class Bar(values: Array[Int]) extends Foo[Int] { + def fun[@specialized(Int) C](init: C)(f: (C, Int) => C): C = { + val arr = values + f(init, arr(0)) + } +} diff --git a/test/files/pos/t3120/J1.java b/test/files/pos/t3120/J1.java new file mode 100644 index 0000000000..12b23c1c98 --- /dev/null +++ b/test/files/pos/t3120/J1.java @@ -0,0 +1,4 @@ +class J1 { + public class Inner1 { } + public static class Inner2 { } +} diff --git a/test/files/pos/t3120/J2.java b/test/files/pos/t3120/J2.java new file mode 100644 index 0000000000..db6e859020 --- /dev/null +++ b/test/files/pos/t3120/J2.java @@ -0,0 +1,4 @@ +public class J2 { + public void f1(J1.Inner1 p) { } + public void f2(J1.Inner2 p) { } +} diff --git a/test/files/pos/t3120/Q.java b/test/files/pos/t3120/Q.java new file mode 100644 index 0000000000..fe2269308a --- /dev/null +++ b/test/files/pos/t3120/Q.java @@ -0,0 +1,3 @@ +public class Q { + public static void passInner(J1.Inner1 myInner) {} +} diff --git a/test/files/pos/t3120/Test.scala b/test/files/pos/t3120/Test.scala new file mode 100644 index 0000000000..c02146fba1 --- /dev/null +++ b/test/files/pos/t3120/Test.scala @@ -0,0 +1,3 @@ +object Test { + Q.passInner(null) +} diff --git a/test/files/pos/t6210.flags b/test/files/pos/t6210.flags new file mode 100644 index 0000000000..e8fb65d50c --- /dev/null +++ b/test/files/pos/t6210.flags @@ -0,0 +1 @@ +-Xfatal-warnings
\ No newline at end of file diff --git a/test/files/pos/t6210.scala b/test/files/pos/t6210.scala new file mode 100644 index 0000000000..1ce8493872 --- /dev/null +++ b/test/files/pos/t6210.scala @@ -0,0 +1,21 @@ +abstract sealed trait AST +abstract sealed trait AExpr extends AST +case class AAssign(name: String, v: AExpr) extends AExpr +case class AConstBool(v: Boolean) extends AExpr + +trait Ty {} +case class TInt() extends Ty +case class TBool() extends Ty + +object Foo { + def checkExpr(ast: AExpr): Ty = { + var astTy:Ty = ast match { + case AAssign(nm: String, v:AExpr) => TBool() + + case AConstBool(v: Boolean) => TBool() + + case _ => throw new Exception(s"Unhandled case check(ast: ${ast.getClass})") + } + astTy + } +} diff --git a/test/files/pos/t6386.scala b/test/files/pos/t6386.scala new file mode 100644 index 0000000000..85098a78f0 --- /dev/null +++ b/test/files/pos/t6386.scala @@ -0,0 +1,5 @@ +import scala.reflect.runtime.universe._ + +object Test extends App { + reify(manifest[Some[_]]) +}
\ No newline at end of file diff --git a/test/files/pos/t6921.scala b/test/files/pos/t6921.scala new file mode 100644 index 0000000000..36e70e5d2c --- /dev/null +++ b/test/files/pos/t6921.scala @@ -0,0 +1,11 @@ +class Message(messageType: String, reason: Option[String]) + +class ReproForSI6921 { + + private[this] var reason = "" + + def decideElection = { + val explanation = None + new Message("", reason = explanation) + } +} diff --git a/test/files/pos/t7232.flags b/test/files/pos/t7232.flags new file mode 100644 index 0000000000..e8fb65d50c --- /dev/null +++ b/test/files/pos/t7232.flags @@ -0,0 +1 @@ +-Xfatal-warnings
\ No newline at end of file diff --git a/test/files/pos/t7232/Foo.java b/test/files/pos/t7232/Foo.java new file mode 100644 index 0000000000..3478301b30 --- /dev/null +++ b/test/files/pos/t7232/Foo.java @@ -0,0 +1,9 @@ +package pack; + +import java.util.List; + +public class Foo { + public static java.util.List okay() { throw new Error(); } + + public static List wrong() { throw new Error(); } +} diff --git a/test/files/pos/t7232/List.java b/test/files/pos/t7232/List.java new file mode 100644 index 0000000000..e42c63aa67 --- /dev/null +++ b/test/files/pos/t7232/List.java @@ -0,0 +1,4 @@ +package pack; + +public class List { +} diff --git a/test/files/pos/t7232/Test.scala b/test/files/pos/t7232/Test.scala new file mode 100644 index 0000000000..49c3c12aed --- /dev/null +++ b/test/files/pos/t7232/Test.scala @@ -0,0 +1,5 @@ +object Test { + import pack._ + Foo.okay().size() + Foo.wrong().size() +} diff --git a/test/files/pos/t7232b.flags b/test/files/pos/t7232b.flags new file mode 100644 index 0000000000..e8fb65d50c --- /dev/null +++ b/test/files/pos/t7232b.flags @@ -0,0 +1 @@ +-Xfatal-warnings
\ No newline at end of file diff --git a/test/files/pos/t7232b/Foo.java b/test/files/pos/t7232b/Foo.java new file mode 100644 index 0000000000..94f08d545e --- /dev/null +++ b/test/files/pos/t7232b/Foo.java @@ -0,0 +1,8 @@ +package pack; + +import java.util.*; + +public class Foo { + // should be pack.List. + public static List list() { throw new Error(); } +} diff --git a/test/files/pos/t7232b/List.java b/test/files/pos/t7232b/List.java new file mode 100644 index 0000000000..ce977152b9 --- /dev/null +++ b/test/files/pos/t7232b/List.java @@ -0,0 +1,5 @@ +package pack; + +public class List { + public void packList() {} +} diff --git a/test/files/pos/t7232b/Test.scala b/test/files/pos/t7232b/Test.scala new file mode 100644 index 0000000000..6377e26bec --- /dev/null +++ b/test/files/pos/t7232b/Test.scala @@ -0,0 +1,5 @@ +object Test { + import pack._ + + Foo.list().packList() +} diff --git a/test/files/pos/t7232c.flags b/test/files/pos/t7232c.flags new file mode 100644 index 0000000000..e8fb65d50c --- /dev/null +++ b/test/files/pos/t7232c.flags @@ -0,0 +1 @@ +-Xfatal-warnings
\ No newline at end of file diff --git a/test/files/pos/t7232c/Foo.java b/test/files/pos/t7232c/Foo.java new file mode 100644 index 0000000000..bbda09a2da --- /dev/null +++ b/test/files/pos/t7232c/Foo.java @@ -0,0 +1,10 @@ +package pack; + +import java.util.List; + +public class Foo { + public static class List { + public void isInnerList() {} + } + public static List innerList() { throw new Error(); } +} diff --git a/test/files/pos/t7232c/Test.scala b/test/files/pos/t7232c/Test.scala new file mode 100644 index 0000000000..aa7c710948 --- /dev/null +++ b/test/files/pos/t7232c/Test.scala @@ -0,0 +1,4 @@ +object Test { + import pack._ + Foo.innerList().isInnerList() +} diff --git a/test/files/pos/t7232d.flags b/test/files/pos/t7232d.flags new file mode 100644 index 0000000000..e8fb65d50c --- /dev/null +++ b/test/files/pos/t7232d.flags @@ -0,0 +1 @@ +-Xfatal-warnings
\ No newline at end of file diff --git a/test/files/pos/t7232d/Entry.java b/test/files/pos/t7232d/Entry.java new file mode 100644 index 0000000000..0cfb6fb25b --- /dev/null +++ b/test/files/pos/t7232d/Entry.java @@ -0,0 +1,4 @@ +package pack; + +public class Entry { +} diff --git a/test/files/pos/t7232d/Foo.java b/test/files/pos/t7232d/Foo.java new file mode 100644 index 0000000000..df7114a0f0 --- /dev/null +++ b/test/files/pos/t7232d/Foo.java @@ -0,0 +1,8 @@ +package pack; + +import java.util.Map.Entry; + +public class Foo { + public static Entry mapEntry() { throw new Error(); } + public static void javaTest() { mapEntry().getKey(); } +} diff --git a/test/files/pos/t7232d/Test.scala b/test/files/pos/t7232d/Test.scala new file mode 100644 index 0000000000..89a8063b3c --- /dev/null +++ b/test/files/pos/t7232d/Test.scala @@ -0,0 +1,4 @@ +object Test { + import pack._ + Foo.mapEntry().getKey() +} diff --git a/test/files/pos/t7239.scala b/test/files/pos/t7239.scala new file mode 100644 index 0000000000..16e9d00f17 --- /dev/null +++ b/test/files/pos/t7239.scala @@ -0,0 +1,38 @@ +object Test { + def BrokenMethod(): HasFilter[(Int, String)] = ??? + + trait HasFilter[B] { + def filter(p: B => Boolean) = ??? + } + + trait HasWithFilter { + def withFilter = ??? + } + + object addWithFilter { + trait NoImplicit + implicit def enrich(v: Any) + (implicit F0: NoImplicit): HasWithFilter = ??? + } + + BrokenMethod().withFilter(_ => true) // okay + BrokenMethod().filter(_ => true) // okay + + locally { + import addWithFilter._ + BrokenMethod().withFilter((_: (Int, String)) => true) // okay + } + + locally { + import addWithFilter._ + // adaptToMemberWithArgs sets the type of the tree `x` + // to ErrorType (while in silent mode, so the error is not + // reported. Later, when the fallback from `withFilter` + // to `filter` is attempted, the closure is taken to have + // have the type `<error> => Boolean`, which conforms to + // `(B => Boolean)`. Only later during pickling does the + // defensive check for erroneous types in the tree pick up + // the problem. + BrokenMethod().withFilter(x => true) // erroneous or inaccessible type. + } +} diff --git a/test/files/pos/t7285a.flags b/test/files/pos/t7285a.flags new file mode 100644 index 0000000000..e8fb65d50c --- /dev/null +++ b/test/files/pos/t7285a.flags @@ -0,0 +1 @@ +-Xfatal-warnings
\ No newline at end of file diff --git a/test/files/pos/t7285a.scala b/test/files/pos/t7285a.scala new file mode 100644 index 0000000000..34e79c741b --- /dev/null +++ b/test/files/pos/t7285a.scala @@ -0,0 +1,83 @@ +sealed abstract class Base + +object Test { + case object Up extends Base + + def foo(d1: Base) = + d1 match { + case Up => + } + + // Sealed subtype: ModuleTypeRef <empty>.this.Test.Up.type + // Pattern: UniqueThisType Test.this.type +} + + +object Test1 { + sealed abstract class Base + + object Base { + case object Down extends Base { + } + + case object Up extends Base { + } + + (d1: Base, d2: Base) => + (d1, d2) match { + case (Up, Up) | (Down, Down) => false + case (Down, Up) => true + case (Up, Down) => false + } + } +} + +object Test2 { + sealed abstract class Base + + object Base { + case object Down extends Base { + } + + case object Up extends Base { + } + + (d1: Base, d2: Base) => + (d1) match { + case Up | Down => false + } + } +} + +object Test3 { + sealed abstract class Base + + object Base { + case object Down extends Base + + (d1: Base, d2: Base) => + (d1, d2) match { + case (Down, Down) => false + } + } +} + +object Test4 { + sealed abstract class Base + + object Base { + case object Down extends Base { + } + + case object Up extends Base { + } + + } + import Test4.Base._ + (d1: Base, d2: Base) => + (d1, d2) match { + case (Up, Up) | (Down, Down) => false + case (Down, Test4.Base.Up) => true + case (Up, Down) => false + } +} diff --git a/test/files/run/blame_eye_triple_eee.check b/test/files/run/blame_eye_triple_eee-double.check index 5e46d91a8f..5e46d91a8f 100644 --- a/test/files/run/blame_eye_triple_eee.check +++ b/test/files/run/blame_eye_triple_eee-double.check diff --git a/test/files/run/blame_eye_triple_eee.flags b/test/files/run/blame_eye_triple_eee-double.flags index c9b68d70dc..c9b68d70dc 100644 --- a/test/files/run/blame_eye_triple_eee.flags +++ b/test/files/run/blame_eye_triple_eee-double.flags diff --git a/test/files/run/blame_eye_triple_eee.scala b/test/files/run/blame_eye_triple_eee-double.scala index 1640aead40..1640aead40 100644 --- a/test/files/run/blame_eye_triple_eee.scala +++ b/test/files/run/blame_eye_triple_eee-double.scala diff --git a/test/files/run/blame_eye_triple_eee-float.check b/test/files/run/blame_eye_triple_eee-float.check new file mode 100644 index 0000000000..5e46d91a8f --- /dev/null +++ b/test/files/run/blame_eye_triple_eee-float.check @@ -0,0 +1,9 @@ +if (NaN == NaN) is good +if (x == x) is good +if (x == NaN) is good +if (NaN != NaN) is good +if (x != x) is good +if (NaN != x) is good +x matching was good +NaN matching was good +loop with NaN was goood diff --git a/test/files/run/blame_eye_triple_eee-float.flags b/test/files/run/blame_eye_triple_eee-float.flags new file mode 100644 index 0000000000..c9b68d70dc --- /dev/null +++ b/test/files/run/blame_eye_triple_eee-float.flags @@ -0,0 +1 @@ +-optimise diff --git a/test/files/run/blame_eye_triple_eee-float.scala b/test/files/run/blame_eye_triple_eee-float.scala new file mode 100644 index 0000000000..4deb9f3d60 --- /dev/null +++ b/test/files/run/blame_eye_triple_eee-float.scala @@ -0,0 +1,61 @@ +object Test extends App { + import Float.NaN + + // NaN must not equal NaN no matter what optimizations are applied + // All the following will seem redundant, but to an optimizer + // they can appear different + + val x = NaN + + if (NaN == NaN) + println("if (NaN == NaN) is broken") + else + println("if (NaN == NaN) is good") + + if (x == x) + println("if (x == x) is broken") + else + println("if (x == x) is good") + + if (x == NaN) + println("if (x == NaN) is broken") + else + println("if (x == NaN) is good") + + if (NaN != NaN) + println("if (NaN != NaN) is good") + else + println("if (NaN != NaN) broken") + + if (x != x) + println("if (x != x) is good") + else + println("if (x != x) broken") + + if (NaN != x) + println("if (NaN != x) is good") + else + println("if (NaN != x) is broken") + + x match { + case 0.0f => println("x matched 0!") + case NaN => println("x matched NaN!") + case _ => println("x matching was good") + } + + NaN match { + case 0.0f => println("NaN matched 0!") + case NaN => println("NaN matched NaN!") + case _ => println("NaN matching was good") + } + + var z = 0.0f + var i = 0 + while (i < 10) { + if (i % 2 == 0) z = NaN + else z = NaN + i += 1 + } + if (z.isNaN && i == 10) println("loop with NaN was goood") + else println("loop with NaN was broken") +} diff --git a/test/files/run/classfile-format-51.scala b/test/files/run/classfile-format-51.scala new file mode 100644 index 0000000000..9b1e612f4f --- /dev/null +++ b/test/files/run/classfile-format-51.scala @@ -0,0 +1,126 @@ +import java.io.{File, FileOutputStream} + +import scala.tools.nsc.settings.ScalaVersion +import scala.tools.partest._ +import scala.tools.asm +import asm.{AnnotationVisitor, ClassWriter, FieldVisitor, Handle, MethodVisitor, Opcodes} +import Opcodes._ + +// This test ensures that we can read JDK 7 (classfile format 51) files, including those +// with invokeDynamic instructions and associated constant pool entries +// to do that it first uses ASM to generate a class called DynamicInvoker. Then +// it runs a normal compile on the source in the 'code' field that refers to +// DynamicInvoker. Any failure will be dumped to std out. +// +// By it's nature the test can only work on JDK 7+ because under JDK 6 some of the +// classes referred to by DynamicInvoker won't be available and DynamicInvoker won't +// verify. So the test includes a version check that short-circuites the whole test +// on JDK 6 +object Test extends DirectTest { + override def extraSettings: String = "-optimise -usejavacp -d " + testOutput.path + " -cp " + testOutput.path + + def generateClass() { + val invokerClassName = "DynamicInvoker" + val bootstrapMethodName = "bootstrap" + val bootStrapMethodType = "(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;" + val targetMethodName = "target" + val targetMethodType = "()Ljava/lang/String;" + + val cw = new ClassWriter(0) + cw.visit(V1_7, ACC_PUBLIC + ACC_SUPER, invokerClassName, null, "java/lang/Object", null) + + val constructor = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null) + constructor.visitCode() + constructor.visitVarInsn(ALOAD, 0) + constructor.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V") + constructor.visitInsn(RETURN) + constructor.visitMaxs(1, 1) + constructor.visitEnd() + + val target = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, targetMethodName, targetMethodType, null, null) + target.visitCode() + target.visitLdcInsn("hello") + target.visitInsn(ARETURN) + target.visitMaxs(1, 1) + target.visitEnd() + + val bootstrap = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, bootstrapMethodName, bootStrapMethodType, null, null) + bootstrap.visitCode() +// val lookup = MethodHandles.lookup(); + bootstrap.visitMethodInsn(INVOKESTATIC, "java/lang/invoke/MethodHandles", "lookup", "()Ljava/lang/invoke/MethodHandles$Lookup;") + bootstrap.visitVarInsn(ASTORE, 3) // lookup + +// val clazz = lookup.lookupClass(); + bootstrap.visitVarInsn(ALOAD, 3) // lookup + bootstrap.visitMethodInsn(INVOKEVIRTUAL, "java/lang/invoke/MethodHandles$Lookup", "lookupClass", "()Ljava/lang/Class;") + bootstrap.visitVarInsn(ASTORE, 4) // clazz + +// val methodType = MethodType.fromMethodDescriptorString("()Ljava/lang/String, clazz.getClassLoader()") + bootstrap.visitLdcInsn("()Ljava/lang/String;") + bootstrap.visitVarInsn(ALOAD, 4) // CLAZZ + bootstrap.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Class", "getClassLoader", "()Ljava/lang/ClassLoader;") + bootstrap.visitMethodInsn(INVOKESTATIC, "java/lang/invoke/MethodType", "fromMethodDescriptorString", "(Ljava/lang/String;Ljava/lang/ClassLoader;)Ljava/lang/invoke/MethodType;") + bootstrap.visitVarInsn(ASTORE, 5) // methodType + +// val methodHandle = lookup.findStatic(thisClass, "target", methodType) + bootstrap.visitVarInsn(ALOAD, 3) // lookup + bootstrap.visitVarInsn(ALOAD, 4) // clazz + bootstrap.visitLdcInsn("target") + bootstrap.visitVarInsn(ALOAD, 5) // methodType + bootstrap.visitMethodInsn(INVOKEVIRTUAL, "java/lang/invoke/MethodHandles$Lookup", "findStatic", "(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/MethodHandle;") + bootstrap.visitVarInsn(ASTORE, 6) // methodHandle + +// new ConstantCallSite(methodHandle) + bootstrap.visitTypeInsn(NEW, "java/lang/invoke/ConstantCallSite") + bootstrap.visitInsn(DUP) + bootstrap.visitVarInsn(ALOAD, 6) // methodHandle + bootstrap.visitMethodInsn(INVOKESPECIAL, "java/lang/invoke/ConstantCallSite", "<init>", "(Ljava/lang/invoke/MethodHandle;)V") + bootstrap.visitInsn(ARETURN) + bootstrap.visitMaxs(4,7) + bootstrap.visitEnd() + + val test = cw.visitMethod(ACC_PUBLIC + ACC_FINAL, "test", s"()Ljava/lang/String;", null, null) + test.visitCode() + val bootstrapHandle = new Handle(H_INVOKESTATIC, invokerClassName, bootstrapMethodName, bootStrapMethodType) + test.visitInvokeDynamicInsn("invoke", targetMethodType, bootstrapHandle) + test.visitInsn(ARETURN) + test.visitMaxs(1, 1) + test.visitEnd() + + cw.visitEnd() + val bytes = cw.toByteArray() + + val fos = new FileOutputStream(new File(s"${testOutput.path}/$invokerClassName.class")) + try + fos write bytes + finally + fos.close() + + } + + def code = +""" +object Driver { + val invoker = new DynamicInvoker() + println(invoker.test()) +} +""" + + override def show(): Unit = { + // redirect err to out, for logging + val prevErr = System.err + System.setErr(System.out) + try { + // this test is only valid under JDK 1.7+ + // cheat a little by using 'ScalaVersion' because it can parse java versions just as well + val requiredJavaVersion = ScalaVersion("1.7") + val executingJavaVersion = ScalaVersion(System.getProperty("java.specification.version")) + if (executingJavaVersion >= requiredJavaVersion) { + generateClass() + compile() + } + } + finally + System.setErr(prevErr) + } +} diff --git a/test/files/run/inline-ex-handlers.check b/test/files/run/inline-ex-handlers.check index abcc8bf42d..7c885d2cc9 100644 --- a/test/files/run/inline-ex-handlers.check +++ b/test/files/run/inline-ex-handlers.check @@ -1,427 +1,492 @@ -172c172 -< locals: value x$1, value x1 ---- -> locals: value x$1, value x1, variable boxed1 -174c174 -< blocks: [1,2,3,4] ---- -> blocks: [1,3,4] -186a187,188 -> 92 STORE_LOCAL(variable boxed1) -> 92 LOAD_LOCAL(variable boxed1) -195,197d196 -< 92 JUMP 2 -< -< 2: -247c246 -< blocks: [1,2,3,4,5,6,7,8,11,12,13,14,15,16,17,18] ---- -> blocks: [1,2,3,4,5,6,8,11,12,13,14,15,16,17,18] -258,260d256 -< 92 JUMP 7 -< -< 7: -391c387 -< locals: value args, variable result, value ex6, value x4, value x5, value message, value x ---- -> locals: value args, variable result, value ex6, value x4, value x5, value x -393c389 -< blocks: [1,2,3,4,5,8,10,11,13] ---- -> blocks: [1,2,3,5,8,10,11,13,14] -417c413,422 -< 103 THROW(MyException) ---- -> ? STORE_LOCAL(value ex6) -> ? JUMP 14 -> -> 14: -> 101 LOAD_LOCAL(value ex6) -> 101 STORE_LOCAL(value x4) -> 101 SCOPE_ENTER value x4 -> 106 LOAD_LOCAL(value x4) -> 106 IS_INSTANCE REF(class MyException) -> 106 CZJUMP (BOOL)NE ? 5 : 8 -430,432d434 -< 101 JUMP 4 -< -< 4: -442,445d443 -< 106 LOAD_LOCAL(value x5) -< 106 CALL_METHOD MyException.message (dynamic) -< 106 STORE_LOCAL(value message) -< 106 SCOPE_ENTER value message -447c445,446 -< 106 LOAD_LOCAL(value message) ---- -> ? LOAD_LOCAL(value x5) -> 106 CALL_METHOD MyException.message (dynamic) -519c518 -< blocks: [1,2,3,4,6,7,9,10] ---- -> blocks: [1,3,4,6,7,9,10,11,12,13] -548c547,552 -< 306 THROW(MyException) ---- -> ? JUMP 11 -> -> 11: -> ? LOAD_LOCAL(variable monitor4) -> 305 MONITOR_EXIT -> ? JUMP 12 -554c558 -< ? THROW(Throwable) ---- -> ? JUMP 12 -560c564,571 -< ? THROW(Throwable) ---- -> ? STORE_LOCAL(value t) -> ? JUMP 13 -> -> 12: -> ? LOAD_LOCAL(variable monitor3) -> 304 MONITOR_EXIT -> ? STORE_LOCAL(value t) -> ? JUMP 13 -574c585 -< 310 JUMP 2 ---- -> 300 RETURN(UNIT) -576c587,596 -< 2: ---- -> 13: -> 310 LOAD_MODULE object Predef -> 310 CALL_PRIMITIVE(StartConcat) -> 310 CONSTANT("Caught crash: ") -> 310 CALL_PRIMITIVE(StringConcat(REF(class String))) -> 310 LOAD_LOCAL(value t) -> 310 CALL_METHOD java.lang.Throwable.toString (dynamic) -> 310 CALL_PRIMITIVE(StringConcat(REF(class String))) -> 310 CALL_PRIMITIVE(EndConcat) -> 310 CALL_METHOD scala.Predef.println (dynamic) -584c604 -< catch (Throwable) in ArrayBuffer(7, 9, 10) starting at: 6 ---- -> catch (Throwable) in ArrayBuffer(7, 9, 10, 11) starting at: 6 -587c607 -< catch (Throwable) in ArrayBuffer(4, 6, 7, 9, 10) starting at: 3 ---- -> catch (Throwable) in ArrayBuffer(4, 6, 7, 9, 10, 11, 12) starting at: 3 -619c639 -< blocks: [1,3,4,5,6,8,9] ---- -> blocks: [1,3,4,5,6,8,9,10,11] -643c663,669 -< 78 THROW(IllegalArgumentException) ---- -> ? STORE_LOCAL(value e) -> ? JUMP 10 -> -> 10: -> 81 LOAD_LOCAL(value e) -> ? STORE_LOCAL(variable exc1) -> ? JUMP 11 -669c695,696 -< 81 THROW(Exception) ---- -> ? STORE_LOCAL(variable exc1) -> ? JUMP 11 -685a713,725 -> 11: -> 83 LOAD_MODULE object Predef -> 83 CONSTANT("finally") -> 83 CALL_METHOD scala.Predef.println (dynamic) -> 84 LOAD_LOCAL(variable result) -> 84 CONSTANT(1) -> 84 CALL_PRIMITIVE(Arithmetic(SUB,INT)) -> 84 CONSTANT(2) -> 84 CALL_PRIMITIVE(Arithmetic(DIV,INT)) -> 84 STORE_LOCAL(variable result) -> 84 LOAD_LOCAL(variable exc1) -> 84 THROW(Throwable) -> -691c731 -< catch (<none>) in ArrayBuffer(4, 5, 6, 8) starting at: 3 ---- -> catch (<none>) in ArrayBuffer(4, 5, 6, 8, 10) starting at: 3 -715c755 -< locals: value args, variable result, value ex6, variable exc2, value x4, value x5, value message, value x, value ex6, value x4, value x5, value message, value x ---- -> locals: value args, variable result, value ex6, variable exc2, value x4, value x5, value x, value ex6, value x4, value x5, value x -717c757 -< blocks: [1,3,4,5,6,9,13,14,15,18,20,21,23,24] ---- -> blocks: [1,3,4,5,6,9,13,14,15,18,20,21,23,24,25,26,27] -741c781,788 -< 172 THROW(MyException) ---- -> ? STORE_LOCAL(value ex6) -> ? JUMP 25 -> -> 25: -> 170 LOAD_LOCAL(value ex6) -> 170 STORE_LOCAL(value x4) -> 170 SCOPE_ENTER value x4 -> 170 JUMP 14 -781,784d827 -< 175 LOAD_LOCAL(value x5) -< 175 CALL_METHOD MyException.message (dynamic) -< 175 STORE_LOCAL(value message) -< 175 SCOPE_ENTER value message -786c829,830 -< 176 LOAD_LOCAL(value message) ---- -> ? LOAD_LOCAL(value x5) -> 176 CALL_METHOD MyException.message (dynamic) -790c834,835 -< 177 LOAD_LOCAL(value message) ---- -> ? LOAD_LOCAL(value x5) -> 177 CALL_METHOD MyException.message (dynamic) -792c837,838 -< 177 THROW(MyException) ---- -> ? STORE_LOCAL(value ex6) -> ? JUMP 26 -796c842,843 -< 170 THROW(Throwable) ---- -> ? STORE_LOCAL(value ex6) -> ? JUMP 26 -805a853,858 -> 26: -> 169 LOAD_LOCAL(value ex6) -> 169 STORE_LOCAL(value x4) -> 169 SCOPE_ENTER value x4 -> 169 JUMP 5 -> -816,819d868 -< 180 LOAD_LOCAL(value x5) -< 180 CALL_METHOD MyException.message (dynamic) -< 180 STORE_LOCAL(value message) -< 180 SCOPE_ENTER value message -821c870,871 -< 181 LOAD_LOCAL(value message) ---- -> ? LOAD_LOCAL(value x5) -> 181 CALL_METHOD MyException.message (dynamic) -825c875,876 -< 182 LOAD_LOCAL(value message) ---- -> ? LOAD_LOCAL(value x5) -> 182 CALL_METHOD MyException.message (dynamic) -827c878,879 -< 182 THROW(MyException) ---- -> ? STORE_LOCAL(variable exc2) -> ? JUMP 27 -831c883,884 -< 169 THROW(Throwable) ---- -> ? STORE_LOCAL(variable exc2) -> ? JUMP 27 -847a901,913 -> 27: -> 184 LOAD_MODULE object Predef -> 184 CONSTANT("finally") -> 184 CALL_METHOD scala.Predef.println (dynamic) -> 185 LOAD_LOCAL(variable result) -> 185 CONSTANT(1) -> 185 CALL_PRIMITIVE(Arithmetic(SUB,INT)) -> 185 CONSTANT(2) -> 185 CALL_PRIMITIVE(Arithmetic(DIV,INT)) -> 185 STORE_LOCAL(variable result) -> 185 LOAD_LOCAL(variable exc2) -> 185 THROW(Throwable) -> -853c919 -< catch (Throwable) in ArrayBuffer(13, 14, 15, 18, 20, 21, 23) starting at: 4 ---- -> catch (Throwable) in ArrayBuffer(13, 14, 15, 18, 20, 21, 23, 25) starting at: 4 -856c922 -< catch (<none>) in ArrayBuffer(4, 5, 6, 9, 13, 14, 15, 18, 20, 21, 23) starting at: 3 ---- -> catch (<none>) in ArrayBuffer(4, 5, 6, 9, 13, 14, 15, 18, 20, 21, 23, 25, 26) starting at: 3 -880c946 -< locals: value args, variable result, value e, value ex6, value x4, value x5, value message, value x ---- -> locals: value args, variable result, value e, value ex6, value x4, value x5, value x -882c948 -< blocks: [1,2,3,6,7,8,11,13,14,16] ---- -> blocks: [1,2,3,6,7,8,11,13,14,16,17] -906c972,979 -< 124 THROW(MyException) ---- -> ? STORE_LOCAL(value ex6) -> ? JUMP 17 -> -> 17: -> 122 LOAD_LOCAL(value ex6) -> 122 STORE_LOCAL(value x4) -> 122 SCOPE_ENTER value x4 -> 122 JUMP 7 -931,934d1003 -< 127 LOAD_LOCAL(value x5) -< 127 CALL_METHOD MyException.message (dynamic) -< 127 STORE_LOCAL(value message) -< 127 SCOPE_ENTER value message -936c1005,1006 -< 127 LOAD_LOCAL(value message) ---- -> ? LOAD_LOCAL(value x5) -> 127 CALL_METHOD MyException.message (dynamic) -965c1035 -< catch (IllegalArgumentException) in ArrayBuffer(6, 7, 8, 11, 13, 14, 16) starting at: 3 ---- -> catch (IllegalArgumentException) in ArrayBuffer(6, 7, 8, 11, 13, 14, 16, 17) starting at: 3 -989c1059 -< locals: value args, variable result, value ex6, value x4, value x5, value message, value x, value e ---- -> locals: value args, variable result, value ex6, value x4, value x5, value x, value e -991c1061 -< blocks: [1,2,3,4,5,8,12,13,14,16] ---- -> blocks: [1,2,3,5,8,12,13,14,16,17] -1015c1085,1094 -< 148 THROW(MyException) ---- -> ? STORE_LOCAL(value ex6) -> ? JUMP 17 -> -> 17: -> 145 LOAD_LOCAL(value ex6) -> 145 STORE_LOCAL(value x4) -> 145 SCOPE_ENTER value x4 -> 154 LOAD_LOCAL(value x4) -> 154 IS_INSTANCE REF(class MyException) -> 154 CZJUMP (BOOL)NE ? 5 : 8 -1036,1038d1114 -< 145 JUMP 4 -< -< 4: -1048,1051d1123 -< 154 LOAD_LOCAL(value x5) -< 154 CALL_METHOD MyException.message (dynamic) -< 154 STORE_LOCAL(value message) -< 154 SCOPE_ENTER value message -1053c1125,1126 -< 154 LOAD_LOCAL(value message) ---- -> ? LOAD_LOCAL(value x5) -> 154 CALL_METHOD MyException.message (dynamic) -1270c1343 -< blocks: [1,2,3,4,5,7] ---- -> blocks: [1,2,3,4,5,7,8] -1294c1367,1374 -< 38 THROW(IllegalArgumentException) ---- -> ? STORE_LOCAL(value e) -> ? JUMP 8 -> -> 8: -> 42 LOAD_MODULE object Predef -> 42 CONSTANT("IllegalArgumentException") -> 42 CALL_METHOD scala.Predef.println (dynamic) -> 42 JUMP 2 -1341c1421 -< locals: value args, variable result, value ex6, value x4, value x5, value message, value x ---- -> locals: value args, variable result, value ex6, value x4, value x5, value x -1343c1423 -< blocks: [1,2,3,4,5,8,10,11,13,14,16] ---- -> blocks: [1,2,3,5,8,10,11,13,14,16,17] -1367c1447,1448 -< 203 THROW(MyException) ---- -> ? STORE_LOCAL(value ex6) -> ? JUMP 17 -1387c1468,1477 -< 209 THROW(MyException) ---- -> ? STORE_LOCAL(value ex6) -> ? JUMP 17 -> -> 17: -> 200 LOAD_LOCAL(value ex6) -> 200 STORE_LOCAL(value x4) -> 200 SCOPE_ENTER value x4 -> 212 LOAD_LOCAL(value x4) -> 212 IS_INSTANCE REF(class MyException) -> 212 CZJUMP (BOOL)NE ? 5 : 8 -1400,1402d1489 -< 200 JUMP 4 -< -< 4: -1412,1415d1498 -< 212 LOAD_LOCAL(value x5) -< 212 CALL_METHOD MyException.message (dynamic) -< 212 STORE_LOCAL(value message) -< 212 SCOPE_ENTER value message -1417c1500,1501 -< 213 LOAD_LOCAL(value message) ---- -> ? LOAD_LOCAL(value x5) -> 213 CALL_METHOD MyException.message (dynamic) -1461c1545 -< blocks: [1,2,3,4,5,7] ---- -> blocks: [1,2,3,4,5,7,8] -1485c1569,1570 -< 58 THROW(IllegalArgumentException) ---- -> ? STORE_LOCAL(value e) -> ? JUMP 8 -1486a1572,1577 -> 8: -> 62 LOAD_MODULE object Predef -> 62 CONSTANT("RuntimeException") -> 62 CALL_METHOD scala.Predef.println (dynamic) -> 62 JUMP 2 -> -1534c1625 -< blocks: [1,3,4] ---- -> blocks: [1,3,4,5] -1554c1645,1650 -< 229 THROW(MyException) ---- -> ? JUMP 5 -> -> 5: -> ? LOAD_LOCAL(variable monitor1) -> 228 MONITOR_EXIT -> 228 THROW(Throwable) -1560c1656 -< ? THROW(Throwable) ---- -> 228 THROW(Throwable) -1588c1684 -< locals: value args, variable result, variable monitor2, variable monitorResult1 ---- -> locals: value exception$1, value args, variable result, variable monitor2, variable monitorResult1 -1590c1686 -< blocks: [1,3,4] ---- -> blocks: [1,3,4,5] -1613c1709,1717 -< 245 THROW(MyException) ---- -> ? STORE_LOCAL(value exception$1) -> ? DROP ConcatClass -> ? LOAD_LOCAL(value exception$1) -> ? JUMP 5 -> -> 5: -> ? LOAD_LOCAL(variable monitor2) -> 244 MONITOR_EXIT -> 244 THROW(Throwable) -1619c1723 -< ? THROW(Throwable) ---- -> 244 THROW(Throwable) - +--- a ++++ b +@@ -171,5 +171,5 @@ + def productElement(x$1: Int (INT)): Object { +- locals: value x$1, value x1 ++ locals: value x$1, value x1, variable boxed1 + startBlock: 1 +- blocks: [1,2,3,4] ++ blocks: [1,3,4] + +@@ -186,2 +186,4 @@ + 92 LOAD_LOCAL(value x$1) ++ 92 STORE_LOCAL(variable boxed1) ++ 92 LOAD_LOCAL(variable boxed1) + 92 BOX INT +@@ -194,5 +196,2 @@ + 92 CALL_METHOD MyException.message (dynamic) +- 92 JUMP 2 +- +- 2: + 92 RETURN(REF(class Object)) +@@ -246,3 +245,3 @@ + startBlock: 1 +- blocks: [1,2,3,4,5,6,7,8,11,12,13,14,15,16,17,18] ++ blocks: [1,2,3,4,5,6,8,11,12,13,14,15,16,17,18] + +@@ -257,5 +256,2 @@ + 92 SCOPE_ENTER value x1 +- 92 JUMP 7 +- +- 7: + 92 LOAD_LOCAL(value x1) +@@ -390,5 +386,5 @@ + def main(args: Array[String] (ARRAY[REF(class String)])): Unit { +- locals: value args, variable result, value ex6, value x4, value x5, value message, value x ++ locals: value args, variable result, value ex6, value x4, value x5, value x + startBlock: 1 +- blocks: [1,2,3,4,5,8,10,11,13] ++ blocks: [1,2,3,5,8,10,11,13,14] + +@@ -416,4 +412,13 @@ + 103 CALL_METHOD MyException.<init> (static-instance) +- 103 THROW(MyException) ++ ? STORE_LOCAL(value ex6) ++ ? JUMP 14 + ++ 14: ++ 101 LOAD_LOCAL(value ex6) ++ 101 STORE_LOCAL(value x4) ++ 101 SCOPE_ENTER value x4 ++ 106 LOAD_LOCAL(value x4) ++ 106 IS_INSTANCE REF(class MyException) ++ 106 CZJUMP (BOOL)NE ? 5 : 8 ++ + 13: +@@ -429,5 +434,2 @@ + 101 SCOPE_ENTER value x4 +- 101 JUMP 4 +- +- 4: + 106 LOAD_LOCAL(value x4) +@@ -441,8 +443,5 @@ + 106 SCOPE_ENTER value x5 +- 106 LOAD_LOCAL(value x5) +- 106 CALL_METHOD MyException.message (dynamic) +- 106 STORE_LOCAL(value message) +- 106 SCOPE_ENTER value message + 106 LOAD_MODULE object Predef +- 106 LOAD_LOCAL(value message) ++ ? LOAD_LOCAL(value x5) ++ 106 CALL_METHOD MyException.message (dynamic) + 106 CALL_METHOD scala.Predef.println (dynamic) +@@ -518,3 +517,3 @@ + startBlock: 1 +- blocks: [1,2,3,4,6,7,9,10] ++ blocks: [1,3,4,6,7,9,10,11,12,13] + +@@ -547,4 +546,9 @@ + 306 CALL_METHOD MyException.<init> (static-instance) +- 306 THROW(MyException) ++ ? JUMP 11 + ++ 11: ++ ? LOAD_LOCAL(variable monitor4) ++ 305 MONITOR_EXIT ++ ? JUMP 12 ++ + 9: +@@ -553,3 +557,3 @@ + 305 MONITOR_EXIT +- ? THROW(Throwable) ++ ? JUMP 12 + +@@ -559,4 +563,11 @@ + 304 MONITOR_EXIT +- ? THROW(Throwable) ++ ? STORE_LOCAL(value t) ++ ? JUMP 13 + ++ 12: ++ ? LOAD_LOCAL(variable monitor3) ++ 304 MONITOR_EXIT ++ ? STORE_LOCAL(value t) ++ ? JUMP 13 ++ + 3: +@@ -573,5 +584,14 @@ + 310 CALL_METHOD scala.Predef.println (dynamic) +- 310 JUMP 2 ++ 300 RETURN(UNIT) + +- 2: ++ 13: ++ 310 LOAD_MODULE object Predef ++ 310 CALL_PRIMITIVE(StartConcat) ++ 310 CONSTANT("Caught crash: ") ++ 310 CALL_PRIMITIVE(StringConcat(REF(class String))) ++ 310 LOAD_LOCAL(value t) ++ 310 CALL_METHOD java.lang.Throwable.toString (dynamic) ++ 310 CALL_PRIMITIVE(StringConcat(REF(class String))) ++ 310 CALL_PRIMITIVE(EndConcat) ++ 310 CALL_METHOD scala.Predef.println (dynamic) + 300 RETURN(UNIT) +@@ -583,6 +603,6 @@ + with finalizer: null +- catch (Throwable) in ArrayBuffer(7, 9, 10) starting at: 6 ++ catch (Throwable) in ArrayBuffer(7, 9, 10, 11) starting at: 6 + consisting of blocks: List(6) + with finalizer: null +- catch (Throwable) in ArrayBuffer(4, 6, 7, 9, 10) starting at: 3 ++ catch (Throwable) in ArrayBuffer(4, 6, 7, 9, 10, 11, 12) starting at: 3 + consisting of blocks: List(3) +@@ -618,3 +638,3 @@ + startBlock: 1 +- blocks: [1,3,4,5,6,8,9] ++ blocks: [1,3,4,5,6,8,9,10,11] + +@@ -642,4 +662,10 @@ + 78 CALL_METHOD java.lang.IllegalArgumentException.<init> (static-instance) +- 78 THROW(IllegalArgumentException) ++ ? STORE_LOCAL(value e) ++ ? JUMP 10 + ++ 10: ++ 81 LOAD_LOCAL(value e) ++ ? STORE_LOCAL(variable exc1) ++ ? JUMP 11 ++ + 8: +@@ -668,3 +694,4 @@ + 81 LOAD_LOCAL(value e) +- 81 THROW(Exception) ++ ? STORE_LOCAL(variable exc1) ++ ? JUMP 11 + +@@ -685,2 +712,15 @@ + ++ 11: ++ 83 LOAD_MODULE object Predef ++ 83 CONSTANT("finally") ++ 83 CALL_METHOD scala.Predef.println (dynamic) ++ 84 LOAD_LOCAL(variable result) ++ 84 CONSTANT(1) ++ 84 CALL_PRIMITIVE(Arithmetic(SUB,INT)) ++ 84 CONSTANT(2) ++ 84 CALL_PRIMITIVE(Arithmetic(DIV,INT)) ++ 84 STORE_LOCAL(variable result) ++ 84 LOAD_LOCAL(variable exc1) ++ 84 THROW(Throwable) ++ + } +@@ -690,3 +730,3 @@ + with finalizer: null +- catch (<none>) in ArrayBuffer(4, 5, 6, 8) starting at: 3 ++ catch (<none>) in ArrayBuffer(4, 5, 6, 8, 10) starting at: 3 + consisting of blocks: List(3) +@@ -714,5 +754,5 @@ + def main(args: Array[String] (ARRAY[REF(class String)])): Unit { +- locals: value args, variable result, value ex6, variable exc2, value x4, value x5, value message, value x, value ex6, value x4, value x5, value message, value x ++ locals: value args, variable result, value ex6, variable exc2, value x4, value x5, value x, value ex6, value x4, value x5, value x + startBlock: 1 +- blocks: [1,3,4,5,6,9,13,14,15,18,20,21,23,24] ++ blocks: [1,3,4,5,6,9,13,14,15,18,20,21,23,24,25,26,27] + +@@ -740,4 +780,11 @@ + 172 CALL_METHOD MyException.<init> (static-instance) +- 172 THROW(MyException) ++ ? STORE_LOCAL(value ex6) ++ ? JUMP 25 + ++ 25: ++ 170 LOAD_LOCAL(value ex6) ++ 170 STORE_LOCAL(value x4) ++ 170 SCOPE_ENTER value x4 ++ 170 JUMP 14 ++ + 23: +@@ -780,8 +827,5 @@ + 175 SCOPE_ENTER value x5 +- 175 LOAD_LOCAL(value x5) +- 175 CALL_METHOD MyException.message (dynamic) +- 175 STORE_LOCAL(value message) +- 175 SCOPE_ENTER value message + 176 LOAD_MODULE object Predef +- 176 LOAD_LOCAL(value message) ++ ? LOAD_LOCAL(value x5) ++ 176 CALL_METHOD MyException.message (dynamic) + 176 CALL_METHOD scala.Predef.println (dynamic) +@@ -789,5 +833,7 @@ + 177 DUP(REF(class MyException)) +- 177 LOAD_LOCAL(value message) ++ ? LOAD_LOCAL(value x5) ++ 177 CALL_METHOD MyException.message (dynamic) + 177 CALL_METHOD MyException.<init> (static-instance) +- 177 THROW(MyException) ++ ? STORE_LOCAL(value ex6) ++ ? JUMP 26 + +@@ -795,3 +841,4 @@ + 170 LOAD_LOCAL(value ex6) +- 170 THROW(Throwable) ++ ? STORE_LOCAL(value ex6) ++ ? JUMP 26 + +@@ -805,2 +852,8 @@ + ++ 26: ++ 169 LOAD_LOCAL(value ex6) ++ 169 STORE_LOCAL(value x4) ++ 169 SCOPE_ENTER value x4 ++ 169 JUMP 5 ++ + 5: +@@ -815,8 +868,5 @@ + 180 SCOPE_ENTER value x5 +- 180 LOAD_LOCAL(value x5) +- 180 CALL_METHOD MyException.message (dynamic) +- 180 STORE_LOCAL(value message) +- 180 SCOPE_ENTER value message + 181 LOAD_MODULE object Predef +- 181 LOAD_LOCAL(value message) ++ ? LOAD_LOCAL(value x5) ++ 181 CALL_METHOD MyException.message (dynamic) + 181 CALL_METHOD scala.Predef.println (dynamic) +@@ -824,5 +874,7 @@ + 182 DUP(REF(class MyException)) +- 182 LOAD_LOCAL(value message) ++ ? LOAD_LOCAL(value x5) ++ 182 CALL_METHOD MyException.message (dynamic) + 182 CALL_METHOD MyException.<init> (static-instance) +- 182 THROW(MyException) ++ ? STORE_LOCAL(variable exc2) ++ ? JUMP 27 + +@@ -830,3 +882,4 @@ + 169 LOAD_LOCAL(value ex6) +- 169 THROW(Throwable) ++ ? STORE_LOCAL(variable exc2) ++ ? JUMP 27 + +@@ -847,2 +900,15 @@ + ++ 27: ++ 184 LOAD_MODULE object Predef ++ 184 CONSTANT("finally") ++ 184 CALL_METHOD scala.Predef.println (dynamic) ++ 185 LOAD_LOCAL(variable result) ++ 185 CONSTANT(1) ++ 185 CALL_PRIMITIVE(Arithmetic(SUB,INT)) ++ 185 CONSTANT(2) ++ 185 CALL_PRIMITIVE(Arithmetic(DIV,INT)) ++ 185 STORE_LOCAL(variable result) ++ 185 LOAD_LOCAL(variable exc2) ++ 185 THROW(Throwable) ++ + } +@@ -852,6 +918,6 @@ + with finalizer: null +- catch (Throwable) in ArrayBuffer(13, 14, 15, 18, 20, 21, 23) starting at: 4 ++ catch (Throwable) in ArrayBuffer(13, 14, 15, 18, 20, 21, 23, 25) starting at: 4 + consisting of blocks: List(9, 8, 6, 5, 4) + with finalizer: null +- catch (<none>) in ArrayBuffer(4, 5, 6, 9, 13, 14, 15, 18, 20, 21, 23) starting at: 3 ++ catch (<none>) in ArrayBuffer(4, 5, 6, 9, 13, 14, 15, 18, 20, 21, 23, 25, 26) starting at: 3 + consisting of blocks: List(3) +@@ -879,5 +945,5 @@ + def main(args: Array[String] (ARRAY[REF(class String)])): Unit { +- locals: value args, variable result, value e, value ex6, value x4, value x5, value message, value x ++ locals: value args, variable result, value e, value ex6, value x4, value x5, value x + startBlock: 1 +- blocks: [1,2,3,6,7,8,11,13,14,16] ++ blocks: [1,2,3,6,7,8,11,13,14,16,17] + +@@ -905,4 +971,11 @@ + 124 CALL_METHOD MyException.<init> (static-instance) +- 124 THROW(MyException) ++ ? STORE_LOCAL(value ex6) ++ ? JUMP 17 + ++ 17: ++ 122 LOAD_LOCAL(value ex6) ++ 122 STORE_LOCAL(value x4) ++ 122 SCOPE_ENTER value x4 ++ 122 JUMP 7 ++ + 16: +@@ -930,8 +1003,5 @@ + 127 SCOPE_ENTER value x5 +- 127 LOAD_LOCAL(value x5) +- 127 CALL_METHOD MyException.message (dynamic) +- 127 STORE_LOCAL(value message) +- 127 SCOPE_ENTER value message + 127 LOAD_MODULE object Predef +- 127 LOAD_LOCAL(value message) ++ ? LOAD_LOCAL(value x5) ++ 127 CALL_METHOD MyException.message (dynamic) + 127 CALL_METHOD scala.Predef.println (dynamic) +@@ -964,3 +1034,3 @@ + with finalizer: null +- catch (IllegalArgumentException) in ArrayBuffer(6, 7, 8, 11, 13, 14, 16) starting at: 3 ++ catch (IllegalArgumentException) in ArrayBuffer(6, 7, 8, 11, 13, 14, 16, 17) starting at: 3 + consisting of blocks: List(3) +@@ -988,5 +1058,5 @@ + def main(args: Array[String] (ARRAY[REF(class String)])): Unit { +- locals: value args, variable result, value ex6, value x4, value x5, value message, value x, value e ++ locals: value args, variable result, value ex6, value x4, value x5, value x, value e + startBlock: 1 +- blocks: [1,2,3,4,5,8,12,13,14,16] ++ blocks: [1,2,3,5,8,12,13,14,16,17] + +@@ -1014,4 +1084,13 @@ + 148 CALL_METHOD MyException.<init> (static-instance) +- 148 THROW(MyException) ++ ? STORE_LOCAL(value ex6) ++ ? JUMP 17 + ++ 17: ++ 145 LOAD_LOCAL(value ex6) ++ 145 STORE_LOCAL(value x4) ++ 145 SCOPE_ENTER value x4 ++ 154 LOAD_LOCAL(value x4) ++ 154 IS_INSTANCE REF(class MyException) ++ 154 CZJUMP (BOOL)NE ? 5 : 8 ++ + 16: +@@ -1035,5 +1114,2 @@ + 145 SCOPE_ENTER value x4 +- 145 JUMP 4 +- +- 4: + 154 LOAD_LOCAL(value x4) +@@ -1047,8 +1123,5 @@ + 154 SCOPE_ENTER value x5 +- 154 LOAD_LOCAL(value x5) +- 154 CALL_METHOD MyException.message (dynamic) +- 154 STORE_LOCAL(value message) +- 154 SCOPE_ENTER value message + 154 LOAD_MODULE object Predef +- 154 LOAD_LOCAL(value message) ++ ? LOAD_LOCAL(value x5) ++ 154 CALL_METHOD MyException.message (dynamic) + 154 CALL_METHOD scala.Predef.println (dynamic) +@@ -1269,3 +1342,3 @@ + startBlock: 1 +- blocks: [1,2,3,4,5,7] ++ blocks: [1,2,3,4,5,7,8] + +@@ -1293,4 +1366,11 @@ + 38 CALL_METHOD java.lang.IllegalArgumentException.<init> (static-instance) +- 38 THROW(IllegalArgumentException) ++ ? STORE_LOCAL(value e) ++ ? JUMP 8 + ++ 8: ++ 42 LOAD_MODULE object Predef ++ 42 CONSTANT("IllegalArgumentException") ++ 42 CALL_METHOD scala.Predef.println (dynamic) ++ 42 JUMP 2 ++ + 7: +@@ -1340,5 +1420,5 @@ + def main(args: Array[String] (ARRAY[REF(class String)])): Unit { +- locals: value args, variable result, value ex6, value x4, value x5, value message, value x ++ locals: value args, variable result, value ex6, value x4, value x5, value x + startBlock: 1 +- blocks: [1,2,3,4,5,8,10,11,13,14,16] ++ blocks: [1,2,3,5,8,10,11,13,14,16,17] + +@@ -1366,3 +1446,4 @@ + 203 CALL_METHOD MyException.<init> (static-instance) +- 203 THROW(MyException) ++ ? STORE_LOCAL(value ex6) ++ ? JUMP 17 + +@@ -1386,4 +1467,13 @@ + 209 CALL_METHOD MyException.<init> (static-instance) +- 209 THROW(MyException) ++ ? STORE_LOCAL(value ex6) ++ ? JUMP 17 + ++ 17: ++ 200 LOAD_LOCAL(value ex6) ++ 200 STORE_LOCAL(value x4) ++ 200 SCOPE_ENTER value x4 ++ 212 LOAD_LOCAL(value x4) ++ 212 IS_INSTANCE REF(class MyException) ++ 212 CZJUMP (BOOL)NE ? 5 : 8 ++ + 16: +@@ -1399,5 +1489,2 @@ + 200 SCOPE_ENTER value x4 +- 200 JUMP 4 +- +- 4: + 212 LOAD_LOCAL(value x4) +@@ -1411,8 +1498,5 @@ + 212 SCOPE_ENTER value x5 +- 212 LOAD_LOCAL(value x5) +- 212 CALL_METHOD MyException.message (dynamic) +- 212 STORE_LOCAL(value message) +- 212 SCOPE_ENTER value message + 213 LOAD_MODULE object Predef +- 213 LOAD_LOCAL(value message) ++ ? LOAD_LOCAL(value x5) ++ 213 CALL_METHOD MyException.message (dynamic) + 213 CALL_METHOD scala.Predef.println (dynamic) +@@ -1460,3 +1544,3 @@ + startBlock: 1 +- blocks: [1,2,3,4,5,7] ++ blocks: [1,2,3,4,5,7,8] + +@@ -1484,4 +1568,11 @@ + 58 CALL_METHOD java.lang.IllegalArgumentException.<init> (static-instance) +- 58 THROW(IllegalArgumentException) ++ ? STORE_LOCAL(value e) ++ ? JUMP 8 + ++ 8: ++ 62 LOAD_MODULE object Predef ++ 62 CONSTANT("RuntimeException") ++ 62 CALL_METHOD scala.Predef.println (dynamic) ++ 62 JUMP 2 ++ + 7: +@@ -1533,3 +1624,3 @@ + startBlock: 1 +- blocks: [1,3,4] ++ blocks: [1,3,4,5] + +@@ -1553,4 +1644,9 @@ + 229 CALL_METHOD MyException.<init> (static-instance) +- 229 THROW(MyException) ++ ? JUMP 5 + ++ 5: ++ ? LOAD_LOCAL(variable monitor1) ++ 228 MONITOR_EXIT ++ 228 THROW(Throwable) ++ + 3: +@@ -1559,3 +1655,3 @@ + 228 MONITOR_EXIT +- ? THROW(Throwable) ++ 228 THROW(Throwable) + +@@ -1587,5 +1683,5 @@ + def main(args: Array[String] (ARRAY[REF(class String)])): Unit { +- locals: value args, variable result, variable monitor2, variable monitorResult1 ++ locals: value exception$1, value args, variable result, variable monitor2, variable monitorResult1 + startBlock: 1 +- blocks: [1,3,4] ++ blocks: [1,3,4,5] + +@@ -1612,4 +1708,12 @@ + 245 CALL_METHOD MyException.<init> (static-instance) +- 245 THROW(MyException) ++ ? STORE_LOCAL(value exception$1) ++ ? DROP ConcatClass ++ ? LOAD_LOCAL(value exception$1) ++ ? JUMP 5 + ++ 5: ++ ? LOAD_LOCAL(variable monitor2) ++ 244 MONITOR_EXIT ++ 244 THROW(Throwable) ++ + 3: +@@ -1618,3 +1722,3 @@ + 244 MONITOR_EXIT +- ? THROW(Throwable) ++ 244 THROW(Throwable) + diff --git a/test/files/run/macro-expand-nullary-generic.check b/test/files/run/macro-expand-nullary-generic.check index 133840c469..42976f4baf 100644 --- a/test/files/run/macro-expand-nullary-generic.check +++ b/test/files/run/macro-expand-nullary-generic.check @@ -1,6 +1,6 @@ -it works TypeTag[Int] -it works TypeTag[Int] -it works TypeTag[Int] -it works TypeTag[Int] -it works TypeTag[Int] +it works WeakTypeTag[Int] +it works WeakTypeTag[Int] +it works WeakTypeTag[Int] +it works WeakTypeTag[Int] +it works WeakTypeTag[Int] kkthxbai diff --git a/test/files/run/macro-expand-tparams-explicit.check b/test/files/run/macro-expand-tparams-explicit.check index e7e6718406..b6b4f6fa3a 100644 --- a/test/files/run/macro-expand-tparams-explicit.check +++ b/test/files/run/macro-expand-tparams-explicit.check @@ -1 +1 @@ -TypeTag[Int] +WeakTypeTag[Int] diff --git a/test/files/run/macro-expand-tparams-implicit.check b/test/files/run/macro-expand-tparams-implicit.check index fa6b335afb..a9bf55423e 100644 --- a/test/files/run/macro-expand-tparams-implicit.check +++ b/test/files/run/macro-expand-tparams-implicit.check @@ -1,2 +1,2 @@ -TypeTag[Int] +WeakTypeTag[Int] WeakTypeTag[String] diff --git a/test/files/run/macro-expand-tparams-prefix-a.check b/test/files/run/macro-expand-tparams-prefix-a.check index 0bf3c55bbe..ca44a4f652 100644 --- a/test/files/run/macro-expand-tparams-prefix-a.check +++ b/test/files/run/macro-expand-tparams-prefix-a.check @@ -1,4 +1,4 @@ -TypeTag[Int] -TypeTag[Int] +WeakTypeTag[Int] +WeakTypeTag[Int] WeakTypeTag[String] -TypeTag[Boolean] +WeakTypeTag[Boolean] diff --git a/test/files/run/macro-expand-tparams-prefix-b.check b/test/files/run/macro-expand-tparams-prefix-b.check index 77c2ee9051..2ff2ce435d 100644 --- a/test/files/run/macro-expand-tparams-prefix-b.check +++ b/test/files/run/macro-expand-tparams-prefix-b.check @@ -1,2 +1,2 @@ -TypeTag[Boolean] TypeTag[Int] -TypeTag[Boolean] WeakTypeTag[String] +WeakTypeTag[Boolean] WeakTypeTag[Int] +WeakTypeTag[Boolean] WeakTypeTag[String] diff --git a/test/files/run/macro-expand-tparams-prefix-c1.check b/test/files/run/macro-expand-tparams-prefix-c1.check index f0dd5b9cd8..0f24f74db1 100644 --- a/test/files/run/macro-expand-tparams-prefix-c1.check +++ b/test/files/run/macro-expand-tparams-prefix-c1.check @@ -1,3 +1,3 @@ -TypeTag[Int] +WeakTypeTag[Int] WeakTypeTag[String] -TypeTag[Boolean] +WeakTypeTag[Boolean] diff --git a/test/files/run/macro-expand-tparams-prefix-c2.check b/test/files/run/macro-expand-tparams-prefix-c2.check index f0dd5b9cd8..0f24f74db1 100644 --- a/test/files/run/macro-expand-tparams-prefix-c2.check +++ b/test/files/run/macro-expand-tparams-prefix-c2.check @@ -1,3 +1,3 @@ -TypeTag[Int] +WeakTypeTag[Int] WeakTypeTag[String] -TypeTag[Boolean] +WeakTypeTag[Boolean] diff --git a/test/files/run/macro-expand-tparams-prefix-d1.check b/test/files/run/macro-expand-tparams-prefix-d1.check index c5aaaf5a09..7832503256 100644 --- a/test/files/run/macro-expand-tparams-prefix-d1.check +++ b/test/files/run/macro-expand-tparams-prefix-d1.check @@ -1,3 +1,3 @@ WeakTypeTag[T] WeakTypeTag[U] -TypeTag[Boolean] +WeakTypeTag[Boolean] diff --git a/test/files/run/macro-undetparams-consfromsls.check b/test/files/run/macro-undetparams-consfromsls.check index b10a90043e..3fee58d9c1 100644 --- a/test/files/run/macro-undetparams-consfromsls.check +++ b/test/files/run/macro-undetparams-consfromsls.check @@ -1,5 +1,5 @@ -A = TypeTag[Int] -B = TypeTag[Nothing] +A = WeakTypeTag[Int] +B = WeakTypeTag[Nothing] List(1) -A = TypeTag[Any] +A = WeakTypeTag[Any] List(abc, 1) diff --git a/test/files/run/macro-undetparams-macroitself.check b/test/files/run/macro-undetparams-macroitself.check index fa6b335afb..a9bf55423e 100644 --- a/test/files/run/macro-undetparams-macroitself.check +++ b/test/files/run/macro-undetparams-macroitself.check @@ -1,2 +1,2 @@ -TypeTag[Int] +WeakTypeTag[Int] WeakTypeTag[String] diff --git a/test/files/run/outertest.scala b/test/files/run/outertest.scala index 3cc96afa5b..fa0443f669 100644 --- a/test/files/run/outertest.scala +++ b/test/files/run/outertest.scala @@ -1,26 +1,57 @@ // A test for the case where the outer field of class B#J should be eliminated. -// You can verify this by running a javap on B.J + +import reflect.ClassTag + abstract class A { + abstract class I - abstract class I { + val foo = this +} +class B extends A { + class J extends I { + val bar = foo } - val foo = "foo" + type II = I + class K extends II { + val bar = foo + } + class L extends (I @annotation.tailrec) { + val bar = foo + } } -class B extends A { - class J extends I { +class C extends A { + val c: C = this + + class M extends c.I { val bar = foo } - } -object Test extends App { +object Test extends App { val b = new B - assert((new b.J).bar == b.foo) + val c0 = new C + val c = new { override val c = c0 } with C + + assert((new b.J).bar eq b) + assert((new b.K).bar eq b) + assert((new b.L).bar eq b) + assert((new c.M).bar eq c) + + def checkOuterFields[C: ClassTag](expected: Int) { + val cls = implicitly[ClassTag[C]].runtimeClass + val outerFields = cls.getDeclaredFields().filter(_.getName.contains("$outer")) + assert(outerFields.size == expected, outerFields.map(_.getName)) + } + checkOuterFields[A#I](1) // the base class must have the $outer pointer + checkOuterFields[B#J](0) // reuse parent class' $outer pointer + checkOuterFields[B#K](0) // ... through an alias + checkOuterFields[B#L](0) // ... through the annotated type + checkOuterFields[C#M](1) // different prefix, can't share. } diff --git a/test/files/run/reify_this.scala b/test/files/run/reify_this.scala index ecbf394bba..c385da6360 100644 --- a/test/files/run/reify_this.scala +++ b/test/files/run/reify_this.scala @@ -1,11 +1,11 @@ import scala.reflect.runtime.universe._ import scala.tools.reflect.Eval -trait Eval { +trait Transvaal { def eval(tree: Expr[_]) = tree.eval } -object Test extends App with Eval { +object Test extends App with Transvaal { // select a value from package eval(reify{println("foo")}) eval(reify{println((new Object).toString == (new Object).toString)}) @@ -17,4 +17,4 @@ object Test extends App with Eval { // select a value from module val x = 2 eval(reify{println(x)}) -}
\ No newline at end of file +} diff --git a/test/files/run/t3994.scala b/test/files/run/t3994.scala new file mode 100644 index 0000000000..0ee1d9d966 --- /dev/null +++ b/test/files/run/t3994.scala @@ -0,0 +1,20 @@ +trait T { + trait Default { def foo = this } + object Default extends Default +} + +class Crash { // if you change this to a `trait` it keeps failing, though if it is an `object` it compiles just fine! + class Element + + /* declare this as a class, and the crash goes away */ + trait ElementOrdering extends Ordering[Element] { + def compare(a: Element, b: Element): Int = 0 + } + + implicit object ElementOrdering extends ElementOrdering +} + +object Test extends App { + (new T {}).Default + (new Crash).ElementOrdering +} diff --git a/test/files/run/t5699.check b/test/files/run/t5699.check new file mode 100755 index 0000000000..df19644ae6 --- /dev/null +++ b/test/files/run/t5699.check @@ -0,0 +1,11 @@ +[[syntax trees at end of parser]] // annodef.java +package <empty> { + object MyAnnotation extends { + def <init>() = _ + }; + class MyAnnotation extends scala.annotation.Annotation with _root_.java.lang.annotation.Annotation with scala.annotation.ClassfileAnnotation { + def <init>() = _; + def value(): String + } +} + diff --git a/test/files/run/t5699.scala b/test/files/run/t5699.scala new file mode 100755 index 0000000000..5cef67e3b1 --- /dev/null +++ b/test/files/run/t5699.scala @@ -0,0 +1,24 @@ +import scala.tools.partest.DirectTest +import scala.tools.nsc.util.BatchSourceFile + +object Test extends DirectTest { + // Java code + override def code = """ + |public @interface MyAnnotation { String value(); } + """.stripMargin + + override def extraSettings: String = "-usejavacp -Ystop-after:typer -Xprint:parser" + + override def show(): Unit = { + // redirect err to out, for logging + val prevErr = System.err + System.setErr(System.out) + compile() + System.setErr(prevErr) + } + + override def newSources(sourceCodes: String*) = { + assert(sourceCodes.size == 1) + List(new BatchSourceFile("annodef.java", sourceCodes(0))) + } +} diff --git a/test/files/run/t6146b.check b/test/files/run/t6146b.check index b664d1152a..49ff70697e 100644 --- a/test/files/run/t6146b.check +++ b/test/files/run/t6146b.check @@ -37,8 +37,15 @@ memType: (sub: u.Type, scrut: u.Type)u.Type scala> -scala> memType(S1, fTpe) -res0: u.Type = O.X.S1.type +scala> val mt1 = memType(S1, fTpe) +mt1: u.Type = O.X.S1.type + +scala> global.typeDeconstruct.show(mt1) +res0: String = +TypeRef( + pre = SingleType(pre = ThisType(object O), object X) + TypeSymbol(class S1 extends C.this.F[T]) +) scala> memType(S2, fTpe) res1: u.Type = O.S2 diff --git a/test/files/run/t6146b.scala b/test/files/run/t6146b.scala index adcd40d2ee..e63709aa9d 100644 --- a/test/files/run/t6146b.scala +++ b/test/files/run/t6146b.scala @@ -31,7 +31,8 @@ val fTpe = typeOf[O.type].decl(newTermName("foo")).paramss.head.head.tpe def memType(sub: Type, scrut: Type): Type = nestedMemberType(sub.typeSymbol, scrut.prefix, scrut.typeSymbol.owner) -memType(S1, fTpe) +val mt1 = memType(S1, fTpe) +global.typeDeconstruct.show(mt1) memType(S2, fTpe) memType(S3, fTpe) memType(S4, fTpe) diff --git a/test/files/run/t6168/Context.java b/test/files/run/t6168/Context.java new file mode 100644 index 0000000000..e527844563 --- /dev/null +++ b/test/files/run/t6168/Context.java @@ -0,0 +1,34 @@ +public class Context<ParentType> { + private ParentType parent; + + public Context() {} + + public ParentType getParent() { + return parent; + } + + public void setParent(ParentType parent) { + this.parent = parent; + } + + public Field<Integer> intField() { + return new Field<Integer>() { + @Override + public Integer get() { + return 0; + } + + @Override + public ParentType set(Integer t) { + return parent; + } + }; + } + + public abstract class Field<T> { //Note this is a path dependent type + + public abstract T get(); + + public abstract ParentType set(T t); + } +}
\ No newline at end of file diff --git a/test/files/run/t6168/JavaTest.java b/test/files/run/t6168/JavaTest.java new file mode 100644 index 0000000000..94ae91661d --- /dev/null +++ b/test/files/run/t6168/JavaTest.java @@ -0,0 +1,8 @@ +public class JavaTest { + public static void main(String[] args) { + SomeClass a = new SomeClass(); + SomeClass2 a2 = new SomeClass2(); + SomeClass b = a.f.set(23).f.set(23); + SomeClass2 b2 = a2.f.set(23).f.set(23); + } +}
\ No newline at end of file diff --git a/test/files/run/t6168/SomeClass.java b/test/files/run/t6168/SomeClass.java new file mode 100644 index 0000000000..6f76b829bb --- /dev/null +++ b/test/files/run/t6168/SomeClass.java @@ -0,0 +1,14 @@ +public class SomeClass { + private final Context<SomeClass> context = new Context<SomeClass>(); + { + context.setParent(this); + } + + public final Context<SomeClass>.Field<Integer> f = context.intField(); + + public SomeClass() { + f.set(23).f.set(23); + } +} + + diff --git a/test/files/run/t6168/SomeClass2.java b/test/files/run/t6168/SomeClass2.java new file mode 100644 index 0000000000..b2c7a7540b --- /dev/null +++ b/test/files/run/t6168/SomeClass2.java @@ -0,0 +1,12 @@ +public class SomeClass2 { + private final Context<SomeClass2> context = new Context<SomeClass2>(); + { + context.setParent(this); + } + + public final Context<SomeClass2>.Field<Integer> f = context.intField(); + + public SomeClass2() { + f.set(23).f.set(23); + } +}
\ No newline at end of file diff --git a/test/files/run/t6168/main.scala b/test/files/run/t6168/main.scala new file mode 100644 index 0000000000..c7ad37830b --- /dev/null +++ b/test/files/run/t6168/main.scala @@ -0,0 +1,15 @@ + + +object Test extends App { + JavaTest.main(null) + + var a1 : SomeClass = new SomeClass + var a2 : SomeClass2 = new SomeClass2 + //import language.implicitConversions + //implicit def setParentType2SomeClass(x:Any) = x.asInstanceOf[SomeClass] + //implicit def setParentType2SomeClass2(x:Any) = x.asInstanceOf[SomeClass2] + //var b : SomeClass = a.f.set(23).asInstanceOf[SomeClass].f.set(23).asInstanceOf[SomeClass] + //var b2 : SomeClass2 = a2.f.set(23).asInstanceOf[SomeClass2].f.set(23).asInstanceOf[SomeClass2] + var b1 : SomeClass = a1.f.set(23).f.set(23) + var b2 : SomeClass2 = a2.f.set(23).f.set(23) +} diff --git a/test/files/run/t6168b/Context.java b/test/files/run/t6168b/Context.java new file mode 100644 index 0000000000..b3ea22126f --- /dev/null +++ b/test/files/run/t6168b/Context.java @@ -0,0 +1,34 @@ +public class Context<ParentType> { + private ParentType parent; + + public Context() {} + + public ParentType getParent() { + return parent; + } + + public void setParent(ParentType parent) { + this.parent = parent; + } + + public Field<Integer> intField() { + return new Field<Integer>() { + @Override + public Integer get() { + return 0; + } + + @Override + public ParentType set(Integer t) { + return parent; + } + }; + } + + public static abstract class Field<T> { + + public abstract T get(); + + public abstract Object set(T t); + } +}
\ No newline at end of file diff --git a/test/files/run/t6168b/JavaTest.java b/test/files/run/t6168b/JavaTest.java new file mode 100644 index 0000000000..a09fa0382d --- /dev/null +++ b/test/files/run/t6168b/JavaTest.java @@ -0,0 +1,6 @@ +public class JavaTest { + public static void main(String[] args) { + SomeClass a = new SomeClass(); + Object b = a.f.set(23); + } +}
\ No newline at end of file diff --git a/test/files/run/t6168b/SomeClass.java b/test/files/run/t6168b/SomeClass.java new file mode 100644 index 0000000000..566c55e1c5 --- /dev/null +++ b/test/files/run/t6168b/SomeClass.java @@ -0,0 +1,11 @@ +public class SomeClass { + private final Context<SomeClass> context = new Context<SomeClass>(); + { + context.setParent(this); + } + + public final Context.Field<Integer> f = context.intField(); + +} + + diff --git a/test/files/run/t6168b/main.scala b/test/files/run/t6168b/main.scala new file mode 100644 index 0000000000..187e9fe85e --- /dev/null +++ b/test/files/run/t6168b/main.scala @@ -0,0 +1,8 @@ + + +object Test extends App { + JavaTest.main(null) + + var a1 : SomeClass = new SomeClass + var b1 : Object = a1.f.set(23) +} diff --git a/test/files/run/t6223.scala b/test/files/run/t6223.scala index fb176e32e6..0996ea1c45 100644 --- a/test/files/run/t6223.scala +++ b/test/files/run/t6223.scala @@ -5,7 +5,7 @@ class Foo[@specialized(Int) A](a:A) { object Test { def main(args:Array[String]) { val f = new Foo(333) - val ms = f.getClass().getDeclaredMethods().sortBy(_.getName) - ms.foreach(m => println(m.getName)) + val ms = f.getClass().getDeclaredMethods().map(_.getName).sorted + ms.foreach(println) } } diff --git a/test/files/run/t6715.scala b/test/files/run/t6715.scala new file mode 100644 index 0000000000..07ff34218a --- /dev/null +++ b/test/files/run/t6715.scala @@ -0,0 +1,15 @@ +import scala.reflect.runtime.universe._ + +class A { + def $$ = 1 + def $times = 1 +} + +object Test { + def main(args: Array[String]): Unit = { + val memberSet: Set[String] = typeOf[A].members.map{ _.toString }.toSet + assert(memberSet contains "method *") + assert(memberSet contains "method $$") + assert(! (memberSet contains "method")) + } +} diff --git a/test/files/run/t6793.scala b/test/files/run/t6793.scala new file mode 100644 index 0000000000..0b1f1619af --- /dev/null +++ b/test/files/run/t6793.scala @@ -0,0 +1,9 @@ +package a { class C1(private[a] val v0: String) } +package b { class C2(v1: String) extends a.C1(v1) { def foo = v1 } } + +object Test extends App { + new b.C2("x") + + val c2Fields = classOf[b.C2].getDeclaredFields + assert(c2Fields.size == 1, c2Fields.map(_.getName).toList) +} diff --git a/test/files/run/t6793b.scala b/test/files/run/t6793b.scala new file mode 100644 index 0000000000..cb3f2fb2fa --- /dev/null +++ b/test/files/run/t6793b.scala @@ -0,0 +1,11 @@ +package a { + class C1(val v0: String) + class C2(v1: String) extends a.C1(v1) { def foo = v1 } +} + +object Test extends App { + new a.C2("x") + + val c2Fields = classOf[a.C2].getDeclaredFields + assert(c2Fields.isEmpty, c2Fields.map(_.getName).mkString(", ")) +} diff --git a/test/files/run/t6793c.scala b/test/files/run/t6793c.scala new file mode 100644 index 0000000000..e28c7c81a1 --- /dev/null +++ b/test/files/run/t6793c.scala @@ -0,0 +1,11 @@ +package a { + class C1(private[a] val v0: String) + class C2(v1: String) extends a.C1(v1) { def foo = v1 } +} + +object Test extends App { + new a.C2("x").foo + + val c2Fields = classOf[a.C2].getDeclaredFields + assert(c2Fields.isEmpty, c2Fields.map(_.getName).toList) +} diff --git a/test/files/run/t6900.scala b/test/files/run/t6900.scala new file mode 100644 index 0000000000..a29d388129 --- /dev/null +++ b/test/files/run/t6900.scala @@ -0,0 +1,36 @@ +import annotation.tailrec + +trait Universe { + type T <: AnyRef +} + +final class Bug { + var i = 1 + def stop() = { i -= 1; i < 0 } + // the alias bypasses the fast path in erasures InfoTransformer + // predicated on `TypeMap.noChangeToSymbols` + type Alias = Any + + @tailrec + // So we get two symbols for `universe`, the original on the ValDef + // and a clone in the MethodType of `f`. + def f(universe: Universe, l: Alias): universe.T = { + if (stop()) null.asInstanceOf[universe.T] else f(universe, null) + } + + @tailrec + def g(universe: Universe)(l: Alias): universe.T = { + if (stop()) null.asInstanceOf[universe.T] else g(universe)(l) + } + + @tailrec + def h(universe: Universe)(l: List[universe.T]): List[universe.T] = { + if (stop()) Nil else h(universe)(l) + } +} + +object Test extends App { + assert(new Bug().f(null, null) == null) + assert(new Bug().g(null)(null) == null) + assert(new Bug().h(null)(null) == Nil) +}
\ No newline at end of file diff --git a/test/files/run/t6937.check b/test/files/run/t6937.check new file mode 100644 index 0000000000..9a1fa4cfaf --- /dev/null +++ b/test/files/run/t6937.check @@ -0,0 +1,26 @@ +Type in expressions to have them evaluated. +Type :help for more information. + +scala> + +scala> import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{universe=>ru} + +scala> import scala.reflect.runtime.{currentMirror => cm} +import scala.reflect.runtime.{currentMirror=>cm} + +scala> import scala.reflect.api.{Universe => ApiUniverse} +import scala.reflect.api.{Universe=>ApiUniverse} + +scala> class A +defined class A + +scala> lazy val apiru = ru: ApiUniverse +apiru: scala.reflect.api.Universe = <lazy> + +scala> apiru.typeTag[A].in(cm) +res0: reflect.runtime.universe.TypeTag[A] = TypeTag[A] + +scala> + +scala> diff --git a/test/files/run/t6937.scala b/test/files/run/t6937.scala new file mode 100644 index 0000000000..4b30894bf3 --- /dev/null +++ b/test/files/run/t6937.scala @@ -0,0 +1,12 @@ +import scala.tools.partest.ReplTest + +object Test extends ReplTest { + def code = """ + import scala.reflect.runtime.{universe => ru} + import scala.reflect.runtime.{currentMirror => cm} + import scala.reflect.api.{Universe => ApiUniverse} + class A + lazy val apiru = ru: ApiUniverse + apiru.typeTag[A].in(cm) + """ +}
\ No newline at end of file diff --git a/test/files/run/t7242.scala b/test/files/run/t7242.scala new file mode 100644 index 0000000000..c995336144 --- /dev/null +++ b/test/files/run/t7242.scala @@ -0,0 +1,71 @@ +class CrashTest { + def foo = () + trait CrashTestTable { + def cols = foo + } + // This was leading to a class between the mixed in + // outer accessor and the outer accessor of this object. + object CrashTestTable extends CrashTestTable { + foo + cols + } +} + +class CrashTest1 { + def foo = () + class CrashTestTable { + def cols = foo + } + object CrashTestTable extends CrashTestTable { + foo + cols + } +} + +class CrashTest2 { + def foo = () + trait CrashTestTable { + def cols = foo + } + object Obj extends CrashTestTable { + foo + cols + } +} + +class CrashTest3 { + def foo = () + + def meth() { + trait CrashTestTable { + def cols = foo + } + object Obj extends CrashTestTable { + foo + cols + } + Obj + } +} + +object Test extends App { + { + val c = new CrashTest + c.CrashTestTable + } + + { + val c = new CrashTest1 + c.CrashTestTable + } + + { + val c = new CrashTest2 + c.Obj + } + + { + val c = new CrashTest3 + c.meth() + } +} diff --git a/test/files/run/t7246.check b/test/files/run/t7246.check new file mode 100755 index 0000000000..ce01362503 --- /dev/null +++ b/test/files/run/t7246.check @@ -0,0 +1 @@ +hello diff --git a/test/files/run/t7246/Outer.java b/test/files/run/t7246/Outer.java new file mode 100755 index 0000000000..163276fb3b --- /dev/null +++ b/test/files/run/t7246/Outer.java @@ -0,0 +1,4 @@ +public class Outer { + public class Inner { + } +}
\ No newline at end of file diff --git a/test/files/run/t7246/Test.scala b/test/files/run/t7246/Test.scala new file mode 100755 index 0000000000..9f23ca8f3a --- /dev/null +++ b/test/files/run/t7246/Test.scala @@ -0,0 +1,16 @@ +object Test extends App { + + val so = new SubOuter + val si = new so.SubInner + println(si.bar) +} + +class SubOuter extends Outer { + + val foo = "hello" + + class SubInner extends Inner { + def bar = foo + } + +}
\ No newline at end of file diff --git a/test/files/run/t7246b.check b/test/files/run/t7246b.check new file mode 100755 index 0000000000..5073bd8617 --- /dev/null +++ b/test/files/run/t7246b.check @@ -0,0 +1,2 @@ +base +sub diff --git a/test/files/run/t7246b/Base.scala b/test/files/run/t7246b/Base.scala new file mode 100755 index 0000000000..4e71d3313d --- /dev/null +++ b/test/files/run/t7246b/Base.scala @@ -0,0 +1,7 @@ +class Base { + val baseOuter = "base" + + class BaseInner { + val baseInner = baseOuter + } +} diff --git a/test/files/run/t7246b/Outer.java b/test/files/run/t7246b/Outer.java new file mode 100755 index 0000000000..53a79316ef --- /dev/null +++ b/test/files/run/t7246b/Outer.java @@ -0,0 +1,4 @@ +public class Outer extends Base { + public class Inner extends BaseInner { + } +}
\ No newline at end of file diff --git a/test/files/run/t7246b/Test.scala b/test/files/run/t7246b/Test.scala new file mode 100755 index 0000000000..f0982ea8d0 --- /dev/null +++ b/test/files/run/t7246b/Test.scala @@ -0,0 +1,14 @@ +object Test extends App { + + val so = new SubOuter + val si = new so.SubInner + println(si.baseInner) + println(si.subInner) +} + +class SubOuter extends Outer { + val subOuter = "sub" + class SubInner extends Inner { + def subInner = subOuter + } +} diff --git a/test/files/run/t7249.check b/test/files/run/t7249.check new file mode 100644 index 0000000000..7777e0a5a2 --- /dev/null +++ b/test/files/run/t7249.check @@ -0,0 +1 @@ +Yup! diff --git a/test/files/run/t7249.scala b/test/files/run/t7249.scala new file mode 100644 index 0000000000..375df5c3ad --- /dev/null +++ b/test/files/run/t7249.scala @@ -0,0 +1,7 @@ +object Test extends App { + def bnToLambda(s: => String): () => String = () => s + var x: () => String = () => sys.error("Nope") + val y = bnToLambda { x() } + x = () => "Yup!" + println(y()) +} diff --git a/test/files/run/t7290.scala b/test/files/run/t7290.scala new file mode 100644 index 0000000000..01f7e8f68e --- /dev/null +++ b/test/files/run/t7290.scala @@ -0,0 +1,9 @@ +object Test extends App { + val y = (0: Int) match { + case 1 => 1 + case 0 | 0 => 0 + case 2 | 2 | 2 | 3 | 2 | 3 => 0 + case _ => -1 + } + assert(y == 0, y) +} diff --git a/test/files/run/t7300.check b/test/files/run/t7300.check new file mode 100644 index 0000000000..51993f072d --- /dev/null +++ b/test/files/run/t7300.check @@ -0,0 +1,2 @@ +2 +2 diff --git a/test/files/run/t7300.scala b/test/files/run/t7300.scala new file mode 100644 index 0000000000..ec841690df --- /dev/null +++ b/test/files/run/t7300.scala @@ -0,0 +1,11 @@ +object Test extends App { + // single line comment in multi line comment + /*//*/ val x = 1 */*/ + val x = 2 + println(x) + + // single line comment in nested multi line comment + /*/*//*/ val y = 1 */*/*/ + val y = 2 + println(y) +} diff --git a/test/files/run/t7341.check b/test/files/run/t7341.check new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/files/run/t7341.check diff --git a/test/files/run/t7341.flags b/test/files/run/t7341.flags new file mode 100755 index 0000000000..ae08446055 --- /dev/null +++ b/test/files/run/t7341.flags @@ -0,0 +1 @@ +-Xcheckinit
\ No newline at end of file diff --git a/test/files/run/t7341.scala b/test/files/run/t7341.scala new file mode 100755 index 0000000000..dc526c6c19 --- /dev/null +++ b/test/files/run/t7341.scala @@ -0,0 +1,15 @@ +object Obj { + private var cache: Any = () + def returning(f: () => Unit) = () + def foo { + returning(() => cache = ()) + } + + def apply(): Any = { + cache + } +} + +object Test extends App { + Obj() +} diff --git a/test/files/run/test-cpp.check b/test/files/run/test-cpp.check index bfea438c60..13f4c64be3 100644 --- a/test/files/run/test-cpp.check +++ b/test/files/run/test-cpp.check @@ -1,65 +1,81 @@ -37c37 -< locals: value args, value x, value y ---- -> locals: value args -42,43d41 -< 52 CONSTANT(2) -< 52 STORE_LOCAL(value x) -45,46d42 -< 53 LOAD_LOCAL(value x) -< 53 STORE_LOCAL(value y) -49c45 -< 54 LOAD_LOCAL(value y) ---- -> 54 CONSTANT(2) -92c88 -< locals: value args, value x, value y ---- -> locals: value args, value x -101,102d96 -< 82 LOAD_LOCAL(value x) -< 82 STORE_LOCAL(value y) -105c99 -< 83 LOAD_LOCAL(value y) ---- -> 83 LOAD_LOCAL(value x) -135c129 -< locals: value args, value x, value y ---- -> locals: value args -140,141d133 -< 66 THIS(TestAliasChainDerefThis) -< 66 STORE_LOCAL(value x) -143,144d134 -< 67 LOAD_LOCAL(value x) -< 67 STORE_LOCAL(value y) -147c137 -< 68 LOAD_LOCAL(value y) ---- -> 68 THIS(Object) -176c166 -< locals: value x, value y ---- -> locals: value x -181,182d170 -< 29 LOAD_LOCAL(value x) -< 29 STORE_LOCAL(value y) -185c173 -< 30 LOAD_LOCAL(value y) ---- -> 30 LOAD_LOCAL(value x) -223,224d210 -< 97 LOAD_LOCAL(variable x) -< 97 STORE_LOCAL(variable y) -227c213 -< 98 LOAD_LOCAL(variable y) ---- -> 98 LOAD_LOCAL(variable x) -233,234d218 -< 101 LOAD_LOCAL(variable y) -< 101 STORE_LOCAL(variable x) -236c220 -< 102 LOAD_LOCAL(variable x) ---- -> 102 LOAD_LOCAL(variable y) - +--- a ++++ b +@@ -36,3 +36,3 @@ + def main(args: Array[String] (ARRAY[REF(class String)])): Unit { +- locals: value args, value x, value y ++ locals: value args + startBlock: 1 +@@ -41,10 +41,6 @@ + 1: +- 52 CONSTANT(2) +- 52 STORE_LOCAL(value x) + 52 SCOPE_ENTER value x +- 53 LOAD_LOCAL(value x) +- 53 STORE_LOCAL(value y) + 53 SCOPE_ENTER value y + 54 LOAD_MODULE object Predef +- 54 LOAD_LOCAL(value y) ++ 54 CONSTANT(2) + 54 BOX INT +@@ -91,3 +87,3 @@ + def main(args: Array[String] (ARRAY[REF(class String)])): Unit { +- locals: value args, value x, value y ++ locals: value args, value x + startBlock: 1 +@@ -100,7 +96,5 @@ + 81 SCOPE_ENTER value x +- 82 LOAD_LOCAL(value x) +- 82 STORE_LOCAL(value y) + 82 SCOPE_ENTER value y + 83 LOAD_MODULE object Predef +- 83 LOAD_LOCAL(value y) ++ 83 LOAD_LOCAL(value x) + 83 BOX INT +@@ -134,3 +128,3 @@ + def main(args: Array[String] (ARRAY[REF(class String)])): Unit { +- locals: value args, value x, value y ++ locals: value args + startBlock: 1 +@@ -139,10 +133,6 @@ + 1: +- 66 THIS(TestAliasChainDerefThis) +- 66 STORE_LOCAL(value x) + 66 SCOPE_ENTER value x +- 67 LOAD_LOCAL(value x) +- 67 STORE_LOCAL(value y) + 67 SCOPE_ENTER value y + 68 LOAD_MODULE object Predef +- 68 LOAD_LOCAL(value y) ++ 68 THIS(Object) + 68 CALL_METHOD scala.Predef.println (dynamic) +@@ -175,3 +165,3 @@ + def test(x: Int (INT)): Unit { +- locals: value x, value y ++ locals: value x + startBlock: 1 +@@ -180,7 +170,5 @@ + 1: +- 29 LOAD_LOCAL(value x) +- 29 STORE_LOCAL(value y) + 29 SCOPE_ENTER value y + 30 LOAD_MODULE object Predef +- 30 LOAD_LOCAL(value y) ++ 30 LOAD_LOCAL(value x) + 30 BOX INT +@@ -222,7 +210,5 @@ + 96 SCOPE_ENTER variable x +- 97 LOAD_LOCAL(variable x) +- 97 STORE_LOCAL(variable y) + 97 SCOPE_ENTER variable y + 98 LOAD_MODULE object Predef +- 98 LOAD_LOCAL(variable y) ++ 98 LOAD_LOCAL(variable x) + 98 BOX INT +@@ -232,6 +218,4 @@ + 100 STORE_LOCAL(variable y) +- 101 LOAD_LOCAL(variable y) +- 101 STORE_LOCAL(variable x) + 102 LOAD_MODULE object Predef +- 102 LOAD_LOCAL(variable x) ++ 102 LOAD_LOCAL(variable y) + 102 BOX INT diff --git a/test/files/scalap/abstractClass/result.test b/test/files/scalap/abstractClass.check index ef1daac23d..ef1daac23d 100644 --- a/test/files/scalap/abstractClass/result.test +++ b/test/files/scalap/abstractClass.check diff --git a/test/files/scalap/abstractClass/A.scala b/test/files/scalap/abstractClass.scala index 19a528d5a1..19a528d5a1 100644 --- a/test/files/scalap/abstractClass/A.scala +++ b/test/files/scalap/abstractClass.scala diff --git a/test/files/scalap/abstractMethod/result.test b/test/files/scalap/abstractMethod.check index 40fa02d408..40fa02d408 100644 --- a/test/files/scalap/abstractMethod/result.test +++ b/test/files/scalap/abstractMethod.check diff --git a/test/files/scalap/abstractMethod/A.scala b/test/files/scalap/abstractMethod.scala index 4bedb377b3..4bedb377b3 100644 --- a/test/files/scalap/abstractMethod/A.scala +++ b/test/files/scalap/abstractMethod.scala diff --git a/test/files/scalap/caseClass/result.test b/test/files/scalap/caseClass.check index 7d7aa4fd8f..7d7aa4fd8f 100644 --- a/test/files/scalap/caseClass/result.test +++ b/test/files/scalap/caseClass.check diff --git a/test/files/scalap/caseClass/A.scala b/test/files/scalap/caseClass.scala index 95f9984519..95f9984519 100644 --- a/test/files/scalap/caseClass/A.scala +++ b/test/files/scalap/caseClass.scala diff --git a/test/files/scalap/caseObject/result.test b/test/files/scalap/caseObject.check index 867a4b2162..867a4b2162 100644 --- a/test/files/scalap/caseObject/result.test +++ b/test/files/scalap/caseObject.check diff --git a/test/files/scalap/caseObject/A.scala b/test/files/scalap/caseObject.scala index 6a3ff10d75..6a3ff10d75 100644 --- a/test/files/scalap/caseObject/A.scala +++ b/test/files/scalap/caseObject.scala diff --git a/test/files/scalap/cbnParam/result.test b/test/files/scalap/cbnParam.check index 52ecb6ae66..52ecb6ae66 100644 --- a/test/files/scalap/cbnParam/result.test +++ b/test/files/scalap/cbnParam.check diff --git a/test/files/scalap/cbnParam/A.scala b/test/files/scalap/cbnParam.scala index 2f366df64a..2f366df64a 100644 --- a/test/files/scalap/cbnParam/A.scala +++ b/test/files/scalap/cbnParam.scala diff --git a/test/files/scalap/classPrivate/result.test b/test/files/scalap/classPrivate.check index ab2d40cdaf..ab2d40cdaf 100644 --- a/test/files/scalap/classPrivate/result.test +++ b/test/files/scalap/classPrivate.check diff --git a/test/files/scalap/classPrivate/A.scala b/test/files/scalap/classPrivate.scala index 9f1bd34a6a..9f1bd34a6a 100644 --- a/test/files/scalap/classPrivate/A.scala +++ b/test/files/scalap/classPrivate.scala diff --git a/test/files/scalap/classWithExistential/result.test b/test/files/scalap/classWithExistential.check index caee3fd6de..caee3fd6de 100644 --- a/test/files/scalap/classWithExistential/result.test +++ b/test/files/scalap/classWithExistential.check diff --git a/test/files/scalap/classWithExistential/A.scala b/test/files/scalap/classWithExistential.scala index 4a5213f963..4a5213f963 100644 --- a/test/files/scalap/classWithExistential/A.scala +++ b/test/files/scalap/classWithExistential.scala diff --git a/test/files/scalap/classWithSelfAnnotation/result.test b/test/files/scalap/classWithSelfAnnotation.check index 82bbd9e8df..82bbd9e8df 100644 --- a/test/files/scalap/classWithSelfAnnotation/result.test +++ b/test/files/scalap/classWithSelfAnnotation.check diff --git a/test/files/scalap/classWithSelfAnnotation/A.scala b/test/files/scalap/classWithSelfAnnotation.scala index 9e0398622a..9e0398622a 100644 --- a/test/files/scalap/classWithSelfAnnotation/A.scala +++ b/test/files/scalap/classWithSelfAnnotation.scala diff --git a/test/files/scalap/covariantParam/result.test b/test/files/scalap/covariantParam.check index f7a3c98966..f7a3c98966 100644 --- a/test/files/scalap/covariantParam/result.test +++ b/test/files/scalap/covariantParam.check diff --git a/test/files/scalap/covariantParam/A.scala b/test/files/scalap/covariantParam.scala index 5b2c24d6fa..5b2c24d6fa 100644 --- a/test/files/scalap/covariantParam/A.scala +++ b/test/files/scalap/covariantParam.scala diff --git a/test/files/scalap/defaultParameter/result.test b/test/files/scalap/defaultParameter.check index 0c775ea7b5..0c775ea7b5 100644 --- a/test/files/scalap/defaultParameter/result.test +++ b/test/files/scalap/defaultParameter.check diff --git a/test/files/scalap/defaultParameter/A.scala b/test/files/scalap/defaultParameter.scala index d3514952f4..d3514952f4 100644 --- a/test/files/scalap/defaultParameter/A.scala +++ b/test/files/scalap/defaultParameter.scala diff --git a/test/files/scalap/implicitParam/result.test b/test/files/scalap/implicitParam.check index a2cfd6092d..a2cfd6092d 100644 --- a/test/files/scalap/implicitParam/result.test +++ b/test/files/scalap/implicitParam.check diff --git a/test/files/scalap/implicitParam/A.scala b/test/files/scalap/implicitParam.scala index 80657218d9..80657218d9 100644 --- a/test/files/scalap/implicitParam/A.scala +++ b/test/files/scalap/implicitParam.scala diff --git a/test/files/scalap/packageObject/result.test b/test/files/scalap/packageObject.check index 5732d92958..5732d92958 100644 --- a/test/files/scalap/packageObject/result.test +++ b/test/files/scalap/packageObject.check diff --git a/test/files/scalap/packageObject/A.scala b/test/files/scalap/packageObject.scala index 7e429c9935..7e429c9935 100644 --- a/test/files/scalap/packageObject/A.scala +++ b/test/files/scalap/packageObject.scala diff --git a/test/files/scalap/paramClauses/result.test b/test/files/scalap/paramClauses.check index 3a141e8faf..3a141e8faf 100644 --- a/test/files/scalap/paramClauses/result.test +++ b/test/files/scalap/paramClauses.check diff --git a/test/files/scalap/paramClauses/A.scala b/test/files/scalap/paramClauses.scala index f9d1917402..f9d1917402 100644 --- a/test/files/scalap/paramClauses/A.scala +++ b/test/files/scalap/paramClauses.scala diff --git a/test/files/scalap/paramNames/result.test b/test/files/scalap/paramNames.check index 85e37f858d..85e37f858d 100644 --- a/test/files/scalap/paramNames/result.test +++ b/test/files/scalap/paramNames.check diff --git a/test/files/scalap/paramNames/A.scala b/test/files/scalap/paramNames.scala index 7ba9ff0feb..7ba9ff0feb 100644 --- a/test/files/scalap/paramNames/A.scala +++ b/test/files/scalap/paramNames.scala diff --git a/test/files/scalap/sequenceParam/result.test b/test/files/scalap/sequenceParam.check index 142d92fea3..142d92fea3 100644 --- a/test/files/scalap/sequenceParam/result.test +++ b/test/files/scalap/sequenceParam.check diff --git a/test/files/scalap/sequenceParam/A.scala b/test/files/scalap/sequenceParam.scala index 86e13340b9..86e13340b9 100644 --- a/test/files/scalap/sequenceParam/A.scala +++ b/test/files/scalap/sequenceParam.scala diff --git a/test/files/scalap/simpleClass/result.test b/test/files/scalap/simpleClass.check index 4fdf25d1cf..4fdf25d1cf 100644 --- a/test/files/scalap/simpleClass/result.test +++ b/test/files/scalap/simpleClass.check diff --git a/test/files/scalap/simpleClass/A.scala b/test/files/scalap/simpleClass.scala index fa82e62680..fa82e62680 100644 --- a/test/files/scalap/simpleClass/A.scala +++ b/test/files/scalap/simpleClass.scala diff --git a/test/files/scalap/traitObject/result.test b/test/files/scalap/traitObject.check index 104ba14f1a..104ba14f1a 100644 --- a/test/files/scalap/traitObject/result.test +++ b/test/files/scalap/traitObject.check diff --git a/test/files/scalap/traitObject/A.scala b/test/files/scalap/traitObject.scala index d5f43181c1..d5f43181c1 100644 --- a/test/files/scalap/traitObject/A.scala +++ b/test/files/scalap/traitObject.scala diff --git a/test/files/scalap/typeAnnotations/result.test b/test/files/scalap/typeAnnotations.check index 407b0235c6..407b0235c6 100644 --- a/test/files/scalap/typeAnnotations/result.test +++ b/test/files/scalap/typeAnnotations.check diff --git a/test/files/scalap/typeAnnotations/A.scala b/test/files/scalap/typeAnnotations.scala index ff2445edc9..ff2445edc9 100644 --- a/test/files/scalap/typeAnnotations/A.scala +++ b/test/files/scalap/typeAnnotations.scala diff --git a/test/files/scalap/valAndVar/result.test b/test/files/scalap/valAndVar.check index e940da9801..e940da9801 100644 --- a/test/files/scalap/valAndVar/result.test +++ b/test/files/scalap/valAndVar.check diff --git a/test/files/scalap/valAndVar/A.scala b/test/files/scalap/valAndVar.scala index 2d89348401..2d89348401 100644 --- a/test/files/scalap/valAndVar/A.scala +++ b/test/files/scalap/valAndVar.scala diff --git a/test/files/scalap/wildcardType/result.test b/test/files/scalap/wildcardType.check index e43261db32..e43261db32 100644 --- a/test/files/scalap/wildcardType/result.test +++ b/test/files/scalap/wildcardType.check diff --git a/test/files/scalap/wildcardType/A.scala b/test/files/scalap/wildcardType.scala index 4bb0d14de5..4bb0d14de5 100644 --- a/test/files/scalap/wildcardType/A.scala +++ b/test/files/scalap/wildcardType.scala |