We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
This example should go through but doesn't:
object ArgumentsEffects { def f(x1: Int, x2: Int, x3: Int): Unit = { require(x1 == 1) require(x2 == 1) require(x3 == 3) } def test: Unit = { var x = 0 f({x += 1; x}, x, {x+= 2; x }) } }
// Before ImperativeCodeElimination [ Debug ] def test$0: Unit = { [ Debug ] var (x$220: Int) @var = 0 [ Debug ] f$75({ [ Debug ] x$220 = (x$220 + 1) [ Debug ] x$220 [ Debug ] }, x$220, { [ Debug ] x$220 = (x$220 + 2) [ Debug ] x$220 [ Debug ] }) [ Debug ] } // After ImperativeCodeElimination [ Debug ] def test$0: Unit = { [ Debug ] val (x$221: Int) @var = 0 [ Debug ] val (x$223: Int) @var = x$221 + 1 [ Debug ] val tmp$15: Unit = () [ Debug ] val (x$222: Int) @var = x$223 + 2 [ Debug ] val tmp$14: Unit = () [ Debug ] f$75(x$223, x$222, x$222) [ Debug ] }
The text was updated successfully, but these errors were encountered:
Note that this works.
def test: Unit = { var x = 0 val xx1 = {x += 1; x} val xx2 = x val xx3 = {x+= 2; x } f(xx1, xx2, xx3) }
I wonder if we should not just first introduce variables for block arguments and then transform?
Sorry, something went wrong.
Yes, great point. I was making a similar reflection in the review of #1252 because this issue is more general than function arguments.
Successfully merging a pull request may close this issue.
This example should go through but doesn't:
The text was updated successfully, but these errors were encountered: