Skip to content

Commit 7c0ca06

Browse files
committed
Remove LangVer check from extended nameof binding
1 parent aae95e9 commit 7c0ca06

File tree

4 files changed

+123
-550
lines changed

4 files changed

+123
-550
lines changed

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

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

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

9287
## Cannot return an out parameter by reference
9388

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

+3-5
Original file line numberDiff line numberDiff line change
@@ -252,10 +252,9 @@ internal enum MessageID
252252
IDS_FeatureUtf8StringLiterals = MessageBase + 12822,
253253

254254
IDS_FeatureUnsignedRightShift = MessageBase + 12823,
255-
IDS_FeatureExtendedNameofScope = MessageBase + 12824,
256-
IDS_FeatureRelaxedShiftOperator = MessageBase + 12825,
257-
IDS_FeatureRequiredMembers = MessageBase + 12826,
258-
IDS_FeatureRefFields = MessageBase + 12827,
255+
IDS_FeatureRelaxedShiftOperator = MessageBase + 12826,
256+
IDS_FeatureRequiredMembers = MessageBase + 12827,
257+
IDS_FeatureRefFields = MessageBase + 12828,
259258
}
260259

261260
// Message IDs may refer to strings that need to be localized.
@@ -377,7 +376,6 @@ internal static LanguageVersion RequiredVersion(this MessageID feature)
377376
case MessageID.IDS_FeatureCheckedUserDefinedOperators: // semantic check for declarations, parsing check for doc comments
378377
case MessageID.IDS_FeatureUtf8StringLiterals: // semantic check
379378
case MessageID.IDS_FeatureUnsignedRightShift: // semantic check for declarations and consumption, parsing check for doc comments
380-
case MessageID.IDS_FeatureExtendedNameofScope: // semantic check
381379
case MessageID.IDS_FeatureRelaxedShiftOperator: // semantic check
382380
case MessageID.IDS_FeatureRefFields: // semantic check
383381
return LanguageVersion.Preview;

0 commit comments

Comments
 (0)