Skip to content

Commit

Permalink
Report diagnostic regardless of language version
Browse files Browse the repository at this point in the history
  • Loading branch information
cston committed Jun 13, 2024
1 parent 4ab8762 commit d3615b6
Show file tree
Hide file tree
Showing 2 changed files with 265 additions and 484 deletions.
5 changes: 1 addition & 4 deletions src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1750,10 +1750,7 @@ internal void ReportFieldOrValueContextualKeywordConflictIfAny(SyntaxNode syntax
case "value" when ContainingMember() is MethodSymbol { MethodKind: MethodKind.PropertySet or MethodKind.EventAdd or MethodKind.EventRemove }:
{
var requiredVersion = MessageID.IDS_FeatureFieldAndValueKeywords.RequiredVersion();
if (Compilation.LanguageVersion < requiredVersion)
{
diagnostics.Add(ErrorCode.INF_IdentifierConflictWithContextualKeyword, syntax, name, requiredVersion.ToDisplayString());
}
diagnostics.Add(ErrorCode.INF_IdentifierConflictWithContextualKeyword, syntax, name, requiredVersion.ToDisplayString());
}
break;
}
Expand Down
Loading

0 comments on commit d3615b6

Please sign in to comment.