diff options
Diffstat (limited to 'test')
49 files changed, 292 insertions, 83 deletions
diff --git a/test/files/neg/accesses.check b/test/files/neg/accesses.check index db58af12ce..5a5e03233e 100644 --- a/test/files/neg/accesses.check +++ b/test/files/neg/accesses.check @@ -1,7 +1,3 @@ -accesses.scala:23: error: overriding method f2 in class A of type ()Unit; - method f2 has weaker access privileges; it should not be private - private def f2(): Unit = () - ^ accesses.scala:24: error: overriding method f3 in class A of type ()Unit; method f3 has weaker access privileges; it should be at least protected private[p2] def f3(): Unit = () @@ -14,4 +10,4 @@ accesses.scala:26: error: overriding method f5 in class A of type ()Unit; method f5 has weaker access privileges; it should be at least protected[p1] protected[p2] def f5(): Unit ^ -four errors found +three errors found diff --git a/test/files/neg/accesses2.check b/test/files/neg/accesses2.check new file mode 100644 index 0000000000..554a7b4c81 --- /dev/null +++ b/test/files/neg/accesses2.check @@ -0,0 +1,4 @@ +accesses2.scala:5: error: class B1 needs to be abstract, since method f2 in class A of type ()Int is not defined + class B1 extends A { + ^ +one error found diff --git a/test/files/neg/accesses2.scala b/test/files/neg/accesses2.scala new file mode 100644 index 0000000000..c7640f84b5 --- /dev/null +++ b/test/files/neg/accesses2.scala @@ -0,0 +1,11 @@ +package p2 { + abstract class A { + private[p2] def f2(): Int + } + class B1 extends A { + private def f2(): Int = 1 + } + abstract class B2 extends A { + private def f2(): Int = 1 + } +} diff --git a/test/files/neg/any-vs-anyref.check b/test/files/neg/any-vs-anyref.check index 63c4853130..7378f0495f 100644 --- a/test/files/neg/any-vs-anyref.check +++ b/test/files/neg/any-vs-anyref.check @@ -36,12 +36,28 @@ Such types can participate in value classes, but instances cannot appear in singleton types or in reference comparisons. def foo5(x: Quux with Product) = (x eq "abc") && ("abc" eq x) ^ +any-vs-anyref.scala:10: error: type mismatch; + found : Quux with Product + required: AnyRef +Note that the parents of this type (Quux, Product) extend Any, not AnyRef. +Such types can participate in value classes, but instances +cannot appear in singleton types or in reference comparisons. + def foo5(x: Quux with Product) = (x eq "abc") && ("abc" eq x) + ^ any-vs-anyref.scala:11: error: value eq is not a member of Quux with Product{def f: Int} Note that the parents of this type (Quux, Product) extend Any, not AnyRef. Such types can participate in value classes, but instances cannot appear in singleton types or in reference comparisons. def foo6(x: Quux with Product { def f: Int }) = (x eq "abc") && ("abc" eq x) ^ +any-vs-anyref.scala:11: error: type mismatch; + found : Quux with Product{def f: Int} + required: AnyRef +Note that the parents of this type (Quux, Product) extend Any, not AnyRef. +Such types can participate in value classes, but instances +cannot appear in singleton types or in reference comparisons. + def foo6(x: Quux with Product { def f: Int }) = (x eq "abc") && ("abc" eq x) + ^ any-vs-anyref.scala:12: error: type mismatch; found : Quux with Product{def eq(other: String): Boolean} required: AnyRef @@ -61,4 +77,4 @@ any-vs-anyref.scala:27: error: type mismatch; required: Quux{def g(x: Int): Int} f(new Quux { def g(x: String) = x }) ^ -9 errors found +11 errors found diff --git a/test/files/neg/applydynamic_sip.check b/test/files/neg/applydynamic_sip.check index dcf97b29fc..f28f26c147 100644 --- a/test/files/neg/applydynamic_sip.check +++ b/test/files/neg/applydynamic_sip.check @@ -4,9 +4,18 @@ applydynamic_sip.scala:7: error: applyDynamic does not support passing a vararg applydynamic_sip.scala:8: error: applyDynamicNamed does not support passing a vararg parameter qual.sel(arg = a, a2: _*) ^ +applydynamic_sip.scala:8: error: not found: value arg + qual.sel(arg = a, a2: _*) + ^ applydynamic_sip.scala:9: error: applyDynamicNamed does not support passing a vararg parameter qual.sel(arg, arg2 = "a2", a2: _*) ^ +applydynamic_sip.scala:9: error: not found: value arg + qual.sel(arg, arg2 = "a2", a2: _*) + ^ +applydynamic_sip.scala:9: error: not found: value arg2 + qual.sel(arg, arg2 = "a2", a2: _*) + ^ applydynamic_sip.scala:18: error: type mismatch; found : String("sel") required: Int @@ -28,6 +37,9 @@ error after rewriting to Test.this.bad1.applyDynamicNamed("sel") possible cause: maybe a wrong Dynamic method signature? bad1.sel(a = 1) ^ +applydynamic_sip.scala:20: error: reassignment to val + bad1.sel(a = 1) + ^ applydynamic_sip.scala:21: error: type mismatch; found : String("sel") required: Int @@ -50,9 +62,12 @@ error after rewriting to Test.this.bad2.applyDynamicNamed("sel") possible cause: maybe a wrong Dynamic method signature? bad2.sel(a = 1) ^ +applydynamic_sip.scala:31: error: reassignment to val + bad2.sel(a = 1) + ^ applydynamic_sip.scala:32: error: Int does not take parameters error after rewriting to Test.this.bad2.updateDynamic("sel") possible cause: maybe a wrong Dynamic method signature? bad2.sel = 1 ^ -11 errors found +16 errors found diff --git a/test/files/neg/macro-basic-mamdmi.check b/test/files/neg/macro-basic-mamdmi.check index 621d318ceb..9328fbd51c 100644 --- a/test/files/neg/macro-basic-mamdmi.check +++ b/test/files/neg/macro-basic-mamdmi.check @@ -1,5 +1,5 @@ -Impls_Macros_Test_1.scala:36: error: macro implementation not found: foo +Impls_Macros_Test_1.scala:36: error: macro implementation not found: quux (the most common reason for that is that you cannot use macro implementations in the same compilation run that defines them) println(foo(2) + Macros.bar(2) * new Macros().quux(4)) - ^ + ^ one error found diff --git a/test/files/neg/names-defaults-neg.check b/test/files/neg/names-defaults-neg.check index cdc12c2490..880ddc4327 100644 --- a/test/files/neg/names-defaults-neg.check +++ b/test/files/neg/names-defaults-neg.check @@ -7,6 +7,11 @@ names-defaults-neg.scala:5: error: type mismatch; required: Int test1(b = 2, a = "#") ^ +names-defaults-neg.scala:5: error: type mismatch; + found : Int(2) + required: String + test1(b = 2, a = "#") + ^ names-defaults-neg.scala:8: error: positional after named argument. test1(b = "(*", 23) ^ @@ -122,6 +127,12 @@ names-defaults-neg.scala:131: error: reference to var2 is ambiguous; it is both names-defaults-neg.scala:134: error: missing parameter type for expanded function ((x$1) => a = x$1) val taf2: Int => Unit = testAnnFun(a = _, b = get("+")) ^ +names-defaults-neg.scala:134: error: not found: value a + val taf2: Int => Unit = testAnnFun(a = _, b = get("+")) + ^ +names-defaults-neg.scala:134: error: not found: value get + val taf2: Int => Unit = testAnnFun(a = _, b = get("+")) + ^ names-defaults-neg.scala:135: error: parameter 'a' is already specified at parameter position 1 val taf3 = testAnnFun(b = _: String, a = get(8)) ^ @@ -131,6 +142,9 @@ names-defaults-neg.scala:136: error: missing parameter type for expanded functio names-defaults-neg.scala:136: error: missing parameter type for expanded function ((x$4) => b = x$4) val taf4: (Int, String) => Unit = testAnnFun(_, b = _) ^ +names-defaults-neg.scala:136: error: not found: value b + val taf4: (Int, String) => Unit = testAnnFun(_, b = _) + ^ names-defaults-neg.scala:144: error: variable definition needs type because 'x' is used as a named argument in its body. def t3 { var x = t.f(x = 1) } ^ @@ -168,4 +182,4 @@ names-defaults-neg.scala:180: error: reference to x is ambiguous; it is both a m class u18 { var x: Int = u.f(x = 1) } ^ four warnings found -42 errors found +46 errors found diff --git a/test/files/neg/reflection-names-neg.check b/test/files/neg/reflection-names-neg.check index a56a19e7fd..f941ec8dc1 100644 --- a/test/files/neg/reflection-names-neg.check +++ b/test/files/neg/reflection-names-neg.check @@ -7,4 +7,7 @@ Note that implicit conversions are not applicable because they are ambiguous: are possible conversion functions from String("abc") to reflect.runtime.universe.Name val x2 = ("abc": Name) drop 1 // error ^ -one error found +reflection-names-neg.scala:5: error: value drop is not a member of reflect.runtime.universe.Name + val x2 = ("abc": Name) drop 1 // error + ^ +two errors found diff --git a/test/files/neg/t0259.check b/test/files/neg/t0259.check index 24e35e6176..8c15d98419 100644 --- a/test/files/neg/t0259.check +++ b/test/files/neg/t0259.check @@ -1,6 +1,6 @@ t0259.scala:4: error: double definition: -constructor TestCase3:(groups: String*)test.TestCase3 and -constructor TestCase3:(groups: (String, Int)*)test.TestCase3 at line 3 +constructor TestCase3: (groups: (String, Int)*)test.TestCase3 at line 3 and +constructor TestCase3: (groups: String*)test.TestCase3 at line 4 have same type after erasure: (groups: Seq)test.TestCase3 def this( groups: String*) = this() ^ diff --git a/test/files/neg/t0418.check b/test/files/neg/t0418.check index 4e9ad2f9ae..b95f8e4e1b 100644 --- a/test/files/neg/t0418.check +++ b/test/files/neg/t0418.check @@ -1,7 +1,4 @@ t0418.scala:2: error: not found: value Foo12340771 null match { case Foo12340771.Bar(x) => x } ^ -t0418.scala:2: error: not found: value x - null match { case Foo12340771.Bar(x) => x } - ^ -two errors found +one error found diff --git a/test/files/neg/t3653.check b/test/files/neg/t3653.check index ac6e2ca9dc..ad68e29fb4 100644 --- a/test/files/neg/t3653.check +++ b/test/files/neg/t3653.check @@ -1,7 +1,7 @@ t3653.scala:3: error: double definition: -method x:(implicit x: Int)Int and -method x:(i: Int)Int at line 2 -have same type after erasure: (x: Int)Int +def x(i: Int): Int at line 2 and +def x(implicit x: Int): Int at line 3 +have same type after erasure: (i: Int)Int def x(implicit x: Int) = 5 ^ one error found diff --git a/test/files/neg/t418.check b/test/files/neg/t418.check index 1489547823..1b99717b82 100644 --- a/test/files/neg/t418.check +++ b/test/files/neg/t418.check @@ -1,7 +1,4 @@ t418.scala:2: error: not found: value Foo12340771 null match { case Foo12340771.Bar(x) => x } ^ -t418.scala:2: error: not found: value x - null match { case Foo12340771.Bar(x) => x } - ^ -two errors found +one error found diff --git a/test/files/neg/t4515.check b/test/files/neg/t4515.check index 64e7cc1ca7..708fcfbd29 100644 --- a/test/files/neg/t4515.check +++ b/test/files/neg/t4515.check @@ -3,4 +3,14 @@ t4515.scala:37: error: type mismatch; required: _$2 handler.onEvent(target, ctx.getEvent, node, ctx) ^ -one error found +t4515.scala:37: error: type mismatch; + found : Main.DerivedPushNode[_$1] where type _$1 + required: Main.PushNode[_$2] + handler.onEvent(target, ctx.getEvent, node, ctx) + ^ +t4515.scala:37: error: type mismatch; + found : Main.PushEventContext[_$1] where type _$1 + required: Main.PushEventContext[_$2] + handler.onEvent(target, ctx.getEvent, node, ctx) + ^ +three errors found diff --git a/test/files/neg/t512.check b/test/files/neg/t512.check index 814e65e405..051e5ee19f 100644 --- a/test/files/neg/t512.check +++ b/test/files/neg/t512.check @@ -1,4 +1,7 @@ t512.scala:3: error: not found: value something val xxx = something || ^ -one error found +t512.scala:4: error: not found: value something_else + something_else; + ^ +two errors found diff --git a/test/files/neg/t545.check b/test/files/neg/t545.check index 8ebbf9bdf6..aae575fa96 100644 --- a/test/files/neg/t545.check +++ b/test/files/neg/t545.check @@ -1,7 +1,4 @@ t545.scala:4: error: value blah is not a member of Test.Foo val x = foo.blah match { ^ -t545.scala:5: error: recursive value x needs type - case List(x) => x - ^ -two errors found +one error found diff --git a/test/files/neg/t556.check b/test/files/neg/t556.check index 5135dc92ef..30cc296b35 100644 --- a/test/files/neg/t556.check +++ b/test/files/neg/t556.check @@ -1,4 +1,7 @@ t556.scala:3: error: missing parameter type def g:Int = f((x,y)=>x) ^ -one error found +t556.scala:3: error: missing parameter type + def g:Int = f((x,y)=>x) + ^ +two errors found diff --git a/test/files/neg/t5572.check b/test/files/neg/t5572.check index 7b1e290861..3c9adf41cd 100644 --- a/test/files/neg/t5572.check +++ b/test/files/neg/t5572.check @@ -3,9 +3,14 @@ t5572.scala:16: error: type mismatch; required: A Z.transf(a, b) match { ^ +t5572.scala:16: error: type mismatch; + found : A + required: B + Z.transf(a, b) match { + ^ t5572.scala:18: error: type mismatch; found : A required: B run(sth, b) ^ -two errors found +three errors found diff --git a/test/files/neg/t5761.check b/test/files/neg/t5761.check index 89d766fe34..2d66af26f6 100644 --- a/test/files/neg/t5761.check +++ b/test/files/neg/t5761.check @@ -13,4 +13,7 @@ Unspecified value parameter x. t5761.scala:13: error: not found: type Tread new Tread("sth") { }.run() ^ -four errors found +t5761.scala:13: error: value run is not a member of AnyRef + new Tread("sth") { }.run() + ^ +5 errors found diff --git a/test/files/neg/t588.check b/test/files/neg/t588.check index f8b5516fdc..ff08f77a6f 100644 --- a/test/files/neg/t588.check +++ b/test/files/neg/t588.check @@ -1,13 +1,13 @@ t588.scala:3: error: double definition: -method visit:(f: Int => String)Boolean and -method visit:(f: Int => Unit)Boolean at line 2 +def visit(f: Int => Unit): Boolean at line 2 and +def visit(f: Int => String): Boolean at line 3 have same type after erasure: (f: Function1)Boolean def visit(f: Int => String): Boolean ^ t588.scala:10: error: double definition: -method f:(brac: Test.this.TypeB)Unit and -method f:(node: Test.this.TypeA)Unit at line 9 -have same type after erasure: (brac: Test#TraitA)Unit +def f(node: Test.this.TypeA): Unit at line 9 and +def f(brac: Test.this.TypeB): Unit at line 10 +have same type after erasure: (node: Test#TraitA)Unit def f(brac : TypeB) : Unit; ^ two errors found diff --git a/test/files/neg/t5903a.check b/test/files/neg/t5903a.check index cbdcfd1bdd..2e5cc87167 100644 --- a/test/files/neg/t5903a.check +++ b/test/files/neg/t5903a.check @@ -1,7 +1,4 @@ Test_2.scala:4: error: wrong number of patterns for <$anon: AnyRef> offering (SomeTree.type, SomeTree.type): expected 2, found 3 case nq"$x + $y + $z" => println((x, y)) ^ -Test_2.scala:4: error: not found: value x - case nq"$x + $y + $z" => println((x, y)) - ^ -two errors found +one error found diff --git a/test/files/neg/t5903b.check b/test/files/neg/t5903b.check index faeb73ad03..e7637d3edb 100644 --- a/test/files/neg/t5903b.check +++ b/test/files/neg/t5903b.check @@ -3,7 +3,4 @@ Test_2.scala:4: error: type mismatch; required: String case t"$x" => println(x) ^ -Test_2.scala:4: error: not found: value x - case t"$x" => println(x) - ^ -two errors found +one error found diff --git a/test/files/neg/t5903c.check b/test/files/neg/t5903c.check index c9476edd11..05bd775d30 100644 --- a/test/files/neg/t5903c.check +++ b/test/files/neg/t5903c.check @@ -1,7 +1,4 @@ Test_2.scala:4: error: String is not supported case t"$x" => println(x) ^ -Test_2.scala:4: error: not found: value x - case t"$x" => println(x) - ^ -two errors found +one error found diff --git a/test/files/neg/t5903d.check b/test/files/neg/t5903d.check index d5d3fdcc28..9b8526b7f5 100644 --- a/test/files/neg/t5903d.check +++ b/test/files/neg/t5903d.check @@ -1,7 +1,4 @@ Test_2.scala:4: error: extractor macros can only expand into extractor calls case t"$x" => println(x) ^ -Test_2.scala:4: error: not found: value x - case t"$x" => println(x) - ^ -two errors found +one error found diff --git a/test/files/neg/t6443c.check b/test/files/neg/t6443c.check index 7cf8d23f4b..7b7f419f6c 100644 --- a/test/files/neg/t6443c.check +++ b/test/files/neg/t6443c.check @@ -1,6 +1,6 @@ t6443c.scala:16: error: double definition: -method foo:(d: B.D)(a: Any)(d2: d.type)Unit and -method foo:(d: B.D)(a: Any, d2: d.type)Unit at line 11 +def foo(d: B.D)(a: Any,d2: d.type): Unit at line 11 and +def foo(d: B.D)(a: Any)(d2: d.type): Unit at line 16 have same type after erasure: (d: B.D, a: Object, d2: B.D)Unit def foo(d: D)(a: Any)(d2: d.type): Unit = () ^ diff --git a/test/files/neg/t663.check b/test/files/neg/t663.check index 40161fb3e3..633e27ee12 100644 --- a/test/files/neg/t663.check +++ b/test/files/neg/t663.check @@ -1,7 +1,7 @@ t663.scala:11: error: name clash between defined and inherited member: -method asMatch:(m: Test.this.Node)Any and -method asMatch:(node: Test.this.Matchable)Any in trait MatchableImpl -have same type after erasure: (m: test.Test#NodeImpl)Object +def asMatch(node: Test.this.Matchable): Any in trait MatchableImpl and +def asMatch(m: Test.this.Node): Any at line 11 +have same type after erasure: (node: test.Test#NodeImpl)Object def asMatch(m : Node) : Any = { ^ one error found diff --git a/test/files/neg/t6829.check b/test/files/neg/t6829.check index c7c641844e..a0b43e3b52 100644 --- a/test/files/neg/t6829.check +++ b/test/files/neg/t6829.check @@ -20,11 +20,31 @@ t6829.scala:50: error: type mismatch; required: _53.State where val _53: G val r = rewards(agent).r(s,a,s2) ^ +t6829.scala:50: error: type mismatch; + found : a.type (with underlying type T2) + required: _53.Action where val _53: G + val r = rewards(agent).r(s,a,s2) + ^ +t6829.scala:50: error: type mismatch; + found : s2.type (with underlying type T3) + required: _53.State where val _53: G + val r = rewards(agent).r(s,a,s2) + ^ t6829.scala:51: error: type mismatch; found : s.type (with underlying type T1) required: _50.State agent.learn(s,a,s2,r): G#Agent ^ +t6829.scala:51: error: type mismatch; + found : a.type (with underlying type T2) + required: _50.Action + agent.learn(s,a,s2,r): G#Agent + ^ +t6829.scala:51: error: type mismatch; + found : s2.type (with underlying type T3) + required: _50.State + agent.learn(s,a,s2,r): G#Agent + ^ t6829.scala:53: error: not found: value nextState Error occurred in an application involving default arguments. copy(agents = updatedAgents, state = nextState, pastHistory = currentHistory) @@ -33,4 +53,4 @@ t6829.scala:53: error: not found: value currentHistory Error occurred in an application involving default arguments. copy(agents = updatedAgents, state = nextState, pastHistory = currentHistory) ^ -9 errors found +13 errors found diff --git a/test/files/neg/t7239.check b/test/files/neg/t7239.check new file mode 100644 index 0000000000..80b14f8fc6 --- /dev/null +++ b/test/files/neg/t7239.check @@ -0,0 +1,4 @@ +t7239.scala:10: error: not found: value foBar + fooBar = foBar.toInt + ^ +one error found diff --git a/test/files/neg/t7239.scala b/test/files/neg/t7239.scala new file mode 100644 index 0000000000..f62cac0a49 --- /dev/null +++ b/test/files/neg/t7239.scala @@ -0,0 +1,12 @@ +class Foo { + def toInt = 12 +} +case class Bar( fooBar : Int ) + +// spurious "erroneous or inaccessible type" error in 2.10.1 +class Test { + var fooBar : Foo = null + def build = Bar( + fooBar = foBar.toInt + ) +} diff --git a/test/files/neg/t7895.check b/test/files/neg/t7895.check new file mode 100644 index 0000000000..1a58e24b77 --- /dev/null +++ b/test/files/neg/t7895.check @@ -0,0 +1,4 @@ +t7895.scala:4: error: not found: value Goop + case Goop(a, b, c) => Tuple2(a, b) + ^ +one error found diff --git a/test/files/neg/t7895.scala b/test/files/neg/t7895.scala new file mode 100644 index 0000000000..87a586a82d --- /dev/null +++ b/test/files/neg/t7895.scala @@ -0,0 +1,6 @@ +class A { + (null: Any) match { + // We don't want "symbol not found errors" for `a` and `b` in the case body. + case Goop(a, b, c) => Tuple2(a, b) + } +} diff --git a/test/files/neg/t7895b.check b/test/files/neg/t7895b.check new file mode 100644 index 0000000000..87ea72704e --- /dev/null +++ b/test/files/neg/t7895b.check @@ -0,0 +1,7 @@ +t7895b.scala:4: error: not found: value a + foo(a, b) + ^ +t7895b.scala:4: error: not found: value b + foo(a, b) + ^ +two errors found diff --git a/test/files/neg/t7895b.scala b/test/files/neg/t7895b.scala new file mode 100644 index 0000000000..1603027446 --- /dev/null +++ b/test/files/neg/t7895b.scala @@ -0,0 +1,5 @@ +object Test { + def foo(a: Any*) = () + + foo(a, b) +} diff --git a/test/files/neg/t7895c.check b/test/files/neg/t7895c.check new file mode 100644 index 0000000000..d4745b1f4b --- /dev/null +++ b/test/files/neg/t7895c.check @@ -0,0 +1,13 @@ +t7895c.scala:2: error: not found: value bong + def booboo = bong + booble + bippity - bazingo + ^ +t7895c.scala:2: error: not found: value booble + def booboo = bong + booble + bippity - bazingo + ^ +t7895c.scala:2: error: not found: value bippity + def booboo = bong + booble + bippity - bazingo + ^ +t7895c.scala:2: error: not found: value bazingo + def booboo = bong + booble + bippity - bazingo + ^ +four errors found diff --git a/test/files/neg/t7895c.scala b/test/files/neg/t7895c.scala new file mode 100644 index 0000000000..53d2a8672e --- /dev/null +++ b/test/files/neg/t7895c.scala @@ -0,0 +1,3 @@ +class A { + def booboo = bong + booble + bippity - bazingo +} diff --git a/test/files/neg/t7899.check b/test/files/neg/t7899.check new file mode 100644 index 0000000000..febfe76b8a --- /dev/null +++ b/test/files/neg/t7899.check @@ -0,0 +1,6 @@ +t7899.scala:5: error: type mismatch; + found : Int => Int + required: (=> Int) => ? + foo(identity)() + ^ +one error found diff --git a/test/files/neg/t7899.scala b/test/files/neg/t7899.scala new file mode 100644 index 0000000000..f2dea3ab1f --- /dev/null +++ b/test/files/neg/t7899.scala @@ -0,0 +1,7 @@ +object Test { + def foo[B](f: (=> Int) => B): () => B = () => f(0) + + def main(args: Array[String]) { + foo(identity)() + } +} diff --git a/test/files/neg/t997.check b/test/files/neg/t997.check index be1e92c369..8c41060ba2 100644 --- a/test/files/neg/t997.check +++ b/test/files/neg/t997.check @@ -4,7 +4,4 @@ t997.scala:13: error: wrong number of patterns for object Foo offering (String, t997.scala:13: error: wrong number of patterns for object Foo offering (String, String): expected 2, found 3 "x" match { case Foo(a, b, c) => Console.println((a,b,c)) } ^ -t997.scala:13: error: not found: value a -"x" match { case Foo(a, b, c) => Console.println((a,b,c)) } - ^ -three errors found +two errors found diff --git a/test/files/neg/typeerror.check b/test/files/neg/typeerror.check index 3ce11dad8a..f117e702f0 100644 --- a/test/files/neg/typeerror.check +++ b/test/files/neg/typeerror.check @@ -3,4 +3,9 @@ typeerror.scala:6: error: type mismatch; required: scala.Long else add2(x.head, y.head) :: add(x.tail, y.tail) ^ -one error found +typeerror.scala:6: error: type mismatch; + found : Long(in method add) + required: scala.Long + else add2(x.head, y.head) :: add(x.tail, y.tail) + ^ +two errors found diff --git a/test/files/neg/valueclasses-doubledefs.check b/test/files/neg/valueclasses-doubledefs.check index 556d7a0900..ec513aca6b 100644 --- a/test/files/neg/valueclasses-doubledefs.check +++ b/test/files/neg/valueclasses-doubledefs.check @@ -1,6 +1,6 @@ valueclasses-doubledefs.scala:5: error: double definition: -method apply:(x: Meter)String and -method apply:(x: Double)String at line 4 +def apply(x: Double): String at line 4 and +def apply(x: Meter): String at line 5 have same type after erasure: (x: Double)String def apply(x: Meter) = x.toString ^ diff --git a/test/files/neg/valueclasses-pavlov.check b/test/files/neg/valueclasses-pavlov.check index 031589edad..17102a0c68 100644 --- a/test/files/neg/valueclasses-pavlov.check +++ b/test/files/neg/valueclasses-pavlov.check @@ -1,6 +1,6 @@ valueclasses-pavlov.scala:8: error: double definition: -method foo:(x: Box2)String and -method foo:(x: String)String at line 7 +def foo(x: String): String at line 7 and +def foo(x: Box2): String at line 8 have same type after erasure: (x: String)String def foo(x: Box2) = "foo(Box2): ok" ^ diff --git a/test/files/pos/t7584.scala b/test/files/pos/t7584.scala deleted file mode 100644 index 52d127ecb9..0000000000 --- a/test/files/pos/t7584.scala +++ /dev/null @@ -1,11 +0,0 @@ -object Test { - def fold[A, B](f: (A, => B) => B) = ??? - def f[A, B](x: A, y: B): B = ??? - def bip[A, B] = fold[A, B]((x, y) => f(x, y)) - def bop[A, B] = fold[A, B](f) - - // these work: - fold[Int, Int]((x, y) => f(x, y)) - fold[Int, Int](f) -} - diff --git a/test/files/pos/t7902.scala b/test/files/pos/t7902.scala new file mode 100644 index 0000000000..47c525c179 --- /dev/null +++ b/test/files/pos/t7902.scala @@ -0,0 +1,17 @@ +import scala.language.higherKinds + +object Bug { + class Tag[W[M1[X1]]] + + def ofType[W[M2[X2]]]: Tag[W] = ??? + type InSeq [M3[X3]] = Some[M3[Any]] + + // fail + val x = ofType[InSeq] + + // okay + val y: Any = ofType[InSeq] + object T { + val z = ofType[InSeq] + } +} diff --git a/test/files/res/t687.check b/test/files/res/t687.check index b741b262b9..5f72c98636 100644 --- a/test/files/res/t687.check +++ b/test/files/res/t687.check @@ -1,8 +1,8 @@ nsc> nsc> t687/QueryB.scala:3: error: name clash between defined and inherited member: -method equals:(o: Object)Boolean and -method equals:(x$1: Any)Boolean in class Any -have same type after erasure: (o: Object)Boolean +def equals(x$1: Any): Boolean in class Any and +override def equals(o: Object): Boolean at line 3 +have same type after erasure: (x$1: Object)Boolean override def equals(o : Object) = false; ^ diff --git a/test/files/run/constrained-types.check b/test/files/run/constrained-types.check index f022aac1b2..d965d8a2ff 100644 --- a/test/files/run/constrained-types.check +++ b/test/files/run/constrained-types.check @@ -138,6 +138,15 @@ scala> val x = 3 : Int @Annot(e+f+g+h) // should have a graceful error message <console>:8: 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 + val x = 3 : Int @Annot(e+f+g+h) // should have a graceful error message + ^ +<console>:8: 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 + val x = 3 : Int @Annot(e+f+g+h) // should have a graceful error message + ^ scala> diff --git a/test/files/run/private-override.check b/test/files/run/private-override.check new file mode 100644 index 0000000000..00750edc07 --- /dev/null +++ b/test/files/run/private-override.check @@ -0,0 +1 @@ +3 diff --git a/test/files/run/private-override.scala b/test/files/run/private-override.scala new file mode 100644 index 0000000000..0a3f57f97c --- /dev/null +++ b/test/files/run/private-override.scala @@ -0,0 +1,17 @@ +package test.p1.p2 { + abstract class A { + private[p2] def f2(): Int = 1 + } + abstract class Other extends A { + // It's a private method - not a private[p2] method. Not a failed + // "weaker access privileges" override, a different namespace. + private def f2(): Int = super.f2() + 2 + def go() = f2() + } +} + +object Test extends test.p1.p2.Other { + def main(args: Array[String]): Unit = { + println(go()) + } +} diff --git a/test/files/run/repl-reset.check b/test/files/run/repl-reset.check index c6e147977a..ed95c7b8ff 100644 --- a/test/files/run/repl-reset.check +++ b/test/files/run/repl-reset.check @@ -33,6 +33,12 @@ 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 + ^ scala> val x1 = 4 x1: Int = 4 diff --git a/test/files/run/t7584b.scala b/test/files/run/t7584b.scala new file mode 100644 index 0000000000..fd560f0418 --- /dev/null +++ b/test/files/run/t7584b.scala @@ -0,0 +1,14 @@ +object Test extends App { + def fold[A, B](f: (A, => B) => B) = (b: B) => f(null.asInstanceOf[A], b) + def f[A, B](x: A, y: B): B = y + def bip[A, B] = fold[A, B]((x, y) => f(x, y)) + def bop[A, B] = fold[A, B](f(_, _)) + + // these work: + fold[Int, Int]((x, y) => f(x, y))(0) + fold[Int, Int](f(_, _))(0) + + // Used to throw a ClassCastException. Since the fix for SI-7899, these issue type errors. + // fold[Int, Int](f _)(0) + // fold[Int, Int](f)(0) +} diff --git a/test/files/run/t7899.scala b/test/files/run/t7899.scala new file mode 100644 index 0000000000..5879d4b9fe --- /dev/null +++ b/test/files/run/t7899.scala @@ -0,0 +1,5 @@ +object Test extends App { + def id[A](a: => A): A = null.asInstanceOf[A] + def foo(f: (=> Int) => Int) = () => f(???) + foo(id)() // should be allowed and not throw ??? +} |