diff options
-rw-r--r-- | src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala | 13 | ||||
-rw-r--r-- | test/pending/run/t5692.flags | 1 | ||||
-rw-r--r-- | test/pending/run/t5692/Impls_Macros_1.scala | 9 | ||||
-rw-r--r-- | test/pending/run/t5692/Test_2.scala | 4 |
4 files changed, 24 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala b/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala index 52648380ec..192cc94b90 100644 --- a/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala +++ b/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala @@ -62,9 +62,16 @@ abstract class Pickler extends SubComponent { // when we pickle it: so let's report an error instead. We know next // to nothing about what happened, but our supposition is a lot better // than "bad type: <error>" in terms of explanatory power. - for (t <- unit.body ; if t.isErroneous) { - unit.error(t.pos, "erroneous or inaccessible type") - return + for (t <- unit.body) { + if (t.isErroneous) { + unit.error(t.pos, "erroneous or inaccessible type") + return + } + + if (!t.isDef && t.hasSymbol && t.symbol.isTermMacro) { + unit.error(t.pos, "macro has not been expanded") + return + } } pickle(unit.body) diff --git a/test/pending/run/t5692.flags b/test/pending/run/t5692.flags new file mode 100644 index 0000000000..cd66464f2f --- /dev/null +++ b/test/pending/run/t5692.flags @@ -0,0 +1 @@ +-language:experimental.macros
\ No newline at end of file diff --git a/test/pending/run/t5692/Impls_Macros_1.scala b/test/pending/run/t5692/Impls_Macros_1.scala new file mode 100644 index 0000000000..f9c1e5f12b --- /dev/null +++ b/test/pending/run/t5692/Impls_Macros_1.scala @@ -0,0 +1,9 @@ +import scala.reflect.makro.Context + +object Impls { + def impl[A](c: reflect.makro.Context) = c.reify(()) +} + +object Macros { + def decl[A] = macro Impls.impl[A] +}
\ No newline at end of file diff --git a/test/pending/run/t5692/Test_2.scala b/test/pending/run/t5692/Test_2.scala new file mode 100644 index 0000000000..29251a5ef5 --- /dev/null +++ b/test/pending/run/t5692/Test_2.scala @@ -0,0 +1,4 @@ +object Test extends App { + val x = Macros.decl + def y() { Macros.decl(); } +}
\ No newline at end of file |