diff --git a/compiler/src/dotty/tools/dotc/ast/tpd.scala b/compiler/src/dotty/tools/dotc/ast/tpd.scala index 1a202ece1e66..aea8cf297ab8 100644 --- a/compiler/src/dotty/tools/dotc/ast/tpd.scala +++ b/compiler/src/dotty/tools/dotc/ast/tpd.scala @@ -47,12 +47,18 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo { Apply(expr, args) case _: RefTree | _: GenericApply | _: Inlined | _: Hole => ta.assignType(untpd.Apply(fn, args), fn, args) + case _ => + assert(ctx.reporter.errorsReported) + ta.assignType(untpd.Apply(fn, args), fn, args) def TypeApply(fn: Tree, args: List[Tree])(using Context): TypeApply = fn match case Block(Nil, expr) => TypeApply(expr, args) case _: RefTree | _: GenericApply => ta.assignType(untpd.TypeApply(fn, args), fn, args) + case _ => + assert(ctx.reporter.errorsReported) + ta.assignType(untpd.TypeApply(fn, args), fn, args) def Literal(const: Constant)(using Context): Literal = ta.assignType(untpd.Literal(const)) diff --git a/tests/neg/i16861.scala b/tests/neg/i16861.scala new file mode 100644 index 000000000000..50c56974d027 --- /dev/null +++ b/tests/neg/i16861.scala @@ -0,0 +1,2 @@ +given foo[T]: Any = summon[bar] // error +def bar: Nothing = ??? \ No newline at end of file diff --git a/tests/neg/i16861a.scala b/tests/neg/i16861a.scala new file mode 100644 index 000000000000..b93f884f5e56 --- /dev/null +++ b/tests/neg/i16861a.scala @@ -0,0 +1,4 @@ +import scala.quoted.* +trait Foo +object Foo: + inline given foo[T <: Foo]: T = summon[Type.of[T]] // error