diff --git a/compiler/src/dotty/tools/dotc/typer/Inliner.scala b/compiler/src/dotty/tools/dotc/typer/Inliner.scala index 4fede9b6b9e4..36c86d9e9a72 100644 --- a/compiler/src/dotty/tools/dotc/typer/Inliner.scala +++ b/compiler/src/dotty/tools/dotc/typer/Inliner.scala @@ -1540,7 +1540,6 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(using Context) { inlineIfNeeded(tryInlineArg(tree.asInstanceOf[tpd.Tree]) `orElse` super.typedIdent(tree, pt)) override def typedSelect(tree: untpd.Select, pt: Type)(using Context): Tree = { - assert(tree.hasType, tree) val qual1 = typed(tree.qualifier, shallowSelectionProto(tree.name, pt, this)) val resNoReduce = untpd.cpy.Select(tree)(qual1, tree.name).withType(tree.typeOpt) val reducedProjection = reducer.reduceProjection(resNoReduce) diff --git a/tests/neg-macros/i14039/Macro_1.scala b/tests/neg-macros/i14039/Macro_1.scala new file mode 100644 index 000000000000..d91a93a1dded --- /dev/null +++ b/tests/neg-macros/i14039/Macro_1.scala @@ -0,0 +1,7 @@ +import scala.quoted.* + +object Macro: + inline def apply(): Any = ${Macro.impl} + + def impl(using Quotes): Expr[Any] = + quotes.reflect.report.errorAndAbort("my message") diff --git a/tests/neg-macros/i14039/Test_2.scala b/tests/neg-macros/i14039/Test_2.scala new file mode 100644 index 000000000000..ff29836b379f --- /dev/null +++ b/tests/neg-macros/i14039/Test_2.scala @@ -0,0 +1,5 @@ +class Dsl { + val entries = Seq.newBuilder[Any] + inline def get(): Unit = entries += Macro.apply() + def test = get() // error +} diff --git a/tests/neg/i14039.check b/tests/neg/i14039.check new file mode 100644 index 000000000000..a9bae09c2415 --- /dev/null +++ b/tests/neg/i14039.check @@ -0,0 +1,4 @@ +-- Error: tests/neg/i14039.scala:4:14 ---------------------------------------------------------------------------------- +4 |def test = get() // error + | ^^^^^ + | my error diff --git a/tests/neg/i14039.scala b/tests/neg/i14039.scala new file mode 100644 index 000000000000..3d34a84f0e8d --- /dev/null +++ b/tests/neg/i14039.scala @@ -0,0 +1,4 @@ +val entries = Seq.newBuilder[Any] +inline def error(): Any = compiletime.error("my error") +inline def get(): Unit = entries += error() +def test = get() // error