diff options
Diffstat (limited to 'test/files')
68 files changed, 414 insertions, 218 deletions
diff --git a/test/files/jvm/interpreter.check b/test/files/jvm/interpreter.check index d03edb638c..9e875235c7 100644 --- a/test/files/jvm/interpreter.check +++ b/test/files/jvm/interpreter.check @@ -32,7 +32,7 @@ scala> val four: anotherint = 4 four: anotherint = 4 scala> val bogus: anotherint = "hello" -<console>:8: error: type mismatch; +<console>:11: error: type mismatch; found : String("hello") required: anotherint (which expands to) Int @@ -280,13 +280,13 @@ scala> // both of the following should abort immediately: scala> def x => y => z <console>:1: error: '=' expected but '=>' found. - def x => y => z - ^ +def x => y => z + ^ scala> [1,2,3] <console>:1: error: illegal start of definition - [1,2,3] - ^ +[1,2,3] +^ scala> @@ -355,7 +355,7 @@ defined class Term scala> def f(e: Exp) = e match { // non-exhaustive warning here case _:Fact => 3 } -<console>:18: warning: match may not be exhaustive. +<console>:21: warning: match may not be exhaustive. It would fail on the following inputs: Exp(), Term() def f(e: Exp) = e match { // non-exhaustive warning here ^ @@ -365,6 +365,6 @@ scala> :quit plusOne: (x: Int)Int res0: Int = 6 res0: String = after reset -<console>:8: error: not found: value plusOne - plusOne(5) // should be undefined now - ^ +<console>:11: error: not found: value plusOne + plusOne(5) // should be undefined now + ^ diff --git a/test/files/jvm/javaReflection/Test.scala b/test/files/jvm/javaReflection/Test.scala index ae5a36eeb2..199399fec8 100644 --- a/test/files/jvm/javaReflection/Test.scala +++ b/test/files/jvm/javaReflection/Test.scala @@ -31,7 +31,7 @@ getSimpleName / getCanonicalName / isAnonymousClass / isLocalClass / isSynthetic These should be avoided, they yield unexpected results: - isAnonymousClass is always false. Scala-defined classes are never anonymous for Java - reflection. Java reflection insepects the class name to decide whether a class is + reflection. Java reflection inspects the class name to decide whether a class is anonymous, based on the name spec referenced above. Also, the implementation of "isAnonymousClass" calls "getSimpleName", which may throw. diff --git a/test/files/jvm/protectedacc.scala b/test/files/jvm/protectedacc.scala index 89e70b90d8..43d218fa89 100644 --- a/test/files/jvm/protectedacc.scala +++ b/test/files/jvm/protectedacc.scala @@ -74,7 +74,7 @@ package p { package b { import a._; - /** Test interraction with Scala inherited methods and currying. */ + /** Test interaction with Scala inherited methods and currying. */ class B extends A { class C { def m = { diff --git a/test/files/jvm/unreachable/Test.scala b/test/files/jvm/unreachable/Test.scala index 3f520eb106..4c0fcb2ae8 100644 --- a/test/files/jvm/unreachable/Test.scala +++ b/test/files/jvm/unreachable/Test.scala @@ -6,7 +6,7 @@ import scala.collection.JavaConverters._ object Test extends BytecodeTest { def show: Unit = { val classNode = loadClassNode("Foo_1") - // Foo_1 is full of unreachable code which if not elimintated + // Foo_1 is full of unreachable code which if not eliminated // will result in NOPs as can be confirmed by adding -Ydisable-unreachable-prevention // to Foo_1.flags for (methodNode <- classNode.methods.asScala) { 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/t3995.scala b/test/files/neg/t3995.scala index b03617ac86..c79f2a5865 100644 --- a/test/files/neg/t3995.scala +++ b/test/files/neg/t3995.scala @@ -27,6 +27,6 @@ object Test { // can be accessed with unambiguous stable prefixes, the implicits infos // which are members of these companion objects." // - // The skolem is stable, but it doen't seem much good to us + // The skolem is stable, but it does not seem much good to us (new Lift).apply("") } diff --git a/test/files/neg/t5120.scala b/test/files/neg/t5120.scala index f28b2cfb4f..0df67bc09b 100644 --- a/test/files/neg/t5120.scala +++ b/test/files/neg/t5120.scala @@ -12,7 +12,7 @@ object Test { str.x1.length } } -// another way demonstrating the same underlying problem, as reported by roman kalukiewicz +// another way demonstrating the same underlying problem, as reported by Roman Kalukiewicz class Holder[_T](_f1 : _T, _f2 : _T) { type T = _T diff --git a/test/files/neg/t8237-default.scala b/test/files/neg/t8237-default.scala index f695aa523f..a4370046bd 100644 --- a/test/files/neg/t8237-default.scala +++ b/test/files/neg/t8237-default.scala @@ -1,4 +1,4 @@ -// This test case was extracte from `names-defaults-neg.scala` +// This test case was extracted from `names-defaults-neg.scala` // It pinpoints an improvement an error message that results from // a type inference failure object Test extends App { 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/t8431.scala b/test/files/neg/t8431.scala index 032a1f394d..bc45bb62ae 100644 --- a/test/files/neg/t8431.scala +++ b/test/files/neg/t8431.scala @@ -48,7 +48,7 @@ class TestExplicit { {val c1 = convert2(s); c1.combined} } -// These ones work before and after; infering G=Null doesn't need to contribute an undetermined type param. +// These ones work before and after; inferring G=Null doesn't need to contribute an undetermined type param. class Test3 { import C.{cbf, convert1, convert2} val s: Invariant[Null] = ??? diff --git a/test/files/neg/t8463.scala b/test/files/neg/t8463.scala index 7c954fd834..1337f8bece 100644 --- a/test/files/neg/t8463.scala +++ b/test/files/neg/t8463.scala @@ -7,7 +7,7 @@ object Test { /* If SI-8230 is fixed, and `viewExists` is changed to no longer leak ambiguity errors, you might expect the check file for this test to - change as folloes: + change as follows: @@ -1,18 +1,10 @@ -t8463.scala:5: error: no type parameters for method apply: (activity: 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/SI-4012-b.scala b/test/files/pos/SI-4012-b.scala index 6bc8592766..f6d84963e4 100644 --- a/test/files/pos/SI-4012-b.scala +++ b/test/files/pos/SI-4012-b.scala @@ -6,7 +6,7 @@ object Sub extends Super[Int] { // it is expected that super[Super].superb crashes, since // specialization does parent class rewiring, and the super // of Sub becomes Super$mcII$sp and not Super. But I consider - // this normal behavior -- if you want, I can modify duplicatiors + // this normal behavior -- if you want, I can modify duplicators // to make this work, but I consider it's best to keep this // let the user know Super is not the superclass anymore. // super[Super].superb - Vlad diff --git a/test/files/pos/delambdafy-patterns.scala b/test/files/pos/delambdafy-patterns.scala index 95d498629b..ca9eaa67e3 100644 --- a/test/files/pos/delambdafy-patterns.scala +++ b/test/files/pos/delambdafy-patterns.scala @@ -2,7 +2,7 @@ class DelambdafyPatterns { def bar: Unit = () def wildcardPatternInTryCatch: Unit => Unit = (x: Unit) => // patterns in try..catch are preserved so we need to be - // careful when it comes to free variable detction + // careful when it comes to free variable detection // in particular a is _not_ free variable, also the // `_` identifier has no symbol attached to it try bar catch { diff --git a/test/files/pos/t7200b.scala b/test/files/pos/t7200b.scala index 9d579c6ef9..59be898fd0 100644 --- a/test/files/pos/t7200b.scala +++ b/test/files/pos/t7200b.scala @@ -10,7 +10,7 @@ trait Foo { object O extends Foo { def coflatMap[A <: T](f: A) = { val f2 = coflatMap(f) // inferred in 2.9.2 / 2.10.0 as [Nothing] - f2.t // so this does't type check. + f2.t // so this fails to type check. f2 } } diff --git a/test/files/pos/t8947/Macro_1.scala b/test/files/pos/t8947/Macro_1.scala index 4a5de3decb..ace389f339 100644 --- a/test/files/pos/t8947/Macro_1.scala +++ b/test/files/pos/t8947/Macro_1.scala @@ -35,7 +35,7 @@ object X { // symtab.EmptyTree.setAttachments(symtab.NoPosition) // } // - // To make this visible to the macro implementaiton, it will need to be compiled in an earlier stage, + // To make this visible to the macro implementation, it will need to be compiled in an earlier stage, // e.g a separate SBT sub-project. } 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.check b/test/files/run/blame_eye_triple_eee-double.check index 5e46d91a8f..53eac99ecd 100644 --- a/test/files/run/blame_eye_triple_eee-double.check +++ b/test/files/run/blame_eye_triple_eee-double.check @@ -6,4 +6,4 @@ if (x != x) is good if (NaN != x) is good x matching was good NaN matching was good -loop with NaN was goood +loop with NaN was good diff --git a/test/files/run/blame_eye_triple_eee-double.scala b/test/files/run/blame_eye_triple_eee-double.scala index 1640aead40..4dcbfe7a7a 100644 --- a/test/files/run/blame_eye_triple_eee-double.scala +++ b/test/files/run/blame_eye_triple_eee-double.scala @@ -56,6 +56,6 @@ object Test extends App { else z = NaN i += 1 } - if (z.isNaN && i == 10) println("loop with NaN was goood") + if (z.isNaN && i == 10) println("loop with NaN was good") else println("loop with NaN was broken") } diff --git a/test/files/run/blame_eye_triple_eee-float.check b/test/files/run/blame_eye_triple_eee-float.check index 5e46d91a8f..53eac99ecd 100644 --- a/test/files/run/blame_eye_triple_eee-float.check +++ b/test/files/run/blame_eye_triple_eee-float.check @@ -6,4 +6,4 @@ if (x != x) is good if (NaN != x) is good x matching was good NaN matching was good -loop with NaN was goood +loop with NaN was good diff --git a/test/files/run/blame_eye_triple_eee-float.scala b/test/files/run/blame_eye_triple_eee-float.scala index 4deb9f3d60..bcc6b195d5 100644 --- a/test/files/run/blame_eye_triple_eee-float.scala +++ b/test/files/run/blame_eye_triple_eee-float.scala @@ -56,6 +56,6 @@ object Test extends App { else z = NaN i += 1 } - if (z.isNaN && i == 10) println("loop with NaN was goood") + if (z.isNaN && i == 10) println("loop with NaN was good") else println("loop with NaN was broken") } diff --git a/test/files/run/constrained-types.check b/test/files/run/constrained-types.check index 89a08d5ccb..6dbf8088c9 100644 --- a/test/files/run/constrained-types.check +++ b/test/files/run/constrained-types.check @@ -135,16 +135,16 @@ y: String = hello scala> scala> val x = 3 : Int @Annot(e+f+g+h) // should have a graceful error message -<console>:8: error: not found: value e +<console>:11: error: not found: value e val x = 3 : Int @Annot(e+f+g+h) // should have a graceful error message ^ -<console>:8: error: not found: value f +<console>:11: error: not found: value f val x = 3 : Int @Annot(e+f+g+h) // should have a graceful error message ^ -<console>:8: error: not found: value g +<console>:11: error: not found: value g val x = 3 : Int @Annot(e+f+g+h) // should have a graceful error message ^ -<console>:8: error: not found: value h +<console>:11: error: not found: value h val x = 3 : Int @Annot(e+f+g+h) // should have a graceful error message ^ diff --git a/test/files/run/deeps.scala b/test/files/run/deeps.scala index 6049cc6024..1546112ed5 100644 --- a/test/files/run/deeps.scala +++ b/test/files/run/deeps.scala @@ -3,7 +3,7 @@ //############################################################################ //############################################################################ -// need to revisit array equqality +// need to revisit array equality object Test { def testEquals1 { 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 2c01edaaef..467c9e5868 100644 --- a/test/files/run/finally.scala +++ b/test/files/run/finally.scala @@ -93,8 +93,8 @@ object Test extends App { } } - // nested finallies with return value - def nestedFinalies: Int = + // nested finally blocks with return value + 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/iq.scala b/test/files/run/iq.scala index 1eb1d40e37..0ccf67a2e9 100644 --- a/test/files/run/iq.scala +++ b/test/files/run/iq.scala @@ -69,7 +69,7 @@ object iq { val (_, q7) = q6.dequeue //val q8 = q7 + 10 + 11 //deprecated val q8 = q7.enqueue(10).enqueue(11) - /* Test dequeu + /* Test dequeue * Expected: q8: Queue(2,3,4,5,6,7,8,9,10,11) */ Console.println("q8: " + q8) diff --git a/test/files/run/kind-repl-command.check b/test/files/run/kind-repl-command.check index 586b2710e1..1853213555 100644 --- a/test/files/run/kind-repl-command.check +++ b/test/files/run/kind-repl-command.check @@ -21,8 +21,8 @@ scala> :k new { def empty = false } AnyRef{def empty: Boolean}'s kind is A scala> :k Nonexisting -<console>:8: error: not found: value Nonexisting - Nonexisting - ^ +<console>:11: error: not found: value Nonexisting + Nonexisting + ^ scala> :quit diff --git a/test/files/run/names-defaults.scala b/test/files/run/names-defaults.scala index b7ed490cbc..7fb4a04546 100644 --- a/test/files/run/names-defaults.scala +++ b/test/files/run/names-defaults.scala @@ -86,7 +86,7 @@ object Test extends App { def f(a: Object) = "first" val f: String => String = a => "second" } - println(t5.f(new Sub1())) // firsst + println(t5.f(new Sub1())) // first println(t5.f("dfklj")) // second object t6 { @@ -239,7 +239,7 @@ object Test extends App { // result type of default getters: parameter type, except if this one mentions any type // parameter, in which case the result type is inferred. examples: - // result type of default getter is "String => String". if it were infered, the compiler + // result type of default getter is "String => String". if it were inferred, the compiler // would put "Nothing => Nothing", which is useless def transform(s: String, f: String => String = identity _) = f(s) println(transform("my text")) diff --git a/test/files/run/nullable-lazyvals.scala b/test/files/run/nullable-lazyvals.scala index c201e74e75..be5d82f3a7 100644 --- a/test/files/run/nullable-lazyvals.scala +++ b/test/files/run/nullable-lazyvals.scala @@ -24,7 +24,7 @@ object Test extends App { // test that try-finally does not generated a liftedTry // helper. This would already fail the first part of the test, - // but this check will help diganose it (if the single access to a + // but this check will help diagnose it (if the single access to a // private field does not happen directly in the lazy val, it won't // be nulled). for (f <- foo.getClass.getDeclaredMethods) { diff --git a/test/files/run/reify-repl-fail-gracefully.check b/test/files/run/reify-repl-fail-gracefully.check index c9e69744d6..eac4d25869 100644 --- a/test/files/run/reify-repl-fail-gracefully.check +++ b/test/files/run/reify-repl-fail-gracefully.check @@ -10,8 +10,8 @@ import scala.reflect.runtime.universe._ scala> scala> reify -<console>:12: error: too few argument lists for macro invocation - reify - ^ +<console>:15: error: too few argument lists for macro invocation + reify + ^ scala> :quit diff --git a/test/files/run/reify_newimpl_22.check b/test/files/run/reify_newimpl_22.check index 952f384a1c..24334df92c 100644 --- a/test/files/run/reify_newimpl_22.check +++ b/test/files/run/reify_newimpl_22.check @@ -17,9 +17,9 @@ scala> { } println(code.eval) } -<console>:15: free term: Ident(TermName("x")) defined by res0 in <console>:14:21 - val code = reify { - ^ +<console>:18: free term: Ident(TermName("x")) defined by res0 in <console>:17:14 + val code = reify { + ^ 2 scala> :quit diff --git a/test/files/run/reify_newimpl_23.check b/test/files/run/reify_newimpl_23.check index b7e9bfdfbc..f8379958db 100644 --- a/test/files/run/reify_newimpl_23.check +++ b/test/files/run/reify_newimpl_23.check @@ -16,7 +16,7 @@ scala> def foo[T]{ } println(code.eval) } -<console>:13: free type: Ident(TypeName("T")) defined by foo in <console>:12:16 +<console>:16: free type: Ident(TypeName("T")) defined by foo in <console>:15:16 val code = reify { ^ foo: [T]=> Unit diff --git a/test/files/run/reify_newimpl_25.check b/test/files/run/reify_newimpl_25.check index 4f36ba10ee..f9a5d7b578 100644 --- a/test/files/run/reify_newimpl_25.check +++ b/test/files/run/reify_newimpl_25.check @@ -7,9 +7,9 @@ scala> { val tt = implicitly[TypeTag[x.type]] println(tt) } -<console>:11: free term: Ident(TermName("x")) defined by res0 in <console>:10:21 - val tt = implicitly[TypeTag[x.type]] - ^ +<console>:14: free term: Ident(TermName("x")) defined by res0 in <console>:13:14 + val tt = implicitly[TypeTag[x.type]] + ^ TypeTag[x.type] scala> :quit diff --git a/test/files/run/reify_newimpl_26.check b/test/files/run/reify_newimpl_26.check index 681b862795..bd77d3d707 100644 --- a/test/files/run/reify_newimpl_26.check +++ b/test/files/run/reify_newimpl_26.check @@ -6,7 +6,7 @@ scala> def foo[T]{ val tt = implicitly[WeakTypeTag[List[T]]] println(tt) } -<console>:9: free type: Ident(TypeName("T")) defined by foo in <console>:7:16 +<console>:12: free type: Ident(TypeName("T")) defined by foo in <console>:10:16 val tt = implicitly[WeakTypeTag[List[T]]] ^ foo: [T]=> Unit diff --git a/test/files/run/repl-bare-expr.check b/test/files/run/repl-bare-expr.check index 07cf23412f..38ad7e818d 100644 --- a/test/files/run/repl-bare-expr.check +++ b/test/files/run/repl-bare-expr.check @@ -2,33 +2,33 @@ Type in expressions to have them evaluated. Type :help for more information. scala> 2 ; 3 -<console>:7: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses - 2 ;; - ^ +<console>:10: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + 2 ;; + ^ res0: Int = 3 scala> { 2 ; 3 } -<console>:8: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses - { 2 ; 3 } - ^ +<console>:11: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + { 2 ; 3 } + ^ res1: Int = 3 scala> 5 ; 10 ; case object Cow ; 20 ; class Moo { override def toString = "Moooooo" } ; 30 ; def bippy = { 1 + 2 + 3 } ; bippy+88+11 -<console>:7: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses - 5 ; 10 ; case object Cow ; 20 ; class Moo { override def toString = "Moooooo" } ; 30 ; def bippy = { - ^ -<console>:7: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses - 5 ; 10 ; case object Cow ; 20 ; class Moo { override def toString = "Moooooo" } ; 30 ; def bippy = { - ^ -<console>:7: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses - 5 ; 10 ; case object Cow ; 20 ; class Moo { override def toString = "Moooooo" } ; 30 ; def bippy = { - ^ -<console>:7: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses - 5 ; 10 ; case object Cow ; 20 ; class Moo { override def toString = "Moooooo" } ; 30 ; def bippy = { - ^ +<console>:10: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + 5 ; 10 ; case object Cow ; 20 ; class Moo { override def toString = "Moooooo" } ; 30 ; def bippy = { + ^ +<console>:10: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + 5 ; 10 ; case object Cow ; 20 ; class Moo { override def toString = "Moooooo" } ; 30 ; def bippy = { + ^ +<console>:10: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + 5 ; 10 ; case object Cow ; 20 ; class Moo { override def toString = "Moooooo" } ; 30 ; def bippy = { + ^ +<console>:10: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + 5 ; 10 ; case object Cow ; 20 ; class Moo { override def toString = "Moooooo" } ; 30 ; def bippy = { + ^ defined object Cow defined class Moo bippy: Int diff --git a/test/files/run/repl-colon-type.check b/test/files/run/repl-colon-type.check index 9898027c1d..fa33af3beb 100644 --- a/test/files/run/repl-colon-type.check +++ b/test/files/run/repl-colon-type.check @@ -3,8 +3,8 @@ Type :help for more information. scala> :type List[1, 2, 3] <console>:1: error: identifier expected but integer literal found. - List[1, 2, 3] - ^ +List[1, 2, 3] + ^ scala> :type List(1, 2, 3) List[Int] diff --git a/test/files/run/repl-parens.check b/test/files/run/repl-parens.check index 74d15ff93c..756a063b68 100644 --- a/test/files/run/repl-parens.check +++ b/test/files/run/repl-parens.check @@ -20,12 +20,12 @@ scala> ( (2 + 2 ) ) res5: Int = 4 scala> 5 ; ( (2 + 2 ) ) ; ((5)) -<console>:7: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses - 5 ; ( (2 + 2 ) ) ;; - ^ -<console>:7: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses - 5 ; ( (2 + 2 ) ) ;; - ^ +<console>:10: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + 5 ; ( (2 + 2 ) ) ;; + ^ +<console>:10: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + 5 ; ( (2 + 2 ) ) ;; + ^ res6: Int = 5 scala> (((2 + 2)), ((2 + 2))) @@ -40,18 +40,18 @@ res9: String = 4423 scala> scala> 55 ; ((2 + 2)) ; (1, 2, 3) -<console>:7: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses - 55 ; ((2 + 2)) ;; - ^ -<console>:7: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses - 55 ; ((2 + 2)) ;; - ^ +<console>:10: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + 55 ; ((2 + 2)) ;; + ^ +<console>:10: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + 55 ; ((2 + 2)) ;; + ^ res10: (Int, Int, Int) = (1,2,3) scala> 55 ; (x: Int) => x + 1 ; () => ((5)) -<console>:7: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses - 55 ; (x: Int) => x + 1 ;; - ^ +<console>:10: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + 55 ; (x: Int) => x + 1 ;; + ^ res11: () => Int = <function0> scala> @@ -60,9 +60,9 @@ scala> () => 5 res12: () => Int = <function0> scala> 55 ; () => 5 -<console>:7: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses - 55 ;; - ^ +<console>:10: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + 55 ;; + ^ res13: () => Int = <function0> scala> () => { class X ; new X } diff --git a/test/files/run/repl-paste-2.check b/test/files/run/repl-paste-2.check index 6ea8e2f419..bc80615107 100644 --- a/test/files/run/repl-paste-2.check +++ b/test/files/run/repl-paste-2.check @@ -44,7 +44,7 @@ scala> res5 + res6 res1: Int = 690 scala> val x = dingus -<console>:7: error: not found: value dingus +<console>:10: error: not found: value dingus val x = dingus ^ diff --git a/test/files/run/repl-reset.check b/test/files/run/repl-reset.check index cd7893bbc3..a2d88fd445 100644 --- a/test/files/run/repl-reset.check +++ b/test/files/run/repl-reset.check @@ -30,23 +30,23 @@ Forgetting all expression results and named terms: $intp, BippyBungus, x1, x2, x Forgetting defined types: BippyBungus scala> x1 + x2 + x3 -<console>:8: error: not found: value x1 - x1 + x2 + x3 - ^ -<console>:8: error: not found: value x2 - x1 + x2 + x3 - ^ -<console>:8: error: not found: value x3 - x1 + x2 + x3 - ^ +<console>:11: error: not found: value x1 + x1 + x2 + x3 + ^ +<console>:11: error: not found: value x2 + x1 + x2 + x3 + ^ +<console>:11: error: not found: value x3 + x1 + x2 + x3 + ^ scala> val x1 = 4 x1: Int = 4 scala> new BippyBungus -<console>:8: error: not found: type BippyBungus - new BippyBungus - ^ +<console>:11: error: not found: type BippyBungus + new BippyBungus + ^ scala> class BippyBungus() { def f = 5 } defined class BippyBungus diff --git a/test/files/run/repl-trim-stack-trace.scala b/test/files/run/repl-trim-stack-trace.scala index a53ce3b3e4..b8c1668691 100644 --- a/test/files/run/repl-trim-stack-trace.scala +++ b/test/files/run/repl-trim-stack-trace.scala @@ -13,7 +13,7 @@ f: Nothing scala> f java.lang.Exception: Uh-oh - at .f(<console>:7) + at .f(<console>:10) ... 69 elided scala> def f = throw new Exception("") @@ -21,7 +21,7 @@ f: Nothing scala> f java.lang.Exception: - at .f(<console>:7) + at .f(<console>:10) ... 69 elided scala> def f = throw new Exception @@ -29,7 +29,7 @@ f: Nothing scala> f java.lang.Exception - at .f(<console>:7) + at .f(<console>:10) ... 69 elided scala> :quit""" 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/t0631.scala b/test/files/run/t0631.scala index c401ed31cb..8d672574ec 100644 --- a/test/files/run/t0631.scala +++ b/test/files/run/t0631.scala @@ -11,6 +11,6 @@ object Test extends App { case class Bar(x: Foo) val b = new Bar(new Foo) - // this should not call Foo.equals, but simply compare object identiy of b + // this should not call Foo.equals, but simply compare object identity of b println(b == b) } diff --git a/test/files/run/t2526.scala b/test/files/run/t2526.scala index 53f3059135..9f3c48ec61 100644 --- a/test/files/run/t2526.scala +++ b/test/files/run/t2526.scala @@ -38,7 +38,7 @@ object Test { /* * Checks foreach of `actual` goes over all the elements in `expected` - * We duplicate the method above because there is no common inteface between Traversable and + * We duplicate the method above because there is no common interface between Traversable and * Iterator and we want to avoid converting between collections to ensure that we test what * we mean to test. */ diff --git a/test/files/run/t4542.check b/test/files/run/t4542.check index f7716dc2f0..f7aad3deb2 100644 --- a/test/files/run/t4542.check +++ b/test/files/run/t4542.check @@ -7,7 +7,7 @@ scala> @deprecated("foooo", "ReplTest version 1.0-FINAL") class Foo() { defined class Foo scala> val f = new Foo -<console>:8: warning: class Foo is deprecated: foooo +<console>:11: warning: class Foo is deprecated: foooo val f = new Foo ^ f: Foo = Bippy diff --git a/test/files/run/t4594-repl-settings.scala b/test/files/run/t4594-repl-settings.scala index db5dc19866..1b883983cf 100644 --- a/test/files/run/t4594-repl-settings.scala +++ b/test/files/run/t4594-repl-settings.scala @@ -17,7 +17,7 @@ object Test extends SessionTest { |scala> :settings -deprecation | |scala> def b = depp - |<console>:8: warning: method depp is deprecated: Please don't do that. + |<console>:11: warning: method depp is deprecated: Please don't do that. | def b = depp | ^ |b: String diff --git a/test/files/run/t5655.check b/test/files/run/t5655.check index 4bbc54b641..e8375c3e90 100644 --- a/test/files/run/t5655.check +++ b/test/files/run/t5655.check @@ -8,19 +8,19 @@ scala> import x._ import x._ scala> x -<console>:12: error: reference to x is ambiguous; +<console>:15: error: reference to x is ambiguous; it is imported twice in the same scope by import x._ and import x - x - ^ + x + ^ scala> x -<console>:12: error: reference to x is ambiguous; +<console>:15: error: reference to x is ambiguous; it is imported twice in the same scope by import x._ and import x - x - ^ + x + ^ scala> :quit diff --git a/test/files/run/t6240-universe-code-gen.scala b/test/files/run/t6240-universe-code-gen.scala index 9f7061ee1b..60e1f76b54 100644 --- a/test/files/run/t6240-universe-code-gen.scala +++ b/test/files/run/t6240-universe-code-gen.scala @@ -13,8 +13,8 @@ object Test extends App { (sym.isMethod && sym.asMethod.isLazy) || sym.isModule ) - val forcables = tp.members.sorted.filter(isLazyAccessorOrObject) - forcables.map { + val forceables = tp.members.sorted.filter(isLazyAccessorOrObject) + forceables.map { sym => val path = s"$prefix.${sym.name}" " " + ( 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/t7319.check b/test/files/run/t7319.check index e35cfc90c0..885136b432 100644 --- a/test/files/run/t7319.check +++ b/test/files/run/t7319.check @@ -17,25 +17,25 @@ warning: there was one feature warning; re-run with -feature for details convert: [F[X <: F[X]]](builder: F[_ <: F[_]])Int scala> convert(Some[Int](0)) -<console>:12: error: no type parameters for method convert: (builder: F[_ <: F[_]])Int exist so that it can be applied to arguments (Some[Int]) +<console>:15: error: no type parameters for method convert: (builder: F[_ <: F[_]])Int exist so that it can be applied to arguments (Some[Int]) --- because --- argument expression's type is not compatible with formal parameter type; found : Some[Int] required: ?F[_$1] forSome { type _$1 <: ?F[_$2] forSome { type _$2 } } - convert(Some[Int](0)) - ^ -<console>:12: error: type mismatch; + convert(Some[Int](0)) + ^ +<console>:15: error: type mismatch; found : Some[Int] required: F[_ <: F[_]] - convert(Some[Int](0)) - ^ + convert(Some[Int](0)) + ^ scala> Range(1,2).toArray: Seq[_] -<console>:11: error: polymorphic expression cannot be instantiated to expected type; +<console>:14: error: polymorphic expression cannot be instantiated to expected type; found : [B >: Int]Array[B] required: Seq[_] - Range(1,2).toArray: Seq[_] - ^ + Range(1,2).toArray: Seq[_] + ^ scala> 0 res2: Int = 0 diff --git a/test/files/run/t7582.check b/test/files/run/t7582.check index 2a11210000..0cfbf08886 100644 --- a/test/files/run/t7582.check +++ b/test/files/run/t7582.check @@ -1,6 +1 @@ -#partest !-Ybackend:GenBCode -warning: there was one inliner warning; re-run with -Yinline-warnings for details -#partest -Ybackend:GenBCode -warning: there was one inliner warning; re-run with -Yopt-warnings for details -#partest 2 diff --git a/test/files/run/t7582/InlineHolder.scala b/test/files/run/t7582/InlineHolder.scala index a18b9effaa..3cbf233ce1 100644 --- a/test/files/run/t7582/InlineHolder.scala +++ b/test/files/run/t7582/InlineHolder.scala @@ -1,3 +1,6 @@ +/* + * filter: inliner warning; re-run with + */ package p1 { object InlineHolder { @inline def inlinable = p1.PackageProtectedJava.protectedMethod() + 1 diff --git a/test/files/run/t7582b.check b/test/files/run/t7582b.check index 2a11210000..0cfbf08886 100644 --- a/test/files/run/t7582b.check +++ b/test/files/run/t7582b.check @@ -1,6 +1 @@ -#partest !-Ybackend:GenBCode -warning: there was one inliner warning; re-run with -Yinline-warnings for details -#partest -Ybackend:GenBCode -warning: there was one inliner warning; re-run with -Yopt-warnings for details -#partest 2 diff --git a/test/files/run/t7582b/InlineHolder.scala b/test/files/run/t7582b/InlineHolder.scala index a18b9effaa..3cbf233ce1 100644 --- a/test/files/run/t7582b/InlineHolder.scala +++ b/test/files/run/t7582b/InlineHolder.scala @@ -1,3 +1,6 @@ +/* + * filter: inliner warning; re-run with + */ package p1 { object InlineHolder { @inline def inlinable = p1.PackageProtectedJava.protectedMethod() + 1 diff --git a/test/files/run/t7747-repl.check b/test/files/run/t7747-repl.check index 5f436ba6b1..98e3d3b821 100644 --- a/test/files/run/t7747-repl.check +++ b/test/files/run/t7747-repl.check @@ -17,33 +17,33 @@ scala> val z = x * y z: Int = 156 scala> 2 ; 3 -<console>:7: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses - 2 ;; - ^ +<console>:10: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + 2 ;; + ^ res0: Int = 3 scala> { 2 ; 3 } -<console>:8: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses - { 2 ; 3 } - ^ +<console>:11: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + { 2 ; 3 } + ^ res1: Int = 3 scala> 5 ; 10 ; case object Cow ; 20 ; class Moo { override def toString = "Moooooo" } ; 30 ; def bippy = { 1 + 2 + 3 } ; bippy+88+11 -<console>:7: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses - 5 ; 10 ; case object Cow ; 20 ; class Moo { override def toString = "Moooooo" } ; 30 ; def bippy = { - ^ -<console>:7: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses - 5 ; 10 ; case object Cow ; 20 ; class Moo { override def toString = "Moooooo" } ; 30 ; def bippy = { - ^ -<console>:7: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses - 5 ; 10 ; case object Cow ; 20 ; class Moo { override def toString = "Moooooo" } ; 30 ; def bippy = { - ^ -<console>:7: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses - 5 ; 10 ; case object Cow ; 20 ; class Moo { override def toString = "Moooooo" } ; 30 ; def bippy = { - ^ +<console>:10: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + 5 ; 10 ; case object Cow ; 20 ; class Moo { override def toString = "Moooooo" } ; 30 ; def bippy = { + ^ +<console>:10: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + 5 ; 10 ; case object Cow ; 20 ; class Moo { override def toString = "Moooooo" } ; 30 ; def bippy = { + ^ +<console>:10: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + 5 ; 10 ; case object Cow ; 20 ; class Moo { override def toString = "Moooooo" } ; 30 ; def bippy = { + ^ +<console>:10: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + 5 ; 10 ; case object Cow ; 20 ; class Moo { override def toString = "Moooooo" } ; 30 ; def bippy = { + ^ defined object Cow defined class Moo bippy: Int @@ -83,12 +83,12 @@ scala> ( (2 + 2 ) ) res10: Int = 4 scala> 5 ; ( (2 + 2 ) ) ; ((5)) -<console>:7: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses - 5 ; ( (2 + 2 ) ) ;; - ^ -<console>:7: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses - 5 ; ( (2 + 2 ) ) ;; - ^ +<console>:10: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + 5 ; ( (2 + 2 ) ) ;; + ^ +<console>:10: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + 5 ; ( (2 + 2 ) ) ;; + ^ res11: Int = 5 scala> (((2 + 2)), ((2 + 2))) @@ -103,18 +103,18 @@ res14: String = 4423 scala> scala> 55 ; ((2 + 2)) ; (1, 2, 3) -<console>:7: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses - 55 ; ((2 + 2)) ;; - ^ -<console>:7: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses - 55 ; ((2 + 2)) ;; - ^ +<console>:10: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + 55 ; ((2 + 2)) ;; + ^ +<console>:10: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + 55 ; ((2 + 2)) ;; + ^ res15: (Int, Int, Int) = (1,2,3) scala> 55 ; (x: Int) => x + 1 ; () => ((5)) -<console>:9: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses - 55 ; (x: Int) => x + 1 ;; - ^ +<console>:12: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + 55 ; (x: Int) => x + 1 ;; + ^ res16: () => Int = <function0> scala> @@ -123,9 +123,9 @@ scala> () => 5 res17: () => Int = <function0> scala> 55 ; () => 5 -<console>:7: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses - 55 ;; - ^ +<console>:10: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + 55 ;; + ^ res18: () => Int = <function0> scala> () => { class X ; new X } @@ -211,23 +211,23 @@ Forgetting all expression results and named terms: $intp, BippyBungus, Bovine, C Forgetting defined types: BippyBungus, Moo, Ruminant scala> x1 + x2 + x3 -<console>:8: error: not found: value x1 - x1 + x2 + x3 - ^ -<console>:8: error: not found: value x2 - x1 + x2 + x3 - ^ -<console>:8: error: not found: value x3 - x1 + x2 + x3 - ^ +<console>:11: error: not found: value x1 + x1 + x2 + x3 + ^ +<console>:11: error: not found: value x2 + x1 + x2 + x3 + ^ +<console>:11: error: not found: value x3 + x1 + x2 + x3 + ^ scala> val x1 = 4 x1: Int = 4 scala> new BippyBungus -<console>:8: error: not found: type BippyBungus - new BippyBungus - ^ +<console>:11: error: not found: type BippyBungus + new BippyBungus + ^ scala> class BippyBungus() { def f = 5 } defined class BippyBungus diff --git a/test/files/run/t7817-tree-gen.scala b/test/files/run/t7817-tree-gen.scala index a8317fda6e..094c0d6289 100644 --- a/test/files/run/t7817-tree-gen.scala +++ b/test/files/run/t7817-tree-gen.scala @@ -1,6 +1,6 @@ import scala.tools.partest._ -// Testing that `mkAttributedRef` doesn't incude the package object test.`package`, +// Testing that `mkAttributedRef` doesn't include the package object test.`package`, // under joint and separate compilation. package testSep { class C { object O } } diff --git a/test/files/run/t8601-closure-elim.scala b/test/files/run/t8601-closure-elim.scala index 2c5b03af77..ebeb16e0c7 100644 --- a/test/files/run/t8601-closure-elim.scala +++ b/test/files/run/t8601-closure-elim.scala @@ -11,7 +11,7 @@ object Test extends BytecodeTest { val classNode = loadClassNode("Foo") val methodNode = getMethod(classNode, "b") val ops = methodNode.instructions.iterator.asScala.map(_.getOpcode).toList - assert(!ops.contains(asm.Opcodes.NEW), ops)// should be allocation free if the closure is eliminiated + assert(!ops.contains(asm.Opcodes.NEW), ops)// should be allocation free if the closure is eliminated } test("b") } diff --git a/test/files/run/t8708_b/Test_2.scala b/test/files/run/t8708_b/Test_2.scala index c978490609..fae3c677ec 100644 --- a/test/files/run/t8708_b/Test_2.scala +++ b/test/files/run/t8708_b/Test_2.scala @@ -13,7 +13,7 @@ object Test extends DirectTest { val c = g.rootMirror.getRequiredClass("p.C") println(c.info.decls) val t = c.info.member(g.newTypeName("T")) - // this test ensrues that the <local child> dummy class symbol is not entered in the + // this test ensures that the <local child> dummy class symbol is not entered in the // scope of trait T during unpickling. println(t.info.decls) }) diff --git a/test/files/run/t9170.scala b/test/files/run/t9170.scala index 25a0e84581..67a58d6803 100644 --- a/test/files/run/t9170.scala +++ b/test/files/run/t9170.scala @@ -10,17 +10,17 @@ object Test extends SessionTest { Type :help for more information. scala> object Y { def f[A](a: => A) = 1 ; def f[A](a: => Either[Exception, A]) = 2 } -<console>:7: error: double definition: -def f[A](a: => A): Int at line 7 and -def f[A](a: => Either[Exception,A]): Int at line 7 +<console>:10: error: double definition: +def f[A](a: => A): Int at line 10 and +def f[A](a: => Either[Exception,A]): Int at line 10 have same type after erasure: (a: Function0)Int object Y { def f[A](a: => A) = 1 ; def f[A](a: => Either[Exception, A]) = 2 } ^ scala> object Y { def f[A](a: => A) = 1 ; def f[A](a: => Either[Exception, A]) = 2 } -<console>:7: error: double definition: -def f[A](a: => A): Int at line 7 and -def f[A](a: => Either[Exception,A]): Int at line 7 +<console>:10: error: double definition: +def f[A](a: => A): Int at line 10 and +def f[A](a: => Either[Exception,A]): Int at line 10 have same type after erasure: (a: Function0)Int object Y { def f[A](a: => A) = 1 ; def f[A](a: => Either[Exception, A]) = 2 } ^ @@ -29,9 +29,9 @@ scala> object Y { | def f[A](a: => A) = 1 | def f[A](a: => Either[Exception, A]) = 2 | } -<console>:9: error: double definition: -def f[A](a: => A): Int at line 8 and -def f[A](a: => Either[Exception,A]): Int at line 9 +<console>:12: error: double definition: +def f[A](a: => A): Int at line 11 and +def f[A](a: => Either[Exception,A]): Int at line 12 have same type after erasure: (a: Function0)Int def f[A](a: => Either[Exception, A]) = 2 ^ @@ -46,9 +46,9 @@ object Y { // Exiting paste mode, now interpreting. -<console>:9: error: double definition: -def f[A](a: => A): Int at line 8 and -def f[A](a: => Either[Exception,A]): Int at line 9 +<console>:12: error: double definition: +def f[A](a: => A): Int at line 11 and +def f[A](a: => Either[Exception,A]): Int at line 12 have same type after erasure: (a: Function0)Int def f[A](a: => Either[Exception, A]) = 2 ^ diff --git a/test/files/run/t9206.scala b/test/files/run/t9206.scala new file mode 100644 index 0000000000..2942d0f73e --- /dev/null +++ b/test/files/run/t9206.scala @@ -0,0 +1,39 @@ + +import scala.tools.partest.SessionTest + +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. + | + |scala> val i: Int = "foo" + |<console>:10: error: type mismatch; + | found : String("foo") + | required: Int + | val i: Int = "foo" + | ^ + | + |scala> { val j = 42 ; val i: Int = "foo" + j } + |<console>:11: error: type mismatch; + | found : String + | required: Int + | { val j = 42 ; val i: Int = "foo" + j } + | ^ + | + |scala> :quit""" + /* + |XXX> XXX> def f = 42 + | + |// Detected repl transcript paste: ctrl-D to finish. + | + |// Replaying 1 commands from transcript. + | + |XXX> def f = 42 + |f: Int + | + |XXX> :quit""" + */ + +} diff --git a/test/files/run/t9359.check b/test/files/run/t9359.check new file mode 100644 index 0000000000..8dcfe4f60a --- /dev/null +++ b/test/files/run/t9359.check @@ -0,0 +1,18 @@ + // access flags 0x4009 + public static enum INNERCLASS A_1$A1N A_1 A1N + + // access flags 0x4409 + public static abstract enum INNERCLASS A_1$A1N_ABSTRACT A_1 A1N_ABSTRACT + + // access flags 0x4019 + public final static enum INNERCLASS A_1$A1N_FINAL A_1 A1N_FINAL + + // access flags 0x4009 + public static enum INNERCLASS B_2$A1N B_2 A1N + + // access flags 0x4409 + public static abstract enum INNERCLASS B_2$A1N_ABSTRACT B_2 A1N_ABSTRACT + + // access flags 0x4019 + public final static enum INNERCLASS B_2$A1N_FINAL B_2 A1N_FINAL + diff --git a/test/files/run/t9359/A_1.java b/test/files/run/t9359/A_1.java new file mode 100644 index 0000000000..3ac82ed55f --- /dev/null +++ b/test/files/run/t9359/A_1.java @@ -0,0 +1,19 @@ +public class A_1 { + // nested final + public static enum A1N_FINAL { + A1N_FINAL_VAL + } + + // nested, non-final + public enum A1N { + A1N_VAL { } // value has a body, so a class extending A1N is generated + } + + // nested, non-final, abstract + public enum A1N_ABSTRACT { + A1N_ABSTRACT_VAL { + void foo() { return; } + }; + abstract void foo(); // abstract member makes the enum class abstract + } +} diff --git a/test/files/run/t9359/B_2.java b/test/files/run/t9359/B_2.java new file mode 100644 index 0000000000..d824facda9 --- /dev/null +++ b/test/files/run/t9359/B_2.java @@ -0,0 +1,19 @@ +public class B_2 { + // nested final + public enum A1N_FINAL { + A1N_FINAL_VAL + } + + // nested, non-final + public enum A1N { + A1N_VAL { } // value has a body, so a class extending A1N is generated + } + + // nested, non-final, abstract + public enum A1N_ABSTRACT { + A1N_ABSTRACT_VAL { + void foo() { return; } + }; + abstract void foo(); // abstract member makes the enum class abstract + } +} diff --git a/test/files/run/t9359/Test_2.scala b/test/files/run/t9359/Test_2.scala new file mode 100644 index 0000000000..869c51b619 --- /dev/null +++ b/test/files/run/t9359/Test_2.scala @@ -0,0 +1,28 @@ +import scala.tools.partest.BytecodeTest +import scala.tools.asm +import asm.tree.{ClassNode, InnerClassNode} +import asm.{Opcodes => Flags} +import scala.collection.JavaConverters._ + +class C { + def f1: A_1.A1N_FINAL = A_1.A1N_FINAL.A1N_FINAL_VAL + def f2: A_1.A1N = A_1.A1N.A1N_VAL + def f3: A_1.A1N_ABSTRACT = A_1.A1N_ABSTRACT.A1N_ABSTRACT_VAL + + def f4: B_2.A1N_FINAL = B_2.A1N_FINAL.A1N_FINAL_VAL + def f5: B_2.A1N = B_2.A1N.A1N_VAL + def f6: B_2.A1N_ABSTRACT = B_2.A1N_ABSTRACT.A1N_ABSTRACT_VAL +} + +object Test extends BytecodeTest { + def tost(n: InnerClassNode) = { + val t = new asm.util.Textifier + t.visitInnerClass(n.name, n.outerName, n.innerName, n.access) + t.getText.get(0); + } + def show(): Unit = { + for (n <- loadClassNode("C").innerClasses.asScala.toList.sortBy(_.name)) { + println(tost(n)) + } + } +} diff --git a/test/files/run/xMigration.check b/test/files/run/xMigration.check index 378f7bb6c3..304132a848 100644 --- a/test/files/run/xMigration.check +++ b/test/files/run/xMigration.check @@ -12,10 +12,10 @@ res1: Iterable[String] = MapLike(eis) scala> :setting -Xmigration:any scala> Map(1 -> "eis").values // warn -<console>:8: warning: method values in trait MapLike has changed semantics in version 2.8.0: +<console>:11: warning: method values in trait MapLike has changed semantics in version 2.8.0: `values` returns `Iterable[B]` rather than `Iterator[B]`. - Map(1 -> "eis").values // warn - ^ + Map(1 -> "eis").values // warn + ^ res2: Iterable[String] = MapLike(eis) scala> :setting -Xmigration:2.8 @@ -26,10 +26,10 @@ res3: Iterable[String] = MapLike(eis) scala> :setting -Xmigration:2.7 scala> Map(1 -> "eis").values // warn -<console>:8: warning: method values in trait MapLike has changed semantics in version 2.8.0: +<console>:11: warning: method values in trait MapLike has changed semantics in version 2.8.0: `values` returns `Iterable[B]` rather than `Iterator[B]`. - Map(1 -> "eis").values // warn - ^ + Map(1 -> "eis").values // warn + ^ res4: Iterable[String] = MapLike(eis) scala> :setting -Xmigration:2.11 @@ -40,10 +40,10 @@ res5: Iterable[String] = MapLike(eis) scala> :setting -Xmigration // same as :any scala> Map(1 -> "eis").values // warn -<console>:8: warning: method values in trait MapLike has changed semantics in version 2.8.0: +<console>:11: warning: method values in trait MapLike has changed semantics in version 2.8.0: `values` returns `Iterable[B]` rather than `Iterator[B]`. - Map(1 -> "eis").values // warn - ^ + Map(1 -> "eis").values // warn + ^ res6: Iterable[String] = MapLike(eis) scala> :quit diff --git a/test/files/scalacheck/quasiquotes/RuntimeErrorProps.scala b/test/files/scalacheck/quasiquotes/RuntimeErrorProps.scala index a3b6137f68..40fb42d63c 100644 --- a/test/files/scalacheck/quasiquotes/RuntimeErrorProps.scala +++ b/test/files/scalacheck/quasiquotes/RuntimeErrorProps.scala @@ -68,7 +68,7 @@ object RuntimeErrorProps extends QuasiquoteProperties("errors") { q"for(..$enums) 0" } - property("for inlalid enum") = testFails { + property("for invalid enum") = testFails { val enums = q"foo" :: Nil q"for(..$enums) 0" } diff --git a/test/files/specialized/constant_lambda.scala b/test/files/specialized/constant_lambda.scala index bb9a97403e..7c5358ce10 100644 --- a/test/files/specialized/constant_lambda.scala +++ b/test/files/specialized/constant_lambda.scala @@ -1,4 +1,4 @@ -// during development of late delmabdafying there was a problem where +// during development of late delambdafying there was a problem where // specialization would undo some of the work done in uncurry if the body of the // lambda had a constant type. That would result in a compiler crash as // when the delambdafy phase got a tree shape it didn't understand |