diff --git a/compiler/src/dotty/tools/dotc/typer/Namer.scala b/compiler/src/dotty/tools/dotc/typer/Namer.scala index bca80fad2687..2933c3dc92a5 100644 --- a/compiler/src/dotty/tools/dotc/typer/Namer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Namer.scala @@ -1153,7 +1153,7 @@ class Namer { typer: Typer => case _ => WildcardType } - paramFn(typedAheadType(mdef.tpt, tptProto).tpe) + paramFn(checkSimpleKinded(typedAheadType(mdef.tpt, tptProto)).tpe) } /** The type signature of a DefDef with given symbol */ diff --git a/tests/neg/i4653.scala b/tests/neg/i4653.scala new file mode 100644 index 000000000000..b4a3411da10b --- /dev/null +++ b/tests/neg/i4653.scala @@ -0,0 +1,14 @@ +trait T { + type S +} + +class C { + class D[X](val t: T) { + def bar: t.S = ??? + } + + def fooD: D = ??? // error + fooD.bar + + def f(fooV: => D): Any = fooV.bar // error +}