Skip to content

Commit 1bcf664

Browse files
hamzaremmaltgodzik
authored andcommitted
fix: synthesise value of this.type in ValueOf
[Cherry-picked dc19b2f]
1 parent f40594c commit 1bcf664

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

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

+2
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,8 @@ class Synthesizer(typer: Typer)(using @constructorOnly c: Context):
231231
withNoErrors(success(Literal(Constant(()))))
232232
case n: TermRef =>
233233
withNoErrors(success(ref(n)))
234+
case ts: ThisType =>
235+
withNoErrors(success(This(ts.cls)))
234236
case tp =>
235237
EmptyTreeNoError
236238
case _ =>

tests/pos/i23086.scala

+2
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)