Closed
Description
import scala.quoted._
sealed trait Trait[T] {
type t = T
}
object O {
def fn[T:Type](t : Trait[T])(using QuoteContext): Type[T] = '[t.t]
}
This fails to compile with a phase incorrectness error:
xxx | def fn[T:Type](t : Trait[T]) : Type[T] = '[t.t]
| ^
| access to value t from wrong staging level:
| - the definition is at level 0,
| - but the access is at level 1.
which can be worked around with the following change, despite in both cases there being a Type[T]
or Type[t.t]
implicitly available:
sealed trait Trait[T] {
type t = T
}
object O {
def fn[T:Type](t : Trait[T]) : Type[T] = {
type TT = t.t
'[TT]
}
}
This isn't a huge issue since the workaround is quite simple, but it does seem like a strange thing to not work.