import scala.compiletime.erasedValue
inline def fooErased[T] = inline erasedValue[T] match { case _ => }
val f = fooErased[EmptyTuple]
Exception in thread "main" scala.MatchError: TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class scala)),module Tuple$package),type EmptyTuple) (of class dotty.tools.dotc.core.Types$CachedTypeRef)
at dotty.tools.dotc.ast.tpd$.singleton(tpd.scala:429)
at dotty.tools.dotc.typer.Inliner.$anonfun$3(Inliner.scala:682)
at dotty.tools.dotc.ast.TreeTypeMap.transform(TreeTypeMap.scala:79)
at dotty.tools.dotc.ast.TreeTypeMap.transform(TreeTypeMap.scala:116)
at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform$$anonfun$2(Trees.scala:1358)
at scala.collection.immutable.List.mapConserve(List.scala:472)
at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1358)
at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transformSub(Trees.scala:1362)
at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1279)
@smarter I run bisect and it is caused by https://github.com/lampepfl/dotty/pull/9049
Can be furthe minimized ^^ I updated the example.
It does not look like #9049 introduced the issue. It can be reproduced with any other alias to an object.
import scala.compiletime.erasedValue
type Foo = Foo.type
object Foo
inline def fooErased[T] = inline erasedValue[T] match { case _ => }
val f = fooErased[Foo]
@nicolasstucki yeah, my example was not "minimal" enough...
Changing the Unit -> EmptyTuple just exposed the issue in the case where you match erasedValue of an empty MirrorElemLabels tuple. That was the example I used for in git bisect.
I found the cause. #9154 should fix it.