Skip to content
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

Implement Langversion switch for implicit yields #7166

Merged

Conversation

KevinRansom
Copy link
Member

@KevinRansom KevinRansom commented Jul 9, 2019

  1. Adds back the 4.6 versions of the tests.
  2. Adds back some validations that were removed for the 4.7 feature change
  3. Places behavior change under Features.ImplicitYield flag
  4. Updates fsharpqa suite slightly, to enable some versioned neg testing.

@KevinRansom KevinRansom requested review from dsyme, cartermp and TIHan July 9, 2019 22:29
Copy link
Contributor

@TIHan TIHan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A quick overview of the change, it looks fine. However, I am a little worried of the complexity; I haven't determined if that complexity is avoidable. It depends on what the change for implicit yields did. Will look at that tomorrow.

Tests are great. Though I wish we could start doing them in our unit tests projects.

@KevinRansom
Copy link
Member Author

@TIHan, amusingly, I was surprised how small the actual change was. I was wondering why I spent so much time on it :-)

@TIHan
Copy link
Contributor

TIHan commented Jul 10, 2019

Only reason why I say it's complex is because there are a lot of checks to see if we support the implicit yield feature or not for such a small change. But, as I said it may be unavoidable.

@KevinRansom
Copy link
Member Author

KevinRansom commented Jul 10, 2019 via email

KevinRansom and others added 2 commits July 9, 2019 18:10
removed some printfns
Copy link
Contributor

@cartermp cartermp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine overall, I agree with @TIHan that it's kind of lame that the flag has to be checked like that, but I suppose that's a consequence of how checking these kinds of expressions is implemented and not really a consequence of LangVersion itself.

| SynExpr.YieldOrReturnFrom _
| SynExpr.YieldOrReturn _
| SynExpr.ImplicitZero _
| SynExpr.Do _ when not langVersionSupportsImplicitYield -> false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: could this be moved up so that it's below YieldOrReturn?

This was a little hard for me to read since I had was mistakenly thinking that the previous cases would also evaluate to false before I realized there was a guard here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the aim is to re-introduce the exact same code that was present for prior versions of F#, so we should keep it exactly as it was

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KevinRansom Can you move this back to the matching location so the diff is minimized?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ dsyme, this is the original location … You moved it, once it was no longer necessary in |SimpleSemicolonSequence|. However, it needs to be in there to verify YieldFree (ness) for IfThenElse.

Copy link
Contributor

@dsyme dsyme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KevinRansom Do you think it might be feasible to redo this with completely separate paths for the old version and the new version? It is really hard to review with the two merged into together. I mean, literally two copies, one SimpleSemicolonSequence and one SimpleSemicolonSequence_OLD etc.

Then we can confidently code review each - the first by comparison with the PR (little or no change) and the spec, the second by exact comparison with the prior code.

@KevinRansom
Copy link
Member Author

@dsyme, I think doubling up on YieldFree with impls for 46 and 47+ will take care of the bulk of the complexity.

Copy link
Contributor

@TIHan TIHan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Thanks for getting rid of a number of the SupportsFeature checks.

@KevinRansom KevinRansom reopened this Jul 10, 2019
@KevinRansom KevinRansom merged commit 1bc2896 into dotnet:release/fsharp47 Jul 11, 2019
@dsyme
Copy link
Contributor

dsyme commented Jul 11, 2019

Thank you @KevinRansom, that's soooo much cleaner. In general it feels like we should aim to have about 1-3 "supports feature" checks in the code for each language feature.

@KevinRansom
Copy link
Member Author

@dsyme, from now on feature implementers, have the joy of doing this :-)

@dsyme
Copy link
Contributor

dsyme commented Jul 17, 2019

@dsyme, from now on feature implementers, have the joy of doing this :-)

What if we ask nicely? You're so good at it! :)

@realvictorprm
Copy link
Contributor

Yay :)

@smoothdeveloper
Copy link
Contributor

What if we ask nicely? You're so good at it! :)

@dsyme, you also need to keep @KevinRansom out of any discussion involving "file ordering" in the compiler for at least 2 months 🙂

What if we ask nicely @KevinRansom to edit a markdown note about using this language feature check so that new commers can follow the instructions?

@KevinRansom KevinRansom deleted the langversion-implicit-yields branch January 1, 2020 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants