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

Remove LangVer check from extended nameof binding #62339

Merged
merged 4 commits into from
Jul 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,6 @@ Possible workarounds are:

1. Rename the type parameter or parameter to avoid shadowing the name from outer scope.
1. Use a string literal instead of the `nameof` operator.
1. Downgrade the `<LangVersion>` element to 9.0 or earlier.

Note: The break will also apply to C# 10 and earlier when .NET 7 ships, but is
currently scoped down to users of LangVer=preview.
Tracked by https://github.com/dotnet/roslyn/issues/60640

## Cannot return an out parameter by reference

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,7 @@ public override void VisitInvocationExpression(InvocationExpressionSyntax node)

WithTypeParametersBinder? withTypeParametersBinder;
Binder? withParametersBinder;
// The LangVer check will be removed before shipping .NET 7.
// Tracked by https://github.com/dotnet/roslyn/issues/60640
if (((_enclosing.Flags & BinderFlags.InContextualAttributeBinder) != 0) && _enclosing.Compilation.IsFeatureEnabled(MessageID.IDS_FeatureExtendedNameofScope))
if ((_enclosing.Flags & BinderFlags.InContextualAttributeBinder) != 0)
{
var attributeTarget = getAttributeTarget(_enclosing);
withTypeParametersBinder = getExtraWithTypeParametersBinder(_enclosing, attributeTarget);
Expand Down
10 changes: 4 additions & 6 deletions src/Compilers/CSharp/Portable/Errors/MessageID.cs
Original file line number Diff line number Diff line change
Expand Up @@ -252,12 +252,11 @@ internal enum MessageID
IDS_FeatureUtf8StringLiterals = MessageBase + 12822,

IDS_FeatureUnsignedRightShift = MessageBase + 12823,
IDS_FeatureExtendedNameofScope = MessageBase + 12824,
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it fine to reuse this ID? I guess it is since the compiler only uses the IDE internally, it's not persisted in IDE settings, etc.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yup


IDS_FeatureRelaxedShiftOperator = MessageBase + 12825,
IDS_FeatureRequiredMembers = MessageBase + 12826,
IDS_FeatureRefFields = MessageBase + 12827,
IDS_FeatureFileTypes = MessageBase + 12828,
IDS_FeatureRelaxedShiftOperator = MessageBase + 12824,
IDS_FeatureRequiredMembers = MessageBase + 12825,
IDS_FeatureRefFields = MessageBase + 12826,
IDS_FeatureFileTypes = MessageBase + 12827,
}

// Message IDs may refer to strings that need to be localized.
Expand Down Expand Up @@ -379,7 +378,6 @@ internal static LanguageVersion RequiredVersion(this MessageID feature)
case MessageID.IDS_FeatureCheckedUserDefinedOperators: // semantic check for declarations, parsing check for doc comments
case MessageID.IDS_FeatureUtf8StringLiterals: // semantic check
case MessageID.IDS_FeatureUnsignedRightShift: // semantic check for declarations and consumption, parsing check for doc comments
case MessageID.IDS_FeatureExtendedNameofScope: // semantic check
case MessageID.IDS_FeatureRelaxedShiftOperator: // semantic check
case MessageID.IDS_FeatureRefFields: // semantic check
case MessageID.IDS_FeatureFileTypes: // semantic check
Expand Down
Loading