Skip to content

Commit 453f94d

Browse files
authored
fix: synthesise value of this.type in ValueOf (#23094)
Closes #23086
2 parents 2926e32 + dc19b2f commit 453f94d

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

compiler/src/dotty/tools/dotc/typer/Synthesizer.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,8 @@ class Synthesizer(typer: Typer)(using @constructorOnly c: Context):
232232
withNoErrors(success(Literal(Constant(()))))
233233
case n: TermRef =>
234234
withNoErrors(success(ref(n)))
235+
case ts: ThisType =>
236+
withNoErrors(success(This(ts.cls)))
235237
case tp =>
236238
EmptyTreeNoError
237239
case _ =>

tests/pos/i23086.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
class Test:
2+
val _: this.type = summon[ValueOf[this.type]].value

0 commit comments

Comments
 (0)