-
Notifications
You must be signed in to change notification settings - Fork 1k
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
summonInline[B <:< A] compiles when quoted despite B not being a subtype of A #10709
Comments
def invalidImpl[A >: Nothing <: Any, B >: Nothing <: Any](using
qctx: quoted.Quotes
, tpeA: quoted.Type[A], tpeB: quoted.Type[B]): quoted.Expr[Any] =
{
'{
{
val t: B <:< A = <:<.refl[B].$asInstanceOf$[B <:< A]
t:B <:< A
}
}.apply(qctx)
} So the implicit search happens early (and I don't see how it can succeed given that we don't know that B <:< A at this point?), unlike what the documentation of summonInline says:
It does work as expected if we remove invalidImpl and replace the apply method by: inline def apply[A, B]: Any = summonInline[B <:< A] |
|
If an a call to an inline method is within a quote, this call must not be inlined.
If an a call to an inline method is within a quote, this call must not be inlined. * Delay inlining within quotes. * Disallow `inline def` within quotes. Same as `inline def` in `inline def`.
If an a call to an inline method is within a quote, this call must not be inlined. * Delay inlining within quotes. * Disallow `inline def` within quotes. Same as `inline def` in `inline def`.
Fix #10709: Add missing level check before inlining
Follow-up of scala#10709
Minimized code
Expectation
'{summonInline[B <:< A]}
should not compile when subtyping rules are violatedThe text was updated successfully, but these errors were encountered: