-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Level checking failing with path dependent types #13376
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
In Scala 2, https://www.scala-lang.org/api/2.13.6/scala-reflect/scala/reflect/api/Exprs$Expr.html#value:T |
That would be a good addition, but the current code should compile. |
Note that 5 |inline def makro(inline x: C): x.T = ${ impl[x.type]('x) }
| ^
| (x : C) is not a valid type prefix, since it is not an immutable path The variant import scala.quoted.*
trait C:
type T
def foo: T
inline def makro(x: C): x.T = ${ impl[x.type]('x) }
def impl[CC <: C](xp: Expr[CC])(using Quotes): Expr[CC#T] = '{ $xp.foo } fails with 6 |def impl[CC <: C](xp: Expr[CC])(using Quotes): Expr[CC#T] = '{ $xp.foo }
| ^^
| CC is not a legal path
| since it is not a concrete type which also seems to be the correct failure. |
The pattern can be encoded as import scala.quoted.*
trait C:
type T
def foo: T
inline def makro(x: C): x.T = ${ impl[x.T]('x) }
def impl[U: Type](xp: Expr[C { def foo: U }])(using Quotes): Expr[U] =
'{ $xp.foo } |
The text was updated successfully, but these errors were encountered: