Skip to content
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

Merged
merged 1 commit into from
Aug 29, 2019

Conversation

gafter
Copy link
Member

@gafter gafter commented Aug 19, 2019

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

@gafter gafter added Area-Compilers Tenet-Compatibility Violation of forwards/backwards compatibility in a design-time piece. labels Aug 19, 2019
@gafter gafter added this to the 16.3 milestone Aug 19, 2019
@gafter gafter requested review from agocke and 333fred August 19, 2019 23:50
@gafter gafter requested a review from a team as a code owner August 19, 2019 23:50
@gafter gafter self-assigned this Aug 19, 2019
Copy link
Member

@333fred 333fred left a 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);
Copy link
Member

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.

Copy link
Member

@jcouv jcouv left a 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)

@jcouv jcouv self-assigned this Aug 20, 2019
@gafter gafter modified the milestones: 16.3, 16.4 Aug 20, 2019
@gafter gafter changed the base branch from master to release/dev16.4-preview1 August 20, 2019 22:16
@gafter gafter changed the base branch from release/dev16.4-preview1 to master August 20, 2019 22:17
@gafter gafter requested review from a team as code owners August 20, 2019 22:20
@gafter gafter changed the base branch from master to release/dev16.4-preview1 August 20, 2019 22:20
@jasonmalinowski jasonmalinowski removed the request for review from a team August 20, 2019 22:34
@gafter gafter changed the base branch from release/dev16.4-preview1 to master August 28, 2019 21:03
…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
@gafter gafter merged commit e149ccb into dotnet:master Aug 29, 2019
@jcouv jcouv modified the milestones: 16.4, 16.4.P1 Sep 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers Tenet-Compatibility Violation of forwards/backwards compatibility in a design-time piece.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Disallow pointer is null in C# 7.3 in VS 2019
3 participants