-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Reject pattern-matching operations on pointer types in C# versions less than 8. #38116
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM (commit 1)
else if (inputType.IsPointerType() == true && Compilation.LanguageVersion < MessageID.IDS_FeatureRecursivePatterns.RequiredVersion()) | ||
{ | ||
// before C# 8 we did not permit `pointer is null` | ||
diagnostics.Add(ErrorCode.ERR_PointerTypeInPatternMatching, patternExpression.Location); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ERR_PointerTypeInPatternMatching [](start = 46, length = 32)
nit: Would it be better to use ERR_FeatureNotAvailableInVersion8
with an existing feature name (IDS_FeatureRecursivePatterns
maybe)? Either way is a bit confusing to users, but we would at least hint towards language version being a fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM Thanks (iteration 1)
…ss than 8. This fix intentionally does not introduce a "language version" diagnostic because I would like this fix to be as simple as possible to hot-fix 16.3, and because we are past translation deadlines. Fixes dotnet#38052
This fix intentionally does not introduce a "language version" diagnostic because I would
like this fix to be as simple as possible to hot-fix 16.3, and because we are past translation
deadlines.
Fixes #38052