Skip to content

Commit b23c5e9

Browse files
committed
Fix #9150: Dealias reference to singleton
1 parent 3c56b3e commit b23c5e9

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

compiler/src/dotty/tools/dotc/ast/tpd.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
421421
t
422422
}
423423

424-
def singleton(tp: Type)(implicit ctx: Context): Tree = tp match {
424+
def singleton(tp: Type)(implicit ctx: Context): Tree = tp.dealias match {
425425
case tp: TermRef => ref(tp)
426426
case tp: ThisType => This(tp.cls)
427427
case tp: SkolemType => singleton(tp.narrow)

tests/pos/i9150-a.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import scala.compiletime.erasedValue
2+
3+
inline def fooErased[T] = inline erasedValue[T] match { case _ => }
4+
val f = fooErased[EmptyTuple]

tests/pos/i9150-b.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import scala.compiletime.erasedValue
2+
3+
type Foo = Foo.type
4+
object Foo
5+
6+
inline def fooErased[T] = inline erasedValue[T] match { case _ => }
7+
val f = fooErased[Foo]

0 commit comments

Comments
 (0)