-
Notifications
You must be signed in to change notification settings - Fork 1.1k
NoSuchElementException when lifting a Type #10127
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
Workaround and ideal code: import scala.quoted._
object T {
def impl[A: Type](using ctx: QuoteContext): Expr[Unit] = {
Expr.summon[A]
'{}
}
} |
@nicolasstucki while ideal, it is not always possible. |
Could you provide an example? |
@nicolasstucki something like that import scala.quoted._
case class T(t: Type[_])
object T {
def impl[A](t: T)(using ctx: QuoteContext): Expr[Unit] = {
Expr.summon[t.t.Underlying]
'{}
}
} |
In those cases you can give it a name using a quote pattern import scala.quoted._
case class T(t: Type[_ <: Any])
object T {
def impl[A](t: T)(using Quotes): Expr[Unit] = {
t.t match
case '[x] =>
Expr.summon[x]
'{}
}
} |
The tags may be unavailablle due to the error.
@nicolasstucki while trying to adapt my code to your example I hit a "match may not be exhaustive" warning (and it actually doesn't matched at runtime). import scala.quoted._
enum TT:
case T(t: Type[_])
object T {
def impl[A](t: TT)(using Quotes): Expr[Unit] = {
t match // match may not be exhaustive
case TT.T('[x]) =>
Expr.summon[x]
'{}
}
} Is it supposed to work without |
I checked and it seems it doesn't :( |
Fix #10127: Don't try to get tags after error
Minimized code
Output
Expectation
The text was updated successfully, but these errors were encountered: