-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix #10709: Add missing level check before inlining #10781
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
Conversation
2c4ec50
to
a9580f2
Compare
62a8378
to
cff105c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Just to double-check. @liufengyun did you see the second commit while reviewing? |
Thanks. For import scala.quoted._
import scala.quoted.staging._
object Test {
def main(args: Array[String]): Unit = {
given Toolbox = Toolbox.make(getClass.getClassLoader)
def x(using Quotes): Expr[Int] = '{ println(); 3 }
def f4(using Quotes): Expr[Int => Int] = '{
inlineLambda
}
println(run(Expr.betaReduce('{$f4($x)})))
println(withQuotes(Expr.betaReduce('{$f4($x)}).show))
}
transparent inline def inlineLambda: Int => Int = x => x + x
} |
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`.
This tests requires inlining after Pickler to be able to inline the missing expression. This will be fixed by scala#9984 and it only affects `scala.quoted.staging.run`.
cff105c
to
d77ae27
Compare
Indeed, it is not obvious.
The issue is that it is not, but it should. This is only needed in Previously we would evaluate Now we evaluate |
Thanks for the detailed explanation, it makes sense 👍 |
The downside of this PR is that it will temporarily break |
I don't think it matters much, as it's not as commonly used as macros and the fix is coming in RC1. |
#10803 will fix |
If an a call to an inline method is within a quote, this call must not be inlined.
inline def
within quotes. Same asinline def
ininline def
.tests/run-staging/i3876-{d,e}.scala
. This test requires inlining after Pickler to be able to inline the missing expression. This will be fixed by Expand non-transparent macros after Typer #9984 and it only affectsscala.quoted.staging.run
.