We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
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
For this code:
object C { def fun: Int = { var a = 10 inline def f(arg: => Unit) = { a += 1 arg } f { return a } a } }
The decompiled code looks like this:
public final class C$ { public static final C$ MODULE$; static { new C$(); } public C$() { MODULE$ = this; } public int fun() { IntRef a = IntRef.create(10); int var2 = a.elem + 1; a.elem = var2; return a.elem; } private void f$1(IntRef a$1, Function0 arg) { int var3 = a$1.elem + 1; a$1.elem = var3; arg.apply(); } }
a should not be boxed
a
The text was updated successfully, but these errors were encountered:
This is the correct transformation for this captured Int reference. Though local optimizations with -optimize do remove this extra box.
Int
-optimize
With -optimise:
-optimise
def fun(): Int = { var a: Int = 10 { a = 1.+(a) return a } a: Int }
Without -optimise:
def fun(): Int = { val a: scala.runtime.IntRef = scala.runtime.IntRef$#create(10) { { val ev$2: Int = a.elem.+(1) a.elem = ev$2 } { return a.elem } } a.elem: Int }
Sorry, something went wrong.
c0fc53a
Merge pull request #5060 from dotty-staging/fix-#4522
5add130
Fix #4522: Add a regression test
No branches or pull requests
Uh oh!
There was an error while loading. Please reload this page.
For this code:
The decompiled code looks like this:
a
should not be boxedThe text was updated successfully, but these errors were encountered: