diff --git a/compiler/src/dotty/tools/dotc/typer/Implicits.scala b/compiler/src/dotty/tools/dotc/typer/Implicits.scala index ad9a73c01aa2..5defa68b319f 100644 --- a/compiler/src/dotty/tools/dotc/typer/Implicits.scala +++ b/compiler/src/dotty/tools/dotc/typer/Implicits.scala @@ -699,7 +699,7 @@ trait ImplicitRunInfo: def apply(t: Type) = t.dealias match case t: TypeRef => - if isAnchor(t.symbol) then t else applyToUnderlying(t) + if t.symbol.isClass || isAnchor(t.symbol) then t else applyToUnderlying(t) case t: TypeVar => apply(t.underlying) case t: ParamRef => applyToUnderlying(t) case t: ConstantType => apply(t.underlying) diff --git a/tests/neg/i9310.scala b/tests/neg/i9310.scala new file mode 100644 index 000000000000..7e57e8c99092 --- /dev/null +++ b/tests/neg/i9310.scala @@ -0,0 +1,5 @@ +//AE-d101cfe6d25117a51897609e673f6c8e74d31e6e +val foo @ this = 0 +class Foo { + foo { } // error +} \ No newline at end of file