-
Notifications
You must be signed in to change notification settings - Fork 840
Enable 4.7 by default #7204
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
Enable 4.7 by default #7204
Conversation
src/fsharp/LanguageFeatures.fs
Outdated
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.
Please don't change these numbers in future.
And I still believe it'd be better to have separate enums for language versions and features.
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.
@auduchinok.
They aren't public and shouldn't be relied on. In fact, I wouldn't mind deleting the individual feature ID's to remove the possibility that we try to add a --enablefeature:WildCardInForLoop option.
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.
It's probably reasonable to think they may become public in FCS at some point when tooling wants to see which features are available.
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.
The smallest subdivision of the language is language version, from it one can infer the set of features available. If we choose to add or I suppose remove features, then we will release a new language version, similarly to how we release new nuget packages and assembly versions for FSharp.Core.
It is not our intention to make the information in these structures public. I can see a good argument for removing
| Preview = 0
| LanguageVersion46 = 1
| LanguageVersion47 = 2
from the LanguageFeature enumeration, given that it has so far not proven to be necessary to do a SupportsFeature.LanguageVersion4.7 call.
Anyway, my 2 cents, and probably not even worth that amount of coin.
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.
The smallest subdivision of the language is language version, from it one can infer the set of features available.
@KevinRansom Thanks for your reply. I don't, however, realise how it should be inferred by external tools using FCS given the whole module is currently internal (unless the whole logic is reimplemented in each tool). There may be situations where tooling behaviour can also change depending on whether some feature is supported in particular language version.
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.
@auduchinok Which situations? The way it works in Roslyn, which is the model we're adopting, is that tools assume latest. But because diagnostics will kick in if something doesn't actually compile, the only weird thing is displaying information when you're in an invalid state.
Here's an example in C# 7.3 but using nullable:
I could believe two opposing arguments:
- That it is incorrect behavior to show
string?, since it's not allowed in the first place. - That it is correct to show
string?, since it is what the programmer wrote
Since this can be resolved either by turning string? to string or setting LangVersion ot 8.0 (or preview), it's unclear to me which is the correct behavior. But it's certainly easier from a tooling standpoint to not flow LangVersion into every tooling feature.
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.
@cartermp I don't have a particular example in mind but I can definitely imagine situations where an IDE could, for instance, produce different generated code or do code formatting differently depending on the language version in future.
486123a to
c60d08c
Compare

This enables FSharp4.7 language features by default in the compiler. And updates the tests to no longer use: "--langversion:preview"
Will need updating after: #7195 is merged.