diff --git a/compiler/src/dotty/tools/dotc/typer/Typer.scala b/compiler/src/dotty/tools/dotc/typer/Typer.scala index 17271618cf09..6a1e6e0b671f 100644 --- a/compiler/src/dotty/tools/dotc/typer/Typer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Typer.scala @@ -4013,6 +4013,8 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer cpy.Select(qual)(pre, name.toTypeName) case qual: This if qual.symbol.is(ModuleClass) => cpy.Ident(qual)(qual.symbol.name.sourceModuleName.toTypeName) + case _ => + errorTree(tree, em"cannot convert from $tree to an instance creation expression") val tycon = tree.tpe.widen.finalResultType.underlyingClassRef(refinementOK = false) typed( untpd.Select( diff --git a/tests/neg/i16095.scala b/tests/neg/i16095.scala new file mode 100644 index 000000000000..1d8085cec53f --- /dev/null +++ b/tests/neg/i16095.scala @@ -0,0 +1,16 @@ +package x + +import scala.concurrent.* + +def cpsAsync[F[_]] = + Test.InfernAsyncArg + +object Test { + class InfernAsyncArg[F[_]] { + def apply[A](): F[A] = ??? + } + object InfernAsyncArg + + def testExample1Future(): Unit = + val fr = cpsAsync[Future]() // error +} \ No newline at end of file