Skip to content

Simplify CSharpRequiredLanguageVersion#51881

Merged
cston merged 1 commit intodotnet:mainfrom
Youssef1313:patch-54
Mar 15, 2021
Merged

Simplify CSharpRequiredLanguageVersion#51881
cston merged 1 commit intodotnet:mainfrom
Youssef1313:patch-54

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)

@Youssef1313 Youssef1313 requested a review from a team as a code owner March 15, 2021 08:09
@ghost ghost added the Area-Compilers label Mar 15, 2021
@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
Contributor

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