-
Notifications
You must be signed in to change notification settings - Fork 785
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
Prevent removal of inlined mutable vars from optimized AST #6333
Conversation
Can you give more context on this? What is this solving? |
I do get why this is needed. The compiler inserts various compiler-generated bindings during type checking, but we make an effort to remove these when revealing the TAST via quotations and FCS expression trees, to make the public form of the expression trees less sensitive to compiler changes and less revealing of compiler internals. We do this by simply substituting However, this may be incorrect when a compiler-generated intermediate value is mutable. I'd imagine the mutability is relevant in some situation related to Fable @ncave two things
|
@TIHan |
That is, in the context of FCS clients like Fable who look at optimized expression trees. It sounds like this doesn't affect quotations as yet, since they don't reveal expression trees after inlining. |
@dsyme That's right, as stated, in optimized AST only. And it's perfectly fine to keep it downstream (Fable-only), I just wanted to bring it up to see if anything can be done here. Basically, is that optimization (extra variable removal) worth applying unconditionally, if there are (not so edge) cases where it impacts (breaks) simple code that just uses FSharp.Core functions (e.g. |
Your fix is good. Can you add a test case please? thanks |
Thank you both. It makes sense to me. |
@dsyme Added some tests. |
This prevents inlined mutable vars to be removed from optimized AST.