-
Notifications
You must be signed in to change notification settings - Fork 790
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
fix problem with loop optimization (#742) #756
Conversation
Cool. Looks good. I did wonder if checking the value in the enumerator and previous let binding was possible, but thought what I had was good enough. Would never have thought to make the change in the type checker either. |
@@ -487,6 +487,31 @@ check "hfhdfsjkfur34" | |||
Failure "ss!!!" -> results := "caught"::!results | |||
!results) | |||
["caught";"ssDispose";"eDispose"] | |||
|
|||
// Check https://github.com/Microsoft/visualfsharp/pull/742 |
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.
In lieu of GitHub not lasting forever, one line of context would be helpful
Thanks for fixing this merged. |
A not-so-pretty workaround for this issue is here: #759 (comment). (note however it requires changes to user code) |
enumeratorVar.IsCompilerGenerated && | ||
let fvs = (freeInExpr CollectLocals bodyExpr) | ||
not (Zset.contains enumerableVar fvs.FreeLocals) && | ||
not (Zset.contains enumeratorVar fvs.FreeLocals) -> |
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.
Don is this right?
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.
Yes, I think so - is there something I've missed? The "bodyExpr" is the body of the while loop, but it shouldn't directly refer to either enumerableVar (the variable holding the enumerable collection, which is consumed in GetEnumeratorCall) or enumeratorVar (the variable holding the enumerator for the collection, which is consumed in the binding for the elemVar "let").
On the internal build this fails with:
|
fails for me also in the wild ;) already on the |
why this difference with appveyor build? |
I think it's a matter of what |
Here is the start of the failing call on my setup |
the appveyor build uses F# 3.1, that is the difference between build success and failure. It fails with the LKG. |
What are the reasons why AppVeyor build doesn't use the LKG version, like the local ones? |
It'seems a bug in the script, we are looking at fixing it. |
pulled |
Provides a modified and reviewed fix for the problem reported here: #742
I've made the code cleaner and added additional constraints to ensure the optimization only applies to the compiled forms of
for ... in ... do ...
loops