Skip to content

Commit

Permalink
Remove LangVer check from extended nameof binding
Browse files Browse the repository at this point in the history
  • Loading branch information
jcouv committed Jul 2, 2022
1 parent aae95e9 commit 7c0ca06
Show file tree
Hide file tree
Showing 4 changed files with 123 additions and 550 deletions.
5 changes: 0 additions & 5 deletions docs/compilers/CSharp/Compiler Breaking Changes - DotNet 7.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,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
4 changes: 1 addition & 3 deletions src/Compilers/CSharp/Portable/Binder/LocalBinderFactory.cs
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
8 changes: 3 additions & 5 deletions src/Compilers/CSharp/Portable/Errors/MessageID.cs
Original file line number Diff line number Diff line change
Expand Up @@ -252,10 +252,9 @@ internal enum MessageID
IDS_FeatureUtf8StringLiterals = MessageBase + 12822,

IDS_FeatureUnsignedRightShift = MessageBase + 12823,
IDS_FeatureExtendedNameofScope = MessageBase + 12824,
IDS_FeatureRelaxedShiftOperator = MessageBase + 12825,
IDS_FeatureRequiredMembers = MessageBase + 12826,
IDS_FeatureRefFields = MessageBase + 12827,
IDS_FeatureRelaxedShiftOperator = MessageBase + 12826,
IDS_FeatureRequiredMembers = MessageBase + 12827,
IDS_FeatureRefFields = MessageBase + 12828,
}

// Message IDs may refer to strings that need to be localized.
Expand Down Expand Up @@ -377,7 +376,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
return LanguageVersion.Preview;
Expand Down
Loading

0 comments on commit 7c0ca06

Please sign in to comment.