summaryrefslogtreecommitdiff
path: root/test/files/neg
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2013-12-08 16:28:41 +0100
committerEugene Burmako <xeno.by@gmail.com>2013-12-10 10:29:02 +0100
commit87979ad96f3a07354be4c15cdf35f71d1d4739cb (patch)
treeaca34d4bec9a31a44c1a81d18a4701ef8ceb4231 /test/files/neg
parent75cc6cf256df9e152eaec771121ce0db9f7039f8 (diff)
downloadscala-87979ad96f3a07354be4c15cdf35f71d1d4739cb.tar.gz
scala-87979ad96f3a07354be4c15cdf35f71d1d4739cb.tar.bz2
scala-87979ad96f3a07354be4c15cdf35f71d1d4739cb.zip
deprecates macro def return type inference
With the new focus on quasiquotes in macro implementations, we now have to change the way how inference of macro def return types works. Previously, if the return type of a macro def wasn’t specified, we looked into the signature of its macro impl, took its return type (which could only be c.Expr[T]) and then assigned T to be the return type of the macro def. We also had a convenient special case which inferred Any in case when the body of the macro impl wasn’t an expr. That avoided reporting spurious errors if the macro impl had its body typed incorrectly (because in that case we would report a def/impl signature mismatch anyway) and also provided a convenience by letting macro impls end with `???`. However now we also allow macro impls to return c.Tree, which means that we are no longer able to do any meaningful type inference, because c.Tree could correspond to tree of any type. Unfortunately, when coupled with the type inference special case described above, this means that the users who migrate from exprs to quasiquotes are going to face an unpleasant surprise. If they haven’t provided explicit return types for their macro defs, those types are going to be silently inferred as `Any`! This commit plugs this loophole by prohibiting type inference from non-expr return types of macro impls (not counting Nothing). Moreover, it also deprecates c.Expr[T] => T inference in order to avoid confusion when switching between exprs and quasiquotes.
Diffstat (limited to 'test/files/neg')
-rw-r--r--test/files/neg/macro-blackbox-extractor/Macros_1.scala2
-rw-r--r--test/files/neg/macro-blackbox-structural/Impls_Macros_1.scala2
-rw-r--r--test/files/neg/macro-bundle-object.check2
-rw-r--r--test/files/neg/macro-invalidret.check22
-rw-r--r--test/files/neg/macro-invalidret.flags4
-rw-r--r--test/files/neg/macro-invalidret/Impls_1.scala3
-rw-r--r--test/files/neg/macro-invalidret/Macros_Test_2.scala8
-rw-r--r--test/files/neg/macro-invalidsig-params-badtype.check2
-rw-r--r--test/files/neg/macro-invalidsig.check30
-rw-r--r--test/files/neg/macro-invalidsig/Macros_Test_2.scala6
-rw-r--r--test/files/neg/macro-invalidusage-badargs/Macros_Test_2.scala2
-rw-r--r--test/files/neg/macro-invalidusage-badbounds/Macros_Test_2.scala2
-rw-r--r--test/files/neg/macro-invalidusage-badtargs.check10
-rw-r--r--test/files/neg/macro-invalidusage-badtargs/Macros_Test_2.scala12
-rw-r--r--test/files/neg/macro-invalidusage-methodvaluesyntax/Macros_Test_2.scala2
-rw-r--r--test/files/neg/macro-override-macro-overrides-abstract-method-a.check2
-rw-r--r--test/files/neg/macro-override-macro-overrides-abstract-method-a/Impls_Macros_1.scala2
-rw-r--r--test/files/neg/macro-override-method-overrides-macro.check2
-rw-r--r--test/files/neg/macro-override-method-overrides-macro/Macros_Test_2.scala14
-rw-r--r--test/files/neg/macro-quasiquotes.check6
-rw-r--r--test/files/neg/macro-quasiquotes/Macros_1.scala6
-rw-r--r--test/files/neg/t5753/Impls_Macros_1.scala2
-rw-r--r--test/files/neg/t5753/Test_2.scala2
-rw-r--r--test/files/neg/t5903a/Macros_1.scala2
-rw-r--r--test/files/neg/t5903b/Macros_1.scala2
-rw-r--r--test/files/neg/t5903c/Macros_1.scala2
-rw-r--r--test/files/neg/t5903d/Macros_1.scala2
-rw-r--r--test/files/neg/t5903e/Macros_1.scala2
-rw-r--r--test/files/neg/t7519-b.check2
-rw-r--r--test/files/neg/t7519-b/Use_2.scala2
30 files changed, 98 insertions, 61 deletions
diff --git a/test/files/neg/macro-blackbox-extractor/Macros_1.scala b/test/files/neg/macro-blackbox-extractor/Macros_1.scala
index 5c7748bec9..f0bfe53aa2 100644
--- a/test/files/neg/macro-blackbox-extractor/Macros_1.scala
+++ b/test/files/neg/macro-blackbox-extractor/Macros_1.scala
@@ -2,7 +2,7 @@ import scala.reflect.macros.BlackboxContext
import language.experimental.macros
object Extractor {
- def unapply(x: Int) = macro Macros.unapplyImpl
+ def unapply(x: Int): Any = macro Macros.unapplyImpl
}
object Macros {
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 08f1c21e89..f5e85d57ea 100644
--- a/test/files/neg/macro-blackbox-structural/Impls_Macros_1.scala
+++ b/test/files/neg/macro-blackbox-structural/Impls_Macros_1.scala
@@ -11,5 +11,5 @@ object Macros {
"""
}
- def foo = macro impl
+ def foo: Any = macro impl
} \ No newline at end of file
diff --git a/test/files/neg/macro-bundle-object.check b/test/files/neg/macro-bundle-object.check
index 293f40a178..78e7119fa7 100644
--- a/test/files/neg/macro-bundle-object.check
+++ b/test/files/neg/macro-bundle-object.check
@@ -1,5 +1,5 @@
macro-bundle-object.scala:10: error: macro implementation has incompatible shape:
- required: (c: scala.reflect.macros.BlackboxContext): c.Expr[Any]
+ required: (c: scala.reflect.macros.BlackboxContext): c.Expr[Nothing]
or : (c: scala.reflect.macros.BlackboxContext): c.Tree
found : : Nothing
number of parameter sections differ
diff --git a/test/files/neg/macro-invalidret.check b/test/files/neg/macro-invalidret.check
index ea003a17ec..6c5baf76b4 100644
--- a/test/files/neg/macro-invalidret.check
+++ b/test/files/neg/macro-invalidret.check
@@ -12,4 +12,24 @@ Macros_Test_2.scala:3: error: macro implementation has incompatible shape:
type mismatch for return type: reflect.runtime.universe.Literal does not conform to c.Expr[Any]
def foo2 = macro Impls.foo2
^
-two errors found
+Macros_Test_2.scala:6: error: macro defs must have explicitly specified return types
+ def foo5 = macro Impls.foo5
+ ^
+Macros_Test_2.scala:7: warning: macro defs must have explicitly specified return types (inference of Int from macro impl's c.Expr[Int] is deprecated and is going to stop working in 2.12)
+ def foo6 = macro Impls.foo6
+ ^
+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 Impls$.foo3(Impls_1.scala:7)
+
+ foo3
+ ^
+Macros_Test_2.scala:15: error: macro implementation is missing
+ foo4
+ ^
+Macros_Test_2.scala:17: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+ foo6
+ ^
+two warnings found
+5 errors found
diff --git a/test/files/neg/macro-invalidret.flags b/test/files/neg/macro-invalidret.flags
index cd66464f2f..946c53ec0e 100644
--- a/test/files/neg/macro-invalidret.flags
+++ b/test/files/neg/macro-invalidret.flags
@@ -1 +1,3 @@
--language:experimental.macros \ No newline at end of file
+-language:experimental.macros
+-Xfatal-warnings
+-deprecation \ No newline at end of file
diff --git a/test/files/neg/macro-invalidret/Impls_1.scala b/test/files/neg/macro-invalidret/Impls_1.scala
index d957b74512..b32463899e 100644
--- a/test/files/neg/macro-invalidret/Impls_1.scala
+++ b/test/files/neg/macro-invalidret/Impls_1.scala
@@ -4,4 +4,7 @@ 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)))
}
diff --git a/test/files/neg/macro-invalidret/Macros_Test_2.scala b/test/files/neg/macro-invalidret/Macros_Test_2.scala
index f8880fa023..8840f492ab 100644
--- a/test/files/neg/macro-invalidret/Macros_Test_2.scala
+++ b/test/files/neg/macro-invalidret/Macros_Test_2.scala
@@ -1,10 +1,18 @@
object Macros {
def foo1 = macro Impls.foo1
def foo2 = macro Impls.foo2
+ def foo3 = macro Impls.foo3
+ def foo4 = macro ???
+ def foo5 = macro Impls.foo5
+ def foo6 = macro Impls.foo6
}
object Test extends App {
import Macros._
foo1
foo2
+ foo3
+ foo4
+ foo5
+ foo6
} \ No newline at end of file
diff --git a/test/files/neg/macro-invalidsig-params-badtype.check b/test/files/neg/macro-invalidsig-params-badtype.check
index 6d72185ff2..d6b5c5521d 100644
--- a/test/files/neg/macro-invalidsig-params-badtype.check
+++ b/test/files/neg/macro-invalidsig-params-badtype.check
@@ -1,5 +1,5 @@
Impls_Macros_1.scala:8: error: macro implementation has incompatible shape:
- required: (c: scala.reflect.macros.BlackboxContext)(x: c.Expr[Int]): c.Expr[Any]
+ 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
type mismatch for parameter x: c.Expr[Int] does not conform to Int
diff --git a/test/files/neg/macro-invalidsig.check b/test/files/neg/macro-invalidsig.check
index e09d46146d..5ff4ed18cb 100644
--- a/test/files/neg/macro-invalidsig.check
+++ b/test/files/neg/macro-invalidsig.check
@@ -1,29 +1,29 @@
Macros_Test_2.scala:2: error: macro implementations cannot have implicit parameters other than WeakTypeTag evidences
- def foo[U] = macro Impls1.foo[U]
- ^
+ 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[Any]
+ required: (c: scala.reflect.macros.BlackboxContext): c.Expr[Nothing]
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 incompatible shape:
- required: (c: scala.reflect.macros.BlackboxContext): c.Expr[Any]
+ required: (c: scala.reflect.macros.BlackboxContext): c.Expr[Nothing]
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 incompatible shape:
- required: (c: scala.reflect.macros.BlackboxContext): c.Expr[Any]
+ required: (c: scala.reflect.macros.BlackboxContext): c.Expr[Nothing]
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 incompatible shape:
- required: (c: scala.reflect.macros.BlackboxContext)(x: c.Expr[Any]): c.Expr[Any]
+ 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
number of parameter sections differ
@@ -33,35 +33,35 @@ 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[Any]
+ 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
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[Any]
+ 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
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[Any]
+ 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
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[Any]
+ 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
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[Any]
+ 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
number of parameter sections differ
@@ -77,9 +77,9 @@ Macros_Test_2.scala:54: error: macro implementation reference has too few type a
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]
- def foo15[V] = macro Impls15.foo
- ^
+ 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]
- def foo16[V] = macro Impls16.foo[V]
- ^
+ def foo16[V]: Unit = macro Impls16.foo[V]
+ ^
16 errors found
diff --git a/test/files/neg/macro-invalidsig/Macros_Test_2.scala b/test/files/neg/macro-invalidsig/Macros_Test_2.scala
index 0a6a321431..89a5302d8a 100644
--- a/test/files/neg/macro-invalidsig/Macros_Test_2.scala
+++ b/test/files/neg/macro-invalidsig/Macros_Test_2.scala
@@ -1,5 +1,5 @@
object Macros1 {
- def foo[U] = macro Impls1.foo[U]
+ def foo[U]: Int = macro Impls1.foo[U]
}
object Macros2 {
@@ -56,8 +56,8 @@ object Macros14 {
class D[T] {
class C[U] {
- def foo15[V] = macro Impls15.foo
- def foo16[V] = macro Impls16.foo[V]
+ def foo15[V]: Unit = macro Impls15.foo
+ def foo16[V]: Unit = macro Impls16.foo[V]
}
}
diff --git a/test/files/neg/macro-invalidusage-badargs/Macros_Test_2.scala b/test/files/neg/macro-invalidusage-badargs/Macros_Test_2.scala
index 0b3ca0590b..cf8accf94f 100644
--- a/test/files/neg/macro-invalidusage-badargs/Macros_Test_2.scala
+++ b/test/files/neg/macro-invalidusage-badargs/Macros_Test_2.scala
@@ -1,4 +1,4 @@
-object Macros { def foo(x: Int) = macro Impls.foo }
+object Macros { def foo(x: Int): Int = macro Impls.foo }
import Macros._
object Test extends App {
diff --git a/test/files/neg/macro-invalidusage-badbounds/Macros_Test_2.scala b/test/files/neg/macro-invalidusage-badbounds/Macros_Test_2.scala
index 3139599108..76397701f9 100644
--- a/test/files/neg/macro-invalidusage-badbounds/Macros_Test_2.scala
+++ b/test/files/neg/macro-invalidusage-badbounds/Macros_Test_2.scala
@@ -1,5 +1,5 @@
object Macros {
- def foo[U <: String] = macro Impls.foo[U]
+ def foo[U <: String]: Unit = macro Impls.foo[U]
}
object Test extends App {
diff --git a/test/files/neg/macro-invalidusage-badtargs.check b/test/files/neg/macro-invalidusage-badtargs.check
index 6a9e1d6e6b..722ec03765 100644
--- a/test/files/neg/macro-invalidusage-badtargs.check
+++ b/test/files/neg/macro-invalidusage-badtargs.check
@@ -1,16 +1,16 @@
-Macros_Test_2.scala:11: error: macro method foo1: (x: Int)Int does not take type parameters.
+Macros_Test_2.scala:13: error: macro method foo1: (x: Int)Int does not take type parameters.
foo1[String](42)
^
-Macros_Test_2.scala:12: error: wrong number of type parameters for macro method foo2: [T](x: Int)Int
+Macros_Test_2.scala:14: error: wrong number of type parameters for macro method foo2: [T](x: Int)Int
foo2[String, String](42)
^
-Macros_Test_2.scala:13: error: wrong number of type parameters for macro method foo3: [T, U](x: Int)Int
+Macros_Test_2.scala:15: error: wrong number of type parameters for macro method foo3: [T, U](x: Int)Int
foo3[String](42)
^
-Macros_Test_2.scala:14: error: String takes no type parameters, expected: one
+Macros_Test_2.scala:16: error: String takes no type parameters, expected: one
foo4[String](42)
^
-Macros_Test_2.scala:15: error: kinds of the type arguments (List) do not conform to the expected kinds of the type parameters (type T).
+Macros_Test_2.scala:17: error: kinds of the type arguments (List) do not conform to the expected kinds of the type parameters (type T).
List's type parameters do not match type T's expected parameters:
type A has no type parameters, but type U has one
foo5[List](42)
diff --git a/test/files/neg/macro-invalidusage-badtargs/Macros_Test_2.scala b/test/files/neg/macro-invalidusage-badtargs/Macros_Test_2.scala
index fd16d163c3..47e51bbf44 100644
--- a/test/files/neg/macro-invalidusage-badtargs/Macros_Test_2.scala
+++ b/test/files/neg/macro-invalidusage-badtargs/Macros_Test_2.scala
@@ -1,9 +1,11 @@
+import scala.language.higherKinds
+
object Macros {
- def foo1(x: Int) = macro Impls.foo
- def foo2[T](x: Int) = macro Impls.foo
- def foo3[T, U](x: Int) = macro Impls.foo
- def foo4[T[_]](x: Int) = macro Impls.foo
- def foo5[T[U[_]]](x: Int) = macro Impls.foo
+ def foo1(x: Int): Int = macro Impls.foo
+ def foo2[T](x: Int): Int = macro Impls.foo
+ def foo3[T, U](x: Int): Int = macro Impls.foo
+ def foo4[T[_]](x: Int): Int = macro Impls.foo
+ def foo5[T[U[_]]](x: Int): Int = macro Impls.foo
}
object Test extends App {
diff --git a/test/files/neg/macro-invalidusage-methodvaluesyntax/Macros_Test_2.scala b/test/files/neg/macro-invalidusage-methodvaluesyntax/Macros_Test_2.scala
index 343cec99b5..578aa45867 100644
--- a/test/files/neg/macro-invalidusage-methodvaluesyntax/Macros_Test_2.scala
+++ b/test/files/neg/macro-invalidusage-methodvaluesyntax/Macros_Test_2.scala
@@ -1,5 +1,5 @@
object Macros {
- def foo = macro Impls.foo
+ def foo: Unit = macro Impls.foo
}
object Test extends App {
diff --git a/test/files/neg/macro-override-macro-overrides-abstract-method-a.check b/test/files/neg/macro-override-macro-overrides-abstract-method-a.check
index 8c8f039225..6b5d3013ba 100644
--- a/test/files/neg/macro-override-macro-overrides-abstract-method-a.check
+++ b/test/files/neg/macro-override-macro-overrides-abstract-method-a.check
@@ -1,5 +1,5 @@
Impls_Macros_1.scala:12: error: overriding method foo in trait Foo of type (x: Int)Int;
macro method foo cannot be used here - term macros cannot override abstract methods
- def foo(x: Int) = macro Impls.impl
+ def foo(x: Int): Int = macro Impls.impl
^
one error found
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 0e8a5f3b01..9c05db83e3 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
@@ -9,5 +9,5 @@ trait Foo {
}
object Macros extends Foo {
- def foo(x: Int) = macro Impls.impl
+ def foo(x: Int): Int = macro Impls.impl
}
diff --git a/test/files/neg/macro-override-method-overrides-macro.check b/test/files/neg/macro-override-method-overrides-macro.check
index e8cba5d029..e396d65ff1 100644
--- a/test/files/neg/macro-override-method-overrides-macro.check
+++ b/test/files/neg/macro-override-method-overrides-macro.check
@@ -1,5 +1,5 @@
Macros_Test_2.scala:8: error: overriding macro method foo in class B of type (x: String)Unit;
method foo cannot be used here - only term macros can override term macros
- override def foo(x: String) = println("fooDString")
+ override def foo(x: String): Unit = println("fooDString")
^
one error found
diff --git a/test/files/neg/macro-override-method-overrides-macro/Macros_Test_2.scala b/test/files/neg/macro-override-method-overrides-macro/Macros_Test_2.scala
index 36821b05d8..d47157766e 100644
--- a/test/files/neg/macro-override-method-overrides-macro/Macros_Test_2.scala
+++ b/test/files/neg/macro-override-method-overrides-macro/Macros_Test_2.scala
@@ -1,15 +1,15 @@
class B {
- def foo(x: String) = macro Impls.fooBString
- def foo(x: Int) = macro Impls.fooBInt
- def foo(x: Boolean) = println("fooBBoolean")
+ def foo(x: String): Unit = macro Impls.fooBString
+ def foo(x: Int): Unit = macro Impls.fooBInt
+ def foo(x: Boolean): Unit = println("fooBBoolean")
}
class D extends B {
- override def foo(x: String) = println("fooDString")
- override def foo(x: Int) = macro Impls.fooDInt
+ override def foo(x: String): Unit = println("fooDString")
+ override def foo(x: Int): Unit = macro Impls.fooDInt
}
class Z extends D {
- override def foo(x: String) = macro Impls.fooZString
- override def foo(x: Boolean) = println("fooZBoolean")
+ override def foo(x: String): Unit = macro Impls.fooZString
+ override def foo(x: Boolean): Unit = println("fooZBoolean")
}
diff --git a/test/files/neg/macro-quasiquotes.check b/test/files/neg/macro-quasiquotes.check
index 338ad42b23..c690b61fe1 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 incompatible shape:
- required: (x: Impls.this.c.Expr[Int]): Impls.this.c.Expr[Any]
+ required: (x: Impls.this.c.Expr[Int]): Impls.this.c.Expr[Unit]
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
- ^
+ def m3(x: Int): Unit = macro Impls.impl3
+ ^
one error found
diff --git a/test/files/neg/macro-quasiquotes/Macros_1.scala b/test/files/neg/macro-quasiquotes/Macros_1.scala
index 7f0219e6ac..098e4b3b92 100644
--- a/test/files/neg/macro-quasiquotes/Macros_1.scala
+++ b/test/files/neg/macro-quasiquotes/Macros_1.scala
@@ -9,7 +9,7 @@ trait Impls extends BlackboxMacro {
}
object Macros {
- def m1(x: Int) = macro Impls.impl1
- def m2(x: Int) = macro Impls.impl2
- def m3(x: Int) = macro Impls.impl3
+ def m1(x: Int): Unit = macro Impls.impl1
+ def m2(x: Int): Unit = macro Impls.impl2
+ def m3(x: Int): Unit = macro Impls.impl3
} \ No newline at end of file
diff --git a/test/files/neg/t5753/Impls_Macros_1.scala b/test/files/neg/t5753/Impls_Macros_1.scala
index f93d731d40..0e81e21c77 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}
trait Impls {
-def impl(c: Ctx)(x: c.Expr[Any]) = x
+ def impl(c: Ctx)(x: c.Expr[Any]) = x
}
diff --git a/test/files/neg/t5753/Test_2.scala b/test/files/neg/t5753/Test_2.scala
index f1cad67fed..150850a0eb 100644
--- a/test/files/neg/t5753/Test_2.scala
+++ b/test/files/neg/t5753/Test_2.scala
@@ -1,7 +1,7 @@
import scala.reflect.macros.{BlackboxContext => Ctx}
object Macros extends Impls {
- def foo(x: Any) = macro impl
+ def foo(x: Any): Any = macro impl
}
object Test extends App {
diff --git a/test/files/neg/t5903a/Macros_1.scala b/test/files/neg/t5903a/Macros_1.scala
index 7888b888e1..ce1b035260 100644
--- a/test/files/neg/t5903a/Macros_1.scala
+++ b/test/files/neg/t5903a/Macros_1.scala
@@ -7,7 +7,7 @@ case object SomeTree extends Tree
object NewQuasiquotes {
implicit class QuasiquoteInterpolation(c: StringContext) {
object nq {
- def unapply(t: Tree) = macro QuasiquoteMacros.unapplyImpl
+ def unapply(t: Tree): Any = macro QuasiquoteMacros.unapplyImpl
}
}
}
diff --git a/test/files/neg/t5903b/Macros_1.scala b/test/files/neg/t5903b/Macros_1.scala
index 46f0eee0f1..dfe9d8d489 100644
--- a/test/files/neg/t5903b/Macros_1.scala
+++ b/test/files/neg/t5903b/Macros_1.scala
@@ -4,7 +4,7 @@ import language.experimental.macros
object Interpolation {
implicit class TestInterpolation(c: StringContext) {
object t {
- def unapply[T](x: T) = macro Macros.unapplyImpl[T]
+ def unapply[T](x: T): Any = macro Macros.unapplyImpl[T]
}
}
}
diff --git a/test/files/neg/t5903c/Macros_1.scala b/test/files/neg/t5903c/Macros_1.scala
index 281a06e93c..d13c3c2ec2 100644
--- a/test/files/neg/t5903c/Macros_1.scala
+++ b/test/files/neg/t5903c/Macros_1.scala
@@ -4,7 +4,7 @@ import language.experimental.macros
object Interpolation {
implicit class TestInterpolation(c: StringContext) {
object t {
- def unapply[T](x: T) = macro Macros.unapplyImpl[T]
+ def unapply[T](x: T): Any = macro Macros.unapplyImpl[T]
}
}
}
diff --git a/test/files/neg/t5903d/Macros_1.scala b/test/files/neg/t5903d/Macros_1.scala
index 5dd6220e1a..2d26e998a1 100644
--- a/test/files/neg/t5903d/Macros_1.scala
+++ b/test/files/neg/t5903d/Macros_1.scala
@@ -4,7 +4,7 @@ import language.experimental.macros
object Interpolation {
implicit class TestInterpolation(c: StringContext) {
object t {
- def unapply(x: Int) = macro Macros.unapplyImpl
+ def unapply(x: Int): Any = macro Macros.unapplyImpl
}
}
}
diff --git a/test/files/neg/t5903e/Macros_1.scala b/test/files/neg/t5903e/Macros_1.scala
index 997e6fd073..5bdc25b832 100644
--- a/test/files/neg/t5903e/Macros_1.scala
+++ b/test/files/neg/t5903e/Macros_1.scala
@@ -4,7 +4,7 @@ import language.experimental.macros
object Interpolation {
implicit class TestInterpolation(c: StringContext) {
object t {
- def unapply(x: Int) = macro Macros.unapplyImpl
+ def unapply(x: Int): Any = macro Macros.unapplyImpl
}
}
}
diff --git a/test/files/neg/t7519-b.check b/test/files/neg/t7519-b.check
index 08d819eeec..bc8500b2b8 100644
--- a/test/files/neg/t7519-b.check
+++ b/test/files/neg/t7519-b.check
@@ -1,4 +1,4 @@
-Use_2.scala:6: error: type mismatch;
+Use_2.scala:8: error: type mismatch;
found : String
required: Q
val x: Q = ex.Mac.mac("asdf")
diff --git a/test/files/neg/t7519-b/Use_2.scala b/test/files/neg/t7519-b/Use_2.scala
index 413e40e25e..0d63eeed5b 100644
--- a/test/files/neg/t7519-b/Use_2.scala
+++ b/test/files/neg/t7519-b/Use_2.scala
@@ -1,3 +1,5 @@
+import scala.language.implicitConversions
+
trait Q
trait K