diff --git a/compiler/src/dotty/tools/dotc/typer/Synthesizer.scala b/compiler/src/dotty/tools/dotc/typer/Synthesizer.scala index 5111a9517fab..9c1e4951a798 100644 --- a/compiler/src/dotty/tools/dotc/typer/Synthesizer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Synthesizer.scala @@ -232,6 +232,8 @@ class Synthesizer(typer: Typer)(using @constructorOnly c: Context): withNoErrors(success(Literal(Constant(())))) case n: TermRef => withNoErrors(success(ref(n))) + case ts: ThisType => + withNoErrors(success(This(ts.cls))) case tp => EmptyTreeNoError case _ => diff --git a/tests/pos/i23086.scala b/tests/pos/i23086.scala new file mode 100644 index 000000000000..2f8ee8689ad4 --- /dev/null +++ b/tests/pos/i23086.scala @@ -0,0 +1,2 @@ +class Test: + val _: this.type = summon[ValueOf[this.type]].value