diff --git a/compiler/src/dotty/tools/dotc/typer/Typer.scala b/compiler/src/dotty/tools/dotc/typer/Typer.scala index 9df0c8409fad..38f3fe94959a 100644 --- a/compiler/src/dotty/tools/dotc/typer/Typer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Typer.scala @@ -2724,6 +2724,7 @@ class Typer extends Namer case tree: untpd.Quote => typedQuote(tree, pt) case tree: untpd.Splice => typedSplice(tree, pt) case tree: untpd.TypSplice => typedTypSplice(tree, pt) + case tree: untpd.MacroTree => report.error("Unexpected macro", tree.srcPos); tpd.nullLiteral // ill-formed code may reach here case _ => typedUnadapted(desugar(tree), pt, locked) } diff --git a/tests/fuzzy/07b22d72e723607d8f0dfef3f4c8fb8076387a7b.scala b/tests/fuzzy/07b22d72e723607d8f0dfef3f4c8fb8076387a7b.scala new file mode 100644 index 000000000000..ab55d7506fdc --- /dev/null +++ b/tests/fuzzy/07b22d72e723607d8f0dfef3f4c8fb8076387a7b.scala @@ -0,0 +1 @@ +val a = macro ??? // error diff --git a/tests/neg/i12361.scala b/tests/neg/i12361.scala new file mode 100644 index 000000000000..dfef0321d7c1 --- /dev/null +++ b/tests/neg/i12361.scala @@ -0,0 +1,3 @@ +object Test { + foo = macro Impls . foo [ U ] += // error // error +}