diff options
Diffstat (limited to 'test/files/neg')
114 files changed, 699 insertions, 320 deletions
diff --git a/test/files/neg/dotless-targs.check b/test/files/neg/dotless-targs.check new file mode 100644 index 0000000000..4aab939f61 --- /dev/null +++ b/test/files/neg/dotless-targs.check @@ -0,0 +1,4 @@ +dotless-targs.scala:2: error: type application is not allowed for postfix operators + def f1 = "f1" isInstanceOf[String] // not ok + ^ +one error found diff --git a/test/files/neg/dotless-targs.scala b/test/files/neg/dotless-targs.scala new file mode 100644 index 0000000000..eff63cbec4 --- /dev/null +++ b/test/files/neg/dotless-targs.scala @@ -0,0 +1,5 @@ +class A { + def f1 = "f1" isInstanceOf[String] // not ok + def f2 = "f2".isInstanceOf[String] // ok + def f3 = "f3" toList // ok +} diff --git a/test/files/neg/macro-abort/Macros_1.scala b/test/files/neg/macro-abort/Macros_1.scala index 577e640089..2077e99ad7 100644 --- a/test/files/neg/macro-abort/Macros_1.scala +++ b/test/files/neg/macro-abort/Macros_1.scala @@ -1,8 +1,8 @@ import scala.language.experimental.macros -import scala.reflect.macros.BlackboxContext +import scala.reflect.macros.blackbox.Context object Macros { - def impl(c: BlackboxContext) = { + def impl(c: Context) = { c.abort(c.enclosingPosition, "aborted") } def abort = macro impl diff --git a/test/files/neg/macro-basic-mamdmi/Impls_Macros_Test_1.scala b/test/files/neg/macro-basic-mamdmi/Impls_Macros_Test_1.scala index ae34815d37..325bb7276f 100644 --- a/test/files/neg/macro-basic-mamdmi/Impls_Macros_Test_1.scala +++ b/test/files/neg/macro-basic-mamdmi/Impls_Macros_Test_1.scala @@ -1,17 +1,17 @@ -import scala.reflect.macros.{BlackboxContext => Ctx} +import scala.reflect.macros.blackbox.Context object Impls { - def foo(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { + def foo(c: Context)(x: c.Expr[Int]): c.Expr[Int] = { import c.universe._ c.Expr[Int](q"$x + 1") } - def bar(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { + def bar(c: Context)(x: c.Expr[Int]): c.Expr[Int] = { import c.universe._ c.Expr[Int](q"$x + 2") } - def quux(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { + def quux(c: Context)(x: c.Expr[Int]): c.Expr[Int] = { import c.universe._ c.Expr[Int](q"$x + 3") } diff --git a/test/files/neg/macro-blackbox-dynamic-materialization/Macros_1.scala b/test/files/neg/macro-blackbox-dynamic-materialization/Macros_1.scala index a00d195005..3cfbdf45e9 100644 --- a/test/files/neg/macro-blackbox-dynamic-materialization/Macros_1.scala +++ b/test/files/neg/macro-blackbox-dynamic-materialization/Macros_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.macros.BlackboxContext +import scala.reflect.macros.blackbox.Context import scala.language.experimental.macros trait Foo[T] @@ -15,7 +15,7 @@ object Foo extends LowPriority { } object Macros { - def impl[T: c.WeakTypeTag](c: BlackboxContext) = { + def impl[T: c.WeakTypeTag](c: Context) = { import c.universe._ val tpe = weakTypeOf[T] if (tpe.members.exists(_.typeSignature =:= typeOf[Int])) diff --git a/test/files/neg/macro-blackbox-extractor/Macros_1.scala b/test/files/neg/macro-blackbox-extractor/Macros_1.scala index f0bfe53aa2..64b6270b74 100644 --- a/test/files/neg/macro-blackbox-extractor/Macros_1.scala +++ b/test/files/neg/macro-blackbox-extractor/Macros_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.macros.BlackboxContext +import scala.reflect.macros.blackbox.Context import language.experimental.macros object Extractor { @@ -6,7 +6,7 @@ object Extractor { } object Macros { - def unapplyImpl(c: BlackboxContext)(x: c.Tree) = { + def unapplyImpl(c: Context)(x: c.Tree) = { import c.universe._ q""" new { diff --git a/test/files/neg/macro-blackbox-fundep-materialization/Macros_1.scala b/test/files/neg/macro-blackbox-fundep-materialization/Macros_1.scala index 6bddef4b9d..a6f7de23bb 100644 --- a/test/files/neg/macro-blackbox-fundep-materialization/Macros_1.scala +++ b/test/files/neg/macro-blackbox-fundep-materialization/Macros_1.scala @@ -1,5 +1,5 @@ import scala.language.experimental.macros -import scala.reflect.macros.BlackboxContext +import scala.reflect.macros.blackbox.Context trait Iso[T, U] { def to(t : T) : U @@ -8,7 +8,7 @@ trait Iso[T, U] { object Iso { implicit def materializeIso[T, U]: Iso[T, U] = macro impl[T, U] - def impl[T: c.WeakTypeTag, U: c.WeakTypeTag](c: BlackboxContext): c.Expr[Iso[T, U]] = { + def impl[T: c.WeakTypeTag, U: c.WeakTypeTag](c: Context): c.Expr[Iso[T, U]] = { import c.universe._ import definitions._ import Flag._ diff --git a/test/files/neg/macro-blackbox-structural/Impls_Macros_1.scala b/test/files/neg/macro-blackbox-structural/Impls_Macros_1.scala index f5e85d57ea..a86a26d2c0 100644 --- a/test/files/neg/macro-blackbox-structural/Impls_Macros_1.scala +++ b/test/files/neg/macro-blackbox-structural/Impls_Macros_1.scala @@ -1,7 +1,7 @@ import scala.language.experimental.macros object Macros { - def impl(c: scala.reflect.macros.BlackboxContext) = { + def impl(c: scala.reflect.macros.blackbox.Context) = { import c.universe._ q""" trait Foo { diff --git a/test/files/neg/macro-bundle-abstract.check b/test/files/neg/macro-bundle-abstract.check index 8ef59106b8..3afd079521 100644 --- a/test/files/neg/macro-bundle-abstract.check +++ b/test/files/neg/macro-bundle-abstract.check @@ -1,4 +1,4 @@ -macro-bundle-abstract.scala:4: error: class Bundle$Bundle needs to be abstract, since method deferred in trait Bundle of type => Int is not defined -trait Bundle extends BlackboxMacro { - ^ +macro-bundle-abstract.scala:10: error: macro bundles must be concrete classes having a single constructor with a `val c: Context` parameter + def foo = macro Bundle.impl + ^ one error found diff --git a/test/files/neg/macro-bundle-abstract.scala b/test/files/neg/macro-bundle-abstract.scala index f7778d03be..0afeaafc01 100644 --- a/test/files/neg/macro-bundle-abstract.scala +++ b/test/files/neg/macro-bundle-abstract.scala @@ -1,7 +1,7 @@ import scala.language.experimental.macros -import scala.reflect.macros.BlackboxMacro +import scala.reflect.macros.blackbox.Context -trait Bundle extends BlackboxMacro { +abstract class Bundle(c: Context) { def deferred: Int def impl = ??? } diff --git a/test/files/neg/macro-bundle-class.check b/test/files/neg/macro-bundle-class.check deleted file mode 100644 index 7108c15b8d..0000000000 --- a/test/files/neg/macro-bundle-class.check +++ /dev/null @@ -1,4 +0,0 @@ -macro-bundle-class.scala:10: error: macro bundles must be monomorphic traits extending either BlackboxMacro or WhiteboxMacro and not implementing their `val c: BlackboxContext/WhiteboxContext` member - def foo = macro Bundle.impl - ^ -one error found diff --git a/test/files/neg/macro-bundle-class.scala b/test/files/neg/macro-bundle-class.scala deleted file mode 100644 index 024e2dbaaa..0000000000 --- a/test/files/neg/macro-bundle-class.scala +++ /dev/null @@ -1,11 +0,0 @@ -import scala.language.experimental.macros -import scala.reflect.macros.BlackboxMacro -import scala.reflect.macros.BlackboxContext - -class Bundle(val c: BlackboxContext) extends BlackboxMacro { - def impl = ??? -} - -object Macros { - def foo = macro Bundle.impl -}
\ No newline at end of file diff --git a/test/files/neg/macro-bundle-mixbox.check b/test/files/neg/macro-bundle-mixbox.check deleted file mode 100644 index c3136d9369..0000000000 --- a/test/files/neg/macro-bundle-mixbox.check +++ /dev/null @@ -1,4 +0,0 @@ -macro-bundle-mixbox.scala:9: error: macro bundles must be monomorphic traits extending either BlackboxMacro or WhiteboxMacro and not implementing their `val c: BlackboxContext/WhiteboxContext` member - def foo = macro Bundle.impl - ^ -one error found diff --git a/test/files/neg/macro-bundle-mixbox.scala b/test/files/neg/macro-bundle-mixbox.scala deleted file mode 100644 index 1e36f3d94c..0000000000 --- a/test/files/neg/macro-bundle-mixbox.scala +++ /dev/null @@ -1,10 +0,0 @@ -import scala.language.experimental.macros -import scala.reflect.macros.{BlackboxMacro, WhiteboxMacro} - -trait Bundle extends BlackboxMacro with WhiteboxMacro { - def impl = ??? -} - -object Macros { - def foo = macro Bundle.impl -}
\ No newline at end of file diff --git a/test/files/neg/macro-bundle-noncontext.check b/test/files/neg/macro-bundle-noncontext.check new file mode 100644 index 0000000000..bb5d0851f5 --- /dev/null +++ b/test/files/neg/macro-bundle-noncontext.check @@ -0,0 +1,4 @@ +macro-bundle-noncontext.scala:8: error: not found: value Bundle + def foo = Bundle.impl + ^ +one error found diff --git a/test/files/neg/macro-bundle-nonmacro.scala b/test/files/neg/macro-bundle-noncontext.scala index c7d99f4582..c228827e70 100644 --- a/test/files/neg/macro-bundle-nonmacro.scala +++ b/test/files/neg/macro-bundle-noncontext.scala @@ -1,6 +1,6 @@ import scala.language.experimental.macros -trait Bundle { +class Bundle { def impl = ??? } diff --git a/test/files/neg/macro-bundle-nonmacro.check b/test/files/neg/macro-bundle-nonmacro.check deleted file mode 100644 index 5a265b5724..0000000000 --- a/test/files/neg/macro-bundle-nonmacro.check +++ /dev/null @@ -1,4 +0,0 @@ -macro-bundle-nonmacro.scala:8: error: not found: value Bundle - def foo = Bundle.impl - ^ -one error found diff --git a/test/files/neg/macro-bundle-object.check b/test/files/neg/macro-bundle-object.check index 78e7119fa7..b8800105f5 100644 --- a/test/files/neg/macro-bundle-object.check +++ b/test/files/neg/macro-bundle-object.check @@ -1,6 +1,6 @@ macro-bundle-object.scala:10: error: macro implementation has incompatible shape: - required: (c: scala.reflect.macros.BlackboxContext): c.Expr[Nothing] - or : (c: scala.reflect.macros.BlackboxContext): c.Tree + required: (c: scala.reflect.macros.blackbox.Context): c.Expr[Nothing] + or : (c: scala.reflect.macros.blackbox.Context): c.Tree found : : Nothing number of parameter sections differ def foo = macro Bundle.impl diff --git a/test/files/neg/macro-bundle-object.scala b/test/files/neg/macro-bundle-object.scala index 105c81f1f5..6e1eec1686 100644 --- a/test/files/neg/macro-bundle-object.scala +++ b/test/files/neg/macro-bundle-object.scala @@ -1,8 +1,8 @@ import scala.language.experimental.macros -import scala.reflect.macros.{BlackboxMacro, BlackboxContext} +import scala.reflect.macros.blackbox.Context -object Bundle extends BlackboxMacro { - val c: BlackboxContext = ??? +object Bundle { + val c: Context = ??? def impl = ??? } diff --git a/test/files/neg/macro-bundle-overloaded.check b/test/files/neg/macro-bundle-overloaded.check new file mode 100644 index 0000000000..fc94ff0000 --- /dev/null +++ b/test/files/neg/macro-bundle-overloaded.check @@ -0,0 +1,4 @@ +macro-bundle-overloaded.scala:11: error: macro bundles must be concrete classes having a single constructor with a `val c: Context` parameter + def foo = macro Bundle.impl + ^ +one error found diff --git a/test/files/neg/macro-bundle-overloaded.scala b/test/files/neg/macro-bundle-overloaded.scala new file mode 100644 index 0000000000..a4bc66f974 --- /dev/null +++ b/test/files/neg/macro-bundle-overloaded.scala @@ -0,0 +1,12 @@ +import scala.language.experimental.macros +import scala.reflect.macros.blackbox.{Context => BlackboxContext} +import scala.reflect.macros.whitebox.{Context => WhiteboxContext} + +class Bundle(val c: BlackboxContext) { + def this(c: WhiteboxContext) = this(c: BlackboxContext) + def impl = ??? +} + +object Macros { + def foo = macro Bundle.impl +}
\ No newline at end of file diff --git a/test/files/neg/macro-bundle-polymorphic.check b/test/files/neg/macro-bundle-polymorphic.check deleted file mode 100644 index e024fcde93..0000000000 --- a/test/files/neg/macro-bundle-polymorphic.check +++ /dev/null @@ -1,10 +0,0 @@ -macro-bundle-polymorphic.scala:9: error: macro bundles must be monomorphic traits extending either BlackboxMacro or WhiteboxMacro and not implementing their `val c: BlackboxContext/WhiteboxContext` member - def foo = macro Bundle.impl - ^ -macro-bundle-polymorphic.scala:10: error: macro bundles must be monomorphic traits extending either BlackboxMacro or WhiteboxMacro and not implementing their `val c: BlackboxContext/WhiteboxContext` member - def foo = macro Bundle[Int].impl - ^ -macro-bundle-polymorphic.scala:11: error: macro bundles must be monomorphic traits extending either BlackboxMacro or WhiteboxMacro and not implementing their `val c: BlackboxContext/WhiteboxContext` member - def foo = macro Bundle[Int, Nothing].impl - ^ -three errors found diff --git a/test/files/neg/macro-bundle-polymorphic.scala b/test/files/neg/macro-bundle-polymorphic.scala deleted file mode 100644 index faf1e2e9e5..0000000000 --- a/test/files/neg/macro-bundle-polymorphic.scala +++ /dev/null @@ -1,12 +0,0 @@ -import scala.language.experimental.macros -import scala.reflect.macros.BlackboxMacro - -trait Bundle[T] extends BlackboxMacro { - def impl = ??? -} - -object Macros { - def foo = macro Bundle.impl - def foo = macro Bundle[Int].impl - def foo = macro Bundle[Int, Nothing].impl -}
\ No newline at end of file diff --git a/test/files/neg/macro-bundle-trait.check b/test/files/neg/macro-bundle-trait.check index 3cb7985013..869c67e1e3 100644 --- a/test/files/neg/macro-bundle-trait.check +++ b/test/files/neg/macro-bundle-trait.check @@ -1,4 +1,4 @@ -macro-bundle-trait.scala:11: error: macro bundles must be monomorphic traits extending either BlackboxMacro or WhiteboxMacro and not implementing their `val c: BlackboxContext/WhiteboxContext` member +macro-bundle-trait.scala:10: error: not found: value Bundle def foo = macro Bundle.impl ^ one error found diff --git a/test/files/neg/macro-bundle-trait.scala b/test/files/neg/macro-bundle-trait.scala index 62ade49953..2aa63216f5 100644 --- a/test/files/neg/macro-bundle-trait.scala +++ b/test/files/neg/macro-bundle-trait.scala @@ -1,9 +1,8 @@ import scala.language.experimental.macros -import scala.reflect.macros.BlackboxMacro -import scala.reflect.macros.BlackboxContext +import scala.reflect.macros.blackbox.Context -trait Bundle extends BlackboxMacro { - val c: BlackboxContext = ??? +trait Bundle { + val c: Context = ??? def impl = ??? } diff --git a/test/files/neg/macro-cyclic/Impls_Macros_1.scala b/test/files/neg/macro-cyclic/Impls_Macros_1.scala index ba08345bcc..ad6890144d 100644 --- a/test/files/neg/macro-cyclic/Impls_Macros_1.scala +++ b/test/files/neg/macro-cyclic/Impls_Macros_1.scala @@ -1,7 +1,7 @@ -import scala.reflect.macros.BlackboxContext +import scala.reflect.macros.blackbox.Context object Macros { - def impl(c: BlackboxContext) = { + def impl(c: Context) = { c.universe.reify { implicitly[SourceLocation] } } diff --git a/test/files/neg/macro-divergence-controlled/Impls_Macros_1.scala b/test/files/neg/macro-divergence-controlled/Impls_Macros_1.scala index 9fb374800b..186c285871 100644 --- a/test/files/neg/macro-divergence-controlled/Impls_Macros_1.scala +++ b/test/files/neg/macro-divergence-controlled/Impls_Macros_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.macros.WhiteboxContext +import scala.reflect.macros.whitebox.Context import language.experimental.macros trait Complex[T] @@ -6,7 +6,7 @@ trait Complex[T] class Foo(val foo: Foo) object Complex { - def impl[T: c.WeakTypeTag](c: WhiteboxContext): c.Expr[Complex[T]] = { + def impl[T: c.WeakTypeTag](c: Context): c.Expr[Complex[T]] = { import c.universe._ val tpe = weakTypeOf[T] for (f <- tpe.declarations.collect{case f: TermSymbol if f.isParamAccessor && !f.isMethod => f}) { diff --git a/test/files/neg/macro-exception/Macros_1.scala b/test/files/neg/macro-exception/Macros_1.scala index 7bd8415e4f..3d6109dc9d 100644 --- a/test/files/neg/macro-exception/Macros_1.scala +++ b/test/files/neg/macro-exception/Macros_1.scala @@ -1,8 +1,8 @@ import scala.language.experimental.macros -import scala.reflect.macros.BlackboxContext +import scala.reflect.macros.blackbox.Context object Macros { - def impl(c: BlackboxContext) = { + def impl(c: Context) = { throw new Exception() } def exception = macro impl diff --git a/test/files/neg/macro-false-deprecation-warning/Impls_Macros_1.scala b/test/files/neg/macro-false-deprecation-warning/Impls_Macros_1.scala index 1bd808d55d..a97dfd4ddf 100644 --- a/test/files/neg/macro-false-deprecation-warning/Impls_Macros_1.scala +++ b/test/files/neg/macro-false-deprecation-warning/Impls_Macros_1.scala @@ -1,11 +1,11 @@ -import scala.reflect.macros.BlackboxContext +import scala.reflect.macros.blackbox.Context object Helper { def unapplySeq[T](x: List[T]): Option[Seq[T]] = } object Macros { - def impl[T: c.WeakTypeTag](c: BlackboxContext)(x: c.Expr[List[T]]) = { + def impl[T: c.WeakTypeTag](c: Context)(x: c.Expr[List[T]]) = { c.universe.reify(Helper.unapplySeq(x.splice)) } diff --git a/test/files/neg/macro-incompatible-macro-engine/Macros_2.scala b/test/files/neg/macro-incompatible-macro-engine/Macros_2.scala index ad57a3cb36..39708eee49 100644 --- a/test/files/neg/macro-incompatible-macro-engine/Macros_2.scala +++ b/test/files/neg/macro-incompatible-macro-engine/Macros_2.scala @@ -1,7 +1,7 @@ import scala.language.experimental.macros -import scala.reflect.macros.BlackboxContext +import scala.reflect.macros.blackbox.Context object Macros { - def impl(c: BlackboxContext) = c.universe.Literal(c.universe.Constant(())) + def impl(c: Context) = c.universe.Literal(c.universe.Constant(())) def foo: Unit = macro impl }
\ No newline at end of file diff --git a/test/files/neg/macro-invalidimpl.check b/test/files/neg/macro-invalidimpl.check index 5eff401bef..ea7d71c667 100644 --- a/test/files/neg/macro-invalidimpl.check +++ b/test/files/neg/macro-invalidimpl.check @@ -19,28 +19,28 @@ macro [<macro bundle>].<method name>[[<type args>]] def foo(x: Any) = macro Impls4.foo ^ Macros_Test_2.scala:26: error: ambiguous reference to overloaded definition, -both method foo in object Impls5 of type (c: scala.reflect.macros.BlackboxContext)(x: c.Expr[Any], y: c.Expr[Any])Nothing -and method foo in object Impls5 of type (c: scala.reflect.macros.BlackboxContext)(x: c.Expr[Any])Nothing +both method foo in object Impls5 of type (c: scala.reflect.macros.blackbox.Context)(x: c.Expr[Any], y: c.Expr[Any])Nothing +and method foo in object Impls5 of type (c: scala.reflect.macros.blackbox.Context)(x: c.Expr[Any])Nothing match expected type ? def foo(x: Any) = macro Impls5.foo ^ Macros_Test_2.scala:27: error: ambiguous reference to overloaded definition, -both method foo in object Impls5 of type (c: scala.reflect.macros.BlackboxContext)(x: c.Expr[Any], y: c.Expr[Any])Nothing -and method foo in object Impls5 of type (c: scala.reflect.macros.BlackboxContext)(x: c.Expr[Any])Nothing +both method foo in object Impls5 of type (c: scala.reflect.macros.blackbox.Context)(x: c.Expr[Any], y: c.Expr[Any])Nothing +and method foo in object Impls5 of type (c: scala.reflect.macros.blackbox.Context)(x: c.Expr[Any])Nothing match expected type ? def foo(x: Any, y: Any) = macro Impls5.foo ^ Macros_Test_2.scala:31: error: macro implementation has incompatible shape: - required: (c: scala.reflect.macros.BlackboxContext): c.Expr[Unit] - or : (c: scala.reflect.macros.BlackboxContext): c.Tree - found : (c: scala.reflect.macros.BlackboxContext)(): c.Expr[Unit] + required: (c: scala.reflect.macros.blackbox.Context): c.Expr[Unit] + or : (c: scala.reflect.macros.blackbox.Context): c.Tree + found : (c: scala.reflect.macros.blackbox.Context)(): c.Expr[Unit] number of parameter sections differ def foo1 = macro Impls6.fooEmpty ^ Macros_Test_2.scala:32: error: macro implementation has incompatible shape: - required: (c: scala.reflect.macros.BlackboxContext)(): c.Expr[Unit] - or : (c: scala.reflect.macros.BlackboxContext)(): c.Tree - found : (c: scala.reflect.macros.BlackboxContext): c.Expr[Unit] + required: (c: scala.reflect.macros.blackbox.Context)(): c.Expr[Unit] + or : (c: scala.reflect.macros.blackbox.Context)(): c.Tree + found : (c: scala.reflect.macros.blackbox.Context): c.Expr[Unit] number of parameter sections differ def bar1() = macro Impls6.fooNullary ^ diff --git a/test/files/neg/macro-invalidimpl/Impls_1.scala b/test/files/neg/macro-invalidimpl/Impls_1.scala index b85ac9ee43..a1c885a4bf 100644 --- a/test/files/neg/macro-invalidimpl/Impls_1.scala +++ b/test/files/neg/macro-invalidimpl/Impls_1.scala @@ -1,39 +1,39 @@ -import scala.reflect.macros.BlackboxContext +import scala.reflect.macros.blackbox.Context class Impls1 { - def foo(c: BlackboxContext)(x: c.Expr[Any]) = ??? + def foo(c: Context)(x: c.Expr[Any]) = ??? } object Impls2 { - def foo(c: BlackboxContext)(x: c.Expr[Any]) = ??? + def foo(c: Context)(x: c.Expr[Any]) = ??? } trait MacroHelpers { object Impls4 { - def foo(c: BlackboxContext)(x: c.Expr[Any]) = x + def foo(c: Context)(x: c.Expr[Any]) = x } } object Impls5 { - def foo(c: BlackboxContext)(x: c.Expr[Any]) = ??? - def foo(c: BlackboxContext)(x: c.Expr[Any], y: c.Expr[Any]) = ??? + def foo(c: Context)(x: c.Expr[Any]) = ??? + def foo(c: Context)(x: c.Expr[Any], y: c.Expr[Any]) = ??? } object Impls6 { - def fooNullary(c: BlackboxContext) = { + def fooNullary(c: Context) = { import c.universe._ c.Expr[Unit](q"""Predef.println("it works")""") } - def fooEmpty(c: BlackboxContext)() = fooNullary(c) + def fooEmpty(c: Context)() = fooNullary(c) } object Impls7 { - def foo[U <: Int](c: BlackboxContext) = ??? + def foo[U <: Int](c: Context) = ??? } package foo { object Impls8 { - private[foo] def impl(c: BlackboxContext) = ??? + private[foo] def impl(c: Context) = ??? } }
\ No newline at end of file diff --git a/test/files/neg/macro-invalidimpl/Macros_Test_2.scala b/test/files/neg/macro-invalidimpl/Macros_Test_2.scala index 0df7d2e0c5..6760d99959 100644 --- a/test/files/neg/macro-invalidimpl/Macros_Test_2.scala +++ b/test/files/neg/macro-invalidimpl/Macros_Test_2.scala @@ -1,4 +1,4 @@ -import scala.reflect.macros.BlackboxContext +import scala.reflect.macros.blackbox.Context object Macros1 { val impls = new Impls1 @@ -12,7 +12,7 @@ object Macros2 { class Macros3 { object Impls3 { - def foo(c: BlackboxContext)(x: c.Expr[Any]) = ??? + def foo(c: Context)(x: c.Expr[Any]) = ??? } def foo(x: Any) = macro Impls3.foo diff --git a/test/files/neg/macro-invalidret.check b/test/files/neg/macro-invalidret.check index 6c5baf76b4..568cc7c570 100644 --- a/test/files/neg/macro-invalidret.check +++ b/test/files/neg/macro-invalidret.check @@ -1,14 +1,14 @@ Macros_Test_2.scala:2: error: macro implementation has incompatible shape: - required: (c: scala.reflect.macros.BlackboxContext): c.Expr[Any] - or : (c: scala.reflect.macros.BlackboxContext): c.Tree - found : (c: scala.reflect.macros.BlackboxContext): Int + required: (c: scala.reflect.macros.blackbox.Context): c.Expr[Any] + or : (c: scala.reflect.macros.blackbox.Context): c.Tree + found : (c: scala.reflect.macros.blackbox.Context): Int type mismatch for return type: Int does not conform to c.Expr[Any] def foo1 = macro Impls.foo1 ^ Macros_Test_2.scala:3: error: macro implementation has incompatible shape: - required: (c: scala.reflect.macros.BlackboxContext): c.Expr[Any] - or : (c: scala.reflect.macros.BlackboxContext): c.Tree - found : (c: scala.reflect.macros.BlackboxContext): reflect.runtime.universe.Literal + required: (c: scala.reflect.macros.blackbox.Context): c.Expr[Any] + or : (c: scala.reflect.macros.blackbox.Context): c.Tree + found : (c: scala.reflect.macros.blackbox.Context): reflect.runtime.universe.Literal type mismatch for return type: reflect.runtime.universe.Literal does not conform to c.Expr[Any] def foo2 = macro Impls.foo2 ^ @@ -20,7 +20,7 @@ Macros_Test_2.scala:7: warning: macro defs must have explicitly specified return ^ Macros_Test_2.scala:14: error: exception during macro expansion: scala.NotImplementedError: an implementation is missing - at scala.Predef$.$qmark$qmark$qmark(Predef.scala:227) + at scala.Predef$.$qmark$qmark$qmark(Predef.scala:225) at Impls$.foo3(Impls_1.scala:7) foo3 diff --git a/test/files/neg/macro-invalidret/Impls_1.scala b/test/files/neg/macro-invalidret/Impls_1.scala index b32463899e..434aeef10f 100644 --- a/test/files/neg/macro-invalidret/Impls_1.scala +++ b/test/files/neg/macro-invalidret/Impls_1.scala @@ -1,10 +1,10 @@ -import scala.reflect.macros.BlackboxContext +import scala.reflect.macros.blackbox.Context import scala.reflect.runtime.{universe => ru} object Impls { - def foo1(c: BlackboxContext) = 2 - def foo2(c: BlackboxContext) = ru.Literal(ru.Constant(42)) - def foo3(c: BlackboxContext) = ??? - def foo5(c: BlackboxContext) = c.universe.Literal(c.universe.Constant(42)) - def foo6(c: BlackboxContext) = c.Expr[Int](c.universe.Literal(c.universe.Constant(42))) + def foo1(c: Context) = 2 + def foo2(c: Context) = ru.Literal(ru.Constant(42)) + def foo3(c: Context) = ??? + def foo5(c: Context) = c.universe.Literal(c.universe.Constant(42)) + def foo6(c: Context) = c.Expr[Int](c.universe.Literal(c.universe.Constant(42))) } diff --git a/test/files/neg/macro-invalidshape/Impls_1.scala b/test/files/neg/macro-invalidshape/Impls_1.scala index 3d5da9a2ed..acc6b52b7b 100644 --- a/test/files/neg/macro-invalidshape/Impls_1.scala +++ b/test/files/neg/macro-invalidshape/Impls_1.scala @@ -1,5 +1,5 @@ -import scala.reflect.macros.{BlackboxContext => Ctx} +import scala.reflect.macros.blackbox.Context object Impls { - def foo(c: Ctx)(x: c.Expr[Any]) = ??? + def foo(c: Context)(x: c.Expr[Any]) = ??? } diff --git a/test/files/neg/macro-invalidshape/Macros_Test_2.scala b/test/files/neg/macro-invalidshape/Macros_Test_2.scala index 8f643ab281..160bbf5f53 100644 --- a/test/files/neg/macro-invalidshape/Macros_Test_2.scala +++ b/test/files/neg/macro-invalidshape/Macros_Test_2.scala @@ -3,7 +3,7 @@ object Macros { def foo2(x: Any) = macro Impls.foo(null)(null) def foo3(x: Any) = macro {2; Impls.foo} { - def impl(c: scala.reflect.macros.BlackboxContext) = { import c.universe._; c.Expr[Unit](q"()") } + def impl(c: scala.reflect.macros.blackbox.Context) = { import c.universe._; c.Expr[Unit](q"()") } def foo = macro impl foo } diff --git a/test/files/neg/macro-invalidsig-params-badtype.check b/test/files/neg/macro-invalidsig-params-badtype.check index d6b5c5521d..159754c72e 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 incompatible shape: - required: (c: scala.reflect.macros.BlackboxContext)(x: c.Expr[Int]): c.Expr[Nothing] - or : (c: scala.reflect.macros.BlackboxContext)(x: c.Tree): c.Tree - found : (c: scala.reflect.macros.BlackboxContext)(x: Int): Nothing + required: (c: scala.reflect.macros.blackbox.Context)(x: c.Expr[Int]): c.Expr[Nothing] + or : (c: scala.reflect.macros.blackbox.Context)(x: c.Tree): c.Tree + found : (c: scala.reflect.macros.blackbox.Context)(x: Int): Nothing type mismatch for parameter x: c.Expr[Int] does not conform to Int def foo(x: Int) = macro Impls.foo ^ diff --git a/test/files/neg/macro-invalidsig-params-badtype/Impls_Macros_1.scala b/test/files/neg/macro-invalidsig-params-badtype/Impls_Macros_1.scala index 5f468424bd..e549cc9576 100644 --- a/test/files/neg/macro-invalidsig-params-badtype/Impls_Macros_1.scala +++ b/test/files/neg/macro-invalidsig-params-badtype/Impls_Macros_1.scala @@ -1,7 +1,7 @@ -import scala.reflect.macros.{BlackboxContext => Ctx} +import scala.reflect.macros.blackbox.Context object Impls { - def foo(c: Ctx)(x: Int) = ??? + def foo(c: Context)(x: Int) = ??? } object Macros { diff --git a/test/files/neg/macro-invalidsig.check b/test/files/neg/macro-invalidsig.check index 5ff4ed18cb..8898ffc3de 100644 --- a/test/files/neg/macro-invalidsig.check +++ b/test/files/neg/macro-invalidsig.check @@ -2,30 +2,30 @@ Macros_Test_2.scala:2: error: macro implementations cannot have implicit paramet def foo[U]: Int = macro Impls1.foo[U] ^ Macros_Test_2.scala:6: error: macro implementation has incompatible shape: - required: (c: scala.reflect.macros.BlackboxContext): c.Expr[Nothing] - or : (c: scala.reflect.macros.BlackboxContext): c.Tree + required: (c: scala.reflect.macros.blackbox.Context): c.Expr[Nothing] + or : (c: scala.reflect.macros.blackbox.Context): c.Tree found : : Nothing number of parameter sections differ def foo = macro Impls2.foo ^ Macros_Test_2.scala:10: error: macro implementation has incompatible shape: - required: (c: scala.reflect.macros.BlackboxContext): c.Expr[Nothing] - or : (c: scala.reflect.macros.BlackboxContext): c.Tree + required: (c: scala.reflect.macros.blackbox.Context): c.Expr[Nothing] + or : (c: scala.reflect.macros.blackbox.Context): c.Tree found : (c: scala.reflect.api.Universe): Nothing -type mismatch for parameter c: scala.reflect.macros.BlackboxContext does not conform to scala.reflect.api.Universe +type mismatch for parameter c: scala.reflect.macros.blackbox.Context does not conform to scala.reflect.api.Universe def foo = macro Impls3.foo ^ Macros_Test_2.scala:14: error: macro implementation has incompatible shape: - required: (c: scala.reflect.macros.BlackboxContext): c.Expr[Nothing] - or : (c: scala.reflect.macros.BlackboxContext): c.Tree - found : (cs: scala.reflect.macros.BlackboxContext*): Nothing + required: (c: scala.reflect.macros.blackbox.Context): c.Expr[Nothing] + or : (c: scala.reflect.macros.blackbox.Context): c.Tree + found : (cs: scala.reflect.macros.blackbox.Context*): Nothing types incompatible for parameter cs: corresponding is not a vararg parameter def foo = macro Impls4.foo ^ Macros_Test_2.scala:18: error: macro implementation has incompatible shape: - required: (c: scala.reflect.macros.BlackboxContext)(x: c.Expr[Any]): c.Expr[Nothing] - or : (c: scala.reflect.macros.BlackboxContext)(x: c.Tree): c.Tree - found : (c: scala.reflect.macros.BlackboxContext): Nothing + required: (c: scala.reflect.macros.blackbox.Context)(x: c.Expr[Any]): c.Expr[Nothing] + or : (c: scala.reflect.macros.blackbox.Context)(x: c.Tree): c.Tree + found : (c: scala.reflect.macros.blackbox.Context): Nothing number of parameter sections differ def foo(x: Any) = macro Impls5.foo ^ @@ -33,37 +33,37 @@ Macros_Test_2.scala:22: error: macro implementations cannot have implicit parame def foo[U](x: Int) = macro Impls6.foo[T, U] ^ Macros_Test_2.scala:26: error: macro implementation has incompatible shape: - required: (c: scala.reflect.macros.BlackboxContext)(x: c.Expr[Int]): c.Expr[Nothing] - or : (c: scala.reflect.macros.BlackboxContext)(x: c.Tree): c.Tree - found : (c: scala.reflect.macros.BlackboxContext)(x: c.Expr[Int], y: c.Expr[Int]): Nothing + required: (c: scala.reflect.macros.blackbox.Context)(x: c.Expr[Int]): c.Expr[Nothing] + or : (c: scala.reflect.macros.blackbox.Context)(x: c.Tree): c.Tree + found : (c: scala.reflect.macros.blackbox.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 Impls7.foo ^ Macros_Test_2.scala:30: error: macro implementation has incompatible shape: - required: (c: scala.reflect.macros.BlackboxContext)(x: c.Expr[Int]): c.Expr[Nothing] - or : (c: scala.reflect.macros.BlackboxContext)(x: c.Tree): c.Tree - found : (c: scala.reflect.macros.BlackboxContext)(x: c.universe.Symbol): Nothing + required: (c: scala.reflect.macros.blackbox.Context)(x: c.Expr[Int]): c.Expr[Nothing] + or : (c: scala.reflect.macros.blackbox.Context)(x: c.Tree): c.Tree + found : (c: scala.reflect.macros.blackbox.Context)(x: c.universe.Symbol): Nothing type mismatch for parameter x: c.Expr[Int] does not conform to c.universe.Symbol def foo(x: Int) = macro Impls8.foo ^ Macros_Test_2.scala:34: error: macro implementation has incompatible shape: - required: (c: scala.reflect.macros.BlackboxContext)(x: c.Expr[Int], y: c.Expr[Int]): c.Expr[Nothing] - or : (c: scala.reflect.macros.BlackboxContext)(x: c.Tree, y: c.Tree): c.Tree - found : (c: scala.reflect.macros.BlackboxContext)(xs: c.Expr[Int]*): Nothing + required: (c: scala.reflect.macros.blackbox.Context)(x: c.Expr[Int], y: c.Expr[Int]): c.Expr[Nothing] + or : (c: scala.reflect.macros.blackbox.Context)(x: c.Tree, y: c.Tree): c.Tree + found : (c: scala.reflect.macros.blackbox.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 Impls9.foo ^ Macros_Test_2.scala:38: error: macro implementation has incompatible shape: - required: (c: scala.reflect.macros.BlackboxContext)(x: c.Expr[Int], y: c.Expr[Int]): c.Expr[Nothing] - or : (c: scala.reflect.macros.BlackboxContext)(x: c.Tree, y: c.Tree): c.Tree - found : (c: scala.reflect.macros.BlackboxContext)(y: c.Expr[Int], x: c.Expr[Int]): Nothing + required: (c: scala.reflect.macros.blackbox.Context)(x: c.Expr[Int], y: c.Expr[Int]): c.Expr[Nothing] + or : (c: scala.reflect.macros.blackbox.Context)(x: c.Tree, y: c.Tree): c.Tree + found : (c: scala.reflect.macros.blackbox.Context)(y: c.Expr[Int], x: c.Expr[Int]): Nothing parameter names differ: x != y def foo(x: Int, y: Int) = macro Impls10.foo ^ Macros_Test_2.scala:42: error: macro implementation has incompatible shape: - required: (c: scala.reflect.macros.BlackboxContext): c.Expr[Nothing] - or : (c: scala.reflect.macros.BlackboxContext): c.Tree - found : (c: scala.reflect.macros.BlackboxContext)(U: c.universe.Type): Nothing + required: (c: scala.reflect.macros.blackbox.Context): c.Expr[Nothing] + or : (c: scala.reflect.macros.blackbox.Context): c.Tree + found : (c: scala.reflect.macros.blackbox.Context)(U: c.universe.Type): Nothing number of parameter sections differ def foo[U] = macro Impls11.foo[U] ^ @@ -73,13 +73,13 @@ Macros_Test_2.scala:46: error: type arguments [U] do not conform to method foo's Macros_Test_2.scala:50: error: type arguments [U] do not conform to method foo's type parameter bounds [U <: String] def foo[U <: Int] = macro Impls13.foo[U] ^ -Macros_Test_2.scala:54: error: macro implementation reference has too few type arguments for method foo: [U](c: scala.reflect.macros.BlackboxContext)(implicit evidence$4: c.WeakTypeTag[U])Nothing +Macros_Test_2.scala:54: error: macro implementation reference has too few type arguments for method foo: [U](c: scala.reflect.macros.blackbox.Context)(implicit evidence$4: c.WeakTypeTag[U])Nothing def foo = macro Impls14.foo ^ -Macros_Test_2.scala:59: error: macro implementation reference has too few type arguments for method foo: [T, U, V](c: scala.reflect.macros.BlackboxContext)(implicit evidence$5: c.WeakTypeTag[T], implicit evidence$6: c.WeakTypeTag[U], implicit V: c.WeakTypeTag[V])c.Expr[Unit] +Macros_Test_2.scala:59: error: macro implementation reference has too few type arguments for method foo: [T, U, V](c: scala.reflect.macros.blackbox.Context)(implicit evidence$5: c.WeakTypeTag[T], implicit evidence$6: c.WeakTypeTag[U], implicit V: c.WeakTypeTag[V])c.Expr[Unit] def foo15[V]: Unit = macro Impls15.foo ^ -Macros_Test_2.scala:60: error: wrong number of type parameters for method foo: [T, U, V](c: scala.reflect.macros.BlackboxContext)(implicit evidence$7: c.WeakTypeTag[T], implicit evidence$8: c.WeakTypeTag[U], implicit V: c.WeakTypeTag[V])c.Expr[Unit] +Macros_Test_2.scala:60: error: wrong number of type parameters for method foo: [T, U, V](c: scala.reflect.macros.blackbox.Context)(implicit evidence$7: c.WeakTypeTag[T], implicit evidence$8: c.WeakTypeTag[U], implicit V: c.WeakTypeTag[V])c.Expr[Unit] def foo16[V]: Unit = macro Impls16.foo[V] ^ 16 errors found diff --git a/test/files/neg/macro-invalidsig/Impls_1.scala b/test/files/neg/macro-invalidsig/Impls_1.scala index 7c98160925..b0a3912380 100644 --- a/test/files/neg/macro-invalidsig/Impls_1.scala +++ b/test/files/neg/macro-invalidsig/Impls_1.scala @@ -1,8 +1,8 @@ import scala.reflect.runtime.universe._ -import scala.reflect.macros.BlackboxContext +import scala.reflect.macros.blackbox.Context object Impls1 { - def foo[U: c.WeakTypeTag: Numeric](c: BlackboxContext) = { import c.universe._; q"42" } + def foo[U: c.WeakTypeTag: Numeric](c: Context) = { import c.universe._; q"42" } } object Impls2 { @@ -14,15 +14,15 @@ object Impls3 { } object Impls4 { - def foo(cs: BlackboxContext*) = ??? + def foo(cs: Context*) = ??? } object Impls5 { - def foo(c: BlackboxContext) = ??? + def foo(c: Context) = ??? } object Impls6 { - def foo[T, U: c.WeakTypeTag](c: BlackboxContext)(implicit x: c.Expr[Int]) = { + def foo[T, U: c.WeakTypeTag](c: Context)(implicit x: c.Expr[Int]) = { import c.{prefix => prefix} import c.universe._ c.Expr[Unit](q""" @@ -34,39 +34,39 @@ object Impls6 { } object Impls7 { - def foo(c: BlackboxContext)(x: c.Expr[Int], y: c.Expr[Int]) = ??? + def foo(c: Context)(x: c.Expr[Int], y: c.Expr[Int]) = ??? } object Impls8 { - def foo(c: BlackboxContext)(x: c.universe.Symbol) = ??? + def foo(c: Context)(x: c.universe.Symbol) = ??? } object Impls9 { - def foo(c: BlackboxContext)(xs: c.Expr[Int]*) = ??? + def foo(c: Context)(xs: c.Expr[Int]*) = ??? } object Impls10 { - def foo(c: BlackboxContext)(y: c.Expr[Int], x: c.Expr[Int]) = ??? + def foo(c: Context)(y: c.Expr[Int], x: c.Expr[Int]) = ??? } object Impls11 { - def foo[U](c: BlackboxContext)(U: c.universe.Type) = ??? + def foo[U](c: Context)(U: c.universe.Type) = ??? } object Impls12 { - def foo[U <: String](c: BlackboxContext) = ??? + def foo[U <: String](c: Context) = ??? } object Impls13 { - def foo[U <: String](c: BlackboxContext) = ??? + def foo[U <: String](c: Context) = ??? } object Impls14 { - def foo[U: c.WeakTypeTag](c: BlackboxContext) = ??? + def foo[U: c.WeakTypeTag](c: Context) = ??? } object Impls15 { - def foo[T: c.WeakTypeTag, U: c.WeakTypeTag, V](c: BlackboxContext)(implicit V: c.WeakTypeTag[V]): c.Expr[Unit] = { + def foo[T: c.WeakTypeTag, U: c.WeakTypeTag, V](c: Context)(implicit V: c.WeakTypeTag[V]): c.Expr[Unit] = { import c.universe._ println(implicitly[c.WeakTypeTag[T]]) println(implicitly[c.WeakTypeTag[U]]) @@ -76,7 +76,7 @@ object Impls15 { } object Impls16 { - def foo[T: c.WeakTypeTag, U: c.WeakTypeTag, V](c: BlackboxContext)(implicit V: c.WeakTypeTag[V]): c.Expr[Unit] = { + def foo[T: c.WeakTypeTag, U: c.WeakTypeTag, V](c: Context)(implicit V: c.WeakTypeTag[V]): c.Expr[Unit] = { import c.universe._ println(implicitly[c.WeakTypeTag[T]]) println(implicitly[c.WeakTypeTag[U]]) diff --git a/test/files/neg/macro-invalidusage-badargs/Impls_1.scala b/test/files/neg/macro-invalidusage-badargs/Impls_1.scala index 678cb53929..8765cfbd5f 100644 --- a/test/files/neg/macro-invalidusage-badargs/Impls_1.scala +++ b/test/files/neg/macro-invalidusage-badargs/Impls_1.scala @@ -1,5 +1,5 @@ -import scala.reflect.macros.{BlackboxContext => Ctx} +import scala.reflect.macros.blackbox.Context object Impls { - def foo(c: Ctx)(x: c.Expr[Int]) = x + def foo(c: Context)(x: c.Expr[Int]) = x } diff --git a/test/files/neg/macro-invalidusage-badbounds/Impls_1.scala b/test/files/neg/macro-invalidusage-badbounds/Impls_1.scala index 393f7de976..1769da91e1 100644 --- a/test/files/neg/macro-invalidusage-badbounds/Impls_1.scala +++ b/test/files/neg/macro-invalidusage-badbounds/Impls_1.scala @@ -1,5 +1,5 @@ -import scala.reflect.macros.{BlackboxContext => Ctx} +import scala.reflect.macros.blackbox.Context object Impls { - def foo[U <: String](c: Ctx) = { import c.universe._; c.Expr[Unit](q"()") } + def foo[U <: String](c: Context) = { import c.universe._; c.Expr[Unit](q"()") } } diff --git a/test/files/neg/macro-invalidusage-badtargs/Impls_1.scala b/test/files/neg/macro-invalidusage-badtargs/Impls_1.scala index 678cb53929..8765cfbd5f 100644 --- a/test/files/neg/macro-invalidusage-badtargs/Impls_1.scala +++ b/test/files/neg/macro-invalidusage-badtargs/Impls_1.scala @@ -1,5 +1,5 @@ -import scala.reflect.macros.{BlackboxContext => Ctx} +import scala.reflect.macros.blackbox.Context object Impls { - def foo(c: Ctx)(x: c.Expr[Int]) = x + def foo(c: Context)(x: c.Expr[Int]) = x } diff --git a/test/files/neg/macro-invalidusage-methodvaluesyntax/Impls_1.scala b/test/files/neg/macro-invalidusage-methodvaluesyntax/Impls_1.scala index 15894efb68..776f8bf71c 100644 --- a/test/files/neg/macro-invalidusage-methodvaluesyntax/Impls_1.scala +++ b/test/files/neg/macro-invalidusage-methodvaluesyntax/Impls_1.scala @@ -1,7 +1,7 @@ -import scala.reflect.macros.{BlackboxContext => Ctx} +import scala.reflect.macros.blackbox.Context object Impls { - def foo(c: Ctx) = { + def foo(c: Context) = { import c.universe._ c.Expr[Unit](q"""println("it works")""") } diff --git a/test/files/neg/macro-invalidusage-nontypeable/Impls_Macros_1.scala b/test/files/neg/macro-invalidusage-nontypeable/Impls_Macros_1.scala index 44e508a1c6..b6b9611743 100644 --- a/test/files/neg/macro-invalidusage-nontypeable/Impls_Macros_1.scala +++ b/test/files/neg/macro-invalidusage-nontypeable/Impls_Macros_1.scala @@ -1,7 +1,7 @@ -import scala.reflect.macros.{BlackboxContext => Ctx} +import scala.reflect.macros.blackbox.Context object Impls { - def foo(c: Ctx) = { + def foo(c: Context) = { import c.universe._ val body = Ident(TermName("IDoNotExist")) c.Expr[Int](body) diff --git a/test/files/neg/macro-invalidusage-presuper/Impls_1.scala b/test/files/neg/macro-invalidusage-presuper/Impls_1.scala index 02c87b5a81..ea98f01fa4 100644 --- a/test/files/neg/macro-invalidusage-presuper/Impls_1.scala +++ b/test/files/neg/macro-invalidusage-presuper/Impls_1.scala @@ -1,5 +1,5 @@ -import scala.reflect.macros.BlackboxContext +import scala.reflect.macros.blackbox.Context object Impls { - def impl(c: BlackboxContext) = { import c.universe._; c.Expr[Unit](q"()") } + def impl(c: Context) = { import c.universe._; c.Expr[Unit](q"()") } }
\ No newline at end of file diff --git a/test/files/neg/macro-noexpand/Impls_1.scala b/test/files/neg/macro-noexpand/Impls_1.scala index 3d5da9a2ed..acc6b52b7b 100644 --- a/test/files/neg/macro-noexpand/Impls_1.scala +++ b/test/files/neg/macro-noexpand/Impls_1.scala @@ -1,5 +1,5 @@ -import scala.reflect.macros.{BlackboxContext => Ctx} +import scala.reflect.macros.blackbox.Context object Impls { - def foo(c: Ctx)(x: c.Expr[Any]) = ??? + def foo(c: Context)(x: c.Expr[Any]) = ??? } diff --git a/test/files/neg/macro-nontypeablebody/Impls_1.scala b/test/files/neg/macro-nontypeablebody/Impls_1.scala index 3d5da9a2ed..acc6b52b7b 100644 --- a/test/files/neg/macro-nontypeablebody/Impls_1.scala +++ b/test/files/neg/macro-nontypeablebody/Impls_1.scala @@ -1,5 +1,5 @@ -import scala.reflect.macros.{BlackboxContext => Ctx} +import scala.reflect.macros.blackbox.Context object Impls { - def foo(c: Ctx)(x: c.Expr[Any]) = ??? + def foo(c: Context)(x: c.Expr[Any]) = ??? } diff --git a/test/files/neg/macro-override-macro-overrides-abstract-method-a/Impls_Macros_1.scala b/test/files/neg/macro-override-macro-overrides-abstract-method-a/Impls_Macros_1.scala index 9c05db83e3..916b454463 100644 --- a/test/files/neg/macro-override-macro-overrides-abstract-method-a/Impls_Macros_1.scala +++ b/test/files/neg/macro-override-macro-overrides-abstract-method-a/Impls_Macros_1.scala @@ -1,7 +1,7 @@ -import scala.reflect.macros.{BlackboxContext => Ctx} +import scala.reflect.macros.blackbox.Context object Impls { - def impl(c: Ctx)(x: c.Expr[Int]) = x + def impl(c: Context)(x: c.Expr[Int]) = x } trait Foo { diff --git a/test/files/neg/macro-override-macro-overrides-abstract-method-b/Impls_Macros_1.scala b/test/files/neg/macro-override-macro-overrides-abstract-method-b/Impls_Macros_1.scala index c98279b2b8..17827abf7a 100644 --- a/test/files/neg/macro-override-macro-overrides-abstract-method-b/Impls_Macros_1.scala +++ b/test/files/neg/macro-override-macro-overrides-abstract-method-b/Impls_Macros_1.scala @@ -1,8 +1,8 @@ -import scala.reflect.macros.BlackboxContext +import scala.reflect.macros.blackbox.Context import language.experimental.macros trait T { def t(): Unit } trait A { def t(): Unit = () } -object Macro { def t(c: BlackboxContext)(): c.Expr[Unit] = c.universe.reify(()) } +object Macro { def t(c: Context)(): c.Expr[Unit] = c.universe.reify(()) } trait C extends T { self: A => override def t(): Unit = macro Macro.t } diff --git a/test/files/neg/macro-override-method-overrides-macro/Impls_1.scala b/test/files/neg/macro-override-method-overrides-macro/Impls_1.scala index f2d3f67ccc..f3917e3093 100644 --- a/test/files/neg/macro-override-method-overrides-macro/Impls_1.scala +++ b/test/files/neg/macro-override-method-overrides-macro/Impls_1.scala @@ -1,14 +1,14 @@ -import scala.reflect.macros.{BlackboxContext => Ctx} +import scala.reflect.macros.blackbox.Context object Impls { - def impl(c: Ctx)(tag: String, x: c.Expr[_]) = { + def impl(c: Context)(tag: String, x: c.Expr[_]) = { import c.{prefix => prefix} import c.universe._ c.Expr[Unit](q"println($tag, ${prefix.toString}, $x)") } - def fooBString(c: Ctx)(x: c.Expr[_]) = impl(c)("fooBString", x) - def fooBInt(c: Ctx)(x: c.Expr[_]) = impl(c)("fooBInt", x) - def fooDInt(c: Ctx)(x: c.Expr[_]) = impl(c)("fooDInt", x) - def fooZString(c: Ctx)(x: c.Expr[_]) = impl(c)("fooZString", x) + def fooBString(c: Context)(x: c.Expr[_]) = impl(c)("fooBString", x) + def fooBInt(c: Context)(x: c.Expr[_]) = impl(c)("fooBInt", x) + def fooDInt(c: Context)(x: c.Expr[_]) = impl(c)("fooDInt", x) + def fooZString(c: Context)(x: c.Expr[_]) = impl(c)("fooZString", x) }
\ No newline at end of file diff --git a/test/files/neg/macro-quasiquotes/Macros_1.scala b/test/files/neg/macro-quasiquotes/Macros_1.scala index 098e4b3b92..b123c475c2 100644 --- a/test/files/neg/macro-quasiquotes/Macros_1.scala +++ b/test/files/neg/macro-quasiquotes/Macros_1.scala @@ -1,7 +1,7 @@ import language.experimental.macros -import scala.reflect.macros.BlackboxMacro +import scala.reflect.macros.blackbox.Context -trait Impls extends BlackboxMacro { +class Impls(val c: Context) { import c.universe._ def impl1(x: Expr[Int]) = q"println(x)" def impl2(x: Tree) = q"println(x)" diff --git a/test/files/neg/macro-reify-splice-splice/Macros_1.scala b/test/files/neg/macro-reify-splice-splice/Macros_1.scala index 691f22ad07..306e78ad97 100644 --- a/test/files/neg/macro-reify-splice-splice/Macros_1.scala +++ b/test/files/neg/macro-reify-splice-splice/Macros_1.scala @@ -1,10 +1,10 @@ -import scala.reflect.macros.{BlackboxContext => Ctx} +import scala.reflect.macros.blackbox.Context object Macros { def foo = macro Impls.foo object Impls { - def foo(c: Ctx) = c.universe.reify { + def foo(c: Context) = c.universe.reify { { c.universe.reify(c.universe.reify("hello world")) }.splice.splice } } diff --git a/test/files/neg/macro-without-xmacros-a/Impls_1.scala b/test/files/neg/macro-without-xmacros-a/Impls_1.scala index 6b73a96184..035913f3e3 100644 --- a/test/files/neg/macro-without-xmacros-a/Impls_1.scala +++ b/test/files/neg/macro-without-xmacros-a/Impls_1.scala @@ -1,17 +1,17 @@ -import scala.reflect.macros.{BlackboxContext => Ctx} +import scala.reflect.macros.blackbox.Context object Impls { - def foo_impl(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { + def foo_impl(c: Context)(x: c.Expr[Int]): c.Expr[Int] = { import c.universe._ c.Expr(q"$x + 1") } - def bar_impl(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { + def bar_impl(c: Context)(x: c.Expr[Int]): c.Expr[Int] = { import c.universe._ c.Expr(q"$x + 2") } - def quux_impl(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { + def quux_impl(c: Context)(x: c.Expr[Int]): c.Expr[Int] = { import c.universe._ c.Expr(q"$x + 3") } diff --git a/test/files/neg/macro-without-xmacros-b/Impls_1.scala b/test/files/neg/macro-without-xmacros-b/Impls_1.scala index 6b73a96184..035913f3e3 100644 --- a/test/files/neg/macro-without-xmacros-b/Impls_1.scala +++ b/test/files/neg/macro-without-xmacros-b/Impls_1.scala @@ -1,17 +1,17 @@ -import scala.reflect.macros.{BlackboxContext => Ctx} +import scala.reflect.macros.blackbox.Context object Impls { - def foo_impl(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { + def foo_impl(c: Context)(x: c.Expr[Int]): c.Expr[Int] = { import c.universe._ c.Expr(q"$x + 1") } - def bar_impl(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { + def bar_impl(c: Context)(x: c.Expr[Int]): c.Expr[Int] = { import c.universe._ c.Expr(q"$x + 2") } - def quux_impl(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { + def quux_impl(c: Context)(x: c.Expr[Int]): c.Expr[Int] = { import c.universe._ c.Expr(q"$x + 3") } diff --git a/test/files/neg/t2066.check b/test/files/neg/t2066.check new file mode 100644 index 0000000000..efade87e26 --- /dev/null +++ b/test/files/neg/t2066.check @@ -0,0 +1,21 @@ +t2066.scala:6: error: overriding method f in trait A1 of type [T[_]]=> Unit; + method f has incompatible type + override def f[T[+_]] = () + ^ +t2066.scala:10: error: overriding method f in trait A1 of type [T[_]]=> Unit; + method f has incompatible type + override def f[T[-_]] = () + ^ +t2066.scala:23: error: overriding method f in trait A2 of type [T[+_]]=> Unit; + method f has incompatible type + override def f[T[-_]] = () + ^ +t2066.scala:45: error: overriding method f in trait A4 of type [T[X[+_]]]=> Unit; + method f has incompatible type + override def f[T[X[_]]] = () + ^ +t2066.scala:53: error: overriding method f in trait A5 of type [T[X[-_]]]=> Unit; + method f has incompatible type + override def f[T[X[_]]] = () + ^ +5 errors found diff --git a/test/files/neg/t2066.scala b/test/files/neg/t2066.scala new file mode 100644 index 0000000000..7f15d39c67 --- /dev/null +++ b/test/files/neg/t2066.scala @@ -0,0 +1,70 @@ +trait A1 { + def f[T[_]] = () +} + +trait B1 extends A1 { + override def f[T[+_]] = () +} + +trait C1 extends A1 { + override def f[T[-_]] = () +} + + +trait A2 { + def f[T[+_]] = () +} + +trait B2 extends A2 { + override def f[T[_]] = () // okay +} + +trait C2 extends A2 { + override def f[T[-_]] = () +} + + +trait A3 { + def f[T[-_]] = () +} + +trait B3 extends A3 { + override def f[T[_]] = () // okay +} + +trait C3 extends A3 { + override def f[T[-_]] = () +} + + +trait A4 { + def f[T[X[+_]]] = () +} + +trait B4 extends A4 { + override def f[T[X[_]]] = () +} + +trait A5 { + def f[T[X[-_]]] = () +} + +trait B5 extends A5 { + override def f[T[X[_]]] = () +} + + + +trait A6 { + def f[T[X[_]]] = () +} + +trait B6 extends A6 { + override def f[T[X[+_]]] = () // okay +} +trait C6 extends A6 { + override def f[T[X[_]]] = () // okay +} +trait D6 extends A6 { + override def f[T[X[-_]]] = () +} diff --git a/test/files/neg/t2066b.check b/test/files/neg/t2066b.check new file mode 100644 index 0000000000..097c44fef3 --- /dev/null +++ b/test/files/neg/t2066b.check @@ -0,0 +1,5 @@ +t2066b.scala:7: error: overriding method f in trait A of type [T[_]](x: T[Int])T[Any]; + method f has incompatible type + def f[T[+_]](x : T[Int]) : T[Any] = x + ^ +one error found diff --git a/test/files/neg/t2066b.scala b/test/files/neg/t2066b.scala new file mode 100644 index 0000000000..46177b19f7 --- /dev/null +++ b/test/files/neg/t2066b.scala @@ -0,0 +1,16 @@ +object Test extends App { + trait A { + def f[T[_]](x : T[Int]) : T[Any] + } + + class B extends A { + def f[T[+_]](x : T[Int]) : T[Any] = x + } + + class P[Y](var y : Y) + + val p = new P(1) + val palias = (new B():A).f[P](p) + palias.y = "hello" + val z: Int = p.y +}
\ No newline at end of file diff --git a/test/files/neg/t3403.scala b/test/files/neg/t3403.scala index 8be6ab2a31..7cf0c3e0f7 100644 --- a/test/files/neg/t3403.scala +++ b/test/files/neg/t3403.scala @@ -1,2 +1,2 @@ -import scala.reflect.{BeanProperty => bp} +import scala.beans.{BeanProperty => bp} class Foo { @bp var bar: Int = 1 } diff --git a/test/files/neg/t4425.check b/test/files/neg/t4425.check index 95b88a6b3d..00006c08f0 100644 --- a/test/files/neg/t4425.check +++ b/test/files/neg/t4425.check @@ -1,12 +1,12 @@ -t4425.scala:3: error: object X is not a case class constructor, nor does it have an unapply/unapplySeq method +t4425.scala:3: error: object X is not a case class, nor does it have an unapply/unapplySeq member Note: def unapply(x: Int)(y: Option[Int]): None.type exists in object X, but it cannot be used as an extractor due to its second non-implicit parameter list 42 match { case _ X _ => () } ^ -t4425.scala:8: error: object X is not a case class constructor, nor does it have an unapply/unapplySeq method +t4425.scala:8: error: object X is not a case class, nor does it have an unapply/unapplySeq member Note: def unapply(x: Int)(y: Int): Some[(Int, Int)] exists in object X, but it cannot be used as an extractor due to its second non-implicit parameter list 42 match { case _ X _ => () } ^ -t4425.scala:13: error: object X is not a case class constructor, nor does it have an unapply/unapplySeq method +t4425.scala:13: error: object X is not a case class, nor does it have an unapply/unapplySeq member Note: def unapply(x: String)(y: String): Some[(Int, Int)] exists in object X, but it cannot be used as an extractor due to its second non-implicit parameter list "" match { case _ X _ => () } ^ diff --git a/test/files/neg/t4425b.check b/test/files/neg/t4425b.check index 1186e8b609..8418b4fd12 100644 --- a/test/files/neg/t4425b.check +++ b/test/files/neg/t4425b.check @@ -1,61 +1,49 @@ -t4425b.scala:5: error: object X is not a case class constructor, nor does it have an unapply/unapplySeq method +t4425b.scala:5: error: object X is not a case class, nor does it have an unapply/unapplySeq member Note: def unapply(x: String)(y: String): Nothing exists in object X, but it cannot be used as an extractor due to its second non-implicit parameter list println( "" match { case _ X _ => "ok" ; case _ => "fail" }) ^ -t4425b.scala:6: error: object X is not a case class constructor, nor does it have an unapply/unapplySeq method +t4425b.scala:6: error: object X is not a case class, nor does it have an unapply/unapplySeq member Note: def unapply(x: String)(y: String): Nothing exists in object X, but it cannot be used as an extractor due to its second non-implicit parameter list println((X: Any) match { case _ X _ => "ok" ; case _ => "fail" }) ^ -t4425b.scala:7: error: object X is not a case class constructor, nor does it have an unapply/unapplySeq method +t4425b.scala:7: error: object X is not a case class, nor does it have an unapply/unapplySeq member Note: def unapply(x: String)(y: String): Nothing exists in object X, but it cannot be used as an extractor due to its second non-implicit parameter list println( "" match { case X(_) => "ok" ; case _ => "fail" }) ^ -t4425b.scala:8: error: object X is not a case class constructor, nor does it have an unapply/unapplySeq method +t4425b.scala:8: error: object X is not a case class, nor does it have an unapply/unapplySeq member Note: def unapply(x: String)(y: String): Nothing exists in object X, but it cannot be used as an extractor due to its second non-implicit parameter list println((X: Any) match { case X(_) => "ok" ; case _ => "fail" }) ^ -t4425b.scala:9: error: object X is not a case class constructor, nor does it have an unapply/unapplySeq method +t4425b.scala:9: error: object X is not a case class, nor does it have an unapply/unapplySeq member Note: def unapply(x: String)(y: String): Nothing exists in object X, but it cannot be used as an extractor due to its second non-implicit parameter list println( "" match { case X(_, _) => "ok" ; case _ => "fail" }) ^ -t4425b.scala:10: error: object X is not a case class constructor, nor does it have an unapply/unapplySeq method +t4425b.scala:10: error: object X is not a case class, nor does it have an unapply/unapplySeq member Note: def unapply(x: String)(y: String): Nothing exists in object X, but it cannot be used as an extractor due to its second non-implicit parameter list println((X: Any) match { case X(_, _) => "ok" ; case _ => "fail" }) ^ -t4425b.scala:18: error: wrong number of patterns for object X offering Nothing: expected 1, found 2 +t4425b.scala:18: error: too many patterns for object X: expected 1, found 2 println( "" match { case _ X _ => "ok" ; case _ => "fail" }) ^ -t4425b.scala:19: error: wrong number of patterns for object X offering Nothing: expected 1, found 2 +t4425b.scala:19: error: too many patterns for object X: expected 1, found 2 println((X: Any) match { case _ X _ => "ok" ; case _ => "fail" }) ^ -t4425b.scala:22: error: wrong number of patterns for object X offering Nothing: expected 1, found 2 +t4425b.scala:22: error: too many patterns for object X: expected 1, found 2 println( "" match { case X(_, _) => "ok" ; case _ => "fail" }) ^ -t4425b.scala:22: error: wrong number of patterns for object X offering Nothing: expected 1, found 2 - println( "" match { case X(_, _) => "ok" ; case _ => "fail" }) - ^ -t4425b.scala:23: error: wrong number of patterns for object X offering Nothing: expected 1, found 2 +t4425b.scala:23: error: too many patterns for object X: expected 1, found 2 println((X: Any) match { case X(_, _) => "ok" ; case _ => "fail" }) ^ -t4425b.scala:23: error: wrong number of patterns for object X offering Nothing: expected 1, found 2 - println((X: Any) match { case X(_, _) => "ok" ; case _ => "fail" }) - ^ -t4425b.scala:31: error: wrong number of patterns for object X offering Nothing: expected 1, found 2 +t4425b.scala:31: error: too many patterns for object X offering Nothing: expected 1, found 2 println( "" match { case _ X _ => "ok" ; case _ => "fail" }) ^ -t4425b.scala:32: error: wrong number of patterns for object X offering Nothing: expected 1, found 2 +t4425b.scala:32: error: too many patterns for object X offering Nothing: expected 1, found 2 println((X: Any) match { case _ X _ => "ok" ; case _ => "fail" }) ^ -t4425b.scala:35: error: wrong number of patterns for object X offering Nothing: expected 1, found 2 +t4425b.scala:35: error: too many patterns for object X offering Nothing: expected 1, found 2 println( "" match { case X(_, _) => "ok" ; case _ => "fail" }) ^ -t4425b.scala:35: error: wrong number of patterns for object X offering Nothing: expected 1, found 2 - println( "" match { case X(_, _) => "ok" ; case _ => "fail" }) - ^ -t4425b.scala:36: error: wrong number of patterns for object X offering Nothing: expected 1, found 2 +t4425b.scala:36: error: too many patterns for object X offering Nothing: expected 1, found 2 println((X: Any) match { case X(_, _) => "ok" ; case _ => "fail" }) ^ -t4425b.scala:36: error: wrong number of patterns for object X offering Nothing: expected 1, found 2 - println((X: Any) match { case X(_, _) => "ok" ; case _ => "fail" }) - ^ -18 errors found +14 errors found diff --git a/test/files/neg/t4851.check b/test/files/neg/t4851.check index 4f2919807e..132dd91b50 100644 --- a/test/files/neg/t4851.check +++ b/test/files/neg/t4851.check @@ -1,10 +1,10 @@ -S.scala:2: warning: Adapting argument list by inserting (): leaky (Object-receiving) target makes this especially dangerous. +S.scala:2: warning: Adaptation of argument list by inserting () has been deprecated: leaky (Object-receiving) target makes this especially dangerous. signature: J(x: Any): J given arguments: <none> after adaptation: new J((): Unit) val x1 = new J ^ -S.scala:3: warning: Adapting argument list by inserting (): leaky (Object-receiving) target makes this especially dangerous. +S.scala:3: warning: Adaptation of argument list by inserting () has been deprecated: leaky (Object-receiving) target makes this especially dangerous. signature: J(x: Any): J given arguments: <none> after adaptation: new J((): Unit) @@ -28,13 +28,13 @@ S.scala:7: warning: Adapting argument list by creating a 3-tuple: this may not b after adaptation: new Some((1, 2, 3): (Int, Int, Int)) val y2 = new Some(1, 2, 3) ^ -S.scala:9: warning: Adapting argument list by inserting (): this is unlikely to be what you want. +S.scala:9: warning: Adaptation of argument list by inserting () has been deprecated: this is unlikely to be what you want. signature: J2[T](x: T): J2[T] given arguments: <none> after adaptation: new J2((): Unit) val z1 = new J2 ^ -S.scala:10: warning: Adapting argument list by inserting (): this is unlikely to be what you want. +S.scala:10: warning: Adaptation of argument list by inserting () has been deprecated: this is unlikely to be what you want. signature: J2[T](x: T): J2[T] given arguments: <none> after adaptation: new J2((): Unit) diff --git a/test/files/neg/t4851.flags b/test/files/neg/t4851.flags index 0545cb8b84..ca0d0a0ba3 100644 --- a/test/files/neg/t4851.flags +++ b/test/files/neg/t4851.flags @@ -1 +1 @@ --Ywarn-adapted-args -Xfatal-warnings +-Ywarn-adapted-args -Xfatal-warnings -deprecation diff --git a/test/files/neg/t5689.check b/test/files/neg/t5689.check index 9271f709ca..7d4f7fb63a 100644 --- a/test/files/neg/t5689.check +++ b/test/files/neg/t5689.check @@ -1,7 +1,7 @@ t5689.scala:4: error: macro implementation has incompatible shape: - required: (c: scala.reflect.macros.BlackboxContext)(i: c.Expr[Double]): c.Expr[String] - or : (c: scala.reflect.macros.BlackboxContext)(i: c.Tree): c.Tree - found : (c: scala.reflect.macros.BlackboxContext)(i: c.Expr[Double]): c.Expr[Int] + required: (c: scala.reflect.macros.blackbox.Context)(i: c.Expr[Double]): c.Expr[String] + or : (c: scala.reflect.macros.blackbox.Context)(i: c.Tree): c.Tree + found : (c: scala.reflect.macros.blackbox.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 ^ diff --git a/test/files/neg/t5689.scala b/test/files/neg/t5689.scala index d0e468849d..d757a55417 100644 --- a/test/files/neg/t5689.scala +++ b/test/files/neg/t5689.scala @@ -1,6 +1,6 @@ -import scala.reflect.macros.BlackboxContext +import scala.reflect.macros.blackbox.Context object Macros { def returnsString(i: Double): String = macro returnsIntImpl - def returnsIntImpl(c: BlackboxContext)(i: c.Expr[Double]): c.Expr[Int] = ??? + def returnsIntImpl(c: Context)(i: c.Expr[Double]): c.Expr[Int] = ??? } diff --git a/test/files/neg/t5753/Impls_Macros_1.scala b/test/files/neg/t5753/Impls_Macros_1.scala index 0e81e21c77..9872c69171 100644 --- a/test/files/neg/t5753/Impls_Macros_1.scala +++ b/test/files/neg/t5753/Impls_Macros_1.scala @@ -1,6 +1,6 @@ -import scala.reflect.macros.{BlackboxContext => Ctx} +import scala.reflect.macros.blackbox.Context trait Impls { - def impl(c: Ctx)(x: c.Expr[Any]) = x + def impl(c: Context)(x: c.Expr[Any]) = x } diff --git a/test/files/neg/t5753/Test_2.scala b/test/files/neg/t5753/Test_2.scala index 150850a0eb..d52ed65c60 100644 --- a/test/files/neg/t5753/Test_2.scala +++ b/test/files/neg/t5753/Test_2.scala @@ -1,4 +1,4 @@ -import scala.reflect.macros.{BlackboxContext => Ctx} +import scala.reflect.macros.blackbox.Context object Macros extends Impls { def foo(x: Any): Any = macro impl diff --git a/test/files/neg/t5903a.check b/test/files/neg/t5903a.check index 2e5cc87167..34003b0a82 100644 --- a/test/files/neg/t5903a.check +++ b/test/files/neg/t5903a.check @@ -1,4 +1,4 @@ -Test_2.scala:4: error: wrong number of patterns for <$anon: AnyRef> offering (SomeTree.type, SomeTree.type): expected 2, found 3 +Test_2.scala:4: error: too many patterns for <$anon: AnyRef> offering (SomeTree.type, SomeTree.type): expected 2, found 3 case nq"$x + $y + $z" => println((x, y)) ^ one error found diff --git a/test/files/neg/t5903a/Macros_1.scala b/test/files/neg/t5903a/Macros_1.scala index ce1b035260..5d084ceed5 100644 --- a/test/files/neg/t5903a/Macros_1.scala +++ b/test/files/neg/t5903a/Macros_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.macros.WhiteboxContext +import scala.reflect.macros.whitebox.Context import language.experimental.macros trait Tree @@ -13,7 +13,7 @@ object NewQuasiquotes { } object QuasiquoteMacros { - def unapplyImpl(c: WhiteboxContext)(t: c.Tree) = { + def unapplyImpl(c: Context)(t: c.Tree) = { import c.universe._ q""" new { diff --git a/test/files/neg/t5903b/Macros_1.scala b/test/files/neg/t5903b/Macros_1.scala index dfe9d8d489..6ce49c0228 100644 --- a/test/files/neg/t5903b/Macros_1.scala +++ b/test/files/neg/t5903b/Macros_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.macros.BlackboxContext +import scala.reflect.macros.blackbox.Context import language.experimental.macros object Interpolation { @@ -10,7 +10,7 @@ object Interpolation { } object Macros { - def unapplyImpl[T: c.WeakTypeTag](c: BlackboxContext)(x: c.Tree) = { + def unapplyImpl[T: c.WeakTypeTag](c: Context)(x: c.Tree) = { import c.universe._ q""" new { diff --git a/test/files/neg/t5903c/Macros_1.scala b/test/files/neg/t5903c/Macros_1.scala index d13c3c2ec2..4792f00454 100644 --- a/test/files/neg/t5903c/Macros_1.scala +++ b/test/files/neg/t5903c/Macros_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.macros.BlackboxContext +import scala.reflect.macros.blackbox.Context import language.experimental.macros object Interpolation { @@ -10,7 +10,7 @@ object Interpolation { } object Macros { - def unapplyImpl[T: c.WeakTypeTag](c: BlackboxContext)(x: c.Tree) = { + def unapplyImpl[T: c.WeakTypeTag](c: Context)(x: c.Tree) = { import c.universe._ if (!(c.weakTypeOf[Int] =:= c.weakTypeOf[T])) c.abort(c.enclosingPosition, s"${c.weakTypeOf[T]} is not supported") else { diff --git a/test/files/neg/t5903d/Macros_1.scala b/test/files/neg/t5903d/Macros_1.scala index 2d26e998a1..3500c2a782 100644 --- a/test/files/neg/t5903d/Macros_1.scala +++ b/test/files/neg/t5903d/Macros_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.macros.BlackboxContext +import scala.reflect.macros.blackbox.Context import language.experimental.macros object Interpolation { @@ -10,7 +10,7 @@ object Interpolation { } object Macros { - def unapplyImpl(c: BlackboxContext)(x: c.Tree) = { + def unapplyImpl(c: Context)(x: c.Tree) = { import c.universe._ q""" class Match(x: Int) { diff --git a/test/files/neg/t5903e/Macros_1.scala b/test/files/neg/t5903e/Macros_1.scala index 5bdc25b832..a64ff7e0b9 100644 --- a/test/files/neg/t5903e/Macros_1.scala +++ b/test/files/neg/t5903e/Macros_1.scala @@ -1,4 +1,4 @@ -import scala.reflect.macros.WhiteboxContext +import scala.reflect.macros.whitebox.Context import language.experimental.macros object Interpolation { @@ -10,7 +10,7 @@ object Interpolation { } object Macros { - def unapplyImpl(c: WhiteboxContext)(x: c.Tree) = { + def unapplyImpl(c: Context)(x: c.Tree) = { import c.universe._ q""" new { diff --git a/test/files/neg/t6123-explaintypes-macros.check b/test/files/neg/t6123-explaintypes-macros.check index ef545fcc32..2c86f3c9cc 100644 --- a/test/files/neg/t6123-explaintypes-macros.check +++ b/test/files/neg/t6123-explaintypes-macros.check @@ -1,9 +1,9 @@ c.universe.Expr[Any]* <: c.universe.Expr[String]*? false BadMac_2.scala:6: error: macro implementation has incompatible shape: - required: (c: scala.reflect.macros.BlackboxContext)(format: c.Expr[String], params: c.Expr[Any]*): c.Expr[Unit] - or : (c: scala.reflect.macros.BlackboxContext)(format: c.Tree, params: Tree*): c.Tree - found : (c: scala.reflect.macros.BlackboxContext)(format: c.Expr[String], params: c.Expr[String]*): c.Expr[Unit] + required: (c: scala.reflect.macros.blackbox.Context)(format: c.Expr[String], params: c.Expr[Any]*): c.Expr[Unit] + or : (c: scala.reflect.macros.blackbox.Context)(format: c.Tree, params: Tree*): c.Tree + found : (c: scala.reflect.macros.blackbox.Context)(format: c.Expr[String], params: c.Expr[String]*): c.Expr[Unit] type mismatch for parameter params: c.Expr[Any]* does not conform to c.Expr[String]* def printf(format: String, params: Any*): Unit = macro printf_impl ^ diff --git a/test/files/neg/t6123-explaintypes-macros/BadMac_2.scala b/test/files/neg/t6123-explaintypes-macros/BadMac_2.scala index 456e753893..75ded4ef7d 100644 --- a/test/files/neg/t6123-explaintypes-macros/BadMac_2.scala +++ b/test/files/neg/t6123-explaintypes-macros/BadMac_2.scala @@ -1,8 +1,8 @@ import scala.language.experimental.macros -import scala.reflect.macros.BlackboxContext +import scala.reflect.macros.blackbox.Context // explain some macro types to me object BadMac { def printf(format: String, params: Any*): Unit = macro printf_impl - def printf_impl(c: BlackboxContext)(format: c.Expr[String], params: c.Expr[String]*): c.Expr[Unit] = ??? + def printf_impl(c: Context)(format: c.Expr[String], params: c.Expr[String]*): c.Expr[Unit] = ??? } diff --git a/test/files/neg/t6123-explaintypes-macros/Macros.scala b/test/files/neg/t6123-explaintypes-macros/Macros.scala index cdcea34272..f2238b39a7 100644 --- a/test/files/neg/t6123-explaintypes-macros/Macros.scala +++ b/test/files/neg/t6123-explaintypes-macros/Macros.scala @@ -1,9 +1,9 @@ import scala.language.experimental.macros -import scala.reflect.macros.BlackboxContext +import scala.reflect.macros.blackbox.Context object Macros { def printf(format: String, params: Any*): Unit = macro printf_impl - def printf_impl(c: BlackboxContext)(format: c.Expr[String], params: c.Expr[Any]*): c.Expr[Unit] = ??? + def printf_impl(c: Context)(format: c.Expr[String], params: c.Expr[Any]*): c.Expr[Unit] = ??? } // something trivial to run diff --git a/test/files/neg/t6426.check b/test/files/neg/t6426.check deleted file mode 100644 index 149f74c4de..0000000000 --- a/test/files/neg/t6426.check +++ /dev/null @@ -1,7 +0,0 @@ -t6426.scala:4: error: wildcard invalid as backquoted identifier - println(`_`.Buffer(0)) - ^ -t6426.scala:5: error: ')' expected but '}' found. -} -^ -two errors found diff --git a/test/files/neg/t6426.scala b/test/files/neg/t6426.scala deleted file mode 100644 index a27d18eb58..0000000000 --- a/test/files/neg/t6426.scala +++ /dev/null @@ -1,5 +0,0 @@ -class A { - import collection.{mutable => _, _} - - println(`_`.Buffer(0)) -} diff --git a/test/files/neg/t6539/Macro_1.scala b/test/files/neg/t6539/Macro_1.scala index 454489752c..60db669c46 100644 --- a/test/files/neg/t6539/Macro_1.scala +++ b/test/files/neg/t6539/Macro_1.scala @@ -1,9 +1,9 @@ import language.experimental.macros -import reflect.macros.BlackboxContext +import scala.reflect.macros.blackbox.Context object M { def m(a: Any, b: Any): Any = macro mImpl - def mImpl(c: BlackboxContext)(a: c.Expr[Any], b: c.Expr[Any]) = c.universe.reify(println(a.splice)) + def mImpl(c: Context)(a: c.Expr[Any], b: c.Expr[Any]) = c.universe.reify(println(a.splice)) @reflect.internal.annotations.compileTimeOnly("cto may only be used as an argument to " + "m") def cto = 0 diff --git a/test/files/neg/t6563.check b/test/files/neg/t6563.check new file mode 100644 index 0000000000..75dca1507d --- /dev/null +++ b/test/files/neg/t6563.check @@ -0,0 +1,4 @@ +t6563.scala:4: error: not found: value e + e("f") + ^ +one error found diff --git a/test/files/neg/t6563.scala b/test/files/neg/t6563.scala new file mode 100644 index 0000000000..b0077b6f94 --- /dev/null +++ b/test/files/neg/t6563.scala @@ -0,0 +1,8 @@ +class A{ + def b(c: => Unit){} + b{ + e("f") + new G()(){} + } +} +class G(h:String="i")() diff --git a/test/files/neg/t6675b.check b/test/files/neg/t6675b.check new file mode 100644 index 0000000000..77f6b3ccbc --- /dev/null +++ b/test/files/neg/t6675b.check @@ -0,0 +1,37 @@ +t6675b.scala:17: warning: object LeftOrRight expects 2 patterns to hold (Int, Int) but crushing into 2-tuple to fit single pattern (SI-6675) + def f1 = (Left((0, 0)): Either[(Int, Int), (Int, Int)]) match { case LeftOrRight(a) => a } // warn + ^ +t6675b.scala:19: error: constructor cannot be instantiated to expected type; + found : (T1, T2, T3) + required: (Int, Int) + def f3 = (Left((0, 0)): Either[(Int, Int), (Int, Int)]) match { case LeftOrRight((a, b, c)) => a } // fail + ^ +t6675b.scala:24: warning: object LeftOrRight expects 2 patterns to hold (A, A) but crushing into 2-tuple to fit single pattern (SI-6675) + def f2[A](x: A) = (Left(x -> x): Either[(A, A), (A, A)]) match { case LeftOrRight(a) => a } // warn + ^ +t6675b.scala:26: error: constructor cannot be instantiated to expected type; + found : (T1, T2, T3) + required: (?A11, ?A12) where type ?A12 <: A (this is a GADT skolem), type ?A11 <: A (this is a GADT skolem) + def f4[A](x: A) = (Left(x -> x): Either[(A, A), (A, A)]) match { case LeftOrRight((a, b, c)) => a } // fail + ^ +t6675b.scala:30: warning: object NativelyTwo expects 2 patterns to hold ((Int, Int), (Int, Int)) but crushing into 2-tuple to fit single pattern (SI-6675) + def f1 = (Left((0, 0)): Either[(Int, Int), (Int, Int)]) match { case NativelyTwo(a) => a } // warn + ^ +t6675b.scala:32: error: constructor cannot be instantiated to expected type; + found : (T1, T2, T3) + required: ((Int, Int), (Int, Int)) + def f3 = (Left((0, 0)): Either[(Int, Int), (Int, Int)]) match { case NativelyTwo((a, b, c)) => a } // fail + ^ +t6675b.scala:36: warning: object NativelyTwo expects 2 patterns to hold (A, A) but crushing into 2-tuple to fit single pattern (SI-6675) + def f1[A](x: A) = (Left(x): Either[A, A]) match { case NativelyTwo(a) => a } // warn + ^ +t6675b.scala:37: warning: object NativelyTwo expects 2 patterns to hold ((A, A), (A, A)) but crushing into 2-tuple to fit single pattern (SI-6675) + def f2[A](x: A) = (Left(x -> x): Either[(A, A), (A, A)]) match { case NativelyTwo(a) => a } // warn + ^ +t6675b.scala:39: error: constructor cannot be instantiated to expected type; + found : (T1, T2, T3) + required: ((?A17, ?A18), (?A19, ?A20)) where type ?A20 <: A (this is a GADT skolem), type ?A19 <: A (this is a GADT skolem), type ?A18 <: A (this is a GADT skolem), type ?A17 <: A (this is a GADT skolem) + def f4[A](x: A) = (Left(x -> x): Either[(A, A), (A, A)]) match { case NativelyTwo((a, b, c)) => a } // fail + ^ +5 warnings found +four errors found diff --git a/test/files/neg/t6675b.flags b/test/files/neg/t6675b.flags new file mode 100644 index 0000000000..1008b0a70c --- /dev/null +++ b/test/files/neg/t6675b.flags @@ -0,0 +1 @@ +-Xlint diff --git a/test/files/neg/t6675b.scala b/test/files/neg/t6675b.scala new file mode 100644 index 0000000000..c86c9c3955 --- /dev/null +++ b/test/files/neg/t6675b.scala @@ -0,0 +1,40 @@ +object LeftOrRight { + def unapply[A](value: Either[A, A]): Option[A] = value match { + case scala.Left(x) => Some(x) + case scala.Right(x) => Some(x) + } +} + +object NativelyTwo { + def unapply[A](value: Either[A, A]): Option[(A, A)] = value match { + case scala.Left(x) => Some(x -> x) + case scala.Right(x) => Some(x -> x) + } +} + + +class A { + def f1 = (Left((0, 0)): Either[(Int, Int), (Int, Int)]) match { case LeftOrRight(a) => a } // warn + def f2 = (Left((0, 0)): Either[(Int, Int), (Int, Int)]) match { case LeftOrRight((a, b)) => a } // no warn + def f3 = (Left((0, 0)): Either[(Int, Int), (Int, Int)]) match { case LeftOrRight((a, b, c)) => a } // fail +} + +class B { + def f1[A](x: A) = (Left(x): Either[A, A]) match { case LeftOrRight(a) => a } // no warn + def f2[A](x: A) = (Left(x -> x): Either[(A, A), (A, A)]) match { case LeftOrRight(a) => a } // warn + def f3[A](x: A) = (Left(x -> x): Either[(A, A), (A, A)]) match { case LeftOrRight((a, b)) => a } // no warn + def f4[A](x: A) = (Left(x -> x): Either[(A, A), (A, A)]) match { case LeftOrRight((a, b, c)) => a } // fail +} + +class C { + def f1 = (Left((0, 0)): Either[(Int, Int), (Int, Int)]) match { case NativelyTwo(a) => a } // warn + def f2 = (Left((0, 0)): Either[(Int, Int), (Int, Int)]) match { case NativelyTwo((a, b)) => a } // no warn + def f3 = (Left((0, 0)): Either[(Int, Int), (Int, Int)]) match { case NativelyTwo((a, b, c)) => a } // fail +} + +class D { + def f1[A](x: A) = (Left(x): Either[A, A]) match { case NativelyTwo(a) => a } // warn + def f2[A](x: A) = (Left(x -> x): Either[(A, A), (A, A)]) match { case NativelyTwo(a) => a } // warn + def f3[A](x: A) = (Left(x -> x): Either[(A, A), (A, A)]) match { case NativelyTwo((a, b)) => a } // no warn + def f4[A](x: A) = (Left(x -> x): Either[(A, A), (A, A)]) match { case NativelyTwo((a, b, c)) => a } // fail +} diff --git a/test/files/neg/t7157/Impls_Macros_1.scala b/test/files/neg/t7157/Impls_Macros_1.scala index 16cb001422..31d4d786d0 100644 --- a/test/files/neg/t7157/Impls_Macros_1.scala +++ b/test/files/neg/t7157/Impls_Macros_1.scala @@ -1,31 +1,31 @@ -import scala.reflect.macros.BlackboxContext +import scala.reflect.macros.blackbox.Context import language.experimental.macros object Macros { - def impl1_0_0(c: BlackboxContext)() = { import c.universe._; c.Expr[Unit](q"""println("hello world")""") } - def impl1_1_1(c: BlackboxContext)(x: c.Expr[Int]) = { import c.universe._; c.Expr[Unit](q"""println("hello world")""") } - def impl1_2_2(c: BlackboxContext)(x: c.Expr[Int], y: c.Expr[Int]) = { import c.universe._; c.Expr[Unit](q"""println("hello world")""") } + def impl1_0_0(c: Context)() = { import c.universe._; c.Expr[Unit](q"""println("hello world")""") } + def impl1_1_1(c: Context)(x: c.Expr[Int]) = { import c.universe._; c.Expr[Unit](q"""println("hello world")""") } + def impl1_2_2(c: Context)(x: c.Expr[Int], y: c.Expr[Int]) = { import c.universe._; c.Expr[Unit](q"""println("hello world")""") } def m1_0_0() = macro impl1_0_0 def m1_1_1(x: Int) = macro impl1_1_1 def m1_2_2(x: Int, y: Int) = macro impl1_2_2 - def impl1_0_inf(c: BlackboxContext)(x: c.Expr[Int]*) = { import c.universe._; c.Expr[Unit](q"""println("hello world")""") } - def impl1_1_inf(c: BlackboxContext)(x: c.Expr[Int], y: c.Expr[Int]*) = { import c.universe._; c.Expr[Unit](q"""println("hello world")""") } - def impl1_2_inf(c: BlackboxContext)(x: c.Expr[Int], y: c.Expr[Int], z: c.Expr[Int]*) = { import c.universe._; c.Expr[Unit](q"""println("hello world")""") } + def impl1_0_inf(c: Context)(x: c.Expr[Int]*) = { import c.universe._; c.Expr[Unit](q"""println("hello world")""") } + def impl1_1_inf(c: Context)(x: c.Expr[Int], y: c.Expr[Int]*) = { import c.universe._; c.Expr[Unit](q"""println("hello world")""") } + def impl1_2_inf(c: Context)(x: c.Expr[Int], y: c.Expr[Int], z: c.Expr[Int]*) = { import c.universe._; c.Expr[Unit](q"""println("hello world")""") } def m1_0_inf(x: Int*) = macro impl1_0_inf def m1_1_inf(x: Int, y: Int*) = macro impl1_1_inf def m1_2_inf(x: Int, y: Int, z: Int*) = macro impl1_2_inf - def impl2_0_0(c: BlackboxContext)()() = { import c.universe._; c.Expr[Unit](q"""println("hello world")""") } - def impl2_1_1(c: BlackboxContext)()(x: c.Expr[Int]) = { import c.universe._; c.Expr[Unit](q"""println("hello world")""") } - def impl2_2_2(c: BlackboxContext)()(x: c.Expr[Int], y: c.Expr[Int]) = { import c.universe._; c.Expr[Unit](q"""println("hello world")""") } + def impl2_0_0(c: Context)()() = { import c.universe._; c.Expr[Unit](q"""println("hello world")""") } + def impl2_1_1(c: Context)()(x: c.Expr[Int]) = { import c.universe._; c.Expr[Unit](q"""println("hello world")""") } + def impl2_2_2(c: Context)()(x: c.Expr[Int], y: c.Expr[Int]) = { import c.universe._; c.Expr[Unit](q"""println("hello world")""") } def m2_0_0()() = macro impl2_0_0 def m2_1_1()(x: Int) = macro impl2_1_1 def m2_2_2()(x: Int, y: Int) = macro impl2_2_2 - def impl2_0_inf(c: BlackboxContext)()(x: c.Expr[Int]*) = { import c.universe._; c.Expr[Unit](q"""println("hello world")""") } - def impl2_1_inf(c: BlackboxContext)()(x: c.Expr[Int], y: c.Expr[Int]*) = { import c.universe._; c.Expr[Unit](q"""println("hello world")""") } - def impl2_2_inf(c: BlackboxContext)()(x: c.Expr[Int], y: c.Expr[Int], z: c.Expr[Int]*) = { import c.universe._; c.Expr[Unit](q"""println("hello world")""") } + def impl2_0_inf(c: Context)()(x: c.Expr[Int]*) = { import c.universe._; c.Expr[Unit](q"""println("hello world")""") } + def impl2_1_inf(c: Context)()(x: c.Expr[Int], y: c.Expr[Int]*) = { import c.universe._; c.Expr[Unit](q"""println("hello world")""") } + def impl2_2_inf(c: Context)()(x: c.Expr[Int], y: c.Expr[Int], z: c.Expr[Int]*) = { import c.universe._; c.Expr[Unit](q"""println("hello world")""") } def m2_0_inf()(x: Int*) = macro impl2_0_inf def m2_1_inf()(x: Int, y: Int*) = macro impl2_1_inf def m2_2_inf()(x: Int, y: Int, z: Int*) = macro impl2_2_inf diff --git a/test/files/neg/t7214neg.check b/test/files/neg/t7214neg.check index 0660cccd02..291af04578 100644 --- a/test/files/neg/t7214neg.check +++ b/test/files/neg/t7214neg.check @@ -1,7 +1,4 @@ -t7214neg.scala:28: error: wrong number of patterns for object Extractor offering Any: expected 1, found 0 +t7214neg.scala:28: error: not enough patterns for object Extractor offering Any: expected 1, found 0 case Extractor() => ^ -t7214neg.scala:28: error: wrong number of patterns for object Extractor offering Any: expected 1, found 0 - case Extractor() => - ^ -two errors found +one error found diff --git a/test/files/neg/t7850.check b/test/files/neg/t7850.check new file mode 100644 index 0000000000..317be2bbce --- /dev/null +++ b/test/files/neg/t7850.check @@ -0,0 +1,7 @@ +t7850.scala:11: error: an unapply result must have a member `def isEmpty: Boolean (found: def isEmpty: Casey) + val Casey(x1) = new Casey(1) + ^ +t7850.scala:12: error: an unapply result must have a member `def isEmpty: Boolean + val Dingy(x2) = new Dingy(1) + ^ +two errors found diff --git a/test/files/neg/t7850.scala b/test/files/neg/t7850.scala new file mode 100644 index 0000000000..04edad82b5 --- /dev/null +++ b/test/files/neg/t7850.scala @@ -0,0 +1,16 @@ +// isEmpty returns non-boolean +class Casey(a: Int) { def isEmpty = this; def get = this } +object Casey { def unapply(a: Casey) = a } + +// no isEmpty method at all +class Dingy(a: Int) { def get = this } +object Dingy { def unapply(a: Dingy) = a } + +object Test { + def main(args: Array[String]) { + val Casey(x1) = new Casey(1) + val Dingy(x2) = new Dingy(1) + println(s"$x1 $x2") + } +} + diff --git a/test/files/neg/t7897.check b/test/files/neg/t7897.check new file mode 100644 index 0000000000..48eff511c7 --- /dev/null +++ b/test/files/neg/t7897.check @@ -0,0 +1,4 @@ +t7897.scala:19: error: value length is not a member of p0.Single + case p0.Single(x) => println(s"`$x` has ${x.length} chars") + ^ +one error found diff --git a/test/files/neg/t7897.scala b/test/files/neg/t7897.scala new file mode 100644 index 0000000000..87c966b1e0 --- /dev/null +++ b/test/files/neg/t7897.scala @@ -0,0 +1,23 @@ +package p0 { + class Single(val x: Any) extends AnyRef with Product1[String] { + private def s = "" + x + override def canEqual(x: Any) = this eq x.asInstanceOf[AnyRef] + def isEmpty = false + def get = this + def _1 = s + " only" + + override def toString = s"Single(${_1})" + } + + object Single { + def unapply(x: Any): Single = new Single(x) + } +} +object Test { + def main(args: Array[String]): Unit = { + "catdog" match { + case p0.Single(x) => println(s"`$x` has ${x.length} chars") + case x => println("fail: " + x) + } + } +} diff --git a/test/files/neg/t8015-ffa.check b/test/files/neg/t8015-ffa.check new file mode 100644 index 0000000000..0f28be7fe7 --- /dev/null +++ b/test/files/neg/t8015-ffa.check @@ -0,0 +1,6 @@ +t8015-ffa.scala:7: error: type mismatch; + found : String("3") + required: Int + val i: Int = "3" // error line 7 (was 8) + ^ +one error found diff --git a/test/files/neg/t8015-ffa.scala b/test/files/neg/t8015-ffa.scala new file mode 100644 index 0000000000..60876d9139 --- /dev/null +++ b/test/files/neg/t8015-ffa.scala @@ -0,0 +1,8 @@ + +package foo + +//-------object Next + +trait F { + val i: Int = "3" // error line 7 (was 8) +} diff --git a/test/files/neg/t8015-ffb.check b/test/files/neg/t8015-ffb.check new file mode 100644 index 0000000000..9b2171ea47 --- /dev/null +++ b/test/files/neg/t8015-ffb.check @@ -0,0 +1,6 @@ +t8015-ffb.scala:10: warning: side-effecting nullary methods are discouraged: suggest defining as `def w()` instead + def w = { x\u000c() } // ^L is colored blue on this screen, hardly visible + ^ +error: No warnings can be incurred under -Xfatal-warnings. +one warning found +one error found diff --git a/test/files/neg/t8015-ffb.flags b/test/files/neg/t8015-ffb.flags new file mode 100644 index 0000000000..7949c2afa2 --- /dev/null +++ b/test/files/neg/t8015-ffb.flags @@ -0,0 +1 @@ +-Xlint -Xfatal-warnings diff --git a/test/files/neg/t8015-ffb.scala b/test/files/neg/t8015-ffb.scala new file mode 100644 index 0000000000..dbdd942555 --- /dev/null +++ b/test/files/neg/t8015-ffb.scala @@ -0,0 +1,11 @@ + +trait G { + val c: Char = '\u000a' // disallowed! + def x\u000d\u000a = 9 // as nl + def y() = x + def z() = { + y()\u000a() // was Int does not take parameters + } + def v = y()\u000c() // was Int does not take parameters + def w = { x() } // ^L is colored blue on this screen, hardly visible +} diff --git a/test/files/neg/t8035-deprecated.check b/test/files/neg/t8035-deprecated.check new file mode 100644 index 0000000000..01f27e5310 --- /dev/null +++ b/test/files/neg/t8035-deprecated.check @@ -0,0 +1,21 @@ +t8035-deprecated.scala:2: warning: Adaptation of argument list by inserting () has been deprecated: this is unlikely to be what you want. + signature: GenSetLike.apply(elem: A): Boolean + given arguments: <none> + after adaptation: GenSetLike((): Unit) + List(1,2,3).toSet() + ^ +t8035-deprecated.scala:5: warning: Adaptation of argument list by inserting () has been deprecated: this is unlikely to be what you want. + signature: A(x: T): Foo.A[T] + given arguments: <none> + after adaptation: new A((): Unit) + new A + ^ +t8035-deprecated.scala:9: warning: Adaptation of argument list by inserting () has been deprecated: leaky (Object-receiving) target makes this especially dangerous. + signature: Format.format(x$1: Any): String + given arguments: <none> + after adaptation: Format.format((): Unit) + sdf.format() + ^ +error: No warnings can be incurred under -Xfatal-warnings. +three warnings found +one error found diff --git a/test/files/neg/t8035-deprecated.flags b/test/files/neg/t8035-deprecated.flags new file mode 100644 index 0000000000..c6bfaf1f64 --- /dev/null +++ b/test/files/neg/t8035-deprecated.flags @@ -0,0 +1 @@ +-deprecation -Xfatal-warnings diff --git a/test/files/neg/t8035-deprecated.scala b/test/files/neg/t8035-deprecated.scala new file mode 100644 index 0000000000..6423157530 --- /dev/null +++ b/test/files/neg/t8035-deprecated.scala @@ -0,0 +1,10 @@ +object Foo { + List(1,2,3).toSet() + + class A[T](val x: T) + new A + + import java.text.SimpleDateFormat + val sdf = new SimpleDateFormat("yyyyMMdd-HH0000") + sdf.format() +} diff --git a/test/files/neg/t8035-removed.check b/test/files/neg/t8035-removed.check new file mode 100644 index 0000000000..e24a0b4e63 --- /dev/null +++ b/test/files/neg/t8035-removed.check @@ -0,0 +1,16 @@ +t8035-removed.scala:2: error: Adaptation of argument list by inserting () has been removed. + signature: GenSetLike.apply(elem: A): Boolean + given arguments: <none> + List(1,2,3).toSet() + ^ +t8035-removed.scala:5: error: Adaptation of argument list by inserting () has been removed. + signature: A(x: T): Foo.A[T] + given arguments: <none> + new A + ^ +t8035-removed.scala:9: error: Adaptation of argument list by inserting () has been removed. + signature: Format.format(x$1: Any): String + given arguments: <none> + sdf.format() + ^ +three errors found diff --git a/test/files/neg/t8035-removed.flags b/test/files/neg/t8035-removed.flags new file mode 100644 index 0000000000..29f4ede37a --- /dev/null +++ b/test/files/neg/t8035-removed.flags @@ -0,0 +1 @@ +-Xfuture diff --git a/test/files/neg/t8035-removed.scala b/test/files/neg/t8035-removed.scala new file mode 100644 index 0000000000..6423157530 --- /dev/null +++ b/test/files/neg/t8035-removed.scala @@ -0,0 +1,10 @@ +object Foo { + List(1,2,3).toSet() + + class A[T](val x: T) + new A + + import java.text.SimpleDateFormat + val sdf = new SimpleDateFormat("yyyyMMdd-HH0000") + sdf.format() +} diff --git a/test/files/neg/t8104/Macros_1.scala b/test/files/neg/t8104/Macros_1.scala index 21d81a3687..2ad4bc5a99 100644 --- a/test/files/neg/t8104/Macros_1.scala +++ b/test/files/neg/t8104/Macros_1.scala @@ -1,7 +1,7 @@ -import scala.reflect.macros.WhiteboxContext +import scala.reflect.macros.whitebox.Context object Macros { - def impl[T](c: WhiteboxContext)(implicit T: c.WeakTypeTag[T]) = { + def impl[T](c: Context)(implicit T: c.WeakTypeTag[T]) = { import c.universe._ import definitions._ val fields = T.tpe.declarations.toList.collect{ case x: TermSymbol if x.isVal && x.isCaseAccessor => x } diff --git a/test/files/neg/t8146-non-finitary-2.check b/test/files/neg/t8146-non-finitary-2.check new file mode 100644 index 0000000000..8c2e1436c2 --- /dev/null +++ b/test/files/neg/t8146-non-finitary-2.check @@ -0,0 +1,9 @@ +t8146-non-finitary-2.scala:5: error: class graph is not finitary because type parameter X is expansively recursive +trait C[X] extends N[N[C[D[X]]]] + ^ +t8146-non-finitary-2.scala:7: error: type mismatch; + found : C[Int] + required: N[C[Int]] + def foo(c: C[Int]): N[C[Int]] = c + ^ +two errors found diff --git a/test/files/neg/t8146-non-finitary-2.scala b/test/files/neg/t8146-non-finitary-2.scala new file mode 100644 index 0000000000..c12f5f8f49 --- /dev/null +++ b/test/files/neg/t8146-non-finitary-2.scala @@ -0,0 +1,8 @@ +// Example 3 from "On Decidability of Nominal Subtyping with Variance" (Pierce, Kennedy) +// http://research.microsoft.com/pubs/64041/fool2007.pdf +trait N[-Z] +trait D[Y] +trait C[X] extends N[N[C[D[X]]]] +object Test { + def foo(c: C[Int]): N[C[Int]] = c +} diff --git a/test/files/neg/t8146-non-finitary.check b/test/files/neg/t8146-non-finitary.check new file mode 100644 index 0000000000..8363b750ca --- /dev/null +++ b/test/files/neg/t8146-non-finitary.check @@ -0,0 +1,9 @@ +t8146-non-finitary.scala:4: error: class graph is not finitary because type parameter A is expansively recursive +trait C[A] extends N[N[C[C[A]]]] + ^ +t8146-non-finitary.scala:6: error: type mismatch; + found : C[Int] + required: N[C[Int]] + def foo(c: C[Int]): N[C[Int]] = c + ^ +two errors found diff --git a/test/files/neg/t8146-non-finitary.scala b/test/files/neg/t8146-non-finitary.scala new file mode 100644 index 0000000000..3d8a3074c7 --- /dev/null +++ b/test/files/neg/t8146-non-finitary.scala @@ -0,0 +1,7 @@ +// Example 3 from "On Decidability of Nominal Subtyping with Variance" (Pierce, Kennedy) +// http://research.microsoft.com/pubs/64041/fool2007.pdf +trait N[-A] +trait C[A] extends N[N[C[C[A]]]] +object Test { + def foo(c: C[Int]): N[C[Int]] = c +} diff --git a/test/files/neg/t8157.check b/test/files/neg/t8157.check new file mode 100644 index 0000000000..9a21a49a07 --- /dev/null +++ b/test/files/neg/t8157.check @@ -0,0 +1,4 @@ +t8157.scala:1: error: in object Test, multiple overloaded alternatives of method foo define default arguments. +object Test { + ^ +one error found diff --git a/test/files/neg/t8157.scala b/test/files/neg/t8157.scala new file mode 100644 index 0000000000..462d4fa3f1 --- /dev/null +++ b/test/files/neg/t8157.scala @@ -0,0 +1,4 @@ +object Test { + def foo(printer: Any, question: => String, show: Boolean = false)(op: => Any): Any = ??? + def foo[T](question: => String, show: Boolean)(op: => Any = ()): Any = ??? +} diff --git a/test/files/neg/t8158.check b/test/files/neg/t8158.check new file mode 100644 index 0000000000..fa6b744ba5 --- /dev/null +++ b/test/files/neg/t8158.check @@ -0,0 +1,4 @@ +Test_2.scala:10: error: not enough patterns for <$anon: AnyRef> offering AnyRef{def isEmpty: Boolean; def get: $anon; def unapply(x: String): $anon}: expected 1, found 0 + case X() => + ^ +one error found diff --git a/test/files/neg/t8158/Macros_1.scala b/test/files/neg/t8158/Macros_1.scala new file mode 100644 index 0000000000..b84e3ed8d3 --- /dev/null +++ b/test/files/neg/t8158/Macros_1.scala @@ -0,0 +1,34 @@ +import scala.language.experimental.macros +import scala.reflect.macros.whitebox.Context + +object Max { + def impl(c: Context)(any: c.Expr[Any]): c.Expr[Any] = { + import c.universe._ + def fail(msg: String) = c.abort(c.enclosingPosition, msg) + val t = c.macroApplication match { + case q"$_.unapply($unargs)" => + /* hangs + */ + q""" + new { + def isEmpty = false + def get = this + def unapply(x: String) = this + }.unapply($unargs) + """ + /* + if get returns Unit or Boolean: + wrong number of patterns for <$anon: AnyRef> offering Unit: expected 1, found 0 + */ + /* straightforward + q""" + new { + def unapply(x: String) = true + }.unapply($unargs) + """ + */ + case _ => fail("bad appl") + } + c.Expr[Any](t) + } +}
\ No newline at end of file diff --git a/test/files/neg/t8158/Test_2.scala b/test/files/neg/t8158/Test_2.scala new file mode 100644 index 0000000000..f5ac6616bb --- /dev/null +++ b/test/files/neg/t8158/Test_2.scala @@ -0,0 +1,14 @@ +import scala.language.experimental.macros + +object X { + def unapply(any: Any): Any = macro Max.impl +} + +class BugTest { + def bug(): Unit = { + "any" match { + case X() => + case _ => ??? + } + } +}
\ No newline at end of file diff --git a/test/files/neg/t997.check b/test/files/neg/t997.check index 8c41060ba2..b118792229 100644 --- a/test/files/neg/t997.check +++ b/test/files/neg/t997.check @@ -1,7 +1,4 @@ -t997.scala:13: error: wrong number of patterns for object Foo offering (String, String): expected 2, found 3 +t997.scala:13: error: too many patterns for object Foo offering (String, String): expected 2, found 3 "x" match { case Foo(a, b, c) => Console.println((a,b,c)) } ^ -t997.scala:13: error: wrong number of patterns for object Foo offering (String, String): expected 2, found 3 -"x" match { case Foo(a, b, c) => Console.println((a,b,c)) } - ^ -two errors found +one error found |