diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2013-12-03 23:50:38 -0800 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2013-12-03 23:50:38 -0800 |
commit | 7d28c4966e5b32b46fda927f303aea4af20c4517 (patch) | |
tree | 27bbc3019e73d75253433b3c4602dba9c82cf529 /test | |
parent | 394da59828b830f639d2418960052655d9dd040a (diff) | |
parent | 1d3ec4e708154ec05554f540d7d68ed55dc12426 (diff) | |
download | scala-7d28c4966e5b32b46fda927f303aea4af20c4517.tar.gz scala-7d28c4966e5b32b46fda927f303aea4af20c4517.tar.bz2 scala-7d28c4966e5b32b46fda927f303aea4af20c4517.zip |
Merge pull request #3216 from xeno-by/topic/macro-error-messages
better error messages for various macro definition errors
Diffstat (limited to 'test')
-rw-r--r-- | test/files/neg/macro-bundle-class.check | 2 | ||||
-rw-r--r-- | test/files/neg/macro-bundle-mixbox.check | 2 | ||||
-rw-r--r-- | test/files/neg/macro-bundle-object.check | 4 | ||||
-rw-r--r-- | test/files/neg/macro-bundle-polymorphic.check | 6 | ||||
-rw-r--r-- | test/files/neg/macro-bundle-trait.check | 2 | ||||
-rw-r--r-- | test/files/neg/macro-invalidimpl.check | 18 | ||||
-rw-r--r-- | test/files/neg/macro-invalidret.check | 8 | ||||
-rw-r--r-- | test/files/neg/macro-invalidshape.check | 6 | ||||
-rw-r--r-- | test/files/neg/macro-invalidsig-params-badtype.check | 4 | ||||
-rw-r--r-- | test/files/neg/macro-invalidsig.check | 60 | ||||
-rw-r--r-- | test/files/neg/macro-quasiquotes.check | 4 | ||||
-rw-r--r-- | test/files/neg/t5689.check | 4 | ||||
-rw-r--r-- | test/files/neg/t6123-explaintypes-macros.check | 4 |
13 files changed, 58 insertions, 66 deletions
diff --git a/test/files/neg/macro-bundle-class.check b/test/files/neg/macro-bundle-class.check index 8fd04f1303..7108c15b8d 100644 --- a/test/files/neg/macro-bundle-class.check +++ b/test/files/neg/macro-bundle-class.check @@ -1,4 +1,4 @@ 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-mixbox.check b/test/files/neg/macro-bundle-mixbox.check index 4f8cedcece..c3136d9369 100644 --- a/test/files/neg/macro-bundle-mixbox.check +++ b/test/files/neg/macro-bundle-mixbox.check @@ -1,4 +1,4 @@ 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-object.check b/test/files/neg/macro-bundle-object.check index e148e86969..293f40a178 100644 --- a/test/files/neg/macro-bundle-object.check +++ b/test/files/neg/macro-bundle-object.check @@ -1,8 +1,8 @@ -macro-bundle-object.scala:10: error: macro implementation has wrong shape: +macro-bundle-object.scala:10: error: macro implementation has incompatible shape: required: (c: scala.reflect.macros.BlackboxContext): c.Expr[Any] or : (c: scala.reflect.macros.BlackboxContext): c.Tree found : : Nothing number of parameter sections differ def foo = macro Bundle.impl - ^ + ^ one error found diff --git a/test/files/neg/macro-bundle-polymorphic.check b/test/files/neg/macro-bundle-polymorphic.check index 07c5f551b1..e024fcde93 100644 --- a/test/files/neg/macro-bundle-polymorphic.check +++ b/test/files/neg/macro-bundle-polymorphic.check @@ -1,10 +1,10 @@ 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-trait.check b/test/files/neg/macro-bundle-trait.check index bf906a5310..3cb7985013 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 def foo = macro Bundle.impl - ^ + ^ one error found diff --git a/test/files/neg/macro-invalidimpl.check b/test/files/neg/macro-invalidimpl.check index 432da4d00b..5eff401bef 100644 --- a/test/files/neg/macro-invalidimpl.check +++ b/test/files/neg/macro-invalidimpl.check @@ -2,22 +2,22 @@ Macros_Test_2.scala:5: error: macro implementation reference has wrong shape. re macro [<static object>].<method name>[[<type args>]] or macro [<macro bundle>].<method name>[[<type args>]] def foo(x: Any) = macro impls.foo - ^ + ^ Macros_Test_2.scala:10: error: macro implementation reference has wrong shape. required: macro [<static object>].<method name>[[<type args>]] or macro [<macro bundle>].<method name>[[<type args>]] def foo(x: Any) = macro impls.foo - ^ + ^ Macros_Test_2.scala:18: error: macro implementation reference has wrong shape. required: macro [<static object>].<method name>[[<type args>]] or macro [<macro bundle>].<method name>[[<type args>]] def foo(x: Any) = macro Impls3.foo - ^ + ^ Macros_Test_2.scala:22: error: macro implementation reference has wrong shape. required: macro [<static object>].<method name>[[<type args>]] or 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 @@ -30,24 +30,24 @@ and method foo in object Impls5 of type (c: scala.reflect.macros.BlackboxContex match expected type ? def foo(x: Any, y: Any) = macro Impls5.foo ^ -Macros_Test_2.scala:31: error: macro implementation has wrong shape: +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] number of parameter sections differ def foo1 = macro Impls6.fooEmpty - ^ -Macros_Test_2.scala:32: error: macro implementation has wrong shape: + ^ +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] number of parameter sections differ def bar1() = macro Impls6.fooNullary - ^ + ^ Macros_Test_2.scala:36: error: type arguments [String] do not conform to method foo's type parameter bounds [U <: Int] def foo = macro Impls7.foo[String] ^ Macros_Test_2.scala:53: error: macro implementation must be public def foo = macro Impls8.impl - ^ + ^ 10 errors found diff --git a/test/files/neg/macro-invalidret.check b/test/files/neg/macro-invalidret.check index 19adc70fb3..ea003a17ec 100644 --- a/test/files/neg/macro-invalidret.check +++ b/test/files/neg/macro-invalidret.check @@ -1,15 +1,15 @@ -Macros_Test_2.scala:2: error: macro implementation has wrong shape: +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 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 wrong shape: + ^ +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 type mismatch for return type: reflect.runtime.universe.Literal does not conform to c.Expr[Any] def foo2 = macro Impls.foo2 - ^ + ^ two errors found diff --git a/test/files/neg/macro-invalidshape.check b/test/files/neg/macro-invalidshape.check index 1938f5ae47..aa694df6d6 100644 --- a/test/files/neg/macro-invalidshape.check +++ b/test/files/neg/macro-invalidshape.check @@ -2,12 +2,12 @@ Macros_Test_2.scala:2: error: macro implementation reference has wrong shape. re macro [<static object>].<method name>[[<type args>]] or macro [<macro bundle>].<method name>[[<type args>]] def foo1(x: Any) = macro 2 - ^ + ^ Macros_Test_2.scala:3: error: macro implementation reference has wrong shape. required: macro [<static object>].<method name>[[<type args>]] or macro [<macro bundle>].<method name>[[<type args>]] def foo2(x: Any) = macro Impls.foo(null)(null) - ^ + ^ Macros_Test_2.scala:4: error: missing arguments for method foo in object Impls; follow this method with `_' if you want to treat it as a partially applied function def foo3(x: Any) = macro {2; Impls.foo} @@ -16,5 +16,5 @@ Macros_Test_2.scala:7: error: macro implementation reference has wrong shape. re macro [<static object>].<method name>[[<type args>]] or macro [<macro bundle>].<method name>[[<type args>]] def foo = macro impl - ^ + ^ four errors found diff --git a/test/files/neg/macro-invalidsig-params-badtype.check b/test/files/neg/macro-invalidsig-params-badtype.check index e0cd63fbe4..6d72185ff2 100644 --- a/test/files/neg/macro-invalidsig-params-badtype.check +++ b/test/files/neg/macro-invalidsig-params-badtype.check @@ -1,8 +1,8 @@ -Impls_Macros_1.scala:8: error: macro implementation has wrong shape: +Impls_Macros_1.scala:8: error: macro implementation has incompatible shape: required: (c: scala.reflect.macros.BlackboxContext)(x: c.Expr[Int]): c.Expr[Any] or : (c: scala.reflect.macros.BlackboxContext)(x: c.Tree): c.Tree found : (c: scala.reflect.macros.BlackboxContext)(x: Int): Nothing type mismatch for parameter x: c.Expr[Int] does not conform to Int def foo(x: Int) = macro Impls.foo - ^ + ^ one error found diff --git a/test/files/neg/macro-invalidsig.check b/test/files/neg/macro-invalidsig.check index 42b8db5628..e09d46146d 100644 --- a/test/files/neg/macro-invalidsig.check +++ b/test/files/neg/macro-invalidsig.check @@ -1,92 +1,84 @@ -Macros_Test_2.scala:2: error: macro implementation has wrong shape: - required: (c: scala.reflect.macros.BlackboxContext): c.Expr[Any] - or : (c: scala.reflect.macros.BlackboxContext): c.Tree - found : (c: scala.reflect.macros.BlackboxContext)(implicit evidence$2: Numeric[U]): c.universe.Literal -macro implementations cannot have implicit parameters other than WeakTypeTag evidences +Macros_Test_2.scala:2: error: macro implementations cannot have implicit parameters other than WeakTypeTag evidences def foo[U] = macro Impls1.foo[U] - ^ -Macros_Test_2.scala:6: error: macro implementation has wrong shape: + ^ +Macros_Test_2.scala:6: error: macro implementation has incompatible shape: required: (c: scala.reflect.macros.BlackboxContext): c.Expr[Any] or : (c: scala.reflect.macros.BlackboxContext): c.Tree found : : Nothing number of parameter sections differ def foo = macro Impls2.foo - ^ -Macros_Test_2.scala:10: error: macro implementation has wrong shape: + ^ +Macros_Test_2.scala:10: 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.api.Universe): Nothing type mismatch for parameter c: scala.reflect.macros.BlackboxContext does not conform to scala.reflect.api.Universe def foo = macro Impls3.foo - ^ -Macros_Test_2.scala:14: error: macro implementation has wrong shape: + ^ +Macros_Test_2.scala:14: error: macro implementation has incompatible shape: required: (c: scala.reflect.macros.BlackboxContext): c.Expr[Any] or : (c: scala.reflect.macros.BlackboxContext): c.Tree found : (cs: scala.reflect.macros.BlackboxContext*): 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 wrong shape: + ^ +Macros_Test_2.scala:18: error: macro implementation has incompatible shape: required: (c: scala.reflect.macros.BlackboxContext)(x: c.Expr[Any]): c.Expr[Any] or : (c: scala.reflect.macros.BlackboxContext)(x: c.Tree): c.Tree found : (c: scala.reflect.macros.BlackboxContext): Nothing number of parameter sections differ def foo(x: Any) = macro Impls5.foo - ^ -Macros_Test_2.scala:22: error: macro implementation has wrong shape: - required: (c: scala.reflect.macros.BlackboxContext)(x: c.Expr[Int]): c.Expr[Unit] - or : (c: scala.reflect.macros.BlackboxContext)(x: c.Tree): c.Tree - found : (c: scala.reflect.macros.BlackboxContext)(implicit x: c.Expr[Int]): c.Expr[Unit] -macro implementations cannot have implicit parameters other than WeakTypeTag evidences + ^ +Macros_Test_2.scala:22: error: macro implementations cannot have implicit parameters other than WeakTypeTag evidences def foo[U](x: Int) = macro Impls6.foo[T, U] - ^ -Macros_Test_2.scala:26: error: macro implementation has wrong shape: + ^ +Macros_Test_2.scala:26: error: macro implementation has incompatible shape: required: (c: scala.reflect.macros.BlackboxContext)(x: c.Expr[Int]): c.Expr[Any] 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 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 wrong shape: + ^ +Macros_Test_2.scala:30: error: macro implementation has incompatible shape: required: (c: scala.reflect.macros.BlackboxContext)(x: c.Expr[Int]): c.Expr[Any] or : (c: scala.reflect.macros.BlackboxContext)(x: c.Tree): c.Tree found : (c: scala.reflect.macros.BlackboxContext)(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 wrong shape: + ^ +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[Any] 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 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 wrong shape: + ^ +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[Any] 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 parameter names differ: x != y def foo(x: Int, y: Int) = macro Impls10.foo - ^ -Macros_Test_2.scala:42: error: macro implementation has wrong shape: + ^ +Macros_Test_2.scala:42: 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)(U: c.universe.Type): Nothing number of parameter sections differ def foo[U] = macro Impls11.foo[U] - ^ + ^ Macros_Test_2.scala:46: error: type arguments [U] do not conform to method foo's type parameter bounds [U <: String] def foo[U] = macro Impls12.foo[U] ^ 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: wrong number of type parameters 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.BlackboxContext)(implicit evidence$4: c.WeakTypeTag[U])Nothing def foo = macro Impls14.foo - ^ -Macros_Test_2.scala:59: error: wrong number of type parameters 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.BlackboxContext)(implicit evidence$5: c.WeakTypeTag[T], implicit evidence$6: c.WeakTypeTag[U], implicit V: c.WeakTypeTag[V])c.Expr[Unit] def foo15[V] = 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] def foo16[V] = macro Impls16.foo[V] ^ diff --git a/test/files/neg/macro-quasiquotes.check b/test/files/neg/macro-quasiquotes.check index d000bb5316..338ad42b23 100644 --- a/test/files/neg/macro-quasiquotes.check +++ b/test/files/neg/macro-quasiquotes.check @@ -1,8 +1,8 @@ -Macros_1.scala:14: error: macro implementation has wrong shape: +Macros_1.scala:14: error: macro implementation has incompatible shape: required: (x: Impls.this.c.Expr[Int]): Impls.this.c.Expr[Any] or : (x: Impls.this.c.Tree): Impls.this.c.Tree found : (x: Impls.this.c.universe.Block): Impls.this.c.Tree type mismatch for parameter x: Impls.this.c.Expr[Int] does not conform to Impls.this.c.universe.Block def m3(x: Int) = macro Impls.impl3 - ^ + ^ one error found diff --git a/test/files/neg/t5689.check b/test/files/neg/t5689.check index e74de40280..9271f709ca 100644 --- a/test/files/neg/t5689.check +++ b/test/files/neg/t5689.check @@ -1,8 +1,8 @@ -t5689.scala:4: error: macro implementation has wrong shape: +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] type mismatch for return type: c.Expr[Int] does not conform to c.Expr[String] def returnsString(i: Double): String = macro returnsIntImpl - ^ + ^ one error found diff --git a/test/files/neg/t6123-explaintypes-macros.check b/test/files/neg/t6123-explaintypes-macros.check index 9a0402039b..ef545fcc32 100644 --- a/test/files/neg/t6123-explaintypes-macros.check +++ b/test/files/neg/t6123-explaintypes-macros.check @@ -1,10 +1,10 @@ c.universe.Expr[Any]* <: c.universe.Expr[String]*? false -BadMac_2.scala:6: error: macro implementation has wrong shape: +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] 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 - ^ + ^ one error found |