diff options
Diffstat (limited to 'test/files')
174 files changed, 489 insertions, 336 deletions
diff --git a/test/files/jvm/innerClassEnclMethodJavaReflection.scala b/test/files/jvm/innerClassEnclMethodJavaReflection.scala index ee39cb43bf..a4d64d0b67 100644 --- a/test/files/jvm/innerClassEnclMethodJavaReflection.scala +++ b/test/files/jvm/innerClassEnclMethodJavaReflection.scala @@ -8,7 +8,7 @@ object Test extends App { // Some classes in scala-compiler.jar have references to jline / ant classes, which seem to be // not on the classpath. We just skip over those classes. // PENDING: for now we also allow missing $anonfun classes: the optimizer may eliminate some closures - // that are refferred to in EnclosingClass attributes. SI-9136 + // that are referred to in EnclosingClass attributes. SI-9136 val allowedMissingPackages = Set("jline", "org.apache.tools.ant", "$anonfun") def ok(t: Throwable) = { diff --git a/test/files/jvm/interpreter.check b/test/files/jvm/interpreter.check index 9e875235c7..08372685d6 100644 --- a/test/files/jvm/interpreter.check +++ b/test/files/jvm/interpreter.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> // basics diff --git a/test/files/jvm/throws-annot-from-java.check b/test/files/jvm/throws-annot-from-java.check index c541b26fcc..ace264a4f5 100644 --- a/test/files/jvm/throws-annot-from-java.check +++ b/test/files/jvm/throws-annot-from-java.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> :power ** Power User mode enabled - BEEP WHIR GYVE ** diff --git a/test/files/jvm/xml05.check b/test/files/jvm/xml05.check index cad907525d..d456c5e1e4 100644 --- a/test/files/jvm/xml05.check +++ b/test/files/jvm/xml05.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> <city name="San José"/> res0: scala.xml.Elem = <city name="San José"/> diff --git a/test/files/neg/incompatibleSettings.check b/test/files/neg/incompatibleSettings.check new file mode 100644 index 0000000000..0f28d41825 --- /dev/null +++ b/test/files/neg/incompatibleSettings.check @@ -0,0 +1,6 @@ +warning: Conflicting compiler settings were detected. Some settings will be ignored. +Compiler settings for the 2.11 optimizer (-optimise) are incompatible with -Ybackend:GenBCode (which is the default in 2.12). +The optimizer settings are ignored. See -Yopt:help for enabling the new optimizer in 2.12. +error: No warnings can be incurred under -Xfatal-warnings. +one warning found +one error found diff --git a/test/files/neg/incompatibleSettings.flags b/test/files/neg/incompatibleSettings.flags new file mode 100644 index 0000000000..00dd9c1c24 --- /dev/null +++ b/test/files/neg/incompatibleSettings.flags @@ -0,0 +1 @@ +-optimise -Ybackend:GenBCode -Xfatal-warnings diff --git a/test/files/neg/incompatibleSettings.scala b/test/files/neg/incompatibleSettings.scala new file mode 100644 index 0000000000..826a1a5bc2 --- /dev/null +++ b/test/files/neg/incompatibleSettings.scala @@ -0,0 +1 @@ +class C diff --git a/test/files/neg/inlineIndyLambdaPrivate.check b/test/files/neg/inlineIndyLambdaPrivate.check new file mode 100644 index 0000000000..dbd142f59e --- /dev/null +++ b/test/files/neg/inlineIndyLambdaPrivate.check @@ -0,0 +1,16 @@ +Test_2.scala:2: warning: A_1::test()Ljava/lang/String; could not be inlined: +The callee A_1::test()Ljava/lang/String; contains the instruction INVOKEDYNAMIC m()LA_1$Fun; [ + // handle kind 0x6 : INVOKESTATIC + java/lang/invoke/LambdaMetafactory.metafactory(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite; + // arguments: + (Ljava/lang/String;)Ljava/lang/String;, + // handle kind 0x6 : INVOKESTATIC + A_1.lambda$test$0(Ljava/lang/String;)Ljava/lang/String;, + (Ljava/lang/String;)Ljava/lang/String; + ] +that would cause an IllegalAccessError when inlined into class Test. + def foo = A_1.test + ^ +error: No warnings can be incurred under -Xfatal-warnings. +one warning found +one error found diff --git a/test/files/neg/inlineIndyLambdaPrivate.flags b/test/files/neg/inlineIndyLambdaPrivate.flags new file mode 100644 index 0000000000..01b466bd8c --- /dev/null +++ b/test/files/neg/inlineIndyLambdaPrivate.flags @@ -0,0 +1 @@ +-Yopt:l:classpath -Yopt-inline-heuristics:everything -Yopt-warnings:_ -Xfatal-warnings
\ No newline at end of file diff --git a/test/files/neg/inlineIndyLambdaPrivate/A_1.java b/test/files/neg/inlineIndyLambdaPrivate/A_1.java new file mode 100644 index 0000000000..a9144a9fa6 --- /dev/null +++ b/test/files/neg/inlineIndyLambdaPrivate/A_1.java @@ -0,0 +1,9 @@ +public class A_1 { + interface Fun { + String m(String s); + } + public static final String test() { + Fun f = s -> s.trim(); + return f.m(" eh "); + } +} diff --git a/test/files/neg/inlineIndyLambdaPrivate/Test_2.scala b/test/files/neg/inlineIndyLambdaPrivate/Test_2.scala new file mode 100644 index 0000000000..dd59c05176 --- /dev/null +++ b/test/files/neg/inlineIndyLambdaPrivate/Test_2.scala @@ -0,0 +1,3 @@ +class Test { + def foo = A_1.test +} diff --git a/test/files/neg/macro-invalidshape.check b/test/files/neg/macro-invalidshape.check index aa694df6d6..5093b87598 100644 --- a/test/files/neg/macro-invalidshape.check +++ b/test/files/neg/macro-invalidshape.check @@ -8,8 +8,9 @@ macro [<static object>].<method name>[[<type args>]] or macro [<macro bundle>].<method name>[[<type args>]] def foo2(x: Any) = macro Impls.foo(null)(null) ^ -Macros_Test_2.scala:4: error: missing arguments for method foo in object Impls; -follow this method with `_' if you want to treat it as a partially applied function +Macros_Test_2.scala:4: error: missing argument list for method foo in object Impls +Unapplied methods are only converted to functions when a function type is expected. +You can make this conversion explicit by writing `foo _` or `foo(_)(_)` instead of `foo`. def foo3(x: Any) = macro {2; Impls.foo} ^ Macros_Test_2.scala:7: error: macro implementation reference has wrong shape. required: diff --git a/test/files/neg/missing-arg-list.check b/test/files/neg/missing-arg-list.check new file mode 100644 index 0000000000..5a011c36f2 --- /dev/null +++ b/test/files/neg/missing-arg-list.check @@ -0,0 +1,21 @@ +missing-arg-list.scala:9: error: missing argument list for method id in trait T +Unapplied methods are only converted to functions when a function type is expected. +You can make this conversion explicit by writing `id _` or `id(_)` instead of `id`. + val w = id + ^ +missing-arg-list.scala:10: error: missing argument list for method f in trait T +Unapplied methods are only converted to functions when a function type is expected. +You can make this conversion explicit by writing `f _` or `f(_)(_)` instead of `f`. + val x = f + ^ +missing-arg-list.scala:11: error: missing argument list for method g in trait T +Unapplied methods are only converted to functions when a function type is expected. +You can make this conversion explicit by writing `g _` or `g(_,_,_)` instead of `g`. + val y = g + ^ +missing-arg-list.scala:12: error: missing argument list for method h in trait T +Unapplied methods are only converted to functions when a function type is expected. +You can make this conversion explicit by writing `h _` or `h(_,_,_)(_)` instead of `h`. + val z = h + ^ +four errors found diff --git a/test/files/neg/missing-arg-list.scala b/test/files/neg/missing-arg-list.scala new file mode 100644 index 0000000000..c422dd32fe --- /dev/null +++ b/test/files/neg/missing-arg-list.scala @@ -0,0 +1,13 @@ + +trait T { + + def id(i: Int) = i + def f(i: Int)(j: Int) = i+j + def g(i: Int, j: Int, k: Int) = i+j+k + def h(i: Int, j: Int, k: Int)(implicit s: String) = s*(i+j+k) + + val w = id + val x = f + val y = g + val z = h +} diff --git a/test/files/neg/sealed-final-neg.flags b/test/files/neg/sealed-final-neg.flags index cfabf7a5b4..3f0fcd2201 100644 --- a/test/files/neg/sealed-final-neg.flags +++ b/test/files/neg/sealed-final-neg.flags @@ -1 +1 @@ --Xfatal-warnings -Yinline-warnings -optimise
\ No newline at end of file +-Xfatal-warnings -Ybackend:GenASM -Yinline-warnings -optimise
\ No newline at end of file diff --git a/test/files/neg/t4425.flags b/test/files/neg/t4425.flags deleted file mode 100644 index 1182725e86..0000000000 --- a/test/files/neg/t4425.flags +++ /dev/null @@ -1 +0,0 @@ --optimize
\ No newline at end of file diff --git a/test/files/neg/t5639b.flags b/test/files/neg/t5639b.flags new file mode 100644 index 0000000000..90b87663af --- /dev/null +++ b/test/files/neg/t5639b.flags @@ -0,0 +1 @@ +-Xsource:2.11
\ No newline at end of file diff --git a/test/files/neg/t6895.check b/test/files/neg/t6895.check new file mode 100644 index 0000000000..df01031fff --- /dev/null +++ b/test/files/neg/t6895.check @@ -0,0 +1,6 @@ +t6895.scala:19: error: polymorphic expression cannot be instantiated to expected type; + found : [F3[F3_P]]Foo[F3] + required: Foo[[X3]Bar[[X1]String]] + val nok: Foo[({type L[X3] = Bar[M]})#L] = barFoo /* Type inference can't unify F with L */ + ^ +one error found diff --git a/test/files/neg/t6895.scala b/test/files/neg/t6895.scala new file mode 100644 index 0000000000..5fb20d8c61 --- /dev/null +++ b/test/files/neg/t6895.scala @@ -0,0 +1,26 @@ +trait Foo[F1[F1_P]] +trait Bar[F2[F2_P]] + +class Test { + def barFoo[F3[F3_P]]: Foo[F3] = ??? + + // Now we can define a couple of type aliases: + type M[X1] = String + type N[X2] = Bar[M] + + // val ok1: Foo[N] = barFoo + // Foo[?F3] <:< Foo[Test.this.N] + // [X2]Test.this.N[X2] <:< [F3_P]?F3[F3_P] + // Test.this.N[X2] <:< ?F3[X2] + // true, ?F3=N + + // val ok2: Foo[({type L[X] = Bar[M]})#L] = barFoo[N] + + val nok: Foo[({type L[X3] = Bar[M]})#L] = barFoo /* Type inference can't unify F with L */ + // Foo[?F3] <:< Foo[[X3]Bar[[X1]String]] + // [X3]Bar[[X1]String] <:< ?F3 + // [X3]Bar[[X1]String] <:< [F3_P]?F3[F3_P] + // Bar[[X1]String] <:< ?F3[X3] + // X3 <:< [X1]String + // false +} diff --git a/test/files/neg/t6895b.check b/test/files/neg/t6895b.check new file mode 100644 index 0000000000..565925127b --- /dev/null +++ b/test/files/neg/t6895b.check @@ -0,0 +1,9 @@ +t6895b.scala:20: error: could not find implicit value for parameter e: Foo[[X]Bar[[X]Or[String,X],X]] + implicitly[Foo[({type L[X] = Bar[StringOr, X]})#L]] + ^ +t6895b.scala:23: error: polymorphic expression cannot be instantiated to expected type; + found : [F[_]]Foo[[X(in type L)]Bar[F,X(in type L)]] + required: Foo[[X(in type L)]Bar[[X]Or[String,X],X(in type L)]] + barFoo(null) : Foo[({type L[X] = Bar[StringOr, X]})#L] + ^ +two errors found diff --git a/test/files/neg/t6895b.scala b/test/files/neg/t6895b.scala new file mode 100644 index 0000000000..c465065011 --- /dev/null +++ b/test/files/neg/t6895b.scala @@ -0,0 +1,39 @@ +trait Foo[F[_]] +trait Bar[F[_], A] + +trait Or[A, B] + +class Test { + implicit def orFoo[A]: Foo[({type L[X] = Or[A, X]})#L] = ??? + implicit def barFoo[F[_]](implicit f: Foo[F]): Foo[({type L[X] = Bar[F, X]})#L] = ??? + + // Now we can define a couple of type aliases: + type StringOr[X] = Or[String, X] + type BarStringOr[X] = Bar[StringOr, X] + + // ok + implicitly[Foo[BarStringOr]] + barFoo[StringOr](null) : Foo[BarStringOr] + barFoo(null) : Foo[BarStringOr] + + // nok + implicitly[Foo[({type L[X] = Bar[StringOr, X]})#L]] + // Let's write the application explicitly, and then + // compile with just this line enabled and -explaintypes. + barFoo(null) : Foo[({type L[X] = Bar[StringOr, X]})#L] + + // Foo[[X]Bar[F,X]] <: Foo[[X]Bar[[X]Or[String,X],X]]? + // Bar[[X]Or[String,X],X] <: Bar[F,X]? + // F[_] <: Or[String,_]? + // false + // false + // false + + // Note that the type annotation above is typechecked as + // Foo[[X]Bar[[X]Or[String,X],X]], ie the type alias `L` + // is eta expanded. + // + // This is done so that it does not escape its defining scope. + // However, one this is done, higher kinded inference + // no longer is able to unify F with `StringOr` (SI-2712) +} diff --git a/test/files/neg/t836.scala b/test/files/neg/t836.scala index 3633b816c6..4b86d04013 100644 --- a/test/files/neg/t836.scala +++ b/test/files/neg/t836.scala @@ -12,5 +12,5 @@ abstract class A { class B extends A { type MyObj = ObjImpl val myString: S = "hello" - val realString: String = myString // error: type missmatch + val realString: String = myString // error: type mismatch } diff --git a/test/files/neg/t8675b.scala b/test/files/neg/t8675b.scala index 2c5015b1d0..bffed2141c 100644 --- a/test/files/neg/t8675b.scala +++ b/test/files/neg/t8675b.scala @@ -13,7 +13,7 @@ object Test { // in the backend. // // This error is itself a regression (or at least a change) in 2.11.0-M7, - // specifically in SI-7944. The type paramaters to the implicit view + // specifically in SI-7944. The type parameters to the implicit view // `EngineTools1` are undetermined, and are now treated as type variables // in the expected type of the closure argument to `withFilter`. for (path: List[Any] <- (null : Engine1).asRequirement.pathsIncludingSelf.toList) { diff --git a/test/files/neg/t8777.check b/test/files/neg/t8777.check new file mode 100644 index 0000000000..cd05f1ec11 --- /dev/null +++ b/test/files/neg/t8777.check @@ -0,0 +1,6 @@ +t8777.scala:3: error: type mismatch; + found : Foo.this.TreePrinter(in trait Printers) + required: Foo.this.TreePrinter(in trait Printers) + super.newCodePrinter(out, tree, printRootPkg) + ^ +one error found diff --git a/test/files/neg/t8777.scala b/test/files/neg/t8777.scala new file mode 100644 index 0000000000..5b7d123202 --- /dev/null +++ b/test/files/neg/t8777.scala @@ -0,0 +1,4 @@ +trait Foo extends scala.tools.nsc.Global { + override def newCodePrinter(out: java.io.PrintWriter, tree: Tree, printRootPkg: Boolean): TreePrinter = + super.newCodePrinter(out, tree, printRootPkg) +} diff --git a/test/files/neg/t8892.check b/test/files/neg/t8892.check new file mode 100644 index 0000000000..5930be58c5 --- /dev/null +++ b/test/files/neg/t8892.check @@ -0,0 +1,7 @@ +t8892.scala:2: error: type mismatch; + found : B + required: C.this.B + (which expands to) String +class C[B](x: B) extends A { def f: B = x } + ^ +one error found diff --git a/test/files/neg/t8892.scala b/test/files/neg/t8892.scala new file mode 100644 index 0000000000..f857e6f115 --- /dev/null +++ b/test/files/neg/t8892.scala @@ -0,0 +1,2 @@ +trait A { type B = String } +class C[B](x: B) extends A { def f: B = x } diff --git a/test/files/neg/warn-unused-privates.scala b/test/files/neg/warn-unused-privates.scala index 2faa07e759..2eda280d40 100644 --- a/test/files/neg/warn-unused-privates.scala +++ b/test/files/neg/warn-unused-privates.scala @@ -21,7 +21,7 @@ class B3(msg0: String) extends A("msg") /*** Early defs warnings disabled primarily due to SI-6595. * The test case is here to assure we aren't issuing false positives; - * the ones labeled "warn" don't warn. + * the ones labelled "warn" don't warn. ***/ class Boppy extends { private val hmm: String = "abc" // no warn, used in early defs diff --git a/test/files/pos/inline-access-levels.flags b/test/files/pos/inline-access-levels.flags index 882f40f050..9bda07eb6c 100644 --- a/test/files/pos/inline-access-levels.flags +++ b/test/files/pos/inline-access-levels.flags @@ -1 +1 @@ --optimise -Xfatal-warnings -Yinline-warnings +-optimise -Ybackend:GenASM -Xfatal-warnings -Yinline-warnings diff --git a/test/files/pos/inliner2.flags b/test/files/pos/inliner2.flags index ea03113c66..bff4bb8afa 100644 --- a/test/files/pos/inliner2.flags +++ b/test/files/pos/inliner2.flags @@ -1 +1 @@ --optimise -Xfatal-warnings
\ No newline at end of file +-optimise -Ybackend:GenASM -Xfatal-warnings
\ No newline at end of file diff --git a/test/files/pos/sealed-final.flags b/test/files/pos/sealed-final.flags index cfabf7a5b4..63f5e65527 100644 --- a/test/files/pos/sealed-final.flags +++ b/test/files/pos/sealed-final.flags @@ -1 +1 @@ --Xfatal-warnings -Yinline-warnings -optimise
\ No newline at end of file +-Xfatal-warnings -Yinline-warnings -Ybackend:GenASM -optimise
\ No newline at end of file diff --git a/test/files/pos/t3420.flags b/test/files/pos/t3420.flags index ea03113c66..bff4bb8afa 100644 --- a/test/files/pos/t3420.flags +++ b/test/files/pos/t3420.flags @@ -1 +1 @@ --optimise -Xfatal-warnings
\ No newline at end of file +-optimise -Ybackend:GenASM -Xfatal-warnings
\ No newline at end of file diff --git a/test/files/pos/t6601/UsePrivateValueClass_2.scala b/test/files/pos/t6601/UsePrivateValueClass_2.scala index 461b8397b2..3b2b3dcc21 100644 --- a/test/files/pos/t6601/UsePrivateValueClass_2.scala +++ b/test/files/pos/t6601/UsePrivateValueClass_2.scala @@ -1,5 +1,5 @@ object Test { - // After the first attempt to make seprately compiled value + // After the first attempt to make separately compiled value // classes respect the privacy of constructors, we got: // // exception when typing v.a().==(v.a())/class scala.reflect.internal.Trees$Apply diff --git a/test/files/pos/t8111.scala b/test/files/pos/t8111.scala index 0d63a16ba4..09463ce697 100644 --- a/test/files/pos/t8111.scala +++ b/test/files/pos/t8111.scala @@ -7,10 +7,10 @@ trait T { foo((u: Unit) => ma) foo(0, (u: Any) => ma) apply () - // crash due to side effects on the onwer of the symbol in the + // crash due to side effects on the owner of the symbol in the // qualifier or arguments of the application during an abandoned - // names/defaults transform. The code type checkes because of - // autp-tupling which promotes and empty parmater list to `(): Unit` + // names/defaults transform. The code type checks because of + // auto-tupling which promotes an empty parameter list to `(): Unit` foo((u: Any) => ma)() {{(u: Any) => ma}; this}.foo(0)() diff --git a/test/files/pos/t8410.flags b/test/files/pos/t8410.flags index dcd5943c2f..2f32e3b26a 100644 --- a/test/files/pos/t8410.flags +++ b/test/files/pos/t8410.flags @@ -1 +1 @@ --optimise -Xfatal-warnings -deprecation:false -Yinline-warnings:false +-optimise -Ybackend:GenASM -Xfatal-warnings -deprecation:false -Yinline-warnings:false diff --git a/test/files/pos/t8954/t2.scala b/test/files/pos/t8954/t2.scala index 4def127832..c178486bc9 100644 --- a/test/files/pos/t8954/t2.scala +++ b/test/files/pos/t8954/t2.scala @@ -19,7 +19,7 @@ class C { } // 2.1 overriding with a deprecated def should be fine -// and also shoudln't trigger the "deprecation is useless" +// and also should not trigger the "deprecation is useless" // warning class D extends C { @deprecated("","") override def foo(): Unit = ??? diff --git a/test/files/pos/t9393/Named.java b/test/files/pos/t9393/Named.java new file mode 100644 index 0000000000..144ddbf26e --- /dev/null +++ b/test/files/pos/t9393/Named.java @@ -0,0 +1,3 @@ +package bug; + +public @interface Named {} diff --git a/test/files/pos/t9393/NamedImpl.java b/test/files/pos/t9393/NamedImpl.java new file mode 100644 index 0000000000..7918739c2b --- /dev/null +++ b/test/files/pos/t9393/NamedImpl.java @@ -0,0 +1,15 @@ +/* + * Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com> + */ +package bug; + +import bug.Named; +import java.io.Serializable; +import java.lang.annotation.Annotation; + +public class NamedImpl implements Named { + + public Class<? extends Annotation> annotationType() { + return null; + } +} diff --git a/test/files/pos/t9393/test.scala b/test/files/pos/t9393/test.scala new file mode 100644 index 0000000000..4df0476c98 --- /dev/null +++ b/test/files/pos/t9393/test.scala @@ -0,0 +1,3 @@ +class C { + new bug.NamedImpl +} diff --git a/test/files/presentation/t8941b/IdempotencyTest.scala b/test/files/presentation/t8941b/IdempotencyTest.scala index af01b36898..ffbbc0d03b 100644 --- a/test/files/presentation/t8941b/IdempotencyTest.scala +++ b/test/files/presentation/t8941b/IdempotencyTest.scala @@ -6,9 +6,9 @@ import reporters.{Reporter => CompilerReporter} import scala.tools.nsc.interactive.InteractiveReporter import scala.reflect.internal.util.SourceFile -/** Determistically interrupts typechecking of `code` when a defintion named - * `MagicInterruptionMarker` is typechecked, and then performs a targetted - * typecheck of the tree at the specal comment marker marker +/** Deterministically interrupts typechecking of `code` when a definition named + * `MagicInterruptionMarker` is typechecked, and then performs a targeted + * typecheck of the tree at the special comment marker marker */ abstract class IdempotencyTest { self => private val settings = new Settings diff --git a/test/files/run/ReplacementMatching.scala b/test/files/run/ReplacementMatching.scala index 05040d98a3..81034aa510 100644 --- a/test/files/run/ReplacementMatching.scala +++ b/test/files/run/ReplacementMatching.scala @@ -32,12 +32,12 @@ object Test { def groupsMatching { val Date = """(\d+)/(\d+)/(\d+)""".r - for (Regex.Groups(a, b, c) <- Date findFirstMatchIn "1/1/2001 marks the start of the millenium. 31/12/2000 doesn't.") { + for (Regex.Groups(a, b, c) <- Date findFirstMatchIn "1/1/2001 marks the start of the millennium. 31/12/2000 doesn't.") { assert(a == "1") assert(b == "1") assert(c == "2001") } - for (Regex.Groups(a, b, c) <- (Date findAllIn "1/1/2001 marks the start of the millenium. 31/12/2000 doesn't.").matchData) { + for (Regex.Groups(a, b, c) <- (Date findAllIn "1/1/2001 marks the start of the millennium. 31/12/2000 doesn't.").matchData) { assert(a == "1" || a == "31") assert(b == "1" || b == "12") assert(c == "2001" || c == "2000") diff --git a/test/files/run/blame_eye_triple_eee-double.flags b/test/files/run/blame_eye_triple_eee-double.flags deleted file mode 100644 index c9b68d70dc..0000000000 --- a/test/files/run/blame_eye_triple_eee-double.flags +++ /dev/null @@ -1 +0,0 @@ --optimise diff --git a/test/files/run/blame_eye_triple_eee-float.flags b/test/files/run/blame_eye_triple_eee-float.flags deleted file mode 100644 index c9b68d70dc..0000000000 --- a/test/files/run/blame_eye_triple_eee-float.flags +++ /dev/null @@ -1 +0,0 @@ --optimise diff --git a/test/files/run/class-symbol-contravariant.check b/test/files/run/class-symbol-contravariant.check index cbb90b52c2..1d95273b50 100644 --- a/test/files/run/class-symbol-contravariant.check +++ b/test/files/run/class-symbol-contravariant.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> :power ** Power User mode enabled - BEEP WHIR GYVE ** diff --git a/test/files/run/classfile-format-51.scala b/test/files/run/classfile-format-51.scala index da322bb5d9..3ef0640b84 100644 --- a/test/files/run/classfile-format-51.scala +++ b/test/files/run/classfile-format-51.scala @@ -13,10 +13,10 @@ import Opcodes._ // // By its 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 +// verify. So the test includes a version check that short-circuits the whole test // on JDK 6 object Test extends DirectTest { - override def extraSettings: String = "-optimise -usejavacp -d " + testOutput.path + " -cp " + testOutput.path + override def extraSettings: String = "-Yopt:l:classpath -usejavacp -d " + testOutput.path + " -cp " + testOutput.path def generateClass() { val invokerClassName = "DynamicInvoker" diff --git a/test/files/run/classfile-format-52.scala b/test/files/run/classfile-format-52.scala index e278d40b8b..ebd0826303 100644 --- a/test/files/run/classfile-format-52.scala +++ b/test/files/run/classfile-format-52.scala @@ -13,7 +13,7 @@ import Opcodes._ // By its nature the test can only work on JDK 8+ because under JDK 7- the // interface won't verify. object Test extends DirectTest { - override def extraSettings: String = "-optimise -usejavacp -d " + testOutput.path + " -cp " + testOutput.path + override def extraSettings: String = "-Yopt:l:classpath -usejavacp -d " + testOutput.path + " -cp " + testOutput.path def generateInterface() { val interfaceName = "HasDefaultMethod" diff --git a/test/files/run/complicatedmatch.scala b/test/files/run/complicatedmatch.scala index 681029aa13..1676a4115a 100644 --- a/test/files/run/complicatedmatch.scala +++ b/test/files/run/complicatedmatch.scala @@ -7,7 +7,7 @@ object Even{ } object Test extends App{ - val LongWord = "supercalifragilisticexpialadocious"; + val LongWord = "supercalifragilisticexpialidocious"; def foo(x : Int, y : String) : Int = (x, y) match { case (Even(i), "bar") => 1 diff --git a/test/files/run/constant-optimization.flags b/test/files/run/constant-optimization.flags index c9b68d70dc..6c9965e749 100644 --- a/test/files/run/constant-optimization.flags +++ b/test/files/run/constant-optimization.flags @@ -1 +1 @@ --optimise +-optimise -Ybackend:GenASM diff --git a/test/files/run/constant-type.check b/test/files/run/constant-type.check index a7ba5a46c2..b92f1481a3 100644 --- a/test/files/run/constant-type.check +++ b/test/files/run/constant-type.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> :power ** Power User mode enabled - BEEP WHIR GYVE ** diff --git a/test/files/run/constrained-types.check b/test/files/run/constrained-types.check index 6dbf8088c9..670d6f49aa 100644 --- a/test/files/run/constrained-types.check +++ b/test/files/run/constrained-types.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> class Annot(obj: Any) extends annotation.Annotation with annotation.TypeConstraint defined class Annot diff --git a/test/files/run/dead-code-elimination.flags b/test/files/run/dead-code-elimination.flags index 49d036a887..b9bb09167e 100644 --- a/test/files/run/dead-code-elimination.flags +++ b/test/files/run/dead-code-elimination.flags @@ -1 +1 @@ --optimize +-optimize -Ybackend:GenASM diff --git a/test/files/run/elidable-opt.flags b/test/files/run/elidable-opt.flags index 62897ff218..6537d2f57a 100644 --- a/test/files/run/elidable-opt.flags +++ b/test/files/run/elidable-opt.flags @@ -1 +1 @@ --optimise -Xelide-below 900 +-optimise -Ybackend:GenASM -Xelide-below 900 diff --git a/test/files/run/elidable-opt.scala b/test/files/run/elidable-opt.scala index a2f29d2caf..ebada46de8 100644 --- a/test/files/run/elidable-opt.scala +++ b/test/files/run/elidable-opt.scala @@ -1,3 +1,6 @@ +/* + * filter: inliner warnings; re-run with + */ import annotation._ import elidable._ diff --git a/test/files/run/finally.check b/test/files/run/finally.check index 901a797426..b0f2293d11 100644 --- a/test/files/run/finally.check +++ b/test/files/run/finally.check @@ -29,7 +29,7 @@ body in finally java.lang.Exception ---------------------------------------- -Running nestedFinalies +Running nestedFinallyBlocks in finally 1 in finally 2 ---------------------------------------- diff --git a/test/files/run/finally.scala b/test/files/run/finally.scala index b66354ca03..467c9e5868 100644 --- a/test/files/run/finally.scala +++ b/test/files/run/finally.scala @@ -94,7 +94,7 @@ object Test extends App { } // nested finally blocks with return value - def nestedFinalies: Int = + def nestedFinallyBlocks: Int = try { try { return 10 @@ -123,5 +123,5 @@ object Test extends App { test(throwBody, "throwBody") test(retFinally, "retFinally") test(throwFinally, "throwFinally") - test(nestedFinalies, "nestedFinalies") + test(nestedFinallyBlocks, "nestedFinallyBlocks") } diff --git a/test/files/run/finalvar.flags b/test/files/run/finalvar.flags index aee3039bec..8d9be3d62e 100644 --- a/test/files/run/finalvar.flags +++ b/test/files/run/finalvar.flags @@ -1 +1 @@ --Yoverride-vars -Yinline
\ No newline at end of file +-Yoverride-vars -Yinline -Ybackend:GenASM
\ No newline at end of file diff --git a/test/files/run/icode-reader-dead-code.scala b/test/files/run/icode-reader-dead-code.scala index 00ba58829f..535ef2a2e2 100644 --- a/test/files/run/icode-reader-dead-code.scala +++ b/test/files/run/icode-reader-dead-code.scala @@ -36,7 +36,7 @@ object Test extends DirectTest { // If inlining fails, the compiler will issue an inliner warning that is not present in the // check file - compileString(newCompiler("-usejavacp", "-optimise"))(bCode) + compileString(newCompiler("-usejavacp", "-optimise", "-Ybackend:GenASM"))(bCode) } def readClass(file: String) = { diff --git a/test/files/run/kind-repl-command.check b/test/files/run/kind-repl-command.check index 1853213555..e050fb4bc1 100644 --- a/test/files/run/kind-repl-command.check +++ b/test/files/run/kind-repl-command.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> :kind scala.Option scala.Option's kind is F[+A] diff --git a/test/files/run/lub-visibility.check b/test/files/run/lub-visibility.check index 135cb3cb76..61dca979a1 100644 --- a/test/files/run/lub-visibility.check +++ b/test/files/run/lub-visibility.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> // should infer List[scala.collection.immutable.Seq[Nothing]] diff --git a/test/files/run/macro-bundle-repl.check b/test/files/run/macro-bundle-repl.check index 75c5c2adda..ce5c980f6e 100644 --- a/test/files/run/macro-bundle-repl.check +++ b/test/files/run/macro-bundle-repl.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> import scala.language.experimental.macros import scala.language.experimental.macros diff --git a/test/files/run/macro-repl-basic.check b/test/files/run/macro-repl-basic.check index fab03d1558..7e1cb61583 100644 --- a/test/files/run/macro-repl-basic.check +++ b/test/files/run/macro-repl-basic.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> import language.experimental.macros import language.experimental.macros diff --git a/test/files/run/macro-repl-dontexpand.check b/test/files/run/macro-repl-dontexpand.check index 6ecc9245fa..a307ffb26e 100644 --- a/test/files/run/macro-repl-dontexpand.check +++ b/test/files/run/macro-repl-dontexpand.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> def bar1(c: scala.reflect.macros.blackbox.Context) = ??? bar1: (c: scala.reflect.macros.blackbox.Context)Nothing diff --git a/test/files/run/macro-system-properties.check b/test/files/run/macro-system-properties.check index e2e2bd32b9..e20a5bbdfb 100644 --- a/test/files/run/macro-system-properties.check +++ b/test/files/run/macro-system-properties.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> import scala.language.experimental._, scala.reflect.macros.blackbox.Context import scala.language.experimental._ diff --git a/test/files/run/macroPlugins-namerHooks.check b/test/files/run/macroPlugins-namerHooks.check index c2db5935d4..56b170cbd9 100644 --- a/test/files/run/macroPlugins-namerHooks.check +++ b/test/files/run/macroPlugins-namerHooks.check @@ -28,7 +28,7 @@ enterStat(<synthetic> val C$1: C = x$1.asInstanceOf[C]) enterSym(def <init>() = { super.<init>(); () }) enterSym(final override <synthetic> def toString() = "C") enterSym(case <synthetic> def apply(x: Int, y: Int): C = new C(x, y)) -enterSym(case <synthetic> def unapply(x$0: C) = if (x$0.==(null)) scala.this.None else Some(scala.Tuple2(x$0.x, x$0.y))) +enterSym(case <synthetic> def unapply(x$0: C): _root_.scala.Option[scala.Tuple2[Int, Int]] = if (x$0.==(null)) scala.this.None else Some(scala.Tuple2(x$0.x, x$0.y))) enterStat(def <init>() = { super.<init>(); () }) enterStat(final override <synthetic> def toString() = "C") enterSym(def <init>() = { super.<init>(); () }) diff --git a/test/files/run/noInlineUnknownIndy.check b/test/files/run/noInlineUnknownIndy.check new file mode 100644 index 0000000000..7cc6d1b675 --- /dev/null +++ b/test/files/run/noInlineUnknownIndy.check @@ -0,0 +1,13 @@ +newSource1.scala:1: warning: A_1::test()Ljava/lang/String; could not be inlined: +Failed to check if A_1::test()Ljava/lang/String; can be safely inlined to T without causing an IllegalAccessError. Checking instruction INVOKEDYNAMIC m()LA_1$Fun; [ + // handle kind 0x6 : INVOKESTATIC + not/java/lang/SomeLambdaMetafactory.notAMetaFactoryMethod(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;[Ljava/lang/Object;)Ljava/lang/invoke/CallSite; + // arguments: + (Ljava/lang/String;)Ljava/lang/String;, + // handle kind 0x6 : INVOKESTATIC + A_1.lambda$test$0(Ljava/lang/String;)Ljava/lang/String;, + (Ljava/lang/String;)Ljava/lang/String; + ] failed: +The callee contains an InvokeDynamic instruction with an unknown bootstrap method (not a LambdaMetaFactory). +class T { def foo = A_1.test } + ^ diff --git a/test/files/run/noInlineUnknownIndy/A_1.java b/test/files/run/noInlineUnknownIndy/A_1.java new file mode 100644 index 0000000000..a9144a9fa6 --- /dev/null +++ b/test/files/run/noInlineUnknownIndy/A_1.java @@ -0,0 +1,9 @@ +public class A_1 { + interface Fun { + String m(String s); + } + public static final String test() { + Fun f = s -> s.trim(); + return f.m(" eh "); + } +} diff --git a/test/files/run/noInlineUnknownIndy/Test.scala b/test/files/run/noInlineUnknownIndy/Test.scala new file mode 100644 index 0000000000..16d8126543 --- /dev/null +++ b/test/files/run/noInlineUnknownIndy/Test.scala @@ -0,0 +1,28 @@ +import java.io.File + +import scala.collection.convert.decorateAsScala._ +import scala.tools.asm.tree.{ClassNode, InvokeDynamicInsnNode} +import scala.tools.asm.{Handle, Opcodes} +import scala.tools.partest.BytecodeTest.modifyClassFile +import scala.tools.partest._ + +object Test extends DirectTest { + def code = ??? + + def compileCode(code: String) = { + val classpath = List(sys.props("partest.lib"), testOutput.path) mkString sys.props("path.separator") + compileString(newCompiler("-cp", classpath, "-d", testOutput.path, "-Yopt:l:classpath", "-Yopt-inline-heuristics:everything", "-Yopt-warnings:_"))(code) + } + + def show(): Unit = { + val unknownBootstrapMethod = new Handle(Opcodes.H_INVOKESTATIC, "not/java/lang/SomeLambdaMetafactory", "notAMetaFactoryMethod", "(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;[Ljava/lang/Object;)Ljava/lang/invoke/CallSite;") + modifyClassFile(new File(testOutput.toFile, "A_1.class"))((cn: ClassNode) => { + val testMethod = cn.methods.iterator.asScala.find(_.name == "test").head + val indy = testMethod.instructions.iterator.asScala.collect({ case i: InvokeDynamicInsnNode => i }).next() + indy.bsm = unknownBootstrapMethod + cn + }) + + compileCode("class T { def foo = A_1.test }") + } +} diff --git a/test/files/run/optimizer-array-load.flags b/test/files/run/optimizer-array-load.flags index eb4d19bcb9..99bd6c895d 100644 --- a/test/files/run/optimizer-array-load.flags +++ b/test/files/run/optimizer-array-load.flags @@ -1 +1 @@ --optimise
\ No newline at end of file +-optimise -Ybackend:GenASM
\ No newline at end of file diff --git a/test/files/run/reflection-equality.check b/test/files/run/reflection-equality.check index d60d861a90..09a0858630 100644 --- a/test/files/run/reflection-equality.check +++ b/test/files/run/reflection-equality.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> class X { def methodIntIntInt(x: Int, y: Int) = x+y diff --git a/test/files/run/reflection-magicsymbols-repl.check b/test/files/run/reflection-magicsymbols-repl.check index ca8857ada4..dd26c08349 100644 --- a/test/files/run/reflection-magicsymbols-repl.check +++ b/test/files/run/reflection-magicsymbols-repl.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> import scala.reflect.runtime.universe._ import scala.reflect.runtime.universe._ diff --git a/test/files/run/reflection-repl-classes.check b/test/files/run/reflection-repl-classes.check index 5ebf993a87..df889b9da6 100644 --- a/test/files/run/reflection-repl-classes.check +++ b/test/files/run/reflection-repl-classes.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> class A defined class A diff --git a/test/files/run/reflection-repl-elementary.check b/test/files/run/reflection-repl-elementary.check index e948c9fd61..2a7f5d90fe 100644 --- a/test/files/run/reflection-repl-elementary.check +++ b/test/files/run/reflection-repl-elementary.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> scala.reflect.runtime.universe.typeOf[List[Nothing]] res0: reflect.runtime.universe.Type = scala.List[Nothing] diff --git a/test/files/run/reify-repl-fail-gracefully.check b/test/files/run/reify-repl-fail-gracefully.check index eac4d25869..025d377a43 100644 --- a/test/files/run/reify-repl-fail-gracefully.check +++ b/test/files/run/reify-repl-fail-gracefully.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> import language.experimental.macros import language.experimental.macros diff --git a/test/files/run/reify_newimpl_22.check b/test/files/run/reify_newimpl_22.check index 24334df92c..e69dc60199 100644 --- a/test/files/run/reify_newimpl_22.check +++ b/test/files/run/reify_newimpl_22.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> import scala.reflect.runtime.universe._ import scala.reflect.runtime.universe._ diff --git a/test/files/run/reify_newimpl_23.check b/test/files/run/reify_newimpl_23.check index f8379958db..1356d509d3 100644 --- a/test/files/run/reify_newimpl_23.check +++ b/test/files/run/reify_newimpl_23.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> import scala.reflect.runtime.universe._ import scala.reflect.runtime.universe._ diff --git a/test/files/run/reify_newimpl_25.check b/test/files/run/reify_newimpl_25.check index f9a5d7b578..e512cfc52e 100644 --- a/test/files/run/reify_newimpl_25.check +++ b/test/files/run/reify_newimpl_25.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> { import scala.reflect.runtime.universe._ diff --git a/test/files/run/reify_newimpl_26.check b/test/files/run/reify_newimpl_26.check index bd77d3d707..b203389db1 100644 --- a/test/files/run/reify_newimpl_26.check +++ b/test/files/run/reify_newimpl_26.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> def foo[T]{ import scala.reflect.runtime.universe._ diff --git a/test/files/run/reify_newimpl_35.check b/test/files/run/reify_newimpl_35.check index bd9b3a2fb1..4f9b43dbbf 100644 --- a/test/files/run/reify_newimpl_35.check +++ b/test/files/run/reify_newimpl_35.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> import scala.reflect.runtime.universe._ import scala.reflect.runtime.universe._ diff --git a/test/files/run/repl-assign.check b/test/files/run/repl-assign.check index faa8a93244..a9e0a2204a 100644 --- a/test/files/run/repl-assign.check +++ b/test/files/run/repl-assign.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> var x = 10 x: Int = 10 diff --git a/test/files/run/repl-bare-expr.check b/test/files/run/repl-bare-expr.check index 38ad7e818d..f0c488455f 100644 --- a/test/files/run/repl-bare-expr.check +++ b/test/files/run/repl-bare-expr.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> 2 ; 3 <console>:10: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses diff --git a/test/files/run/repl-colon-type.check b/test/files/run/repl-colon-type.check index fa33af3beb..21fbe34d96 100644 --- a/test/files/run/repl-colon-type.check +++ b/test/files/run/repl-colon-type.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> :type List[1, 2, 3] <console>:1: error: identifier expected but integer literal found. diff --git a/test/files/run/repl-empty-package.check b/test/files/run/repl-empty-package.check index d3b75f685e..69488ecdcf 100644 --- a/test/files/run/repl-empty-package.check +++ b/test/files/run/repl-empty-package.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> println(Bippy.bippy) bippy! diff --git a/test/files/run/repl-out-dir.check b/test/files/run/repl-out-dir.check index c354492898..6fd85f5bba 100644 --- a/test/files/run/repl-out-dir.check +++ b/test/files/run/repl-out-dir.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> case class Bippy(x: Int) defined class Bippy diff --git a/test/files/run/repl-parens.check b/test/files/run/repl-parens.check index 756a063b68..35853f10da 100644 --- a/test/files/run/repl-parens.check +++ b/test/files/run/repl-parens.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> (2) res0: Int = 2 diff --git a/test/files/run/repl-paste-2.check b/test/files/run/repl-paste-2.check index bc80615107..5b6a84144d 100644 --- a/test/files/run/repl-paste-2.check +++ b/test/files/run/repl-paste-2.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> scala> 999l diff --git a/test/files/run/repl-paste-3.check b/test/files/run/repl-paste-3.check index 23e402852f..603fcfa174 100644 --- a/test/files/run/repl-paste-3.check +++ b/test/files/run/repl-paste-3.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> println(3) 3 diff --git a/test/files/run/repl-paste-4.scala b/test/files/run/repl-paste-4.scala index cb0a6aa768..90f0c1802b 100644 --- a/test/files/run/repl-paste-4.scala +++ b/test/files/run/repl-paste-4.scala @@ -3,9 +3,7 @@ import scala.tools.partest.SessionTest object Test extends SessionTest { def session = -s"""|Type in expressions to have them evaluated. - |Type :help for more information. - | +s"""| |scala> :paste $pastie |Pasting file $pastie... |defined class Foo diff --git a/test/files/run/repl-paste-raw.scala b/test/files/run/repl-paste-raw.scala index 3b41254e96..9bd5e8e63e 100644 --- a/test/files/run/repl-paste-raw.scala +++ b/test/files/run/repl-paste-raw.scala @@ -3,9 +3,7 @@ import scala.tools.partest.SessionTest object Test extends SessionTest { def session = -s"""|Type in expressions to have them evaluated. - |Type :help for more information. - | +s"""| |scala> :paste -raw $pastie |Pasting file $pastie... | diff --git a/test/files/run/repl-paste.check b/test/files/run/repl-paste.check index 171447214f..3bcfd33c94 100644 --- a/test/files/run/repl-paste.check +++ b/test/files/run/repl-paste.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> :paste // Entering paste mode (ctrl-D to finish) diff --git a/test/files/run/repl-power.check b/test/files/run/repl-power.check index e2318c93f2..2a7b7783d9 100644 --- a/test/files/run/repl-power.check +++ b/test/files/run/repl-power.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> :power ** Power User mode enabled - BEEP WHIR GYVE ** diff --git a/test/files/run/repl-reset.check b/test/files/run/repl-reset.check index a2d88fd445..b0683fff79 100644 --- a/test/files/run/repl-reset.check +++ b/test/files/run/repl-reset.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> val x1 = 1 x1: Int = 1 diff --git a/test/files/run/repl-save.scala b/test/files/run/repl-save.scala index c98e6aebc3..8a3a887a8c 100644 --- a/test/files/run/repl-save.scala +++ b/test/files/run/repl-save.scala @@ -2,9 +2,7 @@ import scala.tools.partest.SessionTest object Test extends SessionTest { def session = -s"""|Type in expressions to have them evaluated. - |Type :help for more information. - | +s"""| |scala> val i = 7 |i: Int = 7 | diff --git a/test/files/run/repl-term-macros.check b/test/files/run/repl-term-macros.check index 2cd0b93cd0..b020611167 100644 --- a/test/files/run/repl-term-macros.check +++ b/test/files/run/repl-term-macros.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> import scala.reflect.macros.blackbox.Context import scala.reflect.macros.blackbox.Context diff --git a/test/files/run/repl-transcript.check b/test/files/run/repl-transcript.check index b0f106387b..762a96b9cc 100644 --- a/test/files/run/repl-transcript.check +++ b/test/files/run/repl-transcript.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> scala> class Bippity diff --git a/test/files/run/repl-trim-stack-trace.scala b/test/files/run/repl-trim-stack-trace.scala index b8c1668691..ea91e32239 100644 --- a/test/files/run/repl-trim-stack-trace.scala +++ b/test/files/run/repl-trim-stack-trace.scala @@ -5,8 +5,7 @@ import scala.tools.partest.{ SessionTest, Welcoming } object Test extends SessionTest with Welcoming { def session = """Welcome to Scala -Type in expressions to have them evaluated. -Type :help for more information. +Type in expressions for evaluation. Or try :help. scala> def f = throw new Exception("Uh-oh") f: Nothing @@ -37,7 +36,6 @@ scala> :quit""" // normalize the "elided" lines because the frame count depends on test context lazy val elided = """(\s+\.{3} )\d+( elided)""".r override def normalize(line: String) = line match { - case welcome(w) => w case elided(ellipsis, suffix) => s"$ellipsis???$suffix" case s => s } diff --git a/test/files/run/repl-type-verbose.check b/test/files/run/repl-type-verbose.check index 6f6b47b86d..10a9c1217c 100644 --- a/test/files/run/repl-type-verbose.check +++ b/test/files/run/repl-type-verbose.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> // verbose! diff --git a/test/files/run/run-bug4840.flags b/test/files/run/run-bug4840.flags deleted file mode 100644 index eb4d19bcb9..0000000000 --- a/test/files/run/run-bug4840.flags +++ /dev/null @@ -1 +0,0 @@ --optimise
\ No newline at end of file diff --git a/test/files/run/sbt-icode-interface.scala b/test/files/run/sbt-icode-interface.scala new file mode 100644 index 0000000000..84d38cc65a --- /dev/null +++ b/test/files/run/sbt-icode-interface.scala @@ -0,0 +1,42 @@ +import scala.tools.partest._ +import scala.tools.nsc._ + +object Test extends DirectTest { + + def code = """ + class C { class D } + object O + """.trim + + def show() { + for (b <- List("GenASM", "GenBCode")) { + val global = newCompiler("-usejavacp", s"-Ybackend:$b") + import global._ + val r = new Run + r.compileSources(newSourceFile(code) :: Nil) + + val results = collection.mutable.Buffer[(Boolean, String)]() + + // Nailing down defacto compiler API from SBT's usage + // https://github.com/sbt/sbt/blob/adb41611cf73260938274915d8462d924df200c8/compile/interface/src/main/scala/xsbt/Analyzer.scala#L29-L41 + def isTopLevelModule(sym: Symbol) = sym.isTopLevel && sym.isModule + for (unit <- currentRun.units if !unit.isJava) { + val sourceFile = unit.source.file.file + for (iclass <- unit.icode) { + val sym = iclass.symbol + def addGenerated(separatorRequired: Boolean) { + results += (separatorRequired -> sym.fullName) + } + if (sym.isModuleClass && !sym.isImplClass) { + if (isTopLevelModule(sym) && sym.companionClass == NoSymbol) + addGenerated(false) + addGenerated(true) + } else + addGenerated(false) + } + } + val expected = List((false, "C"), (true, "O"), (false, "C$D")) + assert(results.toList == expected, b + ": " + results.toList) + } + } +} diff --git a/test/files/run/synchronized.flags b/test/files/run/synchronized.flags index 49d036a887..b9bb09167e 100644 --- a/test/files/run/synchronized.flags +++ b/test/files/run/synchronized.flags @@ -1 +1 @@ --optimize +-optimize -Ybackend:GenASM diff --git a/test/files/run/t1987b/cce_test.scala b/test/files/run/t1987b/cce_test.scala index 4f9acf0264..e131df7956 100644 --- a/test/files/run/t1987b/cce_test.scala +++ b/test/files/run/t1987b/cce_test.scala @@ -1,5 +1,5 @@ package scales.xml -//import scales.xml._ // using another pacakge and importing doesn't CCE +//import scales.xml._ // using another package and importing doesn't CCE object CCE_Test { def main(args: Array[String]): Unit = { diff --git a/test/files/run/t2106.check b/test/files/run/t2106.check index c6457216b5..b19165824b 100644 --- a/test/files/run/t2106.check +++ b/test/files/run/t2106.check @@ -1,13 +1,5 @@ -#partest !-Ybackend:GenASM t2106.scala:7: warning: A::foo()Ljava/lang/Object; is annotated @inline but could not be inlined: The callee A::foo()Ljava/lang/Object; contains the instruction INVOKEVIRTUAL java/lang/Object.clone ()Ljava/lang/Object; that would cause an IllegalAccessError when inlined into class Test$. def main(args: Array[String]): Unit = x.foo ^ -#partest -Ybackend:GenASM -t2106.scala:7: warning: Could not inline required method foo because access level required by callee not matched by caller. - def main(args: Array[String]): Unit = x.foo - ^ -t2106.scala:7: warning: At the end of the day, could not inline @inline-marked method foo - def main(args: Array[String]): Unit = x.foo - ^ diff --git a/test/files/run/t2106.flags b/test/files/run/t2106.flags index a2e413bb22..5d6ee831df 100644 --- a/test/files/run/t2106.flags +++ b/test/files/run/t2106.flags @@ -1 +1 @@ --optimise -Yinline-warnings -Yopt:l:classpath +-Yinline-warnings -Yopt:l:classpath diff --git a/test/files/run/t3368-c.check b/test/files/run/t3368-c.check index e0c10cc0dd..4cbe98c577 100644 --- a/test/files/run/t3368-c.check +++ b/test/files/run/t3368-c.check @@ -6,8 +6,8 @@ package <empty> { }; def x = { val $buf = new _root_.scala.xml.NodeBuffer(); - $buf.$amp$plus(new _root_.scala.xml.Text("hi & bye")); - $buf.$amp$plus(new _root_.scala.xml.Text("red & black")); + $buf.$amp$plus(new _root_.scala.xml.PCData("hi & bye")); + $buf.$amp$plus(new _root_.scala.xml.PCData("red & black")); $buf } }; @@ -24,7 +24,8 @@ package <empty> { new _root_.scala.xml.Elem(null, "b", _root_.scala.xml.Null, $scope, true) } }); - $buf.$amp$plus(new _root_.scala.xml.Text("starthi & bye")); + $buf.$amp$plus(new _root_.scala.xml.Text("start")); + $buf.$amp$plus(new _root_.scala.xml.PCData("hi & bye")); $buf.$amp$plus({ { new _root_.scala.xml.Elem(null, "c", _root_.scala.xml.Null, $scope, true) @@ -36,7 +37,8 @@ package <empty> { new _root_.scala.xml.Elem(null, "d", _root_.scala.xml.Null, $scope, true) } }); - $buf.$amp$plus(new _root_.scala.xml.Text("stuffred & black")); + $buf.$amp$plus(new _root_.scala.xml.Text("stuff")); + $buf.$amp$plus(new _root_.scala.xml.PCData("red & black")); $buf }: _*)) } @@ -46,18 +48,19 @@ package <empty> { def $init$() = { () }; - def d = new _root_.scala.xml.Text("hello, world"); + def d = new _root_.scala.xml.PCData("hello, world"); def e = { val $buf = new _root_.scala.xml.NodeBuffer(); - $buf.$amp$plus(new _root_.scala.xml.Text("hello, world")); - $buf.$amp$plus(new _root_.scala.xml.Text("hello, world")); + $buf.$amp$plus(new _root_.scala.xml.PCData("hello, world")); + $buf.$amp$plus(new _root_.scala.xml.PCData("hello, world")); $buf }; def f = { { new _root_.scala.xml.Elem(null, "foo", _root_.scala.xml.Null, $scope, false, ({ val $buf = new _root_.scala.xml.NodeBuffer(); - $buf.$amp$plus(new _root_.scala.xml.Text("xhello, world")); + $buf.$amp$plus(new _root_.scala.xml.Text("x")); + $buf.$amp$plus(new _root_.scala.xml.PCData("hello, world")); $buf }: _*)) } @@ -66,7 +69,7 @@ package <empty> { { new _root_.scala.xml.Elem(null, "foo", _root_.scala.xml.Null, $scope, false, ({ val $buf = new _root_.scala.xml.NodeBuffer(); - $buf.$amp$plus(new _root_.scala.xml.Text("hello, world")); + $buf.$amp$plus(new _root_.scala.xml.PCData("hello, world")); $buf }: _*)) } @@ -75,7 +78,8 @@ package <empty> { { new _root_.scala.xml.Elem(null, "foo", _root_.scala.xml.Null, $scope, false, ({ val $buf = new _root_.scala.xml.NodeBuffer(); - $buf.$amp$plus(new _root_.scala.xml.Text("hello, worldhello, world")); + $buf.$amp$plus(new _root_.scala.xml.PCData("hello, world")); + $buf.$amp$plus(new _root_.scala.xml.PCData("hello, world")); $buf }: _*)) } diff --git a/test/files/run/t3376.check b/test/files/run/t3376.check index b8fd2843f6..0af54d6a53 100644 --- a/test/files/run/t3376.check +++ b/test/files/run/t3376.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> class M[@specialized T] { override def toString = "mmm" } defined class M diff --git a/test/files/run/t3509.flags b/test/files/run/t3509.flags index 6933d924d3..9c59981aa9 100644 --- a/test/files/run/t3509.flags +++ b/test/files/run/t3509.flags @@ -1 +1 @@ --Yinline
\ No newline at end of file +-Yinline -Ybackend:GenASM
\ No newline at end of file diff --git a/test/files/run/t3569.flags b/test/files/run/t3569.flags index 6933d924d3..9c59981aa9 100644 --- a/test/files/run/t3569.flags +++ b/test/files/run/t3569.flags @@ -1 +1 @@ --Yinline
\ No newline at end of file +-Yinline -Ybackend:GenASM
\ No newline at end of file diff --git a/test/files/run/t4025.check b/test/files/run/t4025.check index e8c6851236..ed3f254024 100644 --- a/test/files/run/t4025.check +++ b/test/files/run/t4025.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> class Color(val red: Int) defined class Color diff --git a/test/files/run/t4172.check b/test/files/run/t4172.check index 315c1c9dbd..3141647dba 100644 --- a/test/files/run/t4172.check +++ b/test/files/run/t4172.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> val c = { class C { override def toString = "C" }; ((new C, new C { def f = 2 })) } warning: there was one feature warning; re-run with -feature for details diff --git a/test/files/run/t4216.check b/test/files/run/t4216.check index e4610e87d3..3ec394b939 100644 --- a/test/files/run/t4216.check +++ b/test/files/run/t4216.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> import scala.reflect.ClassTag import scala.reflect.ClassTag diff --git a/test/files/run/t4285.check b/test/files/run/t4285.check index b952cb8e1b..465aee75f1 100644 --- a/test/files/run/t4285.check +++ b/test/files/run/t4285.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> val x = Array(1,2,3,4,5,6,7) x: Array[Int] = Array(1, 2, 3, 4, 5, 6, 7) diff --git a/test/files/run/t4285.flags b/test/files/run/t4285.flags index eb4d19bcb9..99bd6c895d 100644 --- a/test/files/run/t4285.flags +++ b/test/files/run/t4285.flags @@ -1 +1 @@ --optimise
\ No newline at end of file +-optimise -Ybackend:GenASM
\ No newline at end of file diff --git a/test/files/run/t4542.check b/test/files/run/t4542.check index f7aad3deb2..3ab3eaffd8 100644 --- a/test/files/run/t4542.check +++ b/test/files/run/t4542.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> @deprecated("foooo", "ReplTest version 1.0-FINAL") class Foo() { override def toString = "Bippy" diff --git a/test/files/run/t4594-repl-settings.scala b/test/files/run/t4594-repl-settings.scala index 1b883983cf..cbd87b5949 100644 --- a/test/files/run/t4594-repl-settings.scala +++ b/test/files/run/t4594-repl-settings.scala @@ -4,23 +4,21 @@ import scala.tools.partest.SessionTest // Detected repl transcript paste: ctrl-D to finish. object Test extends SessionTest { def session = -""" |Type in expressions to have them evaluated. - |Type :help for more information. - | - |scala> @deprecated(message="Please don't do that.", since="Time began.") def depp = "john" - |depp: String - | - |scala> def a = depp - |warning: there was one deprecation warning; re-run with -deprecation for details - |a: String - | - |scala> :settings -deprecation - | - |scala> def b = depp - |<console>:11: warning: method depp is deprecated: Please don't do that. - | def b = depp - | ^ - |b: String - | - |scala> :quit""" +"""| + |scala> @deprecated(message="Please don't do that.", since="Time began.") def depp = "john" + |depp: String + | + |scala> def a = depp + |warning: there was one deprecation warning; re-run with -deprecation for details + |a: String + | + |scala> :settings -deprecation + | + |scala> def b = depp + |<console>:11: warning: method depp is deprecated: Please don't do that. + | def b = depp + | ^ + |b: String + | + |scala> :quit""" } diff --git a/test/files/run/t4671.check b/test/files/run/t4671.check index 1640dac8e4..b267befee9 100644 --- a/test/files/run/t4671.check +++ b/test/files/run/t4671.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> object o { val file = sys.props("partest.cwd") + "/t4671.scala" } defined object o diff --git a/test/files/run/t4710.check b/test/files/run/t4710.check index 0dd49dfbd3..5f90c68ed1 100644 --- a/test/files/run/t4710.check +++ b/test/files/run/t4710.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> def method : String = { implicit def f(s: Symbol) = "" ; 'symbol } warning: there was one feature warning; re-run with -feature for details diff --git a/test/files/run/t4935.flags b/test/files/run/t4935.flags index 49d036a887..b9bb09167e 100644 --- a/test/files/run/t4935.flags +++ b/test/files/run/t4935.flags @@ -1 +1 @@ --optimize +-optimize -Ybackend:GenASM diff --git a/test/files/run/t4950.check b/test/files/run/t4950.check index 3f3a302b62..8994441163 100644 --- a/test/files/run/t4950.check +++ b/test/files/run/t4950.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> val 1 = 2 scala.MatchError: 2 (of class java.lang.Integer) diff --git a/test/files/run/t5072.check b/test/files/run/t5072.check index ab34e49869..586c0a6004 100644 --- a/test/files/run/t5072.check +++ b/test/files/run/t5072.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> class C defined class C diff --git a/test/files/run/t5256d.check b/test/files/run/t5256d.check index c2b49989ab..3cdcb577b0 100644 --- a/test/files/run/t5256d.check +++ b/test/files/run/t5256d.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> import scala.reflect.runtime.universe._ import scala.reflect.runtime.universe._ diff --git a/test/files/run/t5535.check b/test/files/run/t5535.check index 84097ccea9..11d298c602 100644 --- a/test/files/run/t5535.check +++ b/test/files/run/t5535.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> def h()(i: Int) = 1 + i h: ()(i: Int)Int diff --git a/test/files/run/t5537.check b/test/files/run/t5537.check index 98265ccc92..bffa02f334 100644 --- a/test/files/run/t5537.check +++ b/test/files/run/t5537.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> List[Predef.type]() res0: List[scala.Predef.type] = List() diff --git a/test/files/run/t5583.check b/test/files/run/t5583.check index 32d285cbb3..72ad898e90 100644 --- a/test/files/run/t5583.check +++ b/test/files/run/t5583.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> var s = 0 s: Int = 0 diff --git a/test/files/run/t5655.check b/test/files/run/t5655.check index e8375c3e90..857a5ab556 100644 --- a/test/files/run/t5655.check +++ b/test/files/run/t5655.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> object x { def x={} } defined object x diff --git a/test/files/run/t5789.check b/test/files/run/t5789.check index 193abfaff0..d286922acc 100644 --- a/test/files/run/t5789.check +++ b/test/files/run/t5789.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> val n = 2 n: Int = 2 diff --git a/test/files/run/t5789.scala b/test/files/run/t5789.scala index 2903dada48..c8d95f2153 100644 --- a/test/files/run/t5789.scala +++ b/test/files/run/t5789.scala @@ -5,7 +5,7 @@ import scala.tools.partest.ReplTest object Test extends ReplTest { - override def extraSettings = "-Yinline" + override def extraSettings = "-Yinline -Ybackend:GenASM" def code = """ val n = 2 () => n diff --git a/test/files/run/t6086-repl.check b/test/files/run/t6086-repl.check index b904f118e8..f022e841cd 100644 --- a/test/files/run/t6086-repl.check +++ b/test/files/run/t6086-repl.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> case class X(s: String) defined class X diff --git a/test/files/run/t6102.check b/test/files/run/t6102.check index 395864f57c..ce01362503 100644 --- a/test/files/run/t6102.check +++ b/test/files/run/t6102.check @@ -1,37 +1 @@ -[running phase parser on t6102.scala] -[running phase namer on t6102.scala] -[running phase packageobjects on t6102.scala] -[running phase typer on t6102.scala] -[running phase patmat on t6102.scala] -[running phase superaccessors on t6102.scala] -[running phase extmethods on t6102.scala] -[running phase pickler on t6102.scala] -[running phase refchecks on t6102.scala] -[running phase uncurry on t6102.scala] -[running phase tailcalls on t6102.scala] -[running phase specialize on t6102.scala] -[running phase explicitouter on t6102.scala] -[running phase erasure on t6102.scala] -[running phase posterasure on t6102.scala] -[running phase lazyvals on t6102.scala] -[running phase lambdalift on t6102.scala] -[running phase constructors on t6102.scala] -[running phase flatten on t6102.scala] -[running phase mixin on t6102.scala] -[running phase cleanup on t6102.scala] -[running phase delambdafy on t6102.scala] -[running phase icode on t6102.scala] -#partest -optimise -[running phase inliner on t6102.scala] -[running phase inlinehandlers on t6102.scala] -[running phase closelim on t6102.scala] -[running phase constopt on t6102.scala] -#partest -[running phase dce on t6102.scala] -#partest -Ybackend:GenASM -[running phase jvm on icode] -#partest !-Ybackend:GenASM -[running phase jvm on t6102.scala] -[running phase jvm on t6102.scala] -#partest hello diff --git a/test/files/run/t6102.flags b/test/files/run/t6102.flags index 726e2a997f..db58cf3b4c 100644 --- a/test/files/run/t6102.flags +++ b/test/files/run/t6102.flags @@ -1 +1 @@ --Ydead-code -Ydebug -Xfatal-warnings +-Yopt:l:classpath -Xfatal-warnings diff --git a/test/files/run/t6146b.check b/test/files/run/t6146b.check index 6998873fb7..0e0c216cd7 100644 --- a/test/files/run/t6146b.check +++ b/test/files/run/t6146b.check @@ -2,8 +2,6 @@ t6146b.scala:15: warning: match may not be exhaustive. It would fail on the following inputs: S2(), S3() def foo(f: F[Int]) = f match { case X.S1 => } ^ -Type in expressions to have them evaluated. -Type :help for more information. scala> :power ** Power User mode enabled - BEEP WHIR GYVE ** diff --git a/test/files/run/t6187.check b/test/files/run/t6187.check index 9a9e266ec6..28bc7e34b6 100644 --- a/test/files/run/t6187.check +++ b/test/files/run/t6187.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> import scala.language.experimental.macros, scala.reflect.macros.blackbox.Context import scala.language.experimental.macros diff --git a/test/files/run/t6188.flags b/test/files/run/t6188.flags index 0ebca3e7af..b9bb09167e 100644 --- a/test/files/run/t6188.flags +++ b/test/files/run/t6188.flags @@ -1 +1 @@ - -optimize +-optimize -Ybackend:GenASM diff --git a/test/files/run/t6273.check b/test/files/run/t6273.check index 3b682800df..6190ff254e 100644 --- a/test/files/run/t6273.check +++ b/test/files/run/t6273.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> val y = 55 y: Int = 55 diff --git a/test/files/run/t6320.check b/test/files/run/t6320.check index af7c865690..08ef7fc211 100644 --- a/test/files/run/t6320.check +++ b/test/files/run/t6320.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> import scala.language.dynamics import scala.language.dynamics diff --git a/test/files/run/t6329_repl.check b/test/files/run/t6329_repl.check index ebb1aace7c..8909c47e79 100644 --- a/test/files/run/t6329_repl.check +++ b/test/files/run/t6329_repl.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> import scala.reflect.classTag import scala.reflect.classTag diff --git a/test/files/run/t6329_repl_bug.check b/test/files/run/t6329_repl_bug.check index 84297a629f..4b539f9e58 100644 --- a/test/files/run/t6329_repl_bug.check +++ b/test/files/run/t6329_repl_bug.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> import scala.reflect.runtime.universe._ import scala.reflect.runtime.universe._ diff --git a/test/files/run/t6381.check b/test/files/run/t6381.check index 49c6a784ad..c66eb4c376 100644 --- a/test/files/run/t6381.check +++ b/test/files/run/t6381.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> import scala.language.experimental.macros import scala.language.experimental.macros diff --git a/test/files/run/t6434.check b/test/files/run/t6434.check index 0a75ae2bd5..1f123ee9cd 100644 --- a/test/files/run/t6434.check +++ b/test/files/run/t6434.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> def f(x: => Int): Int = x f: (x: => Int)Int diff --git a/test/files/run/t6439.check b/test/files/run/t6439.check index c4b7591069..eee2da1b12 100644 --- a/test/files/run/t6439.check +++ b/test/files/run/t6439.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> class A defined class A diff --git a/test/files/run/t6440b.scala b/test/files/run/t6440b.scala index 974aca2844..7ab9529ccb 100644 --- a/test/files/run/t6440b.scala +++ b/test/files/run/t6440b.scala @@ -35,7 +35,7 @@ object Test extends StoreReporterDirectTest { def app2 = """ package pack3 object Test { - pack2.V.u.t // we have to fail if T.class is misisng + pack2.V.u.t // we have to fail if T.class is missing } """ diff --git a/test/files/run/t6502.scala b/test/files/run/t6502.scala index d6b15a0189..f4fc39a03d 100644 --- a/test/files/run/t6502.scala +++ b/test/files/run/t6502.scala @@ -1,11 +1,14 @@ import scala.tools.nsc.Settings -import scala.tools.nsc.interpreter.ILoop +import scala.tools.nsc.interpreter.{ ILoop, replProps } import scala.tools.nsc.settings.ClassPathRepresentationType import scala.tools.partest._ object Test extends StoreReporterDirectTest { def code = ??? + lazy val headerLength = replProps.welcome.lines.size + lazy val promptLength = replProps.prompt.lines.size - 1 // extra newlines + def compileCode(code: String, jarFileName: String) = { val classpath = List(sys.props("partest.lib"), testOutput.path) mkString sys.props("path.separator") compileString(newCompiler("-cp", classpath, "-d", s"${testOutput.path}/$jarFileName"))(code) @@ -56,14 +59,21 @@ object Test extends StoreReporterDirectTest { val jar = "test1.jar" compileCode(app1, jar) - val codeToRun = toCodeInSeparateLines(s":require ${testOutput.path}/$jar", "test.Test.test()") + val codeToRun = s""" + |:require ${testOutput.path}/$jar + |test.Test.test() + |""".stripMargin.trim val output = ILoop.run(codeToRun, settings) - val lines = output.split("\n") - assert { - lines(4).contains("Added") && lines(4).contains("test1.jar") - } + var lines = output.lines.drop(headerLength) + lines = lines drop promptLength + val added = lines.next + assert ( + added.contains("Added") && added.contains("test1.jar"), + s"[${added}] in [${output.lines.mkString("/")}]" + ) + lines = lines drop promptLength assert { - lines(lines.length-3).contains("testing...") + lines.next.contains("testing...") } } @@ -73,14 +83,21 @@ object Test extends StoreReporterDirectTest { val jar2 = "test2.jar" compileCode(app2, jar2) - val codeToRun = toCodeInSeparateLines(s":require ${testOutput.path}/$jar1", s":require ${testOutput.path}/$jar2") + val codeToRun = s""" + |:require ${testOutput.path}/$jar1 + |:require ${testOutput.path}/$jar2 + |""".stripMargin.trim val output = ILoop.run(codeToRun, settings) - val lines = output.split("\n") + var lines = output.lines.drop(headerLength) + lines = lines drop promptLength + val added = lines.next assert { - lines(4).contains("Added") && lines(4).contains("test1.jar") + added.contains("Added") && added.contains("test1.jar") } + lines = lines drop promptLength + val msg = lines.next assert { - lines(lines.length-3).contains("test2.jar") && lines(lines.length-3).contains("existing classpath entries conflict") + msg.contains("test2.jar") && msg.contains("existing classpath entries conflict") } } @@ -90,28 +107,42 @@ object Test extends StoreReporterDirectTest { val jar3 = "test3.jar" compileCode(app3, jar3) - val codeToRun = toCodeInSeparateLines(s":require ${testOutput.path}/$jar1", s":require ${testOutput.path}/$jar3", "test.Test3.test()") + val codeToRun = s""" + |:require ${testOutput.path}/$jar1 + |:require ${testOutput.path}/$jar3 + |test.Test3.test() + |""".stripMargin.trim val output = ILoop.run(codeToRun, settings) - val lines = output.split("\n") + var lines = output.lines.drop(headerLength) + lines = lines drop promptLength + val added = lines.next assert { - lines(4).contains("Added") && lines(4).contains("test1.jar") + added.contains("Added") && added.contains("test1.jar") } + lines = lines drop (2 * promptLength + 1) assert { - lines(lines.length-3).contains("new object in existing package") + lines.next.contains("new object in existing package") } } def test4(): Unit = { // twice the same jar should be rejected val jar1 = "test1.jar" - val codeToRun = toCodeInSeparateLines(s":require ${testOutput.path}/$jar1", s":require ${testOutput.path}/$jar1") + val codeToRun = s""" + |:require ${testOutput.path}/$jar1 + |:require ${testOutput.path}/$jar1 + |""".stripMargin.trim val output = ILoop.run(codeToRun, settings) - val lines = output.split("\n") + var lines = output.lines.drop(headerLength) + lines = lines drop promptLength + val added = lines.next assert { - lines(4).contains("Added") && lines(4).contains("test1.jar") + added.contains("Added") && added.contains("test1.jar") } + lines = lines drop promptLength + val msg = lines.next assert { - lines(lines.length-3).contains("test1.jar") && lines(lines.length-3).contains("existing classpath entries conflict") + msg.contains("test1.jar") && msg.contains("existing classpath entries conflict") } } @@ -127,7 +158,10 @@ object Test extends StoreReporterDirectTest { // classloader to parse .class files in order to read their names. val jar = "test6.jar" compileCode(app6, jar) - val codeToRun = toCodeInSeparateLines(s":require ${testOutput.path}/$jar", "import test6._; new A; new Z") + val codeToRun = s""" + |:require ${testOutput.path}/$jar + |import test6._; new A; new Z + |""".stripMargin.trim val output = ILoop.run(codeToRun, settings) assert(output.contains("created test6.A"), output) assert(output.contains("created test6.Z"), output) @@ -141,6 +175,4 @@ object Test extends StoreReporterDirectTest { test5() test6() } - - def toCodeInSeparateLines(lines: String*): String = lines mkString "\n" } diff --git a/test/files/run/t6507.check b/test/files/run/t6507.check index 5da4aa3a24..75cf392304 100644 --- a/test/files/run/t6507.check +++ b/test/files/run/t6507.check @@ -1,8 +1,5 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> :silent -Switched off result printing. scala> class A { override def toString() = { println("!"); "A" } } @@ -15,7 +12,6 @@ scala> b = new A scala> new A scala> :silent -Switched on result printing. scala> res0 ! diff --git a/test/files/run/t6549.check b/test/files/run/t6549.check index be3445927e..00203d5cc7 100644 --- a/test/files/run/t6549.check +++ b/test/files/run/t6549.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> case class `X"`(var xxx: Any) defined class X$u0022 diff --git a/test/files/run/t6937.check b/test/files/run/t6937.check index 5c5d4485b6..b7b2f45385 100644 --- a/test/files/run/t6937.check +++ b/test/files/run/t6937.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> import scala.reflect.runtime.{universe => ru} import scala.reflect.runtime.{universe=>ru} diff --git a/test/files/run/t7185.check b/test/files/run/t7185.check index e4f80a8ff9..6b7fbaf0b1 100644 --- a/test/files/run/t7185.check +++ b/test/files/run/t7185.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> import scala.tools.reflect.ToolBox import scala.tools.reflect.ToolBox diff --git a/test/files/run/t7319.check b/test/files/run/t7319.check index 885136b432..31923e7119 100644 --- a/test/files/run/t7319.check +++ b/test/files/run/t7319.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> class M[A] defined class M diff --git a/test/files/run/t7459b-optimize.flags b/test/files/run/t7459b-optimize.flags index 49d036a887..b9bb09167e 100644 --- a/test/files/run/t7459b-optimize.flags +++ b/test/files/run/t7459b-optimize.flags @@ -1 +1 @@ --optimize +-optimize -Ybackend:GenASM diff --git a/test/files/run/t7482a.check b/test/files/run/t7482a.check index a21ef7b68f..1120bb0271 100644 --- a/test/files/run/t7482a.check +++ b/test/files/run/t7482a.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> val v: java.util.ArrayList[String] = new java.util.ArrayList[String](5) v: java.util.ArrayList[String] = [] diff --git a/test/files/run/t7582.flags b/test/files/run/t7582.flags index 1182725e86..2cd4b38726 100644 --- a/test/files/run/t7582.flags +++ b/test/files/run/t7582.flags @@ -1 +1 @@ --optimize
\ No newline at end of file +-optimize -Ybackend:GenASM
\ No newline at end of file diff --git a/test/files/run/t7582b.flags b/test/files/run/t7582b.flags index 1182725e86..2cd4b38726 100644 --- a/test/files/run/t7582b.flags +++ b/test/files/run/t7582b.flags @@ -1 +1 @@ --optimize
\ No newline at end of file +-optimize -Ybackend:GenASM
\ No newline at end of file diff --git a/test/files/run/t7634.check b/test/files/run/t7634.check index 9c6b8b47dd..879aea67a2 100644 --- a/test/files/run/t7634.check +++ b/test/files/run/t7634.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> .lines diff --git a/test/files/run/t7747-repl.check b/test/files/run/t7747-repl.check index 98e3d3b821..f19c39e7e1 100644 --- a/test/files/run/t7747-repl.check +++ b/test/files/run/t7747-repl.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> var x = 10 x: Int = 10 diff --git a/test/files/run/t7801.check b/test/files/run/t7801.check index e0b656b784..4ec89f0de6 100644 --- a/test/files/run/t7801.check +++ b/test/files/run/t7801.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> val g: scala.reflect.internal.SymbolTable = null; import g.abort g: scala.reflect.internal.SymbolTable = null diff --git a/test/files/run/t7805-repl-i.check b/test/files/run/t7805-repl-i.check index 7f66c06a11..24512c0067 100644 --- a/test/files/run/t7805-repl-i.check +++ b/test/files/run/t7805-repl-i.check @@ -2,8 +2,7 @@ Loading t7805-repl-i.script... import util._ Welcome to Scala -Type in expressions to have them evaluated. -Type :help for more information. +Type in expressions for evaluation. Or try :help. scala> Console println Try(8) Success(8) diff --git a/test/files/run/t8010.scala b/test/files/run/t8010.scala index 8636bbd12e..c78d45a43b 100644 --- a/test/files/run/t8010.scala +++ b/test/files/run/t8010.scala @@ -5,7 +5,7 @@ trait Base { def bt(n: Int) = n } trait Derived extends Base { - // was: double defintion error + // was: double definition error override def t = 1 + super.t override def t(n: Int) = 1 + super.t(n) override def bt = 1 + super.bt @@ -14,7 +14,7 @@ trait Derived extends Base { object Test extends App { val d = new Derived {} - // not the focus of thie bug, but let's just check the runtime behaviour while we're here. + // not the focus of this bug, but let's just check the runtime behaviour while we're here. assert(d.t == 2) assert(d.t(1) == 2) assert(d.bt == 3) diff --git a/test/files/run/t8601.flags b/test/files/run/t8601.flags index 1182725e86..2cd4b38726 100644 --- a/test/files/run/t8601.flags +++ b/test/files/run/t8601.flags @@ -1 +1 @@ --optimize
\ No newline at end of file +-optimize -Ybackend:GenASM
\ No newline at end of file diff --git a/test/files/run/t8601b.flags b/test/files/run/t8601b.flags index 1182725e86..2cd4b38726 100644 --- a/test/files/run/t8601b.flags +++ b/test/files/run/t8601b.flags @@ -1 +1 @@ --optimize
\ No newline at end of file +-optimize -Ybackend:GenASM
\ No newline at end of file diff --git a/test/files/run/t8601c.flags b/test/files/run/t8601c.flags index 1182725e86..2cd4b38726 100644 --- a/test/files/run/t8601c.flags +++ b/test/files/run/t8601c.flags @@ -1 +1 @@ --optimize
\ No newline at end of file +-optimize -Ybackend:GenASM
\ No newline at end of file diff --git a/test/files/run/t8601d.flags b/test/files/run/t8601d.flags index 1182725e86..2cd4b38726 100644 --- a/test/files/run/t8601d.flags +++ b/test/files/run/t8601d.flags @@ -1 +1 @@ --optimize
\ No newline at end of file +-optimize -Ybackend:GenASM
\ No newline at end of file diff --git a/test/files/run/t8601e.flags b/test/files/run/t8601e.flags index 49d036a887..b9bb09167e 100644 --- a/test/files/run/t8601e.flags +++ b/test/files/run/t8601e.flags @@ -1 +1 @@ --optimize +-optimize -Ybackend:GenASM diff --git a/test/files/run/t8843-repl-xlat.scala b/test/files/run/t8843-repl-xlat.scala index 6426dbe7d4..215dd97061 100644 --- a/test/files/run/t8843-repl-xlat.scala +++ b/test/files/run/t8843-repl-xlat.scala @@ -4,9 +4,7 @@ import scala.tools.partest.SessionTest // Handy hamburger helper for repl resources object Test extends SessionTest { def session = -"""Type in expressions to have them evaluated. -Type :help for more information. - +""" scala> $intp.isettings.unwrapStrings = false $intp.isettings.unwrapStrings: Boolean = false diff --git a/test/files/run/t8893b.scala b/test/files/run/t8893b.scala index 19120871aa..066425aab6 100644 --- a/test/files/run/t8893b.scala +++ b/test/files/run/t8893b.scala @@ -5,7 +5,7 @@ object Test { def tick(i : Int): Unit = if (i == 0) () else if (i == 42) { - tick(0) /*not in tail posiiton*/ + tick(0) /*not in tail position*/ tick(i - 1) } else tick(i - 1) diff --git a/test/files/run/t8918-unary-ids.check b/test/files/run/t8918-unary-ids.check new file mode 100644 index 0000000000..92f02371c7 --- /dev/null +++ b/test/files/run/t8918-unary-ids.check @@ -0,0 +1,7 @@ +Expected 41 lines, got 39 +--- expected ++++ actual +@@ -1,3 +1,1 @@ +-Type in expressions to have them evaluated. +-Type :help for more information. + diff --git a/test/files/run/t9003.flags b/test/files/run/t9003.flags index 49d036a887..b9bb09167e 100644 --- a/test/files/run/t9003.flags +++ b/test/files/run/t9003.flags @@ -1 +1 @@ --optimize +-optimize -Ybackend:GenASM diff --git a/test/files/run/t9170.scala b/test/files/run/t9170.scala index 67a58d6803..d6cf516615 100644 --- a/test/files/run/t9170.scala +++ b/test/files/run/t9170.scala @@ -6,9 +6,7 @@ object Test extends SessionTest { override def stripMargins = false def session = -"""Type in expressions to have them evaluated. -Type :help for more information. - +""" scala> object Y { def f[A](a: => A) = 1 ; def f[A](a: => Either[Exception, A]) = 2 } <console>:10: error: double definition: def f[A](a: => A): Int at line 10 and diff --git a/test/files/run/t9174.check b/test/files/run/t9174.check index 9320a081ff..14d6bc10db 100644 --- a/test/files/run/t9174.check +++ b/test/files/run/t9174.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> import scala.util.{Success, Failure} import scala.util.{Success, Failure} diff --git a/test/files/run/t9206.scala b/test/files/run/t9206.scala index 2942d0f73e..872c980fe4 100644 --- a/test/files/run/t9206.scala +++ b/test/files/run/t9206.scala @@ -5,9 +5,7 @@ object Test extends SessionTest { //override def prompt = "XXX> " //Welcome to Scala version 2.11.6 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_40). def session = - s"""|Type in expressions to have them evaluated. - |Type :help for more information. - | + s"""| |scala> val i: Int = "foo" |<console>:10: error: type mismatch; | found : String("foo") diff --git a/test/files/run/t9387.scala b/test/files/run/t9387.scala new file mode 100644 index 0000000000..3e33d19fd2 --- /dev/null +++ b/test/files/run/t9387.scala @@ -0,0 +1,20 @@ +class G[T] +object G { + def v[T](x: T): G[T] = null +} + +class A[T] +object A { + def apply[T](x: => G[T]): A[T] = null +} + +object T { + A[Unit](G.v(() => ())) // Was VerifyError +} + +object Test { + def main(args: Array[String]): Unit = { + T + } + +}
\ No newline at end of file diff --git a/test/files/run/t9387b.check b/test/files/run/t9387b.check new file mode 100644 index 0000000000..6a452c185a --- /dev/null +++ b/test/files/run/t9387b.check @@ -0,0 +1 @@ +() diff --git a/test/files/run/t9387b.scala b/test/files/run/t9387b.scala new file mode 100644 index 0000000000..6339f4caba --- /dev/null +++ b/test/files/run/t9387b.scala @@ -0,0 +1,16 @@ +object T { + val f: Unit = () => () + println(f) +} + +object U { + def f[T](t: T): T = t + f[Unit](() => ()) +} + +object Test { + def main(args: Array[String]): Unit = { + T + U + } +} diff --git a/test/files/run/tpeCache-tyconCache.check b/test/files/run/tpeCache-tyconCache.check index ff604819e0..ac13d32f91 100644 --- a/test/files/run/tpeCache-tyconCache.check +++ b/test/files/run/tpeCache-tyconCache.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> :power ** Power User mode enabled - BEEP WHIR GYVE ** diff --git a/test/files/run/xMigration.check b/test/files/run/xMigration.check index 304132a848..79ce544493 100644 --- a/test/files/run/xMigration.check +++ b/test/files/run/xMigration.check @@ -1,5 +1,3 @@ -Type in expressions to have them evaluated. -Type :help for more information. scala> Map(1 -> "eis").values // no warn res0: Iterable[String] = MapLike(eis) diff --git a/test/files/scalacheck/quasiquotes/ArbitraryTreesAndNames.scala b/test/files/scalacheck/quasiquotes/ArbitraryTreesAndNames.scala index 7bd37140a7..ab1056dd86 100644 --- a/test/files/scalacheck/quasiquotes/ArbitraryTreesAndNames.scala +++ b/test/files/scalacheck/quasiquotes/ArbitraryTreesAndNames.scala @@ -250,8 +250,8 @@ trait ArbitraryTreesAndNames { genAppliedTypeTree(size - 1), genTypeBoundsTree(size - 1)) /* These are marker types that allow to write tests that - * depend specificly on Trees that are terms or types. - * They are transparently tranformed to trees through + * depend specifically on Trees that are terms or types. + * They are transparently transformed to trees through * implicit conversions and liftables for quasiquotes. */ diff --git a/test/files/scalacheck/quasiquotes/DefinitionConstructionProps.scala b/test/files/scalacheck/quasiquotes/DefinitionConstructionProps.scala index fd810674f5..4ab8bb8531 100644 --- a/test/files/scalacheck/quasiquotes/DefinitionConstructionProps.scala +++ b/test/files/scalacheck/quasiquotes/DefinitionConstructionProps.scala @@ -346,7 +346,7 @@ trait MethodConstruction { self: QuasiquoteProperties => } } - property("can't unquote annotations with arguments specificed twice") = test { + property("can't unquote annotations with arguments specified twice") = test { val a = q"new a(x)" assertThrows[IllegalArgumentException] { q"@$a(y) def foo" @@ -370,7 +370,7 @@ trait PackageConstruction { self: QuasiquoteProperties => assertEqAst(q"package $name { }", "package foo.bar { }") } - property("splce name into package name") = test{ + property("splice name into package name") = test{ val name = TermName("bippy") assertEqAst(q"package $name { }", "package bippy { }") } diff --git a/test/files/scalacheck/quasiquotes/ErrorProps.scala b/test/files/scalacheck/quasiquotes/ErrorProps.scala index 2cba07abf2..0c24149372 100644 --- a/test/files/scalacheck/quasiquotes/ErrorProps.scala +++ b/test/files/scalacheck/quasiquotes/ErrorProps.scala @@ -162,7 +162,7 @@ object ErrorProps extends QuasiquoteProperties("errors") { q"$n" """) - property("SI-8211: check unbound placeholder paremeters") = fails( + property("SI-8211: check unbound placeholder parameters") = fails( "unbound placeholder parameter", """ q"_" |