Skip to content

Commit 592e0e3

Browse files
authored
Remove LangVer check from extended nameof binding (dotnet#62339)
1 parent eee708d commit 592e0e3

File tree

5 files changed

+131
-558
lines changed

5 files changed

+131
-558
lines changed

docs/compilers/CSharp/Compiler Breaking Changes - DotNet 7.md

-5
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,6 @@ Possible workarounds are:
9696

9797
1. Rename the type parameter or parameter to avoid shadowing the name from outer scope.
9898
1. Use a string literal instead of the `nameof` operator.
99-
1. Downgrade the `<LangVersion>` element to 9.0 or earlier.
100-
101-
Note: The break will also apply to C# 10 and earlier when .NET 7 ships, but is
102-
currently scoped down to users of LangVer=preview.
103-
Tracked by https://github.com/dotnet/roslyn/issues/60640
10499

105100
## Cannot return an out parameter by reference
106101

src/Compilers/CSharp/Portable/Binder/LocalBinderFactory.cs

+1-3
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,7 @@ public override void VisitInvocationExpression(InvocationExpressionSyntax node)
208208

209209
WithTypeParametersBinder? withTypeParametersBinder;
210210
Binder? withParametersBinder;
211-
// The LangVer check will be removed before shipping .NET 7.
212-
// Tracked by https://github.com/dotnet/roslyn/issues/60640
213-
if (((_enclosing.Flags & BinderFlags.InContextualAttributeBinder) != 0) && _enclosing.Compilation.IsFeatureEnabled(MessageID.IDS_FeatureExtendedNameofScope))
211+
if ((_enclosing.Flags & BinderFlags.InContextualAttributeBinder) != 0)
214212
{
215213
var attributeTarget = getAttributeTarget(_enclosing);
216214
withTypeParametersBinder = getExtraWithTypeParametersBinder(_enclosing, attributeTarget);

src/Compilers/CSharp/Portable/Errors/MessageID.cs

+4-6
Original file line numberDiff line numberDiff line change
@@ -252,12 +252,11 @@ internal enum MessageID
252252
IDS_FeatureUtf8StringLiterals = MessageBase + 12822,
253253

254254
IDS_FeatureUnsignedRightShift = MessageBase + 12823,
255-
IDS_FeatureExtendedNameofScope = MessageBase + 12824,
256255

257-
IDS_FeatureRelaxedShiftOperator = MessageBase + 12825,
258-
IDS_FeatureRequiredMembers = MessageBase + 12826,
259-
IDS_FeatureRefFields = MessageBase + 12827,
260-
IDS_FeatureFileTypes = MessageBase + 12828,
256+
IDS_FeatureRelaxedShiftOperator = MessageBase + 12824,
257+
IDS_FeatureRequiredMembers = MessageBase + 12825,
258+
IDS_FeatureRefFields = MessageBase + 12826,
259+
IDS_FeatureFileTypes = MessageBase + 12827,
261260
}
262261

263262
// Message IDs may refer to strings that need to be localized.
@@ -379,7 +378,6 @@ internal static LanguageVersion RequiredVersion(this MessageID feature)
379378
case MessageID.IDS_FeatureCheckedUserDefinedOperators: // semantic check for declarations, parsing check for doc comments
380379
case MessageID.IDS_FeatureUtf8StringLiterals: // semantic check
381380
case MessageID.IDS_FeatureUnsignedRightShift: // semantic check for declarations and consumption, parsing check for doc comments
382-
case MessageID.IDS_FeatureExtendedNameofScope: // semantic check
383381
case MessageID.IDS_FeatureRelaxedShiftOperator: // semantic check
384382
case MessageID.IDS_FeatureRefFields: // semantic check
385383
case MessageID.IDS_FeatureFileTypes: // semantic check

0 commit comments

Comments
 (0)