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

Simplify CSharpRequiredLanguageVersion #51881

Merged
merged 1 commit into from
Mar 15, 2021
Merged

Conversation

Youssef1313
Copy link
Member

@Youssef1313 Youssef1313 commented Mar 15, 2021

LanguageVersion.Preview.MapSpecifiedToEffectiveVersion() will always return "Preview" as far as I understand. See:

/// <summary>
/// Map a language version (such as Default, Latest, or CSharpN) to a specific version (CSharpM).
/// </summary>
public static LanguageVersion MapSpecifiedToEffectiveVersion(this LanguageVersion version)
{
switch (version)
{
case LanguageVersion.Latest:
case LanguageVersion.Default:
case LanguageVersion.LatestMajor:
return LanguageVersion.CSharp9;
default:
return version;
}
}

Thus, the Version property is always set to version.

Did Preview in past used to map to a language version?

Could this be taken further and simplify all new CSharpRequiredLanguageVersion(...), and even trying to get rid of the class (if possible)? (Probably not possible - See string? GetRequiredLanguageVersion(Diagnostic diagnostic) - But I'll give it a try later)

@cston cston merged commit 0eac7d1 into dotnet:main Mar 15, 2021
@ghost ghost added this to the Next milestone Mar 15, 2021
@cston
Copy link
Member

cston commented Mar 15, 2021

Thanks @Youssef1313.

@Youssef1313 Youssef1313 deleted the patch-54 branch March 15, 2021 18:28
@AlekseyTs AlekseyTs added the Community The pull request was submitted by a contributor who is not a Microsoft employee. label Mar 16, 2021
@allisonchou allisonchou modified the milestones: Next, 16.10.P2 Mar 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers Community The pull request was submitted by a contributor who is not a Microsoft employee.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants