diff options
Diffstat (limited to 'test/files/neg')
196 files changed, 1685 insertions, 754 deletions
diff --git a/test/files/neg/any-vs-anyref.check b/test/files/neg/any-vs-anyref.check new file mode 100644 index 0000000000..63c4853130 --- /dev/null +++ b/test/files/neg/any-vs-anyref.check @@ -0,0 +1,64 @@ +any-vs-anyref.scala:6: error: type mismatch; + found : a.type (with underlying type A) + required: AnyRef +Note that A is bounded only by Equals, which means AnyRef is not a known parent. +Such types can participate in value classes, but instances +cannot appear in singleton types or in reference comparisons. + def foo1[A <: Product](a: A) = { type X = a.type } + ^ +any-vs-anyref.scala:7: error: type mismatch; + found : a.type (with underlying type A) + required: AnyRef +Note that A is bounded only by Product, Quux, which means AnyRef is not a known parent. +Such types can participate in value classes, but instances +cannot appear in singleton types or in reference comparisons. + def foo2[A <: Product with Quux](a: A) = { type X = a.type } + ^ +any-vs-anyref.scala:8: error: type mismatch; + found : a.type (with underlying type Product) + required: AnyRef +Note that Product extends Any, not AnyRef. +Such types can participate in value classes, but instances +cannot appear in singleton types or in reference comparisons. + def foo3(a: Product) = { type X = a.type } + ^ +any-vs-anyref.scala:9: error: type mismatch; + found : Product with Quux + required: AnyRef +Note that the parents of this type (Product, Quux) extend Any, not AnyRef. +Such types can participate in value classes, but instances +cannot appear in singleton types or in reference comparisons. + def foo4(a: Product with Quux) = { type X = a.type } + ^ +any-vs-anyref.scala:10: error: value eq is not a member of Quux with Product +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:12: error: type mismatch; + found : Quux with Product{def eq(other: String): Boolean} + 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 foo7(x: Quux with Product { def eq(other: String): Boolean }) = (x eq "abc") && ("abc" eq x) + ^ +any-vs-anyref.scala:22: error: value eq is not a member of Bippy +Note that Bippy extends Any, not AnyRef. +Such types can participate in value classes, but instances +cannot appear in singleton types or in reference comparisons. + def bad1(x: Bippy, y: Bippy) = x eq y + ^ +any-vs-anyref.scala:27: error: type mismatch; + found : Quux{def g(x: String): String} + required: Quux{def g(x: Int): Int} + f(new Quux { def g(x: String) = x }) + ^ +9 errors found diff --git a/test/files/neg/any-vs-anyref.scala b/test/files/neg/any-vs-anyref.scala new file mode 100644 index 0000000000..8d237fbaec --- /dev/null +++ b/test/files/neg/any-vs-anyref.scala @@ -0,0 +1,29 @@ +trait Quux extends Any +trait QuuxRef extends AnyRef +final class Bippy(val x: Any) extends AnyVal with Quux + +object Foo { + def foo1[A <: Product](a: A) = { type X = a.type } + def foo2[A <: Product with Quux](a: A) = { type X = a.type } + def foo3(a: Product) = { type X = a.type } + def foo4(a: Product with Quux) = { type X = a.type } + def foo5(x: Quux with Product) = (x eq "abc") && ("abc" eq x) + def foo6(x: Quux with Product { def f: Int }) = (x eq "abc") && ("abc" eq x) + def foo7(x: Quux with Product { def eq(other: String): Boolean }) = (x eq "abc") && ("abc" eq x) + + def ok1[A <: QuuxRef](a: A) = { type X = a.type } + def ok2[A <: Product with QuuxRef](a: A) = { type X = a.type } + def ok3(a: QuuxRef) = { type X = a.type } + def ok4(a: Product with QuuxRef) = { type X = a.type } + def ok5(x: QuuxRef with Product) = (x eq "abc") && ("abc" eq x) + def ok6(x: QuuxRef with Product { def f: Int }) = (x eq "abc") && ("abc" eq x) + def ok7(x: QuuxRef { def eq(other: String): Boolean }) = (x eq "abc") && ("abc" eq x) + + def bad1(x: Bippy, y: Bippy) = x eq y +} + +object Bar { + def f(x: Quux { def g(x: Int): Int }): Int = x g 5 + f(new Quux { def g(x: String) = x }) + f(new Quux { def g(x: Int) = x }) +} diff --git a/test/files/neg/applydynamic_sip.check b/test/files/neg/applydynamic_sip.check index 8845f68a52..dcf97b29fc 100644 --- a/test/files/neg/applydynamic_sip.check +++ b/test/files/neg/applydynamic_sip.check @@ -7,4 +7,52 @@ applydynamic_sip.scala:8: error: applyDynamicNamed does not support passing a va applydynamic_sip.scala:9: error: applyDynamicNamed does not support passing a vararg parameter qual.sel(arg, arg2 = "a2", a2: _*) ^ -three errors found +applydynamic_sip.scala:18: error: type mismatch; + found : String("sel") + required: Int +error after rewriting to Test.this.bad1.selectDynamic("sel") +possible cause: maybe a wrong Dynamic method signature? + bad1.sel + ^ +applydynamic_sip.scala:19: error: type mismatch; + found : String("sel") + required: Int +error after rewriting to Test.this.bad1.applyDynamic("sel") +possible cause: maybe a wrong Dynamic method signature? + bad1.sel(1) + ^ +applydynamic_sip.scala:20: error: type mismatch; + found : String("sel") + required: Int +error after rewriting to Test.this.bad1.applyDynamicNamed("sel") +possible cause: maybe a wrong Dynamic method signature? + bad1.sel(a = 1) + ^ +applydynamic_sip.scala:21: error: type mismatch; + found : String("sel") + required: Int +error after rewriting to Test.this.bad1.updateDynamic("sel") +possible cause: maybe a wrong Dynamic method signature? + bad1.sel = 1 + ^ +applydynamic_sip.scala:29: error: Int does not take parameters +error after rewriting to Test.this.bad2.selectDynamic("sel") +possible cause: maybe a wrong Dynamic method signature? + bad2.sel + ^ +applydynamic_sip.scala:30: error: Int does not take parameters +error after rewriting to Test.this.bad2.applyDynamic("sel") +possible cause: maybe a wrong Dynamic method signature? + bad2.sel(1) + ^ +applydynamic_sip.scala:31: error: Int does not take parameters +error after rewriting to Test.this.bad2.applyDynamicNamed("sel") +possible cause: maybe a wrong Dynamic method signature? + 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 diff --git a/test/files/neg/applydynamic_sip.flags b/test/files/neg/applydynamic_sip.flags new file mode 100644 index 0000000000..1141f97507 --- /dev/null +++ b/test/files/neg/applydynamic_sip.flags @@ -0,0 +1 @@ +-language:dynamics diff --git a/test/files/neg/applydynamic_sip.scala b/test/files/neg/applydynamic_sip.scala index 362461577b..ee4432ebe6 100644 --- a/test/files/neg/applydynamic_sip.scala +++ b/test/files/neg/applydynamic_sip.scala @@ -7,4 +7,27 @@ object Test extends App { qual.sel(a, a2: _*) qual.sel(arg = a, a2: _*) qual.sel(arg, arg2 = "a2", a2: _*) -}
\ No newline at end of file + + val bad1 = new Dynamic { + def selectDynamic(n: Int) = n + def applyDynamic(n: Int) = n + def applyDynamicNamed(n: Int) = n + def updateDynamic(n: Int) = n + + } + bad1.sel + bad1.sel(1) + bad1.sel(a = 1) + bad1.sel = 1 + + val bad2 = new Dynamic { + def selectDynamic = 1 + def applyDynamic = 1 + def applyDynamicNamed = 1 + def updateDynamic = 1 + } + bad2.sel + bad2.sel(1) + bad2.sel(a = 1) + bad2.sel = 1 +} diff --git a/test/files/neg/checksensible.check b/test/files/neg/checksensible.check index 23af94180a..d785179a56 100644 --- a/test/files/neg/checksensible.check +++ b/test/files/neg/checksensible.check @@ -1,100 +1,100 @@ -checksensible.scala:13: error: comparing a fresh object using `eq' will always yield false
- (new AnyRef) eq (new AnyRef)
- ^
-checksensible.scala:14: error: comparing a fresh object using `ne' will always yield true
- (new AnyRef) ne (new AnyRef)
- ^
-checksensible.scala:15: error: comparing a fresh object using `eq' will always yield false
- Shmoopie eq (new AnyRef)
- ^
-checksensible.scala:16: error: comparing a fresh object using `eq' will always yield false
- (Shmoopie: AnyRef) eq (new AnyRef)
- ^
-checksensible.scala:17: error: comparing a fresh object using `eq' will always yield false
- (new AnyRef) eq Shmoopie
- ^
-checksensible.scala:18: error: comparing a fresh object using `eq' will always yield false
- (new AnyRef) eq null
- ^
-checksensible.scala:19: error: comparing a fresh object using `eq' will always yield false
- null eq new AnyRef
- ^
-checksensible.scala:26: error: comparing values of types Unit and Int using `==' will always yield false
- (c = 1) == 0
- ^
-checksensible.scala:27: error: comparing values of types Int and Unit using `==' will always yield false
- 0 == (c = 1)
- ^
-checksensible.scala:29: error: comparing values of types Int and String using `==' will always yield false
- 1 == "abc"
- ^
-checksensible.scala:33: error: comparing values of types Some[Int] and Int using `==' will always yield false
- Some(1) == 1 // as above
- ^
-checksensible.scala:38: error: comparing a fresh object using `==' will always yield false
- new AnyRef == 1
- ^
-checksensible.scala:41: error: comparing values of types Int and Boolean using `==' will always yield false
- 1 == (new java.lang.Boolean(true))
- ^
-checksensible.scala:43: error: comparing values of types Int and Boolean using `!=' will always yield true
- 1 != true
- ^
-checksensible.scala:44: error: comparing values of types Unit and Boolean using `==' will always yield false
- () == true
- ^
-checksensible.scala:45: error: comparing values of types Unit and Unit using `==' will always yield true
- () == ()
- ^
-checksensible.scala:46: error: comparing values of types Unit and Unit using `==' will always yield true
- () == println
- ^
-checksensible.scala:47: error: comparing values of types Unit and scala.runtime.BoxedUnit using `==' will always yield true
- () == scala.runtime.BoxedUnit.UNIT // these should warn for always being true/false
- ^
-checksensible.scala:48: error: comparing values of types scala.runtime.BoxedUnit and Unit using `!=' will always yield false
- scala.runtime.BoxedUnit.UNIT != ()
- ^
-checksensible.scala:51: error: comparing values of types Int and Unit using `!=' will always yield true
- (1 != println)
- ^
-checksensible.scala:52: error: comparing values of types Int and Symbol using `!=' will always yield true
- (1 != 'sym)
- ^
-checksensible.scala:58: error: comparing a fresh object using `==' will always yield false
- ((x: Int) => x + 1) == null
- ^
-checksensible.scala:59: error: comparing a fresh object using `==' will always yield false
- Bep == ((_: Int) + 1)
- ^
-checksensible.scala:61: error: comparing a fresh object using `==' will always yield false
- new Object == new Object
- ^
-checksensible.scala:62: error: comparing a fresh object using `==' will always yield false
- new Object == "abc"
- ^
-checksensible.scala:63: error: comparing a fresh object using `!=' will always yield true
- new Exception() != new Exception()
- ^
-checksensible.scala:66: error: comparing values of types Int and Null using `==' will always yield false
- if (foo.length == null) "plante" else "plante pas"
- ^
-checksensible.scala:71: error: comparing values of types Bip and Bop using `==' will always yield false
- (x1 == x2)
- ^
-checksensible.scala:81: error: comparing values of types EqEqRefTest.this.C3 and EqEqRefTest.this.Z1 using `==' will always yield false
- c3 == z1
- ^
-checksensible.scala:82: error: comparing values of types EqEqRefTest.this.Z1 and EqEqRefTest.this.C3 using `==' will always yield false
- z1 == c3
- ^
-checksensible.scala:83: error: comparing values of types EqEqRefTest.this.Z1 and EqEqRefTest.this.C3 using `!=' will always yield true
- z1 != c3
- ^
-checksensible.scala:84: error: comparing values of types EqEqRefTest.this.C3 and String using `!=' will always yield true
- c3 != "abc"
- ^
-checksensible.scala:95: error: comparing values of types Unit and Int using `!=' will always yield true
- while ((c = in.read) != -1)
- ^
-33 errors found
+checksensible.scala:13: error: comparing a fresh object using `eq' will always yield false + (new AnyRef) eq (new AnyRef) + ^ +checksensible.scala:14: error: comparing a fresh object using `ne' will always yield true + (new AnyRef) ne (new AnyRef) + ^ +checksensible.scala:15: error: comparing a fresh object using `eq' will always yield false + Shmoopie eq (new AnyRef) + ^ +checksensible.scala:16: error: comparing a fresh object using `eq' will always yield false + (Shmoopie: AnyRef) eq (new AnyRef) + ^ +checksensible.scala:17: error: comparing a fresh object using `eq' will always yield false + (new AnyRef) eq Shmoopie + ^ +checksensible.scala:18: error: comparing a fresh object using `eq' will always yield false + (new AnyRef) eq null + ^ +checksensible.scala:19: error: comparing a fresh object using `eq' will always yield false + null eq new AnyRef + ^ +checksensible.scala:26: error: comparing values of types Unit and Int using `==' will always yield false + (c = 1) == 0 + ^ +checksensible.scala:27: error: comparing values of types Int and Unit using `==' will always yield false + 0 == (c = 1) + ^ +checksensible.scala:29: error: comparing values of types Int and String using `==' will always yield false + 1 == "abc" + ^ +checksensible.scala:33: error: comparing values of types Some[Int] and Int using `==' will always yield false + Some(1) == 1 // as above + ^ +checksensible.scala:38: error: comparing a fresh object using `==' will always yield false + new AnyRef == 1 + ^ +checksensible.scala:41: error: comparing values of types Int and Boolean using `==' will always yield false + 1 == (new java.lang.Boolean(true)) + ^ +checksensible.scala:43: error: comparing values of types Int and Boolean using `!=' will always yield true + 1 != true + ^ +checksensible.scala:44: error: comparing values of types Unit and Boolean using `==' will always yield false + () == true + ^ +checksensible.scala:45: error: comparing values of types Unit and Unit using `==' will always yield true + () == () + ^ +checksensible.scala:46: error: comparing values of types Unit and Unit using `==' will always yield true + () == println + ^ +checksensible.scala:47: error: comparing values of types Unit and scala.runtime.BoxedUnit using `==' will always yield true + () == scala.runtime.BoxedUnit.UNIT // these should warn for always being true/false + ^ +checksensible.scala:48: error: comparing values of types scala.runtime.BoxedUnit and Unit using `!=' will always yield false + scala.runtime.BoxedUnit.UNIT != () + ^ +checksensible.scala:51: error: comparing values of types Int and Unit using `!=' will always yield true + (1 != println) + ^ +checksensible.scala:52: error: comparing values of types Int and Symbol using `!=' will always yield true + (1 != 'sym) + ^ +checksensible.scala:58: error: comparing a fresh object using `==' will always yield false + ((x: Int) => x + 1) == null + ^ +checksensible.scala:59: error: comparing a fresh object using `==' will always yield false + Bep == ((_: Int) + 1) + ^ +checksensible.scala:61: error: comparing a fresh object using `==' will always yield false + new Object == new Object + ^ +checksensible.scala:62: error: comparing a fresh object using `==' will always yield false + new Object == "abc" + ^ +checksensible.scala:63: error: comparing a fresh object using `!=' will always yield true + new Exception() != new Exception() + ^ +checksensible.scala:66: error: comparing values of types Int and Null using `==' will always yield false + if (foo.length == null) "plante" else "plante pas" + ^ +checksensible.scala:71: error: comparing values of types Bip and Bop using `==' will always yield false + (x1 == x2) + ^ +checksensible.scala:81: error: comparing values of types EqEqRefTest.this.C3 and EqEqRefTest.this.Z1 using `==' will always yield false + c3 == z1 + ^ +checksensible.scala:82: error: comparing values of types EqEqRefTest.this.Z1 and EqEqRefTest.this.C3 using `==' will always yield false + z1 == c3 + ^ +checksensible.scala:83: error: comparing values of types EqEqRefTest.this.Z1 and EqEqRefTest.this.C3 using `!=' will always yield true + z1 != c3 + ^ +checksensible.scala:84: error: comparing values of types EqEqRefTest.this.C3 and String using `!=' will always yield true + c3 != "abc" + ^ +checksensible.scala:95: error: comparing values of types Unit and Int using `!=' will always yield true + while ((c = in.read) != -1) + ^ +33 errors found diff --git a/test/files/neg/classmanifests_new_deprecations.check b/test/files/neg/classmanifests_new_deprecations.check index 841e893249..e10308a66f 100644 --- a/test/files/neg/classmanifests_new_deprecations.check +++ b/test/files/neg/classmanifests_new_deprecations.check @@ -1,61 +1,61 @@ -classmanifests_new_deprecations.scala:2: error: type ClassManifest in object Predef is deprecated: Use scala.reflect.ClassTag instead
- def cm1[T: ClassManifest] = ???
- ^
-classmanifests_new_deprecations.scala:3: error: type ClassManifest in object Predef is deprecated: Use scala.reflect.ClassTag instead
- def cm2[T](implicit evidence$1: ClassManifest[T]) = ???
- ^
-classmanifests_new_deprecations.scala:4: error: type ClassManifest in object Predef is deprecated: Use scala.reflect.ClassTag instead
- val cm3: ClassManifest[Int] = null
- ^
-classmanifests_new_deprecations.scala:4: error: type ClassManifest in object Predef is deprecated: Use scala.reflect.ClassTag instead
- val cm3: ClassManifest[Int] = null
- ^
-classmanifests_new_deprecations.scala:6: error: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead
- def rcm1[T: scala.reflect.ClassManifest] = ???
- ^
-classmanifests_new_deprecations.scala:7: error: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead
- def rcm2[T](implicit evidence$1: scala.reflect.ClassManifest[T]) = ???
- ^
-classmanifests_new_deprecations.scala:8: error: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead
- val rcm3: scala.reflect.ClassManifest[Int] = null
- ^
-classmanifests_new_deprecations.scala:8: error: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead
- val rcm3: scala.reflect.ClassManifest[Int] = null
- ^
-classmanifests_new_deprecations.scala:10: error: type ClassManifest in object Predef is deprecated: Use scala.reflect.ClassTag instead
- type CM[T] = ClassManifest[T]
- ^
-classmanifests_new_deprecations.scala:15: error: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead
- type RCM[T] = scala.reflect.ClassManifest[T]
- ^
-classmanifests_new_deprecations.scala:20: error: type Manifest in object Predef is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead
- def m1[T: Manifest] = ???
- ^
-classmanifests_new_deprecations.scala:21: error: type Manifest in object Predef is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead
- def m2[T](implicit evidence$1: Manifest[T]) = ???
- ^
-classmanifests_new_deprecations.scala:22: error: type Manifest in object Predef is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead
- val m3: Manifest[Int] = null
- ^
-classmanifests_new_deprecations.scala:22: error: type Manifest in object Predef is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead
- val m3: Manifest[Int] = null
- ^
-classmanifests_new_deprecations.scala:24: error: trait Manifest in package reflect is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead
- def rm1[T: scala.reflect.Manifest] = ???
- ^
-classmanifests_new_deprecations.scala:25: error: trait Manifest in package reflect is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead
- def rm2[T](implicit evidence$1: scala.reflect.Manifest[T]) = ???
- ^
-classmanifests_new_deprecations.scala:26: error: trait Manifest in package reflect is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead
- val rm3: scala.reflect.Manifest[Int] = null
- ^
-classmanifests_new_deprecations.scala:26: error: trait Manifest in package reflect is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead
- val rm3: scala.reflect.Manifest[Int] = null
- ^
-classmanifests_new_deprecations.scala:28: error: type Manifest in object Predef is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead
- type M[T] = Manifest[T]
- ^
-classmanifests_new_deprecations.scala:33: error: trait Manifest in package reflect is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead
- type RM[T] = scala.reflect.Manifest[T]
- ^
-20 errors found
+classmanifests_new_deprecations.scala:2: error: type ClassManifest in object Predef is deprecated: Use scala.reflect.ClassTag instead + def cm1[T: ClassManifest] = ??? + ^ +classmanifests_new_deprecations.scala:3: error: type ClassManifest in object Predef is deprecated: Use scala.reflect.ClassTag instead + def cm2[T](implicit evidence$1: ClassManifest[T]) = ??? + ^ +classmanifests_new_deprecations.scala:4: error: type ClassManifest in object Predef is deprecated: Use scala.reflect.ClassTag instead + val cm3: ClassManifest[Int] = null + ^ +classmanifests_new_deprecations.scala:4: error: type ClassManifest in object Predef is deprecated: Use scala.reflect.ClassTag instead + val cm3: ClassManifest[Int] = null + ^ +classmanifests_new_deprecations.scala:6: error: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead + def rcm1[T: scala.reflect.ClassManifest] = ??? + ^ +classmanifests_new_deprecations.scala:7: error: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead + def rcm2[T](implicit evidence$1: scala.reflect.ClassManifest[T]) = ??? + ^ +classmanifests_new_deprecations.scala:8: error: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead + val rcm3: scala.reflect.ClassManifest[Int] = null + ^ +classmanifests_new_deprecations.scala:8: error: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead + val rcm3: scala.reflect.ClassManifest[Int] = null + ^ +classmanifests_new_deprecations.scala:10: error: type ClassManifest in object Predef is deprecated: Use scala.reflect.ClassTag instead + type CM[T] = ClassManifest[T] + ^ +classmanifests_new_deprecations.scala:15: error: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead + type RCM[T] = scala.reflect.ClassManifest[T] + ^ +classmanifests_new_deprecations.scala:20: error: type Manifest in object Predef is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead + def m1[T: Manifest] = ??? + ^ +classmanifests_new_deprecations.scala:21: error: type Manifest in object Predef is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead + def m2[T](implicit evidence$1: Manifest[T]) = ??? + ^ +classmanifests_new_deprecations.scala:22: error: type Manifest in object Predef is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead + val m3: Manifest[Int] = null + ^ +classmanifests_new_deprecations.scala:22: error: type Manifest in object Predef is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead + val m3: Manifest[Int] = null + ^ +classmanifests_new_deprecations.scala:24: error: trait Manifest in package reflect is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead + def rm1[T: scala.reflect.Manifest] = ??? + ^ +classmanifests_new_deprecations.scala:25: error: trait Manifest in package reflect is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead + def rm2[T](implicit evidence$1: scala.reflect.Manifest[T]) = ??? + ^ +classmanifests_new_deprecations.scala:26: error: trait Manifest in package reflect is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead + val rm3: scala.reflect.Manifest[Int] = null + ^ +classmanifests_new_deprecations.scala:26: error: trait Manifest in package reflect is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead + val rm3: scala.reflect.Manifest[Int] = null + ^ +classmanifests_new_deprecations.scala:28: error: type Manifest in object Predef is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead + type M[T] = Manifest[T] + ^ +classmanifests_new_deprecations.scala:33: error: trait Manifest in package reflect is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead + type RM[T] = scala.reflect.Manifest[T] + ^ +20 errors found diff --git a/test/files/neg/classtags_contextbound_a.check b/test/files/neg/classtags_contextbound_a.check index f4b6ff5af1..5edb7f9a5a 100644 --- a/test/files/neg/classtags_contextbound_a.check +++ b/test/files/neg/classtags_contextbound_a.check @@ -1,4 +1,4 @@ -classtags_contextbound_a.scala:2: error: No ClassTag available for T
- def foo[T] = Array[T]()
- ^
-one error found
+classtags_contextbound_a.scala:2: error: No ClassTag available for T + def foo[T] = Array[T]() + ^ +one error found diff --git a/test/files/neg/classtags_contextbound_b.check b/test/files/neg/classtags_contextbound_b.check index e08ab504bc..e17ab8b0d1 100644 --- a/test/files/neg/classtags_contextbound_b.check +++ b/test/files/neg/classtags_contextbound_b.check @@ -1,4 +1,4 @@ -classtags_contextbound_b.scala:5: error: No ClassTag available for T
- def foo[T] = mkArray[T]
- ^
-one error found
+classtags_contextbound_b.scala:5: error: No ClassTag available for T + def foo[T] = mkArray[T] + ^ +one error found diff --git a/test/files/neg/classtags_contextbound_c.check b/test/files/neg/classtags_contextbound_c.check index f8768eea2b..e8666f7a10 100644 --- a/test/files/neg/classtags_contextbound_c.check +++ b/test/files/neg/classtags_contextbound_c.check @@ -1,4 +1,4 @@ -classtags_contextbound_c.scala:4: error: No ClassTag available for T
- def mkArray[T] = Array[T]()
- ^
-one error found
+classtags_contextbound_c.scala:4: error: No ClassTag available for T + def mkArray[T] = Array[T]() + ^ +one error found diff --git a/test/files/neg/classtags_dont_use_typetags.check b/test/files/neg/classtags_dont_use_typetags.check index 24585e7c3f..4f728d267d 100644 --- a/test/files/neg/classtags_dont_use_typetags.check +++ b/test/files/neg/classtags_dont_use_typetags.check @@ -1,4 +1,4 @@ -classtags_dont_use_typetags.scala:4: error: No ClassTag available for T
- def foo[T: TypeTag] = Array[T]()
- ^
-one error found
+classtags_dont_use_typetags.scala:4: error: No ClassTag available for T + def foo[T: TypeTag] = Array[T]() + ^ +one error found diff --git a/test/files/neg/deadline-inf-illegal.check b/test/files/neg/deadline-inf-illegal.check new file mode 100644 index 0000000000..530d2b2443 --- /dev/null +++ b/test/files/neg/deadline-inf-illegal.check @@ -0,0 +1,15 @@ +deadline-inf-illegal.scala:5: error: value fromNow is not a member of scala.concurrent.duration.Duration + d.fromNow + ^ +deadline-inf-illegal.scala:6: error: type mismatch; + found : scala.concurrent.duration.Duration + required: scala.concurrent.duration.FiniteDuration + Deadline.now + d + ^ +deadline-inf-illegal.scala:7: error: overloaded method value - with alternatives: + (other: scala.concurrent.duration.Deadline)scala.concurrent.duration.FiniteDuration <and> + (other: scala.concurrent.duration.FiniteDuration)scala.concurrent.duration.Deadline + cannot be applied to (scala.concurrent.duration.Duration) + Deadline.now - d + ^ +three errors found diff --git a/test/files/neg/deadline-inf-illegal.scala b/test/files/neg/deadline-inf-illegal.scala new file mode 100644 index 0000000000..942cea7014 --- /dev/null +++ b/test/files/neg/deadline-inf-illegal.scala @@ -0,0 +1,8 @@ +import concurrent.duration.{ Deadline, Duration } + +class T { + val d: Duration = Duration.Zero + d.fromNow + Deadline.now + d + Deadline.now - d +} diff --git a/test/files/neg/implicit-shadow.check b/test/files/neg/implicit-shadow.check new file mode 100644 index 0000000000..042fca867a --- /dev/null +++ b/test/files/neg/implicit-shadow.check @@ -0,0 +1,11 @@ +implicit-shadow.scala:4: <i2s: error> is not a valid implicit value for Int(1) => ?{def isEmpty: ?} because: +reference to i2s is ambiguous; +it is imported twice in the same scope by +import C._ +and import B._ + 1.isEmpty + ^ +implicit-shadow.scala:4: error: value isEmpty is not a member of Int + 1.isEmpty + ^ +one error found diff --git a/test/files/neg/implicit-shadow.flags b/test/files/neg/implicit-shadow.flags new file mode 100644 index 0000000000..44842a9d65 --- /dev/null +++ b/test/files/neg/implicit-shadow.flags @@ -0,0 +1 @@ +-Xlog-implicits diff --git a/test/files/neg/implicit-shadow.scala b/test/files/neg/implicit-shadow.scala new file mode 100644 index 0000000000..ffd34b6408 --- /dev/null +++ b/test/files/neg/implicit-shadow.scala @@ -0,0 +1,13 @@ +object Test { + import B._, C._ + + 1.isEmpty +} + +trait A { + implicit def i2s(i: Int): String = "" +} + +object B extends A + +object C extends A
\ No newline at end of file diff --git a/test/files/neg/interop_abstypetags_arenot_classmanifests.check b/test/files/neg/interop_abstypetags_arenot_classmanifests.check index 15bdcfc5b1..d15e33346c 100644 --- a/test/files/neg/interop_abstypetags_arenot_classmanifests.check +++ b/test/files/neg/interop_abstypetags_arenot_classmanifests.check @@ -1,4 +1,4 @@ -interop_abstypetags_arenot_classmanifests.scala:5: error: No ClassManifest available for T.
- println(classManifest[T])
- ^
-one error found
+interop_abstypetags_arenot_classmanifests.scala:5: error: No ClassManifest available for T. + println(classManifest[T]) + ^ +one error found diff --git a/test/files/neg/interop_abstypetags_arenot_classmanifests.scala b/test/files/neg/interop_abstypetags_arenot_classmanifests.scala index c8567be5d4..5d88c90ffd 100644 --- a/test/files/neg/interop_abstypetags_arenot_classmanifests.scala +++ b/test/files/neg/interop_abstypetags_arenot_classmanifests.scala @@ -1,11 +1,11 @@ import scala.reflect.runtime.universe._ object Test extends App { - def absTypeTagIsnotClassManifest[T: AbsTypeTag] = { + def weakTypeTagIsnotClassManifest[T: WeakTypeTag] = { println(classManifest[T]) } - absTypeTagIsnotClassManifest[Int] - absTypeTagIsnotClassManifest[String] - absTypeTagIsnotClassManifest[Array[Int]] + weakTypeTagIsnotClassManifest[Int] + weakTypeTagIsnotClassManifest[String] + weakTypeTagIsnotClassManifest[Array[Int]] }
\ No newline at end of file diff --git a/test/files/neg/interop_abstypetags_arenot_classtags.check b/test/files/neg/interop_abstypetags_arenot_classtags.check index 637db83e57..3aa7a50b50 100644 --- a/test/files/neg/interop_abstypetags_arenot_classtags.check +++ b/test/files/neg/interop_abstypetags_arenot_classtags.check @@ -1,4 +1,4 @@ -interop_abstypetags_arenot_classtags.scala:6: error: No ClassTag available for T
- println(classTag[T])
- ^
-one error found
+interop_abstypetags_arenot_classtags.scala:6: error: No ClassTag available for T + println(classTag[T]) + ^ +one error found diff --git a/test/files/neg/interop_abstypetags_arenot_classtags.scala b/test/files/neg/interop_abstypetags_arenot_classtags.scala index e3911c1588..de1f8657b6 100644 --- a/test/files/neg/interop_abstypetags_arenot_classtags.scala +++ b/test/files/neg/interop_abstypetags_arenot_classtags.scala @@ -2,11 +2,11 @@ import scala.reflect.runtime.universe._ import scala.reflect.{ClassTag, classTag} object Test extends App { - def absTypeTagIsnotClassTag[T: AbsTypeTag] = { + def weakTypeTagIsnotClassTag[T: WeakTypeTag] = { println(classTag[T]) } - absTypeTagIsnotClassTag[Int] - absTypeTagIsnotClassTag[String] - absTypeTagIsnotClassTag[Array[Int]] + weakTypeTagIsnotClassTag[Int] + weakTypeTagIsnotClassTag[String] + weakTypeTagIsnotClassTag[Array[Int]] }
\ No newline at end of file diff --git a/test/files/neg/interop_abstypetags_arenot_manifests.check b/test/files/neg/interop_abstypetags_arenot_manifests.check index c80635543f..5916b68742 100644 --- a/test/files/neg/interop_abstypetags_arenot_manifests.check +++ b/test/files/neg/interop_abstypetags_arenot_manifests.check @@ -1,4 +1,4 @@ -interop_abstypetags_arenot_manifests.scala:5: error: No Manifest available for T.
- println(manifest[T])
- ^
-one error found
+interop_abstypetags_arenot_manifests.scala:5: error: No Manifest available for T. + println(manifest[T]) + ^ +one error found diff --git a/test/files/neg/interop_abstypetags_arenot_manifests.scala b/test/files/neg/interop_abstypetags_arenot_manifests.scala index 77a95048fd..1ca3673ce4 100644 --- a/test/files/neg/interop_abstypetags_arenot_manifests.scala +++ b/test/files/neg/interop_abstypetags_arenot_manifests.scala @@ -1,11 +1,11 @@ import scala.reflect.runtime.universe._ object Test extends App { - def absTypeTagIsnotManifest[T: AbsTypeTag] = { + def weakTypeTagIsnotManifest[T: WeakTypeTag] = { println(manifest[T]) } - absTypeTagIsnotManifest[Int] - absTypeTagIsnotManifest[String] - absTypeTagIsnotManifest[Array[Int]] + weakTypeTagIsnotManifest[Int] + weakTypeTagIsnotManifest[String] + weakTypeTagIsnotManifest[Array[Int]] }
\ No newline at end of file diff --git a/test/files/neg/interop_classmanifests_arenot_typetags.check b/test/files/neg/interop_classmanifests_arenot_typetags.check index 6675fd9eae..db8e57981a 100644 --- a/test/files/neg/interop_classmanifests_arenot_typetags.check +++ b/test/files/neg/interop_classmanifests_arenot_typetags.check @@ -1,4 +1,4 @@ -interop_classmanifests_arenot_typetags.scala:5: error: No TypeTag available for T
- println(implicitly[TypeTag[T]])
- ^
-one error found
+interop_classmanifests_arenot_typetags.scala:5: error: No TypeTag available for T + println(implicitly[TypeTag[T]]) + ^ +one error found diff --git a/test/files/neg/interop_classtags_arenot_manifests.check b/test/files/neg/interop_classtags_arenot_manifests.check index 6982f0b805..fa805b5918 100644 --- a/test/files/neg/interop_classtags_arenot_manifests.check +++ b/test/files/neg/interop_classtags_arenot_manifests.check @@ -1,4 +1,4 @@ -interop_classtags_arenot_manifests.scala:5: error: No Manifest available for T.
- println(manifest[T])
- ^
-one error found
+interop_classtags_arenot_manifests.scala:5: error: No Manifest available for T. + println(manifest[T]) + ^ +one error found diff --git a/test/files/neg/interop_typetags_arenot_classmanifests.check b/test/files/neg/interop_typetags_arenot_classmanifests.check index b404f94d69..88fb1647e5 100644 --- a/test/files/neg/interop_typetags_arenot_classmanifests.check +++ b/test/files/neg/interop_typetags_arenot_classmanifests.check @@ -1,4 +1,4 @@ -interop_typetags_arenot_classmanifests.scala:5: error: No ClassManifest available for T.
- println(classManifest[T])
- ^
-one error found
+interop_typetags_arenot_classmanifests.scala:5: error: No ClassManifest available for T. + println(classManifest[T]) + ^ +one error found diff --git a/test/files/neg/interop_typetags_arenot_classtags.check b/test/files/neg/interop_typetags_arenot_classtags.check index 673ad2f941..1d1fb15f9e 100644 --- a/test/files/neg/interop_typetags_arenot_classtags.check +++ b/test/files/neg/interop_typetags_arenot_classtags.check @@ -1,4 +1,4 @@ -interop_typetags_arenot_classtags.scala:6: error: No ClassTag available for T
- println(classTag[T])
- ^
-one error found
+interop_typetags_arenot_classtags.scala:6: error: No ClassTag available for T + println(classTag[T]) + ^ +one error found diff --git a/test/files/neg/interop_typetags_without_classtags_arenot_manifests.check b/test/files/neg/interop_typetags_without_classtags_arenot_manifests.check index a95f1ad308..ba744a8837 100644 --- a/test/files/neg/interop_typetags_without_classtags_arenot_manifests.check +++ b/test/files/neg/interop_typetags_without_classtags_arenot_manifests.check @@ -1,6 +1,6 @@ -interop_typetags_without_classtags_arenot_manifests.scala:6: error: to create a manifest here, it is necessary to interoperate with the type tag `evidence$1` in scope.
-however typetag -> manifest conversion requires a class tag for the corresponding type to be present.
-to proceed add a class tag to the type `T` (e.g. by introducing a context bound) and recompile.
- println(manifest[T])
- ^
-one error found
+interop_typetags_without_classtags_arenot_manifests.scala:6: error: to create a manifest here, it is necessary to interoperate with the type tag `evidence$1` in scope. +however typetag -> manifest conversion requires a class tag for the corresponding type to be present. +to proceed add a class tag to the type `T` (e.g. by introducing a context bound) and recompile. + println(manifest[T]) + ^ +one error found diff --git a/test/files/neg/javaConversions-2.10-ambiguity.check b/test/files/neg/javaConversions-2.10-ambiguity.check new file mode 100644 index 0000000000..c064a22964 --- /dev/null +++ b/test/files/neg/javaConversions-2.10-ambiguity.check @@ -0,0 +1,6 @@ +javaConversions-2.10-ambiguity.scala:8: error: type mismatch; + found : scala.collection.concurrent.Map[String,String] + required: scala.collection.mutable.ConcurrentMap[String,String] + assertType[mutable.ConcurrentMap[String, String]](a) + ^ +one error found diff --git a/test/files/neg/javaConversions-2.10-ambiguity.scala b/test/files/neg/javaConversions-2.10-ambiguity.scala new file mode 100644 index 0000000000..e856846a29 --- /dev/null +++ b/test/files/neg/javaConversions-2.10-ambiguity.scala @@ -0,0 +1,10 @@ +import collection.{JavaConversions, mutable, concurrent} +import JavaConversions._ +import java.util.concurrent.{ConcurrentHashMap => CHM} + +object Bar { + def assertType[T](t: T) = t + val a = new CHM[String, String]() += (("", "")) + assertType[mutable.ConcurrentMap[String, String]](a) +} +// vim: set et: diff --git a/test/files/neg/macro-basic-mamdmi.check b/test/files/neg/macro-basic-mamdmi.check index 67b00c0ec5..c7b58d70d2 100644 --- a/test/files/neg/macro-basic-mamdmi.check +++ b/test/files/neg/macro-basic-mamdmi.check @@ -1,4 +1,4 @@ -Impls_Macros_Test_1.scala:36: error: macro implementation not found: foo (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
+Impls_Macros_Test_1.scala:36: error: macro implementation not found: foo (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/macro-deprecate-idents.check b/test/files/neg/macro-deprecate-idents.check index f8a7e519df..22b667c390 100644 --- a/test/files/neg/macro-deprecate-idents.check +++ b/test/files/neg/macro-deprecate-idents.check @@ -1,52 +1,52 @@ -macro-deprecate-idents.scala:2: error: macro is now a reserved word; usage as an identifier is deprecated
- val macro = ???
- ^
-macro-deprecate-idents.scala:6: error: macro is now a reserved word; usage as an identifier is deprecated
- var macro = ???
- ^
-macro-deprecate-idents.scala:10: error: macro is now a reserved word; usage as an identifier is deprecated
- type macro = Int
- ^
-macro-deprecate-idents.scala:14: error: macro is now a reserved word; usage as an identifier is deprecated
- class macro
- ^
-macro-deprecate-idents.scala:18: error: macro is now a reserved word; usage as an identifier is deprecated
- class macro
- ^
-macro-deprecate-idents.scala:22: error: macro is now a reserved word; usage as an identifier is deprecated
- object macro
- ^
-macro-deprecate-idents.scala:26: error: macro is now a reserved word; usage as an identifier is deprecated
- object macro
- ^
-macro-deprecate-idents.scala:30: error: macro is now a reserved word; usage as an identifier is deprecated
- trait macro
- ^
-macro-deprecate-idents.scala:34: error: macro is now a reserved word; usage as an identifier is deprecated
- trait macro
- ^
-macro-deprecate-idents.scala:37: error: macro is now a reserved word; usage as an identifier is deprecated
-package macro {
- ^
-macro-deprecate-idents.scala:38: error: macro is now a reserved word; usage as an identifier is deprecated
- package macro.bar {
- ^
-macro-deprecate-idents.scala:43: error: macro is now a reserved word; usage as an identifier is deprecated
- package macro.foo {
- ^
-macro-deprecate-idents.scala:48: error: macro is now a reserved word; usage as an identifier is deprecated
- val Some(macro) = Some(42)
- ^
-macro-deprecate-idents.scala:49: error: macro is now a reserved word; usage as an identifier is deprecated
- macro match {
- ^
-macro-deprecate-idents.scala:50: error: macro is now a reserved word; usage as an identifier is deprecated
- case macro => println(macro)
- ^
-macro-deprecate-idents.scala:50: error: macro is now a reserved word; usage as an identifier is deprecated
- case macro => println(macro)
- ^
-macro-deprecate-idents.scala:55: error: macro is now a reserved word; usage as an identifier is deprecated
- def macro = 2
- ^
-17 errors found
+macro-deprecate-idents.scala:2: error: macro is now a reserved word; usage as an identifier is deprecated + val macro = ??? + ^ +macro-deprecate-idents.scala:6: error: macro is now a reserved word; usage as an identifier is deprecated + var macro = ??? + ^ +macro-deprecate-idents.scala:10: error: macro is now a reserved word; usage as an identifier is deprecated + type macro = Int + ^ +macro-deprecate-idents.scala:14: error: macro is now a reserved word; usage as an identifier is deprecated + class macro + ^ +macro-deprecate-idents.scala:18: error: macro is now a reserved word; usage as an identifier is deprecated + class macro + ^ +macro-deprecate-idents.scala:22: error: macro is now a reserved word; usage as an identifier is deprecated + object macro + ^ +macro-deprecate-idents.scala:26: error: macro is now a reserved word; usage as an identifier is deprecated + object macro + ^ +macro-deprecate-idents.scala:30: error: macro is now a reserved word; usage as an identifier is deprecated + trait macro + ^ +macro-deprecate-idents.scala:34: error: macro is now a reserved word; usage as an identifier is deprecated + trait macro + ^ +macro-deprecate-idents.scala:37: error: macro is now a reserved word; usage as an identifier is deprecated +package macro { + ^ +macro-deprecate-idents.scala:38: error: macro is now a reserved word; usage as an identifier is deprecated + package macro.bar { + ^ +macro-deprecate-idents.scala:43: error: macro is now a reserved word; usage as an identifier is deprecated + package macro.foo { + ^ +macro-deprecate-idents.scala:48: error: macro is now a reserved word; usage as an identifier is deprecated + val Some(macro) = Some(42) + ^ +macro-deprecate-idents.scala:49: error: macro is now a reserved word; usage as an identifier is deprecated + macro match { + ^ +macro-deprecate-idents.scala:50: error: macro is now a reserved word; usage as an identifier is deprecated + case macro => println(macro) + ^ +macro-deprecate-idents.scala:50: error: macro is now a reserved word; usage as an identifier is deprecated + case macro => println(macro) + ^ +macro-deprecate-idents.scala:55: error: macro is now a reserved word; usage as an identifier is deprecated + def macro = 2 + ^ +17 errors found diff --git a/test/files/neg/macro-invalidimpl-a.check b/test/files/neg/macro-invalidimpl-a.check index 855fe2d169..7f11f3b865 100644 --- a/test/files/neg/macro-invalidimpl-a.check +++ b/test/files/neg/macro-invalidimpl-a.check @@ -1,4 +1,4 @@ -Macros_Test_2.scala:3: error: macro implementation must be in statically accessible object
- def foo(x: Any) = macro impls.foo
- ^
-one error found
+Macros_Test_2.scala:3: error: macro implementation must be in statically accessible object + def foo(x: Any) = macro impls.foo + ^ +one error found diff --git a/test/files/neg/macro-invalidimpl-b.check b/test/files/neg/macro-invalidimpl-b.check index 855fe2d169..7f11f3b865 100644 --- a/test/files/neg/macro-invalidimpl-b.check +++ b/test/files/neg/macro-invalidimpl-b.check @@ -1,4 +1,4 @@ -Macros_Test_2.scala:3: error: macro implementation must be in statically accessible object
- def foo(x: Any) = macro impls.foo
- ^
-one error found
+Macros_Test_2.scala:3: error: macro implementation must be in statically accessible object + def foo(x: Any) = macro impls.foo + ^ +one error found diff --git a/test/files/neg/macro-invalidimpl-c.check b/test/files/neg/macro-invalidimpl-c.check index 722ec3c7bd..9e0181c0a3 100644 --- a/test/files/neg/macro-invalidimpl-c.check +++ b/test/files/neg/macro-invalidimpl-c.check @@ -1,4 +1,4 @@ -Impls_Macros_1.scala:8: error: macro implementation must be in statically accessible object
- def foo(x: Any) = macro Impls.foo
- ^
-one error found
+Impls_Macros_1.scala:8: error: macro implementation must be in statically accessible object + def foo(x: Any) = macro Impls.foo + ^ +one error found diff --git a/test/files/neg/macro-invalidimpl-d.check b/test/files/neg/macro-invalidimpl-d.check index 6fedfa74fc..76a5ba9c8c 100644 --- a/test/files/neg/macro-invalidimpl-d.check +++ b/test/files/neg/macro-invalidimpl-d.check @@ -1,4 +1,4 @@ -Macros_Test_2.scala:2: error: macro implementation must be in statically accessible object
- def foo(x: Any) = macro Impls.foo
- ^
-one error found
+Macros_Test_2.scala:2: error: macro implementation must be in statically accessible object + def foo(x: Any) = macro Impls.foo + ^ +one error found diff --git a/test/files/neg/macro-invalidimpl-e.check b/test/files/neg/macro-invalidimpl-e.check index 5cfcf85625..e0910b2899 100644 --- a/test/files/neg/macro-invalidimpl-e.check +++ b/test/files/neg/macro-invalidimpl-e.check @@ -1,13 +1,13 @@ -Macros_Test_2.scala:2: error: ambiguous reference to overloaded definition,
-both method foo in object Impls of type (c: scala.reflect.macros.Context)(x: c.Expr[Any], y: c.Expr[Any])Nothing
-and method foo in object Impls of type (c: scala.reflect.macros.Context)(x: c.Expr[Any])Nothing
-match expected type ?
- def foo(x: Any) = macro Impls.foo
- ^
-Macros_Test_2.scala:3: error: ambiguous reference to overloaded definition,
-both method foo in object Impls of type (c: scala.reflect.macros.Context)(x: c.Expr[Any], y: c.Expr[Any])Nothing
-and method foo in object Impls of type (c: scala.reflect.macros.Context)(x: c.Expr[Any])Nothing
-match expected type ?
- def foo(x: Any, y: Any) = macro Impls.foo
- ^
-two errors found
+Macros_Test_2.scala:2: error: ambiguous reference to overloaded definition, +both method foo in object Impls of type (c: scala.reflect.macros.Context)(x: c.Expr[Any], y: c.Expr[Any])Nothing +and method foo in object Impls of type (c: scala.reflect.macros.Context)(x: c.Expr[Any])Nothing +match expected type ? + def foo(x: Any) = macro Impls.foo + ^ +Macros_Test_2.scala:3: error: ambiguous reference to overloaded definition, +both method foo in object Impls of type (c: scala.reflect.macros.Context)(x: c.Expr[Any], y: c.Expr[Any])Nothing +and method foo in object Impls of type (c: scala.reflect.macros.Context)(x: c.Expr[Any])Nothing +match expected type ? + def foo(x: Any, y: Any) = macro Impls.foo + ^ +two errors found diff --git a/test/files/neg/macro-invalidimpl-f.check b/test/files/neg/macro-invalidimpl-f.check index 14f1e25287..4e5851f566 100644 --- a/test/files/neg/macro-invalidimpl-f.check +++ b/test/files/neg/macro-invalidimpl-f.check @@ -1,7 +1,7 @@ -Macros_Test_2.scala:2: error: macro implementation has wrong shape:
- required: (c: scala.reflect.macros.Context)(): c.Expr[Unit]
- found : (c: scala.reflect.macros.Context): c.Expr[Unit]
-number of parameter sections differ
- def bar1() = macro Impls.fooNullary
- ^
-one error found
+Macros_Test_2.scala:2: error: macro implementation has wrong shape: + required: (c: scala.reflect.macros.Context)(): c.Expr[Unit] + found : (c: scala.reflect.macros.Context): c.Expr[Unit] +number of parameter sections differ + def bar1() = macro Impls.fooNullary + ^ +one error found diff --git a/test/files/neg/macro-invalidimpl-g.check b/test/files/neg/macro-invalidimpl-g.check index a886436d35..7342f7336f 100644 --- a/test/files/neg/macro-invalidimpl-g.check +++ b/test/files/neg/macro-invalidimpl-g.check @@ -1,7 +1,7 @@ -Macros_Test_2.scala:2: error: macro implementation has wrong shape:
- required: (c: scala.reflect.macros.Context): c.Expr[Unit]
- found : (c: scala.reflect.macros.Context)(): c.Expr[Unit]
-number of parameter sections differ
- def foo1 = macro Impls.fooEmpty
- ^
-one error found
+Macros_Test_2.scala:2: error: macro implementation has wrong shape: + required: (c: scala.reflect.macros.Context): c.Expr[Unit] + found : (c: scala.reflect.macros.Context)(): c.Expr[Unit] +number of parameter sections differ + def foo1 = macro Impls.fooEmpty + ^ +one error found diff --git a/test/files/neg/macro-invalidimpl-h.check b/test/files/neg/macro-invalidimpl-h.check index cc7fc794d3..ea76e1aeac 100644 --- a/test/files/neg/macro-invalidimpl-h.check +++ b/test/files/neg/macro-invalidimpl-h.check @@ -1,4 +1,4 @@ -Macros_Test_2.scala:2: error: type arguments [String] do not conform to method foo's type parameter bounds [U <: Int]
- def foo = macro Impls.foo[String]
- ^
-one error found
+Macros_Test_2.scala:2: error: type arguments [String] do not conform to method foo's type parameter bounds [U <: Int] + def foo = macro Impls.foo[String] + ^ +one error found diff --git a/test/files/neg/macro-invalidimpl-i.check b/test/files/neg/macro-invalidimpl-i.check new file mode 100644 index 0000000000..846ed8d134 --- /dev/null +++ b/test/files/neg/macro-invalidimpl-i.check @@ -0,0 +1,4 @@ +Macros_Test_2.scala:4: error: macro implementation must be public + def foo = macro Impls.impl + ^ +one error found diff --git a/test/files/neg/macro-invalidusage-badbounds.flags b/test/files/neg/macro-invalidimpl-i.flags index cd66464f2f..cd66464f2f 100644 --- a/test/files/neg/macro-invalidusage-badbounds.flags +++ b/test/files/neg/macro-invalidimpl-i.flags diff --git a/test/files/neg/macro-invalidimpl-i/Impls_1.scala b/test/files/neg/macro-invalidimpl-i/Impls_1.scala new file mode 100644 index 0000000000..c35d8ab3c1 --- /dev/null +++ b/test/files/neg/macro-invalidimpl-i/Impls_1.scala @@ -0,0 +1,7 @@ +package foo + +import scala.reflect.macros.Context + +object Impls { + private[foo] def impl(c: Context) = ??? +}
\ No newline at end of file diff --git a/test/files/neg/macro-invalidimpl-i/Macros_Test_2.scala b/test/files/neg/macro-invalidimpl-i/Macros_Test_2.scala new file mode 100644 index 0000000000..fb129c70be --- /dev/null +++ b/test/files/neg/macro-invalidimpl-i/Macros_Test_2.scala @@ -0,0 +1,5 @@ +package foo + +object Test extends App { + def foo = macro Impls.impl +} diff --git a/test/files/neg/macro-invalidret-nontree.check b/test/files/neg/macro-invalidret-nontree.check index 78ab08df3e..6d8336d06d 100644 --- a/test/files/neg/macro-invalidret-nontree.check +++ b/test/files/neg/macro-invalidret-nontree.check @@ -1,7 +1,7 @@ -Macros_Test_2.scala:2: error: macro implementation has wrong shape:
- required: (c: scala.reflect.macros.Context): c.Expr[Any]
- found : (c: scala.reflect.macros.Context): Int
-type mismatch for return type: Int does not conform to c.Expr[Any]
- def foo = macro Impls.foo
- ^
-one error found
+Macros_Test_2.scala:2: error: macro implementation has wrong shape: + required: (c: scala.reflect.macros.Context): c.Expr[Any] + found : (c: scala.reflect.macros.Context): Int +type mismatch for return type: Int does not conform to c.Expr[Any] + def foo = macro Impls.foo + ^ +one error found diff --git a/test/files/neg/macro-invalidret-nonuniversetree.check b/test/files/neg/macro-invalidret-nonuniversetree.check index 09df2c0a92..089bfd0dc9 100644 --- a/test/files/neg/macro-invalidret-nonuniversetree.check +++ b/test/files/neg/macro-invalidret-nonuniversetree.check @@ -1,7 +1,7 @@ -Macros_Test_2.scala:2: error: macro implementation has wrong shape:
- required: (c: scala.reflect.macros.Context): c.Expr[Any]
- found : (c: scala.reflect.macros.Context): reflect.basis.Literal
-type mismatch for return type: reflect.basis.Literal does not conform to c.Expr[Any]
- def foo = macro Impls.foo
- ^
-one error found
+Macros_Test_2.scala:2: error: macro implementation has wrong shape: + required: (c: scala.reflect.macros.Context): c.Expr[Any] + found : (c: scala.reflect.macros.Context): reflect.runtime.universe.Literal +type mismatch for return type: reflect.runtime.universe.Literal does not conform to c.Expr[Any] + def foo = macro Impls.foo + ^ +one error found diff --git a/test/files/neg/macro-invalidret-nonuniversetree/Impls_1.scala b/test/files/neg/macro-invalidret-nonuniversetree/Impls_1.scala index 8311d474c2..f98376a2ba 100644 --- a/test/files/neg/macro-invalidret-nonuniversetree/Impls_1.scala +++ b/test/files/neg/macro-invalidret-nonuniversetree/Impls_1.scala @@ -1,5 +1,6 @@ import scala.reflect.macros.{Context => Ctx} +import scala.reflect.runtime.{universe => ru} object Impls { - def foo(c: Ctx) = scala.reflect.basis.Literal(scala.reflect.basis.Constant(42)) + def foo(c: Ctx) = ru.Literal(ru.Constant(42)) } diff --git a/test/files/neg/macro-invalidshape-a.check b/test/files/neg/macro-invalidshape-a.check index 246b5c3226..f38a90819e 100644 --- a/test/files/neg/macro-invalidshape-a.check +++ b/test/files/neg/macro-invalidshape-a.check @@ -1,6 +1,5 @@ -Macros_Test_2.scala:2: error: macro body has wrong shape:
- required: macro <reference to implementation object>.<implementation method name>
- or : macro <implementation method name>
- def foo(x: Any) = macro 2
- ^
-one error found
+Macros_Test_2.scala:2: error: macro body has wrong shape: + required: macro [<implementation object>].<method name>[[<type args>]] + def foo(x: Any) = macro 2 + ^ +one error found diff --git a/test/files/neg/macro-invalidshape-b.check b/test/files/neg/macro-invalidshape-b.check index 59701d023b..976685c6bd 100644 --- a/test/files/neg/macro-invalidshape-b.check +++ b/test/files/neg/macro-invalidshape-b.check @@ -1,6 +1,5 @@ -Macros_Test_2.scala:2: error: macro body has wrong shape:
- required: macro <reference to implementation object>.<implementation method name>
- or : macro <implementation method name>
- def foo(x: Any) = macro Impls.foo(null)(null)
- ^
-one error found
+Macros_Test_2.scala:2: error: macro body has wrong shape: + required: macro [<implementation object>].<method name>[[<type args>]] + def foo(x: Any) = macro Impls.foo(null)(null) + ^ +one error found diff --git a/test/files/neg/macro-invalidshape-c.check b/test/files/neg/macro-invalidshape-c.check index 84d8c35222..0b2e9cfe4f 100644 --- a/test/files/neg/macro-invalidshape-c.check +++ b/test/files/neg/macro-invalidshape-c.check @@ -1,6 +1,9 @@ -Macros_Test_2.scala:2: error: macro body has wrong shape:
- required: macro <reference to implementation object>.<implementation method name>
- or : macro <implementation method name>
- def foo(x: Any) = macro {2; Impls.foo}
- ^
-one error found
+Macros_Test_2.scala:2: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + def foo(x: Any) = macro {2; Impls.foo} + ^ +Macros_Test_2.scala:2: error: missing arguments for method foo in object Impls; +follow this method with `_' if you want to treat it as a partially applied function + def foo(x: Any) = macro {2; Impls.foo} + ^ +one warning found +one error found diff --git a/test/files/neg/macro-invalidshape-d.check b/test/files/neg/macro-invalidshape-d.check index f0d77e2f2d..e43a2ca0ab 100644 --- a/test/files/neg/macro-invalidshape-d.check +++ b/test/files/neg/macro-invalidshape-d.check @@ -1,8 +1,8 @@ -Macros_Test_2.scala:2: warning: macro is now a reserved word; usage as an identifier is deprecated
- def foo(x: Any) = {2; macro Impls.foo}
- ^
-Macros_Test_2.scala:2: error: ';' expected but '.' found.
- def foo(x: Any) = {2; macro Impls.foo}
- ^
-one warning found
-one error found
+Macros_Test_2.scala:2: warning: macro is now a reserved word; usage as an identifier is deprecated + def foo(x: Any) = {2; macro Impls.foo} + ^ +Macros_Test_2.scala:2: error: ';' expected but '.' found. + def foo(x: Any) = {2; macro Impls.foo} + ^ +one warning found +one error found diff --git a/test/files/neg/macro-invalidsig-context-bounds.check b/test/files/neg/macro-invalidsig-context-bounds.check index 894eabc442..43b8c23b35 100644 --- a/test/files/neg/macro-invalidsig-context-bounds.check +++ b/test/files/neg/macro-invalidsig-context-bounds.check @@ -1,4 +1,7 @@ -Impls_1.scala:5: error: macro implementations cannot have implicit parameters other than AbsTypeTag evidences
- def foo[U: c.AbsTypeTag: Numeric](c: Ctx) = {
- ^
-one error found
+Macros_Test_1.scala:2: error: macro implementation has wrong shape: + required: (c: scala.reflect.macros.Context): c.Expr[Any] + found : (c: scala.reflect.macros.Context)(implicit evidence$2: Numeric[U]): c.universe.Literal +macro implementations cannot have implicit parameters other than WeakTypeTag evidences + def foo[U] = macro Impls.foo[U] + ^ +one error found diff --git a/test/files/neg/macro-invalidsig-context-bounds/Impls_1.scala b/test/files/neg/macro-invalidsig-context-bounds/Impls_1.scala index 5aa9a7eaf9..c066c485b1 100644 --- a/test/files/neg/macro-invalidsig-context-bounds/Impls_1.scala +++ b/test/files/neg/macro-invalidsig-context-bounds/Impls_1.scala @@ -2,7 +2,7 @@ import scala.reflect.runtime.universe._ import scala.reflect.macros.{Context => Ctx} object Impls { - def foo[U: c.AbsTypeTag: Numeric](c: Ctx) = { + def foo[U: c.WeakTypeTag: Numeric](c: Ctx) = { import c.universe._ Literal(Constant(42)) } diff --git a/test/files/neg/macro-invalidsig-ctx-badargc.check b/test/files/neg/macro-invalidsig-ctx-badargc.check index 8a1ca6a8b1..1c14072a94 100644 --- a/test/files/neg/macro-invalidsig-ctx-badargc.check +++ b/test/files/neg/macro-invalidsig-ctx-badargc.check @@ -1,7 +1,7 @@ -Macros_Test_2.scala:2: error: macro implementation has wrong shape:
- required: (c: scala.reflect.macros.Context): c.Expr[Any]
- found : : Nothing
-number of parameter sections differ
- def foo = macro Impls.foo
- ^
-one error found
+Macros_Test_2.scala:2: error: macro implementation has wrong shape: + required: (c: scala.reflect.macros.Context): c.Expr[Any] + found : : Nothing +number of parameter sections differ + def foo = macro Impls.foo + ^ +one error found diff --git a/test/files/neg/macro-invalidsig-ctx-badtype.check b/test/files/neg/macro-invalidsig-ctx-badtype.check index 9e57ab8631..340ace6a38 100644 --- a/test/files/neg/macro-invalidsig-ctx-badtype.check +++ b/test/files/neg/macro-invalidsig-ctx-badtype.check @@ -1,7 +1,7 @@ -Macros_Test_2.scala:2: error: macro implementation has wrong shape:
- required: (c: scala.reflect.macros.Context): c.Expr[Any]
- found : (c: scala.reflect.api.Universe): Nothing
-type mismatch for parameter c: scala.reflect.macros.Context does not conform to scala.reflect.api.Universe
- def foo = macro Impls.foo
- ^
-one error found
+Macros_Test_2.scala:2: error: macro implementation has wrong shape: + required: (c: scala.reflect.macros.Context): c.Expr[Any] + found : (c: scala.reflect.api.Universe): Nothing +type mismatch for parameter c: scala.reflect.macros.Context does not conform to scala.reflect.api.Universe + def foo = macro Impls.foo + ^ +one error found diff --git a/test/files/neg/macro-invalidsig-ctx-badvarargs.check b/test/files/neg/macro-invalidsig-ctx-badvarargs.check index 37941a7dc9..a6478f03e3 100644 --- a/test/files/neg/macro-invalidsig-ctx-badvarargs.check +++ b/test/files/neg/macro-invalidsig-ctx-badvarargs.check @@ -1,7 +1,7 @@ -Macros_Test_2.scala:2: error: macro implementation has wrong shape:
- required: (c: scala.reflect.macros.Context): c.Expr[Any]
- found : (cs: scala.reflect.macros.Context*): Nothing
-types incompatible for parameter cs: corresponding is not a vararg parameter
- def foo = macro Impls.foo
- ^
-one error found
+Macros_Test_2.scala:2: error: macro implementation has wrong shape: + required: (c: scala.reflect.macros.Context): c.Expr[Any] + found : (cs: scala.reflect.macros.Context*): Nothing +types incompatible for parameter cs: corresponding is not a vararg parameter + def foo = macro Impls.foo + ^ +one error found diff --git a/test/files/neg/macro-invalidsig-ctx-noctx.check b/test/files/neg/macro-invalidsig-ctx-noctx.check index 722fe9dfb6..b7dc9a449b 100644 --- a/test/files/neg/macro-invalidsig-ctx-noctx.check +++ b/test/files/neg/macro-invalidsig-ctx-noctx.check @@ -1,7 +1,7 @@ -Macros_Test_2.scala:2: error: macro implementation has wrong shape:
- required: (c: scala.reflect.macros.Context)(x: c.Expr[Any]): c.Expr[Any]
- found : (c: scala.reflect.macros.Context): Nothing
-number of parameter sections differ
- def foo(x: Any) = macro Impls.foo
- ^
-one error found
+Macros_Test_2.scala:2: error: macro implementation has wrong shape: + required: (c: scala.reflect.macros.Context)(x: c.Expr[Any]): c.Expr[Any] + found : (c: scala.reflect.macros.Context): Nothing +number of parameter sections differ + def foo(x: Any) = macro Impls.foo + ^ +one error found diff --git a/test/files/neg/macro-invalidsig-implicit-params.check b/test/files/neg/macro-invalidsig-implicit-params.check index 029b8a4634..f210eb8a32 100644 --- a/test/files/neg/macro-invalidsig-implicit-params.check +++ b/test/files/neg/macro-invalidsig-implicit-params.check @@ -1,4 +1,7 @@ -Impls_Macros_1.scala:5: error: macro implementations cannot have implicit parameters other than AbsTypeTag evidences
- def foo_targs[T, U: c.AbsTypeTag](c: Ctx)(implicit x: c.Expr[Int]) = {
- ^
-one error found
+Impls_Macros_1.scala:18: error: macro implementation has wrong shape: + required: (c: scala.reflect.macros.Context)(x: c.Expr[Int]): c.Expr[Unit] + found : (c: scala.reflect.macros.Context)(implicit x: c.Expr[Int]): c.Expr[Unit] +macro implementations cannot have implicit parameters other than WeakTypeTag evidences + def foo_targs[U](x: Int) = macro Impls.foo_targs[T, U] + ^ +one error found diff --git a/test/files/neg/macro-invalidsig-implicit-params/Impls_Macros_1.scala b/test/files/neg/macro-invalidsig-implicit-params/Impls_Macros_1.scala index f724538993..845a168ff2 100644 --- a/test/files/neg/macro-invalidsig-implicit-params/Impls_Macros_1.scala +++ b/test/files/neg/macro-invalidsig-implicit-params/Impls_Macros_1.scala @@ -2,13 +2,13 @@ import scala.reflect.runtime.universe._ import scala.reflect.macros.{Context => Ctx} object Impls { - def foo_targs[T, U: c.AbsTypeTag](c: Ctx)(implicit x: c.Expr[Int]) = { + def foo_targs[T, U: c.WeakTypeTag](c: Ctx)(implicit x: c.Expr[Int]) = { import c.{prefix => prefix} import c.universe._ val body = Block( Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("invoking foo_targs...")))), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("type of prefix is: " + prefix.staticType)))), - Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("U is: " + implicitly[c.AbsTypeTag[U]].tpe)))), + Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("U is: " + implicitly[c.WeakTypeTag[U]].tpe)))), Literal(Constant(()))) c.Expr[Unit](body) } diff --git a/test/files/neg/macro-invalidsig-params-badargc.check b/test/files/neg/macro-invalidsig-params-badargc.check index ab4fb535c5..3f6d815b8e 100644 --- a/test/files/neg/macro-invalidsig-params-badargc.check +++ b/test/files/neg/macro-invalidsig-params-badargc.check @@ -1,7 +1,7 @@ -Impls_Macros_1.scala:8: error: macro implementation has wrong shape:
- required: (c: scala.reflect.macros.Context)(x: c.Expr[Int]): c.Expr[Any]
- found : (c: scala.reflect.macros.Context)(x: c.Expr[Int], y: c.Expr[Int]): Nothing
-parameter lists have different length, found extra parameter y: c.Expr[Int]
- def foo(x: Int) = macro Impls.foo
- ^
-one error found
+Impls_Macros_1.scala:8: error: macro implementation has wrong shape: + required: (c: scala.reflect.macros.Context)(x: c.Expr[Int]): c.Expr[Any] + found : (c: scala.reflect.macros.Context)(x: c.Expr[Int], y: c.Expr[Int]): Nothing +parameter lists have different length, found extra parameter y: c.Expr[Int] + def foo(x: Int) = macro Impls.foo + ^ +one error found diff --git a/test/files/neg/macro-invalidsig-params-badtype.check b/test/files/neg/macro-invalidsig-params-badtype.check index 007620a366..3ec40d7e5b 100644 --- a/test/files/neg/macro-invalidsig-params-badtype.check +++ b/test/files/neg/macro-invalidsig-params-badtype.check @@ -1,7 +1,7 @@ -Impls_Macros_1.scala:8: error: macro implementation has wrong shape:
- required: (c: scala.reflect.macros.Context)(x: c.Expr[Int]): c.Expr[Any]
- found : (c: scala.reflect.macros.Context)(x: c.universe.Tree): Nothing
-type mismatch for parameter x: c.Expr[Int] does not conform to c.universe.Tree
- def foo(x: Int) = macro Impls.foo
- ^
-one error found
+Impls_Macros_1.scala:8: error: macro implementation has wrong shape: + required: (c: scala.reflect.macros.Context)(x: c.Expr[Int]): c.Expr[Any] + found : (c: scala.reflect.macros.Context)(x: c.universe.Tree): Nothing +type mismatch for parameter x: c.Expr[Int] does not conform to c.universe.Tree + def foo(x: Int) = macro Impls.foo + ^ +one error found diff --git a/test/files/neg/macro-invalidsig-params-badvarargs.check b/test/files/neg/macro-invalidsig-params-badvarargs.check index f0dcc24d03..50607ff52d 100644 --- a/test/files/neg/macro-invalidsig-params-badvarargs.check +++ b/test/files/neg/macro-invalidsig-params-badvarargs.check @@ -1,7 +1,7 @@ -Impls_Macros_1.scala:8: error: macro implementation has wrong shape:
- required: (c: scala.reflect.macros.Context)(x: c.Expr[Int], y: c.Expr[Int]): c.Expr[Any]
- found : (c: scala.reflect.macros.Context)(xs: c.Expr[Int]*): Nothing
-parameter lists have different length, required extra parameter y: c.Expr[Int]
- def foo(x: Int, y: Int) = macro Impls.foo
- ^
-one error found
+Impls_Macros_1.scala:8: error: macro implementation has wrong shape: + required: (c: scala.reflect.macros.Context)(x: c.Expr[Int], y: c.Expr[Int]): c.Expr[Any] + found : (c: scala.reflect.macros.Context)(xs: c.Expr[Int]*): Nothing +parameter lists have different length, required extra parameter y: c.Expr[Int] + def foo(x: Int, y: Int) = macro Impls.foo + ^ +one error found diff --git a/test/files/neg/macro-invalidsig-params-namemismatch.check b/test/files/neg/macro-invalidsig-params-namemismatch.check index 00d781a2ac..4029bc8129 100644 --- a/test/files/neg/macro-invalidsig-params-namemismatch.check +++ b/test/files/neg/macro-invalidsig-params-namemismatch.check @@ -1,7 +1,7 @@ -Impls_Macros_1.scala:8: error: macro implementation has wrong shape:
- required: (c: scala.reflect.macros.Context)(x: c.Expr[Int], y: c.Expr[Int]): c.Expr[Any]
- found : (c: scala.reflect.macros.Context)(y: c.Expr[Int], x: c.Expr[Int]): Nothing
-parameter names differ: x != y
- def foo(x: Int, y: Int) = macro Impls.foo
- ^
-one error found
+Impls_Macros_1.scala:8: error: macro implementation has wrong shape: + required: (c: scala.reflect.macros.Context)(x: c.Expr[Int], y: c.Expr[Int]): c.Expr[Any] + found : (c: scala.reflect.macros.Context)(y: c.Expr[Int], x: c.Expr[Int]): Nothing +parameter names differ: x != y + def foo(x: Int, y: Int) = macro Impls.foo + ^ +one error found diff --git a/test/files/neg/macro-invalidsig-tparams-badtype.check b/test/files/neg/macro-invalidsig-tparams-badtype.check index e5e8366ba4..e9f3547133 100644 --- a/test/files/neg/macro-invalidsig-tparams-badtype.check +++ b/test/files/neg/macro-invalidsig-tparams-badtype.check @@ -1,7 +1,7 @@ -Macros_Test_2.scala:2: error: macro implementation has wrong shape:
- required: (c: scala.reflect.macros.Context): c.Expr[Any]
- found : (c: scala.reflect.macros.Context)(U: c.universe.Type): Nothing
-number of parameter sections differ
- def foo[U] = macro Impls.foo[U]
- ^
-one error found
+Macros_Test_2.scala:2: error: macro implementation has wrong shape: + required: (c: scala.reflect.macros.Context): c.Expr[Any] + found : (c: scala.reflect.macros.Context)(U: c.universe.Type): Nothing +number of parameter sections differ + def foo[U] = macro Impls.foo[U] + ^ +one error found diff --git a/test/files/neg/macro-invalidsig-tparams-bounds-a.check b/test/files/neg/macro-invalidsig-tparams-bounds-a.check index 6ba80b45c0..b6248a1c47 100644 --- a/test/files/neg/macro-invalidsig-tparams-bounds-a.check +++ b/test/files/neg/macro-invalidsig-tparams-bounds-a.check @@ -1,4 +1,4 @@ -Macros_Test_2.scala:2: error: type arguments [U] do not conform to method foo's type parameter bounds [U <: String]
- def foo[U] = macro Impls.foo[U]
- ^
-one error found
+Macros_Test_2.scala:2: error: type arguments [U] do not conform to method foo's type parameter bounds [U <: String] + def foo[U] = macro Impls.foo[U] + ^ +one error found diff --git a/test/files/neg/macro-invalidsig-tparams-bounds-b.check b/test/files/neg/macro-invalidsig-tparams-bounds-b.check index 50f0944acc..74eb522cdd 100644 --- a/test/files/neg/macro-invalidsig-tparams-bounds-b.check +++ b/test/files/neg/macro-invalidsig-tparams-bounds-b.check @@ -1,4 +1,4 @@ -Macros_Test_2.scala:2: error: type arguments [U] do not conform to method foo's type parameter bounds [U <: String]
- def foo[U <: Int] = macro Impls.foo[U]
- ^
-one error found
+Macros_Test_2.scala:2: error: type arguments [U] do not conform to method foo's type parameter bounds [U <: String] + def foo[U <: Int] = macro Impls.foo[U] + ^ +one error found diff --git a/test/files/neg/macro-invalidsig-tparams-notparams-a.check b/test/files/neg/macro-invalidsig-tparams-notparams-a.check index 5b4ef42ea5..61a5628b7e 100644 --- a/test/files/neg/macro-invalidsig-tparams-notparams-a.check +++ b/test/files/neg/macro-invalidsig-tparams-notparams-a.check @@ -1,4 +1,4 @@ -Macros_Test_2.scala:2: error: macro implementation reference needs type arguments
- def foo = macro Impls.foo
- ^
-one error found
+Macros_Test_2.scala:2: error: wrong number of type parameters for method foo: [U](c: scala.reflect.macros.Context)(implicit evidence$1: c.WeakTypeTag[U])Nothing + def foo = macro Impls.foo + ^ +one error found diff --git a/test/files/neg/macro-invalidsig-tparams-notparams-a/Impls_1.scala b/test/files/neg/macro-invalidsig-tparams-notparams-a/Impls_1.scala index afbe0f0915..f8b3c92869 100644 --- a/test/files/neg/macro-invalidsig-tparams-notparams-a/Impls_1.scala +++ b/test/files/neg/macro-invalidsig-tparams-notparams-a/Impls_1.scala @@ -2,5 +2,5 @@ import scala.reflect.runtime.universe._ import scala.reflect.macros.{Context => Ctx} object Impls { - def foo[U: c.AbsTypeTag](c: Ctx) = ??? + def foo[U: c.WeakTypeTag](c: Ctx) = ??? }
\ No newline at end of file diff --git a/test/files/neg/macro-invalidsig-tparams-notparams-b.check b/test/files/neg/macro-invalidsig-tparams-notparams-b.check index 261e3b8293..a605af6beb 100644 --- a/test/files/neg/macro-invalidsig-tparams-notparams-b.check +++ b/test/files/neg/macro-invalidsig-tparams-notparams-b.check @@ -1,4 +1,4 @@ -Macros_Test_2.scala:3: error: macro implementation reference needs type arguments
- def foo[V] = macro Impls.foo
- ^
-one error found
+Macros_Test_2.scala:3: error: wrong number of type parameters for method foo: [T, U, V](c: scala.reflect.macros.Context)(implicit evidence$1: c.WeakTypeTag[T], implicit evidence$2: c.WeakTypeTag[U], implicit V: c.WeakTypeTag[V])c.Expr[Unit] + def foo[V] = macro Impls.foo + ^ +one error found diff --git a/test/files/neg/macro-invalidsig-tparams-notparams-b/Impls_1.scala b/test/files/neg/macro-invalidsig-tparams-notparams-b/Impls_1.scala index b48f9d5f98..baf3aab9e3 100644 --- a/test/files/neg/macro-invalidsig-tparams-notparams-b/Impls_1.scala +++ b/test/files/neg/macro-invalidsig-tparams-notparams-b/Impls_1.scala @@ -2,9 +2,9 @@ import scala.reflect.runtime.universe._ import scala.reflect.macros.{Context => Ctx} object Impls { - def foo[T: c.AbsTypeTag, U: c.AbsTypeTag, V](c: Ctx)(implicit V: c.AbsTypeTag[V]): c.Expr[Unit] = { - println(implicitly[c.AbsTypeTag[T]]) - println(implicitly[c.AbsTypeTag[U]]) + def foo[T: c.WeakTypeTag, U: c.WeakTypeTag, V](c: Ctx)(implicit V: c.WeakTypeTag[V]): c.Expr[Unit] = { + println(implicitly[c.WeakTypeTag[T]]) + println(implicitly[c.WeakTypeTag[U]]) println(V) c.literalUnit } diff --git a/test/files/neg/macro-invalidsig-tparams-notparams-c.check b/test/files/neg/macro-invalidsig-tparams-notparams-c.check index b1078fb233..0be0b6fad1 100644 --- a/test/files/neg/macro-invalidsig-tparams-notparams-c.check +++ b/test/files/neg/macro-invalidsig-tparams-notparams-c.check @@ -1,4 +1,4 @@ -Macros_Test_2.scala:3: error: wrong number of type parameters for method foo: [T, U, V](c: scala.reflect.macros.Context)(implicit evidence$1: c.AbsTypeTag[T], implicit evidence$2: c.AbsTypeTag[U], implicit V: c.AbsTypeTag[V])c.Expr[Unit]
- def foo[V] = macro Impls.foo[V]
- ^
-one error found
+Macros_Test_2.scala:3: error: wrong number of type parameters for method foo: [T, U, V](c: scala.reflect.macros.Context)(implicit evidence$1: c.WeakTypeTag[T], implicit evidence$2: c.WeakTypeTag[U], implicit V: c.WeakTypeTag[V])c.Expr[Unit] + def foo[V] = macro Impls.foo[V] + ^ +one error found diff --git a/test/files/neg/macro-invalidsig-tparams-notparams-c/Impls_1.scala b/test/files/neg/macro-invalidsig-tparams-notparams-c/Impls_1.scala index 3506bdc789..44b4ed6ab3 100644 --- a/test/files/neg/macro-invalidsig-tparams-notparams-c/Impls_1.scala +++ b/test/files/neg/macro-invalidsig-tparams-notparams-c/Impls_1.scala @@ -2,10 +2,10 @@ import scala.reflect.runtime.universe._ import scala.reflect.macros.{Context => Ctx} object Impls { - def foo[T: c.AbsTypeTag, U: c.AbsTypeTag, V](c: Ctx)(implicit V: c.AbsTypeTag[V]): c.Expr[Unit] = { + def foo[T: c.WeakTypeTag, U: c.WeakTypeTag, V](c: Ctx)(implicit V: c.WeakTypeTag[V]): c.Expr[Unit] = { import c.universe._ - println(implicitly[c.AbsTypeTag[T]]) - println(implicitly[c.AbsTypeTag[U]]) + println(implicitly[c.WeakTypeTag[T]]) + println(implicitly[c.WeakTypeTag[U]]) println(V) c.literalUnit } diff --git a/test/files/neg/macro-invalidusage-badargs.check b/test/files/neg/macro-invalidusage-badargs.check index 52beda5b61..294cfd0cf5 100644 --- a/test/files/neg/macro-invalidusage-badargs.check +++ b/test/files/neg/macro-invalidusage-badargs.check @@ -1,6 +1,6 @@ -Macros_Test_2.scala:7: error: type mismatch;
- found : String("42")
- required: Int
- val s: String = foo("42")
- ^
-one error found
+Macros_Test_2.scala:7: error: type mismatch; + found : String("42") + required: Int + val s: String = foo("42") + ^ +one error found diff --git a/test/files/neg/macro-invalidusage-badbounds.check b/test/files/neg/macro-invalidusage-badbounds-a.check index fd0b64533e..277f407d38 100644 --- a/test/files/neg/macro-invalidusage-badbounds.check +++ b/test/files/neg/macro-invalidusage-badbounds-a.check @@ -1,4 +1,4 @@ -Macros_Test_2.scala:7: error: type arguments [Int] do not conform to macro method foo's type parameter bounds [U <: String]
- foo[Int]
- ^
-one error found
+Macros_Test_2.scala:7: error: type arguments [Int] do not conform to macro method foo's type parameter bounds [U <: String] + foo[Int] + ^ +one error found diff --git a/test/files/neg/macro-invalidusage-badbounds-a.flags b/test/files/neg/macro-invalidusage-badbounds-a.flags new file mode 100644 index 0000000000..cd66464f2f --- /dev/null +++ b/test/files/neg/macro-invalidusage-badbounds-a.flags @@ -0,0 +1 @@ +-language:experimental.macros
\ No newline at end of file diff --git a/test/files/neg/macro-invalidusage-badbounds/Impls_1.scala b/test/files/neg/macro-invalidusage-badbounds-a/Impls_1.scala index 89020de7dd..6ee71a3628 100644 --- a/test/files/neg/macro-invalidusage-badbounds/Impls_1.scala +++ b/test/files/neg/macro-invalidusage-badbounds-a/Impls_1.scala @@ -1,5 +1,5 @@ import scala.reflect.macros.{Context => Ctx} object Impls { - def foo[U <: String](c: Ctx) = ??? + def foo[U <: String](c: Ctx) = c.literalUnit } diff --git a/test/files/neg/macro-invalidusage-badbounds/Macros_Test_2.scala b/test/files/neg/macro-invalidusage-badbounds-a/Macros_Test_2.scala index 3139599108..3139599108 100644 --- a/test/files/neg/macro-invalidusage-badbounds/Macros_Test_2.scala +++ b/test/files/neg/macro-invalidusage-badbounds-a/Macros_Test_2.scala diff --git a/test/files/neg/macro-invalidusage-badtargs.check b/test/files/neg/macro-invalidusage-badtargs.check index 61ef6f5af7..73801ab43e 100644 --- a/test/files/neg/macro-invalidusage-badtargs.check +++ b/test/files/neg/macro-invalidusage-badtargs.check @@ -1,4 +1,4 @@ -Macros_Test_2.scala:7: error: macro method foo: (x: Int)Int does not take type parameters.
- val s: String = foo[String](42)
- ^
-one error found
+Macros_Test_2.scala:7: error: macro method foo: (x: Int)Int does not take type parameters. + val s: String = foo[String](42) + ^ +one error found diff --git a/test/files/neg/macro-invalidusage-methodvaluesyntax.check b/test/files/neg/macro-invalidusage-methodvaluesyntax.check index 27b2023202..10046b2305 100644 --- a/test/files/neg/macro-invalidusage-methodvaluesyntax.check +++ b/test/files/neg/macro-invalidusage-methodvaluesyntax.check @@ -1,4 +1,4 @@ -Macros_Test_2.scala:6: error: macros cannot be eta-expanded
- val firstClassFoo = Macros.foo _
- ^
-one error found
+Macros_Test_2.scala:6: error: macros cannot be eta-expanded + val firstClassFoo = Macros.foo _ + ^ +one error found diff --git a/test/files/neg/macro-noexpand.check b/test/files/neg/macro-noexpand.check index c829bbab71..2c176a99be 100644 --- a/test/files/neg/macro-noexpand.check +++ b/test/files/neg/macro-noexpand.check @@ -1,4 +1,4 @@ -Macros_Test_2.scala:7: error: not found: value x
- foo(x)
- ^
-one error found
+Macros_Test_2.scala:7: error: not found: value x + foo(x) + ^ +one error found diff --git a/test/files/neg/macro-nontypeablebody.check b/test/files/neg/macro-nontypeablebody.check index 0cfc864df8..9f5831ab30 100644 --- a/test/files/neg/macro-nontypeablebody.check +++ b/test/files/neg/macro-nontypeablebody.check @@ -1,4 +1,4 @@ -Macros_Test_2.scala:2: error: value foo2 is not a member of object Impls
- def foo(x: Any) = macro Impls.foo2
- ^
-one error found
+Macros_Test_2.scala:2: error: value foo2 is not a member of object Impls + def foo(x: Any) = macro Impls.foo2 + ^ +one error found diff --git a/test/files/neg/macro-override-macro-overrides-abstract-method-a.check b/test/files/neg/macro-override-macro-overrides-abstract-method-a.check index 4d95dfc45c..895e0dca50 100644 --- a/test/files/neg/macro-override-macro-overrides-abstract-method-a.check +++ b/test/files/neg/macro-override-macro-overrides-abstract-method-a.check @@ -1,5 +1,5 @@ -Impls_Macros_1.scala:12: error: overriding method foo in trait Foo of type (x: Int)Int;
- macro method foo cannot override an abstract method
- def foo(x: Int) = macro Impls.impl
- ^
-one error found
+Impls_Macros_1.scala:12: error: overriding method foo in trait Foo of type (x: Int)Int; + macro method foo cannot override an abstract method + def foo(x: Int) = macro Impls.impl + ^ +one error found diff --git a/test/files/neg/macro-override-macro-overrides-abstract-method-b.check b/test/files/neg/macro-override-macro-overrides-abstract-method-b.check index 4d95dfc45c..895e0dca50 100644 --- a/test/files/neg/macro-override-macro-overrides-abstract-method-b.check +++ b/test/files/neg/macro-override-macro-overrides-abstract-method-b.check @@ -1,5 +1,5 @@ -Impls_Macros_1.scala:12: error: overriding method foo in trait Foo of type (x: Int)Int;
- macro method foo cannot override an abstract method
- def foo(x: Int) = macro Impls.impl
- ^
-one error found
+Impls_Macros_1.scala:12: error: overriding method foo in trait Foo of type (x: Int)Int; + macro method foo cannot override an abstract method + def foo(x: Int) = macro Impls.impl + ^ +one error found diff --git a/test/files/neg/macro-override-method-overrides-macro.check b/test/files/neg/macro-override-method-overrides-macro.check index 42edb0ff23..66dc11be96 100644 --- a/test/files/neg/macro-override-method-overrides-macro.check +++ b/test/files/neg/macro-override-method-overrides-macro.check @@ -1,5 +1,5 @@ -Macros_Test_2.scala:8: error: overriding macro method foo in class B of type (x: String)Unit;
- method foo cannot override a macro
- override def foo(x: String) = println("fooDString")
- ^
-one error found
+Macros_Test_2.scala:8: error: overriding macro method foo in class B of type (x: String)Unit; + method foo cannot override a macro + override def foo(x: String) = println("fooDString") + ^ +one error found diff --git a/test/files/neg/macro-reify-typetag-hktypeparams-notags.check b/test/files/neg/macro-reify-typetag-hktypeparams-notags.check index 742d87b0a4..44efaae775 100644 --- a/test/files/neg/macro-reify-typetag-hktypeparams-notags.check +++ b/test/files/neg/macro-reify-typetag-hktypeparams-notags.check @@ -1,7 +1,7 @@ -Test.scala:5: error: No TypeTag available for C[T]
- println(implicitly[TypeTag[C[T]]])
- ^
-Test.scala:6: error: No TypeTag available for List[C[T]]
- println(implicitly[TypeTag[List[C[T]]]])
- ^
-two errors found
+Test.scala:5: error: No TypeTag available for C[T] + println(implicitly[TypeTag[C[T]]]) + ^ +Test.scala:6: error: No TypeTag available for List[C[T]] + println(implicitly[TypeTag[List[C[T]]]]) + ^ +two errors found diff --git a/test/files/neg/macro-reify-typetag-typeparams-notags.check b/test/files/neg/macro-reify-typetag-typeparams-notags.check index db88260047..7c67b02aa6 100644 --- a/test/files/neg/macro-reify-typetag-typeparams-notags.check +++ b/test/files/neg/macro-reify-typetag-typeparams-notags.check @@ -1,7 +1,7 @@ -Test.scala:5: error: No TypeTag available for T
- println(implicitly[TypeTag[T]])
- ^
-Test.scala:6: error: No TypeTag available for List[T]
- println(implicitly[TypeTag[List[T]]])
- ^
-two errors found
+Test.scala:5: error: No TypeTag available for T + println(implicitly[TypeTag[T]]) + ^ +Test.scala:6: error: No TypeTag available for List[T] + println(implicitly[TypeTag[List[T]]]) + ^ +two errors found diff --git a/test/files/neg/macro-reify-typetag-useabstypetag.check b/test/files/neg/macro-reify-typetag-useabstypetag.check index db88260047..7c67b02aa6 100644 --- a/test/files/neg/macro-reify-typetag-useabstypetag.check +++ b/test/files/neg/macro-reify-typetag-useabstypetag.check @@ -1,7 +1,7 @@ -Test.scala:5: error: No TypeTag available for T
- println(implicitly[TypeTag[T]])
- ^
-Test.scala:6: error: No TypeTag available for List[T]
- println(implicitly[TypeTag[List[T]]])
- ^
-two errors found
+Test.scala:5: error: No TypeTag available for T + println(implicitly[TypeTag[T]]) + ^ +Test.scala:6: error: No TypeTag available for List[T] + println(implicitly[TypeTag[List[T]]]) + ^ +two errors found diff --git a/test/files/neg/macro-reify-typetag-useabstypetag/Test.scala b/test/files/neg/macro-reify-typetag-useabstypetag/Test.scala index b66ad6c523..1e7fcb3f45 100644 --- a/test/files/neg/macro-reify-typetag-useabstypetag/Test.scala +++ b/test/files/neg/macro-reify-typetag-useabstypetag/Test.scala @@ -1,7 +1,7 @@ import scala.reflect.runtime.universe._ object Test extends App { - def fooTypeTag[T: AbsTypeTag] = { + def fooTypeTag[T: WeakTypeTag] = { println(implicitly[TypeTag[T]]) println(implicitly[TypeTag[List[T]]]) } diff --git a/test/files/neg/macro-without-xmacros-a.check b/test/files/neg/macro-without-xmacros-a.check index fd2667dbb8..ae6c6c695a 100644 --- a/test/files/neg/macro-without-xmacros-a.check +++ b/test/files/neg/macro-without-xmacros-a.check @@ -1,17 +1,17 @@ -Macros_2.scala:5: error: macro definition needs to be enabled
-by making the implicit value language.experimental.macros visible.
-This can be achieved by adding the import clause 'import language.experimental.macros'
-or by setting the compiler option -language:experimental.macros.
-See the Scala docs for value scala.language.experimental.macros for a discussion
-why the feature needs to be explicitly enabled.
- def foo(x: Int): Int = macro foo_impl
- ^
-Macros_2.scala:7: error: macro definition needs to be enabled
-by making the implicit value language.experimental.macros visible.
- def bar(x: Int): Int = macro bar_impl
- ^
-Macros_2.scala:11: error: macro definition needs to be enabled
-by making the implicit value language.experimental.macros visible.
- def quux(x: Int): Int = macro quux_impl
- ^
-three errors found
+Macros_2.scala:5: error: macro definition needs to be enabled +by making the implicit value language.experimental.macros visible. +This can be achieved by adding the import clause 'import scala.language.experimental.macros' +or by setting the compiler option -language:experimental.macros. +See the Scala docs for value scala.language.experimental.macros for a discussion +why the feature needs to be explicitly enabled. + def foo(x: Int): Int = macro foo_impl + ^ +Macros_2.scala:7: error: macro definition needs to be enabled +by making the implicit value language.experimental.macros visible. + def bar(x: Int): Int = macro bar_impl + ^ +Macros_2.scala:11: error: macro definition needs to be enabled +by making the implicit value language.experimental.macros visible. + def quux(x: Int): Int = macro quux_impl + ^ +three errors found diff --git a/test/files/neg/macro-without-xmacros-b.check b/test/files/neg/macro-without-xmacros-b.check index 2d675b8319..c3cadcf36a 100644 --- a/test/files/neg/macro-without-xmacros-b.check +++ b/test/files/neg/macro-without-xmacros-b.check @@ -1,17 +1,17 @@ -Macros_2.scala:3: error: macro definition needs to be enabled
-by making the implicit value language.experimental.macros visible.
-This can be achieved by adding the import clause 'import language.experimental.macros'
-or by setting the compiler option -language:experimental.macros.
-See the Scala docs for value scala.language.experimental.macros for a discussion
-why the feature needs to be explicitly enabled.
- def foo(x: Int): Int = macro Impls.foo_impl
- ^
-Macros_2.scala:5: error: macro definition needs to be enabled
-by making the implicit value language.experimental.macros visible.
- def bar(x: Int): Int = macro Impls.bar_impl
- ^
-Macros_2.scala:9: error: macro definition needs to be enabled
-by making the implicit value language.experimental.macros visible.
- def quux(x: Int): Int = macro Impls.quux_impl
- ^
-three errors found
+Macros_2.scala:3: error: macro definition needs to be enabled +by making the implicit value language.experimental.macros visible. +This can be achieved by adding the import clause 'import scala.language.experimental.macros' +or by setting the compiler option -language:experimental.macros. +See the Scala docs for value scala.language.experimental.macros for a discussion +why the feature needs to be explicitly enabled. + def foo(x: Int): Int = macro Impls.foo_impl + ^ +Macros_2.scala:5: error: macro definition needs to be enabled +by making the implicit value language.experimental.macros visible. + def bar(x: Int): Int = macro Impls.bar_impl + ^ +Macros_2.scala:9: error: macro definition needs to be enabled +by making the implicit value language.experimental.macros visible. + def quux(x: Int): Int = macro Impls.quux_impl + ^ +three errors found diff --git a/test/files/neg/names-defaults-neg.check b/test/files/neg/names-defaults-neg.check index 2809350855..f3c45a6aa0 100644 --- a/test/files/neg/names-defaults-neg.check +++ b/test/files/neg/names-defaults-neg.check @@ -76,7 +76,7 @@ and method f in object t8 of type (a: Int, b: Object)String match argument types (a: Int,b: String) and expected result type Any println(t8.f(a = 0, b = "1")) // ambigous reference ^ -names-defaults-neg.scala:69: error: wrong number of arguments for <none>: (x: Int, y: String)A1 +names-defaults-neg.scala:69: error: wrong number of arguments for pattern A1(x: Int,y: String) A1() match { case A1(_) => () } ^ names-defaults-neg.scala:76: error: no type parameters for method test4: (x: T[T[List[T[X forSome { type X }]]]])T[T[List[T[X forSome { type X }]]]] exist so that it can be applied to arguments (List[Int]) diff --git a/test/files/neg/newpat_unreachable.check b/test/files/neg/newpat_unreachable.check new file mode 100644 index 0000000000..08453cac19 --- /dev/null +++ b/test/files/neg/newpat_unreachable.check @@ -0,0 +1,27 @@ +newpat_unreachable.scala:6: error: patterns after a variable pattern cannot match (SLS 8.1.1) +If you intended to match against parameter b of method contrivedExample, you must use backticks, like: case `b` => + case b => println("matched b") + ^ +newpat_unreachable.scala:7: error: unreachable code due to variable pattern 'b' on line 6 +If you intended to match against parameter c of method contrivedExample, you must use backticks, like: case `c` => + case c => println("matched c") + ^ +newpat_unreachable.scala:8: error: unreachable code due to variable pattern 'b' on line 6 +If you intended to match against value d in class A, you must use backticks, like: case `d` => + case d => println("matched d") + ^ +newpat_unreachable.scala:9: error: unreachable code due to variable pattern 'b' on line 6 + case _ => println("matched neither") + ^ +newpat_unreachable.scala:22: error: patterns after a variable pattern cannot match (SLS 8.1.1) +If you intended to match against parameter b of method g, you must use backticks, like: case `b` => + case b => 1 + ^ +newpat_unreachable.scala:23: error: unreachable code due to variable pattern 'b' on line 22 +If you intended to match against parameter c of method h, you must use backticks, like: case `c` => + case c => 2 + ^ +newpat_unreachable.scala:24: error: unreachable code due to variable pattern 'b' on line 22 + case _ => 3 + ^ +7 errors found diff --git a/test/files/neg/newpat_unreachable.flags b/test/files/neg/newpat_unreachable.flags new file mode 100644 index 0000000000..85d8eb2ba2 --- /dev/null +++ b/test/files/neg/newpat_unreachable.flags @@ -0,0 +1 @@ +-Xfatal-warnings diff --git a/test/files/neg/newpat_unreachable.scala b/test/files/neg/newpat_unreachable.scala new file mode 100644 index 0000000000..c9cc85cec6 --- /dev/null +++ b/test/files/neg/newpat_unreachable.scala @@ -0,0 +1,29 @@ +object Test { + class A { + val d = 55 + + def contrivedExample[A, B, C](a: A, b: B, c: C): Unit = a match { + case b => println("matched b") + case c => println("matched c") + case d => println("matched d") + case _ => println("matched neither") + } + + def correctExample[A, B, C](a: A, b: B, c: C): Unit = a match { + case `b` => println("matched b") + case `c` => println("matched c") + case `d` => println("matched d") + case _ => println("matched neither") + } + + def f[A](a: A) = { + def g[B](b: B) = { + def h[C](c: C) = a match { + case b => 1 + case c => 2 + case _ => 3 + } + } + } + } +} diff --git a/test/files/neg/no-implicit-to-anyref.check b/test/files/neg/no-implicit-to-anyref.check new file mode 100644 index 0000000000..d94b57a30a --- /dev/null +++ b/test/files/neg/no-implicit-to-anyref.check @@ -0,0 +1,28 @@ +no-implicit-to-anyref.scala:11: error: type mismatch; + found : Int(1) + required: AnyRef +Note: an implicit exists from scala.Int => java.lang.Integer, but +methods inherited from Object are rendered ambiguous. This is to avoid +a blanket implicit which would convert any scala.Int to any AnyRef. +You may wish to use a type ascription: `x: java.lang.Integer`. + 1: AnyRef + ^ +no-implicit-to-anyref.scala:17: error: type mismatch; + found : Any + required: AnyRef + (null: Any): AnyRef + ^ +no-implicit-to-anyref.scala:21: error: type mismatch; + found : AnyVal + required: AnyRef + (0: AnyVal): AnyRef + ^ +no-implicit-to-anyref.scala:27: error: type mismatch; + found : Test.AV + required: AnyRef +Note that AV extends Any, not AnyRef. +Such types can participate in value classes, but instances +cannot appear in singleton types or in reference comparisons. + new AV(0): AnyRef + ^ +four errors found diff --git a/test/files/neg/no-implicit-to-anyref.scala b/test/files/neg/no-implicit-to-anyref.scala new file mode 100644 index 0000000000..3e3d373e38 --- /dev/null +++ b/test/files/neg/no-implicit-to-anyref.scala @@ -0,0 +1,29 @@ +// Checks that the state of standard implicits in Predef._ and scala._ +// doesn't allow us to unambiguously and implicitly convert AnyVal +// and subtypes to AnyRef. +// +// In the days before value classes, this was precariously held be +// the competing implicits Any => StringAdd and Any => StringFormat. +// Since then, these have both become value classes, but seeing as +// this happened simultaneously, we're still okay. +object Test { + locally { + 1: AnyRef + } + + locally { + // before this test case was added and ContextErrors was tweaked, this + // emitted: "Note that Any extends Any, not AnyRef." + (null: Any): AnyRef + } + + locally { + (0: AnyVal): AnyRef + } + + class AV(val a: Int) extends AnyVal + + locally { + new AV(0): AnyRef + } +} diff --git a/test/files/neg/not-possible-cause.check b/test/files/neg/not-possible-cause.check new file mode 100644 index 0000000000..5c09fa1545 --- /dev/null +++ b/test/files/neg/not-possible-cause.check @@ -0,0 +1,9 @@ +not-possible-cause.scala:2: error: type mismatch; + found : a.type (with underlying type A) + required: AnyRef +Note that A is bounded only by Equals, which means AnyRef is not a known parent. +Such types can participate in value classes, but instances +cannot appear in singleton types or in reference comparisons. + def foo[A <: Product](a: A) { type X = a.type } + ^ +one error found diff --git a/test/files/neg/not-possible-cause.scala b/test/files/neg/not-possible-cause.scala new file mode 100644 index 0000000000..83ec24dec8 --- /dev/null +++ b/test/files/neg/not-possible-cause.scala @@ -0,0 +1,3 @@ +object Foo { + def foo[A <: Product](a: A) { type X = a.type } +} diff --git a/test/files/neg/override.check b/test/files/neg/override.check index fc152cb3b1..8be98bf4d0 100644 --- a/test/files/neg/override.check +++ b/test/files/neg/override.check @@ -1,5 +1,5 @@ override.scala:9: error: overriding type T in trait A with bounds >: Int <: Int; type T in trait B with bounds >: String <: String has incompatible type - lazy val x : A with B = x + lazy val x : A with B = {println(""); x} ^ one error found diff --git a/test/files/neg/override.scala b/test/files/neg/override.scala index 3e589b52e3..7975516061 100755 --- a/test/files/neg/override.scala +++ b/test/files/neg/override.scala @@ -6,7 +6,7 @@ trait X { trait Y extends X { trait B { type T >: String <: String } - lazy val x : A with B = x + lazy val x : A with B = {println(""); x} n = "foo" } diff --git a/test/files/neg/pat_unreachable.check b/test/files/neg/pat_unreachable.check index 4e1463d591..c5706b7fad 100644 --- a/test/files/neg/pat_unreachable.check +++ b/test/files/neg/pat_unreachable.check @@ -4,4 +4,10 @@ pat_unreachable.scala:5: error: unreachable code pat_unreachable.scala:9: error: unreachable code case Seq(x, y) => List(x, y) ^ -two errors found +pat_unreachable.scala:23: error: unreachable code + case c => println("matched c") + ^ +pat_unreachable.scala:24: error: unreachable code + case _ => println("matched neither") + ^ +four errors found diff --git a/test/files/neg/pat_unreachable.scala b/test/files/neg/pat_unreachable.scala index fc0fd41920..1f402e5212 100644 --- a/test/files/neg/pat_unreachable.scala +++ b/test/files/neg/pat_unreachable.scala @@ -8,7 +8,7 @@ object Test extends App { case Seq(x, y, _*) => x::y::Nil case Seq(x, y) => List(x, y) } - + def not_unreachable(xs:Seq[Char]) = xs match { case Seq(x, y, _*) => x::y::Nil case Seq(x) => List(x) @@ -17,4 +17,10 @@ object Test extends App { case Seq(x, y) => x::y::Nil case Seq(x, y, z, _*) => List(x,y) } + + def contrivedExample[A, B, C](a: A, b: B, c: C): Unit = a match { + case b => println("matched b") + case c => println("matched c") + case _ => println("matched neither") + } } diff --git a/test/files/neg/reify_ann2b.check b/test/files/neg/reify_ann2b.check index 1cef405bef..d32bedaf8f 100644 --- a/test/files/neg/reify_ann2b.check +++ b/test/files/neg/reify_ann2b.check @@ -1,4 +1,4 @@ -reify_ann2b.scala:9: error: inner classes cannot be classfile annotations
- class ann(bar: String) extends annotation.ClassfileAnnotation
- ^
-one error found
+reify_ann2b.scala:9: error: inner classes cannot be classfile annotations + class ann(bar: String) extends annotation.ClassfileAnnotation + ^ +one error found diff --git a/test/files/neg/reify_ann2b.scala b/test/files/neg/reify_ann2b.scala index 2076af34c8..72d8c611cb 100644 --- a/test/files/neg/reify_ann2b.scala +++ b/test/files/neg/reify_ann2b.scala @@ -24,5 +24,5 @@ object Test extends App { println(ttree.toString) // test 3: import and compile - toolbox.runExpr(tree) + toolbox.eval(tree) }
\ No newline at end of file diff --git a/test/files/neg/reify_metalevel_breach_+0_refers_to_1.check b/test/files/neg/reify_metalevel_breach_+0_refers_to_1.check index efdbd7e282..75b7555b01 100644 --- a/test/files/neg/reify_metalevel_breach_+0_refers_to_1.check +++ b/test/files/neg/reify_metalevel_breach_+0_refers_to_1.check @@ -1,7 +1,7 @@ -reify_metalevel_breach_+0_refers_to_1.scala:10: error: the splice cannot be resolved statically, which means there is a cross-stage evaluation involved.
-cross-stage evaluations need to be invoked explicitly, so we're showing you this error.
-if you're sure this is not an oversight, add scala-compiler.jar to the classpath,
-import `scala.tools.reflect.Eval` and call `<your expr>.eval` instead.
- inner.splice
- ^
-one error found
+reify_metalevel_breach_+0_refers_to_1.scala:10: error: the splice cannot be resolved statically, which means there is a cross-stage evaluation involved. +cross-stage evaluations need to be invoked explicitly, so we're showing you this error. +if you're sure this is not an oversight, add scala-compiler.jar to the classpath, +import `scala.tools.reflect.Eval` and call `<your expr>.eval` instead. + inner.splice + ^ +one error found diff --git a/test/files/neg/reify_metalevel_breach_+0_refers_to_1.scala b/test/files/neg/reify_metalevel_breach_+0_refers_to_1.scala index 9499960480..e4d1edffc4 100644 --- a/test/files/neg/reify_metalevel_breach_+0_refers_to_1.scala +++ b/test/files/neg/reify_metalevel_breach_+0_refers_to_1.scala @@ -11,6 +11,6 @@ object Test extends App { }; val toolbox = cm.mkToolBox() - val evaluated = toolbox.runExpr(code.tree) + val evaluated = toolbox.eval(code.tree) println("evaluated = " + evaluated) }
\ No newline at end of file diff --git a/test/files/neg/reify_metalevel_breach_-1_refers_to_0_a.check b/test/files/neg/reify_metalevel_breach_-1_refers_to_0_a.check index 91755c789a..ca5556db02 100644 --- a/test/files/neg/reify_metalevel_breach_-1_refers_to_0_a.check +++ b/test/files/neg/reify_metalevel_breach_-1_refers_to_0_a.check @@ -1,7 +1,7 @@ -reify_metalevel_breach_-1_refers_to_0_a.scala:9: error: the splice cannot be resolved statically, which means there is a cross-stage evaluation involved.
-cross-stage evaluations need to be invoked explicitly, so we're showing you this error.
-if you're sure this is not an oversight, add scala-compiler.jar to the classpath,
-import `scala.tools.reflect.Eval` and call `<your expr>.eval` instead.
- val code = reify{outer.splice.splice}
- ^
-one error found
+reify_metalevel_breach_-1_refers_to_0_a.scala:9: error: the splice cannot be resolved statically, which means there is a cross-stage evaluation involved. +cross-stage evaluations need to be invoked explicitly, so we're showing you this error. +if you're sure this is not an oversight, add scala-compiler.jar to the classpath, +import `scala.tools.reflect.Eval` and call `<your expr>.eval` instead. + val code = reify{outer.splice.splice} + ^ +one error found diff --git a/test/files/neg/reify_metalevel_breach_-1_refers_to_0_a.scala b/test/files/neg/reify_metalevel_breach_-1_refers_to_0_a.scala index e6aaeb9426..7397441586 100644 --- a/test/files/neg/reify_metalevel_breach_-1_refers_to_0_a.scala +++ b/test/files/neg/reify_metalevel_breach_-1_refers_to_0_a.scala @@ -9,6 +9,6 @@ object Test extends App { val code = reify{outer.splice.splice} val toolbox = cm.mkToolBox() - val evaluated = toolbox.runExpr(code.tree) + val evaluated = toolbox.eval(code.tree) println("evaluated = " + evaluated) }
\ No newline at end of file diff --git a/test/files/neg/reify_metalevel_breach_-1_refers_to_0_b.check b/test/files/neg/reify_metalevel_breach_-1_refers_to_0_b.check index f703bfb05f..e34cb1ac1e 100644 --- a/test/files/neg/reify_metalevel_breach_-1_refers_to_0_b.check +++ b/test/files/neg/reify_metalevel_breach_-1_refers_to_0_b.check @@ -1,7 +1,7 @@ -reify_metalevel_breach_-1_refers_to_0_b.scala:12: error: the splice cannot be resolved statically, which means there is a cross-stage evaluation involved.
-cross-stage evaluations need to be invoked explicitly, so we're showing you this error.
-if you're sure this is not an oversight, add scala-compiler.jar to the classpath,
-import `scala.tools.reflect.Eval` and call `<your expr>.eval` instead.
- }.splice
- ^
-one error found
+reify_metalevel_breach_-1_refers_to_0_b.scala:12: error: the splice cannot be resolved statically, which means there is a cross-stage evaluation involved. +cross-stage evaluations need to be invoked explicitly, so we're showing you this error. +if you're sure this is not an oversight, add scala-compiler.jar to the classpath, +import `scala.tools.reflect.Eval` and call `<your expr>.eval` instead. + }.splice + ^ +one error found diff --git a/test/files/neg/reify_metalevel_breach_-1_refers_to_0_b.scala b/test/files/neg/reify_metalevel_breach_-1_refers_to_0_b.scala index 16dcae8683..4f27a44f0c 100644 --- a/test/files/neg/reify_metalevel_breach_-1_refers_to_0_b.scala +++ b/test/files/neg/reify_metalevel_breach_-1_refers_to_0_b.scala @@ -13,6 +13,6 @@ object Test extends App { } val toolbox = cm.mkToolBox() - val evaluated = toolbox.runExpr(code.tree) + val evaluated = toolbox.eval(code.tree) println("evaluated = " + evaluated) }
\ No newline at end of file diff --git a/test/files/neg/reify_metalevel_breach_-1_refers_to_1.check b/test/files/neg/reify_metalevel_breach_-1_refers_to_1.check index 068e4accd2..90b0e8dac6 100644 --- a/test/files/neg/reify_metalevel_breach_-1_refers_to_1.check +++ b/test/files/neg/reify_metalevel_breach_-1_refers_to_1.check @@ -1,7 +1,7 @@ -reify_metalevel_breach_-1_refers_to_1.scala:10: error: the splice cannot be resolved statically, which means there is a cross-stage evaluation involved.
-cross-stage evaluations need to be invoked explicitly, so we're showing you this error.
-if you're sure this is not an oversight, add scala-compiler.jar to the classpath,
-import `scala.tools.reflect.Eval` and call `<your expr>.eval` instead.
- inner.splice.splice
- ^
-one error found
+reify_metalevel_breach_-1_refers_to_1.scala:10: error: the splice cannot be resolved statically, which means there is a cross-stage evaluation involved. +cross-stage evaluations need to be invoked explicitly, so we're showing you this error. +if you're sure this is not an oversight, add scala-compiler.jar to the classpath, +import `scala.tools.reflect.Eval` and call `<your expr>.eval` instead. + inner.splice.splice + ^ +one error found diff --git a/test/files/neg/reify_metalevel_breach_-1_refers_to_1.scala b/test/files/neg/reify_metalevel_breach_-1_refers_to_1.scala index 9600489f35..2f637301aa 100644 --- a/test/files/neg/reify_metalevel_breach_-1_refers_to_1.scala +++ b/test/files/neg/reify_metalevel_breach_-1_refers_to_1.scala @@ -11,6 +11,6 @@ object Test extends App { }; val toolbox = cm.mkToolBox() - val evaluated = toolbox.runExpr(code.tree) + val evaluated = toolbox.eval(code.tree) println("evaluated = " + evaluated) }
\ No newline at end of file diff --git a/test/files/neg/reify_nested_inner_refers_to_local.check b/test/files/neg/reify_nested_inner_refers_to_local.check index 3f897bded9..68689b18d0 100644 --- a/test/files/neg/reify_nested_inner_refers_to_local.check +++ b/test/files/neg/reify_nested_inner_refers_to_local.check @@ -1,7 +1,7 @@ -reify_nested_inner_refers_to_local.scala:9: error: the splice cannot be resolved statically, which means there is a cross-stage evaluation involved.
-cross-stage evaluations need to be invoked explicitly, so we're showing you this error.
-if you're sure this is not an oversight, add scala-compiler.jar to the classpath,
-import `scala.tools.reflect.Eval` and call `<your expr>.eval` instead.
- reify{x}.splice
- ^
-one error found
+reify_nested_inner_refers_to_local.scala:9: error: the splice cannot be resolved statically, which means there is a cross-stage evaluation involved. +cross-stage evaluations need to be invoked explicitly, so we're showing you this error. +if you're sure this is not an oversight, add scala-compiler.jar to the classpath, +import `scala.tools.reflect.Eval` and call `<your expr>.eval` instead. + reify{x}.splice + ^ +one error found diff --git a/test/files/neg/reify_nested_inner_refers_to_local.scala b/test/files/neg/reify_nested_inner_refers_to_local.scala index fcbc1f7865..75ed1bf330 100644 --- a/test/files/neg/reify_nested_inner_refers_to_local.scala +++ b/test/files/neg/reify_nested_inner_refers_to_local.scala @@ -10,6 +10,6 @@ object Test extends App { }; val toolbox = cm.mkToolBox() - val evaluated = toolbox.runExpr(code.tree) + val evaluated = toolbox.eval(code.tree) println("evaluated = " + evaluated) }
\ No newline at end of file diff --git a/test/files/neg/static-annot.check b/test/files/neg/static-annot.check deleted file mode 100644 index 66efebdcee..0000000000 --- a/test/files/neg/static-annot.check +++ /dev/null @@ -1,19 +0,0 @@ -static-annot.scala:8: error: Only members of top-level objects and their nested objects can be annotated with @static. - @static val bar = 1 - ^ -static-annot.scala:27: error: @static annotated field bar has the same name as a member of class Conflicting - @static val bar = 1 - ^ -static-annot.scala:37: error: The @static annotation is only allowed on public members. - @static private val bar = 1 - ^ -static-annot.scala:38: error: The @static annotation is only allowed on public members. - @static private val baz = 2 - ^ -static-annot.scala:39: error: The @static annotation is not allowed on lazy members. - @static lazy val bam = 3 - ^ -static-annot.scala:14: error: Only members of top-level objects and their nested objects can be annotated with @static. - @static val blah = 2 - ^ -6 errors found
\ No newline at end of file diff --git a/test/files/neg/static-annot.scala b/test/files/neg/static-annot.scala deleted file mode 100644 index c6c626d42b..0000000000 --- a/test/files/neg/static-annot.scala +++ /dev/null @@ -1,47 +0,0 @@ - - -import annotation.static - - - -class StaticInClass { - @static val bar = 1 -} - - -class NestedObjectInClass { - object Nested { - @static val blah = 2 - } -} - - -object NestedObjectInObject { - object Nested { - @static val succeed = 3 - } -} - - -object Conflicting { - @static val bar = 1 -} - - -class Conflicting { - val bar = 45 -} - - -object PrivateProtectedLazy { - @static private val bar = 1 - @static private val baz = 2 - @static lazy val bam = 3 -} - - -class PrivateProtectedLazy { - println(PrivateProtectedLazy.bar) - println(PrivateProtectedLazy.baz) - println(PrivateProtectedLazy.bam) -} diff --git a/test/files/neg/structural.check b/test/files/neg/structural.check index 6ef57db1b4..5b2f352a76 100644 --- a/test/files/neg/structural.check +++ b/test/files/neg/structural.check @@ -1,28 +1,28 @@ structural.scala:47: error: Parameter type in structural refinement may not refer to the type of that refinement (self type) val s1 = new { def f(p: this.type): Unit = () } - ^ + ^ structural.scala:10: error: Parameter type in structural refinement may not refer to an abstract type defined outside that refinement def f1[C <: Object](x: Object{ type D <: Object; def m[E >: Null <: Object](x: A): Object; val x: A }) = x.m[Tata](x.x) //fail - ^ + ^ structural.scala:11: error: Parameter type in structural refinement may not refer to an abstract type defined outside that refinement def f2[C <: Object](x: Object{ type D <: Object; def m[E >: Null <: Object](x: B): Object; val x: B }) = x.m[Tata](x.x) //fail - ^ + ^ structural.scala:12: error: Parameter type in structural refinement may not refer to an abstract type defined outside that refinement def f3[C <: Object](x: Object{ type D <: Object; def m[E >: Null <: Object](x: C): Object; val x: C }) = x.m[Tata](x.x) //fail - ^ + ^ structural.scala:13: error: Parameter type in structural refinement may not refer to a type member of that refinement def f4[C <: Object](x: Object{ type D <: Object; def m[E >: Null <: Object](x: D): Object; val x: D }) = x.m[Tata](x.x) //fail - ^ + ^ structural.scala:42: error: Parameter type in structural refinement may not refer to an abstract type defined outside that refinement type Summable[T] = { def +(v : T) : T } - ^ + ^ structural.scala:46: error: Parameter type in structural refinement may not refer to the type of that refinement (self type) type S1 = { def f(p: this.type): Unit } - ^ + ^ structural.scala:49: error: Parameter type in structural refinement may not refer to a type member of that refinement type S2 = { type T; def f(p: T): Unit } - ^ + ^ structural.scala:52: error: Parameter type in structural refinement may not refer to an abstract type defined outside that refinement def s3[U >: Null <: Object](p: { def f(p: U): Unit; def u: U }) = () - ^ + ^ 9 errors found diff --git a/test/files/neg/t0565.check b/test/files/neg/t0565.check index c5a64d0e53..98e61a2503 100644 --- a/test/files/neg/t0565.check +++ b/test/files/neg/t0565.check @@ -1,4 +1,4 @@ t0565.scala:8: error: Parameter type in structural refinement may not refer to a type member of that refinement def z (w : T) : T } = - ^ + ^ one error found diff --git a/test/files/neg/t2144.check b/test/files/neg/t2144.check index 7239f4406e..670e188c2a 100644 --- a/test/files/neg/t2144.check +++ b/test/files/neg/t2144.check @@ -1,4 +1,4 @@ t2144.scala:2: error: Parameter type in structural refinement may not refer to an abstract type defined outside that refinement def foo[A](a: A) = new { def bar(x: A): A = x } - ^ + ^ one error found diff --git a/test/files/neg/t2296a.check b/test/files/neg/t2296a.check new file mode 100644 index 0000000000..863b861046 --- /dev/null +++ b/test/files/neg/t2296a.check @@ -0,0 +1,5 @@ +S.scala:6: error: Implementation restriction: trait S accesses protected method foo inside a concrete trait method. +Add an accessor in a class extending class J as a workaround. + foo() + ^ +one error found diff --git a/test/files/neg/t2296a/J.java b/test/files/neg/t2296a/J.java new file mode 100644 index 0000000000..78ff3e9804 --- /dev/null +++ b/test/files/neg/t2296a/J.java @@ -0,0 +1,7 @@ +package j; + +public class J { + protected void foo() { + System.out.println("J.foo()"); + } +}
\ No newline at end of file diff --git a/test/files/neg/t2296a/S.scala b/test/files/neg/t2296a/S.scala new file mode 100644 index 0000000000..532d038a42 --- /dev/null +++ b/test/files/neg/t2296a/S.scala @@ -0,0 +1,18 @@ +package s { + import j.J + + trait S extends J { + def bar() { + foo() + } + } + + class SC extends J with S +} + +object Test { + def main(args : Array[String]) { + (new s.SC).bar() + (new s.S { }).bar() + } +}
\ No newline at end of file diff --git a/test/files/neg/t2296b.check b/test/files/neg/t2296b.check new file mode 100644 index 0000000000..07cc54d573 --- /dev/null +++ b/test/files/neg/t2296b.check @@ -0,0 +1,5 @@ +S_2.scala:6: error: Implementation restriction: trait S accesses protected method foo inside a concrete trait method. +Add an accessor in a class extending class J_1 as a workaround. + foo() + ^ +one error found diff --git a/test/files/neg/t2296b/J_1.java b/test/files/neg/t2296b/J_1.java new file mode 100644 index 0000000000..4c91d47073 --- /dev/null +++ b/test/files/neg/t2296b/J_1.java @@ -0,0 +1,7 @@ +package j; + +public class J_1 { + protected void foo() { + System.out.println("J.foo()"); + } +}
\ No newline at end of file diff --git a/test/files/neg/t2296b/S_2.scala b/test/files/neg/t2296b/S_2.scala new file mode 100644 index 0000000000..6cdb0cfaba --- /dev/null +++ b/test/files/neg/t2296b/S_2.scala @@ -0,0 +1,18 @@ +package s { + import j.J_1 + + trait S extends J_1 { + def bar() { + foo() + } + } + + class SC extends J_1 with S +} + +object Test { + def main(args : Array[String]) { + (new s.SC).bar() + (new s.S { }).bar() + } +} diff --git a/test/files/neg/t2775.check b/test/files/neg/t2775.check index f357221cd9..934a970f2e 100644 --- a/test/files/neg/t2775.check +++ b/test/files/neg/t2775.check @@ -1,4 +1,4 @@ -t2775.scala:1: error: cannot find class tag for element type B.this.T
-trait B[S] { type T = S; val c = new Array[T](1) }
- ^
-one error found
+t2775.scala:1: error: cannot find class tag for element type B.this.T +trait B[S] { type T = S; val c = new Array[T](1) } + ^ +one error found diff --git a/test/files/neg/t3507-old.check b/test/files/neg/t3507-old.check index 5c58444cb3..b3ac40473e 100644 --- a/test/files/neg/t3507-old.check +++ b/test/files/neg/t3507-old.check @@ -1,4 +1,4 @@ -t3507-old.scala:13: error: No Manifest available for _1.b.c.type.
- mani/*[object _1.b.c]*/(c) // kaboom in manifestOfType / TreeGen.mkAttributedQualifier
- ^
-one error found
+t3507-old.scala:13: error: No Manifest available for _1.b.c.type. + mani/*[object _1.b.c]*/(c) // kaboom in manifestOfType / TreeGen.mkAttributedQualifier + ^ +one error found diff --git a/test/files/neg/t3614.check b/test/files/neg/t3614.check index 5fdb5cbf1f..0f9c83aa0d 100644 --- a/test/files/neg/t3614.check +++ b/test/files/neg/t3614.check @@ -1,4 +1,4 @@ -t3614.scala:2: error: class type required but AnyRef{def a: <?>} found +t3614.scala:2: error: class type required but AnyRef{def a: Int} found def v = new ({ def a=0 }) ^ -one error found
\ No newline at end of file +one error found diff --git a/test/files/neg/t4425.check b/test/files/neg/t4425.check index a6a1a1fad4..0f2fe6f2d1 100644 --- a/test/files/neg/t4425.check +++ b/test/files/neg/t4425.check @@ -1,5 +1,4 @@ -t4425.scala:3: error: error during expansion of this match (this is a scalac bug). -The underlying error was: value _1 is not a member of object Foo.X +t4425.scala:3: error: isInstanceOf cannot test if value types are references. 42 match { case _ X _ => () } - ^ + ^ one error found diff --git a/test/files/neg/t4425.flags b/test/files/neg/t4425.flags new file mode 100644 index 0000000000..1182725e86 --- /dev/null +++ b/test/files/neg/t4425.flags @@ -0,0 +1 @@ +-optimize
\ No newline at end of file diff --git a/test/files/neg/t5031.check b/test/files/neg/t5031.check index 8983d8daf9..2f1090c321 100644 --- a/test/files/neg/t5031.check +++ b/test/files/neg/t5031.check @@ -1,5 +1,5 @@ -Id.scala:3: error: Companions 'class Test' and 'object Test' must be defined in same file: +package.scala:2: error: Companions 'class Test' and 'object Test' must be defined in same file: Found in t5031/package.scala and t5031/Id.scala -object Test - ^ + class Test + ^ one error found diff --git a/test/files/neg/t5031b.check b/test/files/neg/t5031b.check new file mode 100644 index 0000000000..3bc2284a4d --- /dev/null +++ b/test/files/neg/t5031b.check @@ -0,0 +1,5 @@ +b.scala:3: error: Companions 'class Bippy' and 'object Bippy' must be defined in same file: + Found in t5031b/a.scala and t5031b/b.scala +object Bippy + ^ +one error found diff --git a/test/files/neg/t5031b/a.scala b/test/files/neg/t5031b/a.scala new file mode 100644 index 0000000000..0ab9aa9769 --- /dev/null +++ b/test/files/neg/t5031b/a.scala @@ -0,0 +1,3 @@ +package foo + +class Bippy diff --git a/test/files/neg/t5031b/b.scala b/test/files/neg/t5031b/b.scala new file mode 100644 index 0000000000..bdef237af5 --- /dev/null +++ b/test/files/neg/t5031b/b.scala @@ -0,0 +1,3 @@ +package foo + +object Bippy diff --git a/test/files/neg/t5148.check b/test/files/neg/t5148.check index 96eb1fd364..6edfdf2b1e 100644 --- a/test/files/neg/t5148.check +++ b/test/files/neg/t5148.check @@ -1,2 +1,3 @@ -error: bad reference while unpickling Imports.class: term memberHandlers not found in scala.tools.nsc.interpreter.IMain -one error found +error: bad symbolic reference to value global in class IMain - referenced from t5148.scala (a classfile may be missing) +error: bad symbolic reference to value memberHandlers in class IMain - referenced from t5148.scala (a classfile may be missing) +two errors found diff --git a/test/files/neg/t5452-new.check b/test/files/neg/t5452-new.check index 4bbeff3644..1850a7004a 100644 --- a/test/files/neg/t5452-new.check +++ b/test/files/neg/t5452-new.check @@ -1,8 +1,8 @@ -t5452-new.scala:30: error: overloaded method value apply with alternatives:
- ()Queryable[CoffeesTable] <and>
- (t: Tree)(implicit evidence$2: scala.reflect.ClassTag[CoffeesTable])Nothing <and>
- (implicit evidence$1: scala.reflect.ClassTag[CoffeesTable])Nothing
- cannot be applied to (Queryable[CoffeesTable])
- Queryable[CoffeesTable]( q.treeFilter(null) )
- ^
-one error found
+t5452-new.scala:30: error: overloaded method value apply with alternatives: + ()Queryable[CoffeesTable] <and> + (t: Tree)(implicit evidence$2: scala.reflect.ClassTag[CoffeesTable])Nothing <and> + (implicit evidence$1: scala.reflect.ClassTag[CoffeesTable])Nothing + cannot be applied to (Queryable[CoffeesTable]) + Queryable[CoffeesTable]( q.treeFilter(null) ) + ^ +one error found diff --git a/test/files/neg/t5452-old.check b/test/files/neg/t5452-old.check index e5872a5759..1860c98c53 100644 --- a/test/files/neg/t5452-old.check +++ b/test/files/neg/t5452-old.check @@ -1,8 +1,8 @@ -t5452-old.scala:28: error: overloaded method value apply with alternatives:
- ()Queryable[CoffeesTable] <and>
- (t: Tree)(implicit evidence$2: Manifest[CoffeesTable])Nothing <and>
- (implicit evidence$1: Manifest[CoffeesTable])Nothing
- cannot be applied to (Queryable[CoffeesTable])
- Queryable[CoffeesTable]( q.treeFilter(null) )
- ^
-one error found
+t5452-old.scala:28: error: overloaded method value apply with alternatives: + ()Queryable[CoffeesTable] <and> + (t: Tree)(implicit evidence$2: Manifest[CoffeesTable])Nothing <and> + (implicit evidence$1: Manifest[CoffeesTable])Nothing + cannot be applied to (Queryable[CoffeesTable]) + Queryable[CoffeesTable]( q.treeFilter(null) ) + ^ +one error found diff --git a/test/files/neg/t5510.check b/test/files/neg/t5510.check index 60da3bed40..04220e79bb 100644 --- a/test/files/neg/t5510.check +++ b/test/files/neg/t5510.check @@ -13,7 +13,7 @@ t5510.scala:5: error: unclosed string literal t5510.scala:6: error: unclosed multi-line string literal val s5 = ""s""" $s1 $s2 s" ^ -t5510.scala:7: error: '}' expected but eof found. +t5510.scala:7: error: unclosed multi-line string literal } ^ 6 errors found diff --git a/test/files/neg/t5687.check b/test/files/neg/t5687.check new file mode 100644 index 0000000000..5096077ee5 --- /dev/null +++ b/test/files/neg/t5687.check @@ -0,0 +1,8 @@ +t5687.scala:4: error: type arguments [T] do not conform to class Template's type parameter bounds [T <: AnyRef] + type Repr[T]<:Template[T] + ^ +t5687.scala:20: error: overriding type Repr in class Template with bounds[T] <: Template[T]; + type Repr has incompatible type + type Repr = CurveTemplate[T] + ^ +two errors found diff --git a/test/files/neg/t5687.scala b/test/files/neg/t5687.scala new file mode 100644 index 0000000000..90a9ae265c --- /dev/null +++ b/test/files/neg/t5687.scala @@ -0,0 +1,55 @@ +abstract class Template[T <: AnyRef](private val t: T) { + +// type Repr[A<:AnyRef]<:Template[T] + type Repr[T]<:Template[T] + + def access1(timeout: Int): Repr[T] = this.asInstanceOf[Repr[T]] + def access2: Repr[T] = this.asInstanceOf[Repr[T]] + val access3: Repr[T] = this.asInstanceOf[Repr[T]] + def access4(v: Repr[T]): Repr[T] = this.asInstanceOf[Repr[T]] + def access5(x: X): Repr[T] = this.asInstanceOf[Repr[T]] + def access5(x: Y): Repr[T] = this.asInstanceOf[Repr[T]] + + def withReadModifiers(readModifiers:Int): Repr[T] = this.asInstanceOf[Repr[T]] +} + +class Curve + +class CurveTemplate [T <: Curve](t: T) extends Template(t) { +// type Repr[A<: AnyRef] = CurveTemplate[T] + type Repr = CurveTemplate[T] +} + +class Base +class X extends Base +class Y extends Base + + +object Example { + def test1() { + new CurveTemplate(new Curve).access1(10) + + new CurveTemplate(new Curve).access2 + + new CurveTemplate(new Curve).access3 + + new CurveTemplate(new Curve).access4(null) + + new CurveTemplate(new Curve).access5(new X) + + () + + } + + def test2() { + new CurveTemplate(new Curve).access1(10).withReadModifiers(1) + + new CurveTemplate(new Curve).access2.withReadModifiers(1) + + new CurveTemplate(new Curve).access3.withReadModifiers(1) + + new CurveTemplate(new Curve).access4(null).withReadModifiers(1) + + new CurveTemplate(new Curve).access5(new X).withReadModifiers(1) + } +} diff --git a/test/files/neg/t5689.check b/test/files/neg/t5689.check index 3b25dd612e..50aaa7dbfe 100644 --- a/test/files/neg/t5689.check +++ b/test/files/neg/t5689.check @@ -1,7 +1,7 @@ -t5689.scala:4: error: macro implementation has wrong shape:
- required: (c: scala.reflect.macros.Context)(i: c.Expr[Double]): c.Expr[String]
- found : (c: scala.reflect.macros.Context)(i: c.Expr[Double]): c.Expr[Int]
-type mismatch for return type: c.Expr[Int] does not conform to c.Expr[String]
- def returnsString(i: Double): String = macro returnsIntImpl
- ^
-one error found
+t5689.scala:4: error: macro implementation has wrong shape: + required: (c: scala.reflect.macros.Context)(i: c.Expr[Double]): c.Expr[String] + found : (c: scala.reflect.macros.Context)(i: c.Expr[Double]): c.Expr[Int] +type mismatch for return type: c.Expr[Int] does not conform to c.Expr[String] + def returnsString(i: Double): String = macro returnsIntImpl + ^ +one error found diff --git a/test/files/neg/t5692a.check b/test/files/neg/t5692a.check new file mode 100644 index 0000000000..ded95a8820 --- /dev/null +++ b/test/files/neg/t5692a.check @@ -0,0 +1,4 @@ +Test_2.scala:2: error: type parameter not specified + def x = Macros.foo + ^ +one error found diff --git a/test/files/neg/t5692a.flags b/test/files/neg/t5692a.flags new file mode 100644 index 0000000000..cd66464f2f --- /dev/null +++ b/test/files/neg/t5692a.flags @@ -0,0 +1 @@ +-language:experimental.macros
\ No newline at end of file diff --git a/test/files/neg/t5692a/Macros_1.scala b/test/files/neg/t5692a/Macros_1.scala new file mode 100644 index 0000000000..06b5a3de36 --- /dev/null +++ b/test/files/neg/t5692a/Macros_1.scala @@ -0,0 +1,6 @@ +import scala.reflect.macros.Context + +object Macros { + def impl[T](c: Context) = c.literalUnit + def foo[T] = macro impl[T] +}
\ No newline at end of file diff --git a/test/files/neg/t5692a/Test_2.scala b/test/files/neg/t5692a/Test_2.scala new file mode 100644 index 0000000000..08d510cc6f --- /dev/null +++ b/test/files/neg/t5692a/Test_2.scala @@ -0,0 +1,3 @@ +class Test { + def x = Macros.foo +}
\ No newline at end of file diff --git a/test/files/neg/t5692b.check b/test/files/neg/t5692b.check new file mode 100644 index 0000000000..e453870ec8 --- /dev/null +++ b/test/files/neg/t5692b.check @@ -0,0 +1,4 @@ +Test_2.scala:2: error: type parameters not specified + def x = Macros.foo + ^ +one error found diff --git a/test/files/neg/t5692b.flags b/test/files/neg/t5692b.flags new file mode 100644 index 0000000000..cd66464f2f --- /dev/null +++ b/test/files/neg/t5692b.flags @@ -0,0 +1 @@ +-language:experimental.macros
\ No newline at end of file diff --git a/test/files/neg/t5692b/Macros_1.scala b/test/files/neg/t5692b/Macros_1.scala new file mode 100644 index 0000000000..b28d19f903 --- /dev/null +++ b/test/files/neg/t5692b/Macros_1.scala @@ -0,0 +1,6 @@ +import scala.reflect.macros.Context + +object Macros { + def impl[T, U](c: Context) = c.literalUnit + def foo[T, U] = macro impl[T, U] +}
\ No newline at end of file diff --git a/test/files/neg/t5692b/Test_2.scala b/test/files/neg/t5692b/Test_2.scala new file mode 100644 index 0000000000..08d510cc6f --- /dev/null +++ b/test/files/neg/t5692b/Test_2.scala @@ -0,0 +1,3 @@ +class Test { + def x = Macros.foo +}
\ No newline at end of file diff --git a/test/files/neg/t5878.check b/test/files/neg/t5878.check index 50dba0d272..c60c4653a2 100644 --- a/test/files/neg/t5878.check +++ b/test/files/neg/t5878.check @@ -1,13 +1,13 @@ -t5878.scala:1: error: value class may not unbox to itself +t5878.scala:1: error: value class may not wrap another user-defined value class case class Foo(x: Bar) extends AnyVal - ^ -t5878.scala:2: error: value class may not unbox to itself + ^ +t5878.scala:2: error: value class may not wrap another user-defined value class case class Bar(x: Foo) extends AnyVal - ^ -t5878.scala:4: error: value class may not unbox to itself + ^ +t5878.scala:4: error: value class may not wrap another user-defined value class class Foo1(val x: Bar1) extends AnyVal - ^ -t5878.scala:5: error: value class may not unbox to itself + ^ +t5878.scala:5: error: value class may not wrap another user-defined value class class Bar1(val x: Foo1) extends AnyVal - ^ + ^ four errors found diff --git a/test/files/neg/t6040.check b/test/files/neg/t6040.check index f44a81c471..f6757f97e3 100644 --- a/test/files/neg/t6040.check +++ b/test/files/neg/t6040.check @@ -1,6 +1,6 @@ error: extension of type scala.Dynamic needs to be enabled by making the implicit value language.dynamics visible. -This can be achieved by adding the import clause 'import language.dynamics' +This can be achieved by adding the import clause 'import scala.language.dynamics' or by setting the compiler option -language:dynamics. See the Scala docs for value scala.language.dynamics for a discussion why the feature needs to be explicitly enabled. diff --git a/test/files/neg/t6048.check b/test/files/neg/t6048.check index 051f41877e..5bdf2eca88 100644 --- a/test/files/neg/t6048.check +++ b/test/files/neg/t6048.check @@ -4,7 +4,10 @@ t6048.scala:3: error: unreachable code t6048.scala:8: error: unreachable code case _ if false => x // unreachable ^ -t6048.scala:14: error: unreachable code +t6048.scala:13: error: patterns after a variable pattern cannot match (SLS 8.1.1) + case _ => x + ^ +t6048.scala:14: error: unreachable code due to variable pattern on line 13 case 5 if true => x // unreachable ^ -three errors found +four errors found diff --git a/test/files/neg/t6162-inheritance.check b/test/files/neg/t6162-inheritance.check new file mode 100644 index 0000000000..a7d3cc3238 --- /dev/null +++ b/test/files/neg/t6162-inheritance.check @@ -0,0 +1,10 @@ +t6162-inheritance.scala:6: error: inheritance from class Foo in package t6126 is deprecated: `Foo` will be made final in a future version. +class SubFoo extends Foo + ^ +t6162-inheritance.scala:11: error: inheritance from trait T in package t6126 is deprecated +object SubT extends T + ^ +t6162-inheritance.scala:17: error: inheritance from trait S in package t6126 is deprecated + new S { + ^ +three errors found diff --git a/test/files/neg/t6162-inheritance.flags b/test/files/neg/t6162-inheritance.flags new file mode 100644 index 0000000000..65faf53579 --- /dev/null +++ b/test/files/neg/t6162-inheritance.flags @@ -0,0 +1 @@ +-Xfatal-warnings -deprecation
\ No newline at end of file diff --git a/test/files/neg/t6162-inheritance.scala b/test/files/neg/t6162-inheritance.scala new file mode 100644 index 0000000000..7b47b9285a --- /dev/null +++ b/test/files/neg/t6162-inheritance.scala @@ -0,0 +1,19 @@ +package scala.t6126 + +@deprecatedInheritance("`Foo` will be made final in a future version.", "2.10.0") +class Foo + +class SubFoo extends Foo + +@deprecatedInheritance() +trait T + +object SubT extends T + +@deprecatedInheritance() +trait S + +object O { + new S { + } +} diff --git a/test/files/neg/t6162-overriding.check b/test/files/neg/t6162-overriding.check new file mode 100644 index 0000000000..e774888d36 --- /dev/null +++ b/test/files/neg/t6162-overriding.check @@ -0,0 +1,7 @@ +t6162-overriding.scala:14: error: overriding method bar in class Bar is deprecated: `bar` will be made private in a future version. + override def bar = 43 + ^ +t6162-overriding.scala:15: error: overriding method baz in class Bar is deprecated + override def baz = 43 + ^ +two errors found diff --git a/test/files/neg/t6162-overriding.flags b/test/files/neg/t6162-overriding.flags new file mode 100644 index 0000000000..65faf53579 --- /dev/null +++ b/test/files/neg/t6162-overriding.flags @@ -0,0 +1 @@ +-Xfatal-warnings -deprecation
\ No newline at end of file diff --git a/test/files/neg/t6162-overriding.scala b/test/files/neg/t6162-overriding.scala new file mode 100644 index 0000000000..4cab0c2dee --- /dev/null +++ b/test/files/neg/t6162-overriding.scala @@ -0,0 +1,17 @@ +package scala.t6162 + +class Bar { + @deprecatedOverriding("`bar` will be made private in a future version.", "2.10.0") + def bar = 42 + + @deprecatedOverriding() + def baz = 42 + + def baz(a: Any) = 0 +} + +class SubBar extends Bar { + override def bar = 43 + override def baz = 43 + override def baz(a: Any) = 43 // okay +} diff --git a/test/files/neg/t6214.check b/test/files/neg/t6214.check new file mode 100644 index 0000000000..6349a3e71c --- /dev/null +++ b/test/files/neg/t6214.check @@ -0,0 +1,4 @@ +t6214.scala:5: error: missing parameter type + m { s => case class Foo() } + ^ +one error found diff --git a/test/files/neg/t6214.scala b/test/files/neg/t6214.scala new file mode 100644 index 0000000000..734acda35e --- /dev/null +++ b/test/files/neg/t6214.scala @@ -0,0 +1,7 @@ +object Test { + def m(f: String => Unit) = 0 + def m(f: Int => Unit) = 0 + def foo { + m { s => case class Foo() } + } +} diff --git a/test/files/neg/t6227.check b/test/files/neg/t6227.check new file mode 100644 index 0000000000..5e3c636712 --- /dev/null +++ b/test/files/neg/t6227.check @@ -0,0 +1,4 @@ +t6227.scala:2: error: illegal combination of modifiers: implicit and case for: class IntOps + implicit case class IntOps( i: Int ) { + ^ +one error found diff --git a/test/files/neg/t6227.scala b/test/files/neg/t6227.scala new file mode 100644 index 0000000000..46416839d1 --- /dev/null +++ b/test/files/neg/t6227.scala @@ -0,0 +1,6 @@ +object Test { + implicit case class IntOps( i: Int ) { + def twice = i * 2 + } +} + diff --git a/test/files/neg/t6258.check b/test/files/neg/t6258.check new file mode 100644 index 0000000000..73363d8280 --- /dev/null +++ b/test/files/neg/t6258.check @@ -0,0 +1,16 @@ +t6258.scala:2: error: missing parameter type for expanded function +The argument types of an anonymous function must be fully known. (SLS 8.5) +Expected type was: PartialFunction[?, Int] + val f : PartialFunction[_, Int] = { case a : Int => a } // undefined param + ^ +t6258.scala:5: error: missing parameter type for expanded function +The argument types of an anonymous function must be fully known. (SLS 8.5) +Expected type was: PartialFunction[?,Int] + foo { case a : Int => a } // undefined param + ^ +t6258.scala:22: error: missing parameter type for expanded function +The argument types of an anonymous function must be fully known. (SLS 8.5) +Expected type was: PartialFunction[?,Any] + bar[M[Any]] (foo { // undefined param + ^ +three errors found diff --git a/test/files/neg/t6258.scala b/test/files/neg/t6258.scala new file mode 100644 index 0000000000..5046a4750a --- /dev/null +++ b/test/files/neg/t6258.scala @@ -0,0 +1,25 @@ +object Test { + val f : PartialFunction[_, Int] = { case a : Int => a } // undefined param + + def foo[A](pf: PartialFunction[A, Int]) {}; + foo { case a : Int => a } // undefined param + + val g : PartialFunction[Int, _] = { case a : Int => a } // okay +} + + +// Another variation, seen in the wild with Specs2. +class X { + trait Matcher[-T] + + def bar[T](m: Matcher[T]) = null + def bar[T](i: Int) = null + + def foo[T](p: PartialFunction[T, Any]): Matcher[T] = null + + case class M[X](a: X) + + bar[M[Any]] (foo { // undefined param + case M(_) => null + }) +} diff --git a/test/files/neg/t6260.check b/test/files/neg/t6260.check new file mode 100644 index 0000000000..2b7f1a8bfb --- /dev/null +++ b/test/files/neg/t6260.check @@ -0,0 +1,13 @@ +t6260.scala:3: error: bridge generated for member method apply: (x$1: Box[X])Box[Y] in anonymous class $anonfun +which overrides method apply: (v1: T1)R in trait Function1 +clashes with definition of the member itself; +both have erased type (v1: Object)Object + ((bx: Box[X]) => new Box(f(bx.x)))(this) + ^ +t6260.scala:8: error: bridge generated for member method apply: (x$1: Box[X])Box[Y] in anonymous class $anonfun +which overrides method apply: (v1: T1)R in trait Function1 +clashes with definition of the member itself; +both have erased type (v1: Object)Object + ((bx: Box[X]) => new Box(f(bx.x)))(self) + ^ +two errors found diff --git a/test/files/neg/t6260.scala b/test/files/neg/t6260.scala new file mode 100644 index 0000000000..93b5448227 --- /dev/null +++ b/test/files/neg/t6260.scala @@ -0,0 +1,17 @@ +class Box[X](val x: X) extends AnyVal { + def map[Y](f: X => Y): Box[Y] = + ((bx: Box[X]) => new Box(f(bx.x)))(this) +} + +object Test { + def map2[X, Y](self: Box[X], f: X => Y): Box[Y] = + ((bx: Box[X]) => new Box(f(bx.x)))(self) + + def main(args: Array[String]) { + val f = (x: Int) => x + 1 + val g = (x: String) => x + x + + map2(new Box(42), f) + new Box("abc") map g + } +} diff --git a/test/files/neg/t6263.check b/test/files/neg/t6263.check new file mode 100644 index 0000000000..9e9c7c615b --- /dev/null +++ b/test/files/neg/t6263.check @@ -0,0 +1,9 @@ +t6263.scala:5: error: type mismatch; + found : A.this.c.type (with underlying type C) + required: AnyRef +Note that C extends Any, not AnyRef. +Such types can participate in value classes, but instances +cannot appear in singleton types or in reference comparisons. + type t = c.type + ^ +one error found diff --git a/test/files/neg/t6263.scala b/test/files/neg/t6263.scala new file mode 100644 index 0000000000..6575185b5c --- /dev/null +++ b/test/files/neg/t6263.scala @@ -0,0 +1,6 @@ +class C(val a: Any) extends AnyVal +class A { + implicit def c2AnyRef(c: C): AnyRef = new {} + val c = new C(0) + type t = c.type +} diff --git a/test/files/neg/t6264.check b/test/files/neg/t6264.check new file mode 100644 index 0000000000..438be4c39f --- /dev/null +++ b/test/files/neg/t6264.check @@ -0,0 +1,4 @@ +t6264.scala:3: error: non-variable type argument Tuple1[_] in type Tuple2[_, Tuple1[_]] is unchecked since it is eliminated by erasure + x.isInstanceOf[Tuple2[_, Tuple1[_]]] + ^ +one error found diff --git a/test/files/neg/t6264.flags b/test/files/neg/t6264.flags new file mode 100644 index 0000000000..85d8eb2ba2 --- /dev/null +++ b/test/files/neg/t6264.flags @@ -0,0 +1 @@ +-Xfatal-warnings diff --git a/test/files/neg/t6264.scala b/test/files/neg/t6264.scala new file mode 100644 index 0000000000..dc3b727934 --- /dev/null +++ b/test/files/neg/t6264.scala @@ -0,0 +1,6 @@ +class Foo { + def foo(x: AnyRef): Unit = { + x.isInstanceOf[Tuple2[_, Tuple1[_]]] + () + } +} diff --git a/test/files/neg/t6276.check b/test/files/neg/t6276.check new file mode 100644 index 0000000000..0b3dfa5531 --- /dev/null +++ b/test/files/neg/t6276.check @@ -0,0 +1,19 @@ +t6276.scala:4: error: method a in class C does nothing other than call itself recursively + def a: Any = a // warn + ^ +t6276.scala:5: error: value b in class C does nothing other than call itself recursively + val b: Any = b // warn + ^ +t6276.scala:7: error: method c in class C does nothing other than call itself recursively + def c: Any = this.c // warn + ^ +t6276.scala:8: error: method d in class C does nothing other than call itself recursively + def d: Any = C.this.d // warn + ^ +t6276.scala:13: error: method a does nothing other than call itself recursively + def a: Any = a // warn + ^ +t6276.scala:22: error: method a does nothing other than call itself recursively + def a = a // warn + ^ +6 errors found diff --git a/test/files/neg/t6276.flags b/test/files/neg/t6276.flags new file mode 100644 index 0000000000..85d8eb2ba2 --- /dev/null +++ b/test/files/neg/t6276.flags @@ -0,0 +1 @@ +-Xfatal-warnings diff --git a/test/files/neg/t6276.scala b/test/files/neg/t6276.scala new file mode 100644 index 0000000000..bd0a473f71 --- /dev/null +++ b/test/files/neg/t6276.scala @@ -0,0 +1,44 @@ +object Test { + def foo(a: Int, b: Int, c: Int) { + class C { + def a: Any = a // warn + val b: Any = b // warn + + def c: Any = this.c // warn + def d: Any = C.this.d // warn + } + + def method { + // method local + def a: Any = a // warn + } + + trait T { + def a: Any + } + + new T { + // inherited return type + def a = a // warn + } + + // no warnings below + new { + def a: Any = {println(""); a} + val b: Any = {println(""); b} + def c(i: Int): Any = c(i - 0) + } + + class D { + def other: D = null + def foo: Any = other.foo + } + + class E { + def foo: Any = 0 + class D extends E { + override def foo: Any = E.this.foo + } + } + } +} diff --git a/test/files/neg/t6283.check b/test/files/neg/t6283.check new file mode 100644 index 0000000000..69e417ee93 --- /dev/null +++ b/test/files/neg/t6283.check @@ -0,0 +1,4 @@ +t6283.scala:1: error: `abstract' modifier cannot be used with value classes +abstract class Funky(val i: Int) extends AnyVal + ^ +one error found diff --git a/test/files/neg/t6283.scala b/test/files/neg/t6283.scala new file mode 100644 index 0000000000..d41eb18a74 --- /dev/null +++ b/test/files/neg/t6283.scala @@ -0,0 +1 @@ +abstract class Funky(val i: Int) extends AnyVal diff --git a/test/files/neg/t6323a.check b/test/files/neg/t6323a.check new file mode 100644 index 0000000000..670247887c --- /dev/null +++ b/test/files/neg/t6323a.check @@ -0,0 +1,9 @@ +t6323a.scala:11: `package`.this.materializeTypeTag[Test](scala.reflect.runtime.`package`.universe) is not a valid implicit value for reflect.runtime.universe.TypeTag[Test] because: +failed to typecheck the materialized tag: +cannot create a TypeTag referring to local class Test.Test + val value = u.typeOf[Test] + ^ +t6323a.scala:11: error: No TypeTag available for Test + val value = u.typeOf[Test] + ^ +one error found diff --git a/test/files/neg/t6323a.flags b/test/files/neg/t6323a.flags new file mode 100644 index 0000000000..4c6cdb71e2 --- /dev/null +++ b/test/files/neg/t6323a.flags @@ -0,0 +1 @@ +-Xlog-implicits
\ No newline at end of file diff --git a/test/files/neg/t6323a.scala b/test/files/neg/t6323a.scala new file mode 100644 index 0000000000..a203167f3c --- /dev/null +++ b/test/files/neg/t6323a.scala @@ -0,0 +1,21 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => m} +import scala.reflect.runtime.{universe => u} + +object Test extends App { + locally { + try { + case class Test(a:String,b:List[Int]) + + val lookAtMe = m.reflect(Test("a",List(5))) + val value = u.typeOf[Test] + val members = value.members + val member = value.members.filter(_.name.encoded == "a") + val aAccessor = lookAtMe.reflectMethod(member.head.asMethod) + val thisShouldBeA = aAccessor.apply() + println(thisShouldBeA) + } catch { + case ScalaReflectionException(msg) => println(msg) + } + } +}
\ No newline at end of file diff --git a/test/files/neg/t6335.check b/test/files/neg/t6335.check new file mode 100644 index 0000000000..1727a05eb2 --- /dev/null +++ b/test/files/neg/t6335.check @@ -0,0 +1,9 @@ +t6335.scala:6: error: method Z is defined twice + conflicting symbols both originated in file 't6335.scala' + implicit class Z[A](val i: A) { def zz = i } + ^ +t6335.scala:3: error: method X is defined twice + conflicting symbols both originated in file 't6335.scala' + implicit class X(val x: Int) { def xx = x } + ^ +two errors found diff --git a/test/files/neg/t6335.scala b/test/files/neg/t6335.scala new file mode 100644 index 0000000000..5c41e81ef5 --- /dev/null +++ b/test/files/neg/t6335.scala @@ -0,0 +1,7 @@ +object ImplicitClass { + def X(i: Int) {} + implicit class X(val x: Int) { def xx = x } + + def Z[A](i: A) {} + implicit class Z[A](val i: A) { def zz = i } +}
\ No newline at end of file diff --git a/test/files/neg/t6336.check b/test/files/neg/t6336.check new file mode 100644 index 0000000000..f70a5f70ab --- /dev/null +++ b/test/files/neg/t6336.check @@ -0,0 +1,7 @@ +t6336.scala:3: error: Parameter type in structural refinement may not refer to a user-defined value class + val a = new { def y[T](x: X[T]) = x.i } + ^ +t6336.scala:4: error: Result type in structural refinement may not refer to a user-defined value class + val b = new { def y[T](x: T): X[T] = new X(2) } + ^ +two errors found diff --git a/test/files/neg/t6336.scala b/test/files/neg/t6336.scala new file mode 100644 index 0000000000..b1d61f4dd2 --- /dev/null +++ b/test/files/neg/t6336.scala @@ -0,0 +1,12 @@ +object D { + def main(args: Array[String]) { + val a = new { def y[T](x: X[T]) = x.i } + val b = new { def y[T](x: T): X[T] = new X(2) } + val x = new X(3) + val t = a.y(x) + println(t) + } +} + +class X[T](val i: Int) extends AnyVal + diff --git a/test/files/neg/t6337.check b/test/files/neg/t6337.check new file mode 100644 index 0000000000..8448f71320 --- /dev/null +++ b/test/files/neg/t6337.check @@ -0,0 +1,7 @@ +t6337.scala:10: error: value class may not wrap another user-defined value class +class X[T](val i: XX[T]) extends AnyVal + ^ +t6337.scala:20: error: value class may not wrap another user-defined value class +class X1[T](val i: XX1[T]) extends AnyVal + ^ +two errors found diff --git a/test/files/neg/t6337.scala b/test/files/neg/t6337.scala new file mode 100644 index 0000000000..c3858f8c04 --- /dev/null +++ b/test/files/neg/t6337.scala @@ -0,0 +1,21 @@ +object C { + + def main(args: Array[String]) = { + val x = new X(new XX(3)) + println(x.i.x + 9) + } + +} + +class X[T](val i: XX[T]) extends AnyVal +class XX[T](val x: T) extends AnyVal + +object C1 { + def main(args: Array[String]) { + val x = new X1(new XX1(Some(3))) + println(x.i.x.get + 9) + } +} + +class X1[T](val i: XX1[T]) extends AnyVal +class XX1[T](val x: Option[T]) extends AnyVal diff --git a/test/files/neg/t6340.check b/test/files/neg/t6340.check new file mode 100644 index 0000000000..f18b8c3f4b --- /dev/null +++ b/test/files/neg/t6340.check @@ -0,0 +1,10 @@ +t6340.scala:11: error: value D is not a member of object Foo + import Foo.{ A, B, C, D, E, X, Y, Z } + ^ +t6340.scala:16: error: not found: type D + val d = new D + ^ +t6340.scala:17: error: not found: type W + val w = new W + ^ +three errors found diff --git a/test/files/neg/t6340.scala b/test/files/neg/t6340.scala new file mode 100644 index 0000000000..8934d5c15d --- /dev/null +++ b/test/files/neg/t6340.scala @@ -0,0 +1,21 @@ +object Foo { + class A + class B + class C + class X + class Y + class Z +} + +object Test { + import Foo.{ A, B, C, D, E, X, Y, Z } + + val a = new A + val b = new B + val c = new C + val d = new D + val w = new W + val x = new X + val y = new Y + val z = new Z +} diff --git a/test/files/neg/t6359.check b/test/files/neg/t6359.check new file mode 100644 index 0000000000..2aa1ac5035 --- /dev/null +++ b/test/files/neg/t6359.check @@ -0,0 +1,7 @@ +t6359.scala:3: error: value class may not have nested module definitions + object X + ^ +t6359.scala:4: error: value class may not have nested class definitions + class Y + ^ +two errors found diff --git a/test/files/neg/t6359.scala b/test/files/neg/t6359.scala new file mode 100644 index 0000000000..96550fd906 --- /dev/null +++ b/test/files/neg/t6359.scala @@ -0,0 +1,8 @@ +class M(val t: Int) extends AnyVal { + def lazyString = { + object X + class Y + + () => {X; new Y} + } +} diff --git a/test/files/neg/t6385.check b/test/files/neg/t6385.check new file mode 100644 index 0000000000..93e51e8927 --- /dev/null +++ b/test/files/neg/t6385.check @@ -0,0 +1,7 @@ +t6385.scala:12: error: bridge generated for member method x: ()C[T] in class C +which overrides method x: ()C[T] in trait AA +clashes with definition of the member itself; +both have erased type ()Object + def x = this + ^ +one error found diff --git a/test/files/neg/t6385.scala b/test/files/neg/t6385.scala new file mode 100644 index 0000000000..cec58eec9e --- /dev/null +++ b/test/files/neg/t6385.scala @@ -0,0 +1,13 @@ +object N { + def main(args: Array[String]) { + val y: AA[Int] = C(2) + val c: Int = y.x.y + println(c) + } +} +trait AA[T] extends Any { + def x: C[T] +} +case class C[T](val y: T) extends AnyVal with AA[T] { + def x = this +} diff --git a/test/files/neg/t900.check b/test/files/neg/t900.check index 4611ceba8c..6fe26a31ac 100644 --- a/test/files/neg/t900.check +++ b/test/files/neg/t900.check @@ -1,10 +1,9 @@ t900.scala:4: error: type mismatch; found : Foo.this.x.type (with underlying type Foo.this.bar) required: AnyRef -Note that implicit conversions are not applicable because they are ambiguous: - both method any2stringfmt in object Predef of type (x: Any)scala.runtime.StringFormat - and method any2stringadd in object Predef of type (x: Any)scala.runtime.StringAdd - are possible conversion functions from Foo.this.x.type to AnyRef +Note that bar is unbounded, which means AnyRef is not a known parent. +Such types can participate in value classes, but instances +cannot appear in singleton types or in reference comparisons. def break(): x.type ^ one error found diff --git a/test/files/neg/unit2anyref.check b/test/files/neg/unit2anyref.check index 10fe1861f5..6d11461700 100644 --- a/test/files/neg/unit2anyref.check +++ b/test/files/neg/unit2anyref.check @@ -1,8 +1,6 @@ unit2anyref.scala:2: error: type mismatch; found : Unit required: AnyRef -Note: Unit is not implicitly converted to AnyRef. You can safely -pattern match `x: AnyRef` or cast `x.asInstanceOf[AnyRef]` to do so. val x: AnyRef = () // this should not succeed. ^ one error found diff --git a/test/files/neg/valueclasses-pavlov.check b/test/files/neg/valueclasses-pavlov.check new file mode 100644 index 0000000000..031589edad --- /dev/null +++ b/test/files/neg/valueclasses-pavlov.check @@ -0,0 +1,7 @@ +valueclasses-pavlov.scala:8: error: double definition: +method foo:(x: Box2)String and +method foo:(x: String)String at line 7 +have same type after erasure: (x: String)String + def foo(x: Box2) = "foo(Box2): ok" + ^ +one error found diff --git a/test/files/neg/valueclasses-pavlov.scala b/test/files/neg/valueclasses-pavlov.scala new file mode 100644 index 0000000000..a5858b2cf0 --- /dev/null +++ b/test/files/neg/valueclasses-pavlov.scala @@ -0,0 +1,23 @@ +trait Foo[T <: AnyVal] extends Any { + def foo(x: String): String + def foo(x: T): String +} + +class Box1(val value: String) extends AnyVal with Foo[Box2] { + def foo(x: String) = "foo(String): ok" + def foo(x: Box2) = "foo(Box2): ok" +} + +class Box2(val value: String) extends AnyVal + + +object test2a { + + def main(args: Array[String]) { + val b1 = new Box1(null) + val b2 = new Box2(null) + val f: Foo[Box2] = b1 + println(f.foo("")) + println(f.foo(b2)) + } +} diff --git a/test/files/neg/wrong-args-for-none.check b/test/files/neg/wrong-args-for-none.check new file mode 100644 index 0000000000..d3b2d572ab --- /dev/null +++ b/test/files/neg/wrong-args-for-none.check @@ -0,0 +1,4 @@ +wrong-args-for-none.scala:5: error: wrong number of arguments for pattern Test.Foo(x: Int,y: Int) + def f(x: Any) = x match { case Bar(Foo(5)) => } + ^ +one error found diff --git a/test/files/neg/wrong-args-for-none.scala b/test/files/neg/wrong-args-for-none.scala new file mode 100644 index 0000000000..1caa4782a3 --- /dev/null +++ b/test/files/neg/wrong-args-for-none.scala @@ -0,0 +1,6 @@ +object Test { + case class Foo(x: Int, y: Int) + case class Bar(x: AnyRef) + + def f(x: Any) = x match { case Bar(Foo(5)) => } +} |