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

Test plan for "extended property patterns" #52468

Closed
34 tasks done
alrz opened this issue Apr 7, 2021 · 2 comments
Closed
34 tasks done

Test plan for "extended property patterns" #52468

alrz opened this issue Apr 7, 2021 · 2 comments
Assignees
Labels
Milestone

Comments

@alrz
Copy link
Contributor

alrz commented Apr 7, 2021

Championed issue: dotnet/csharplang#4394
Spec: https://github.com/dotnet/csharplang/blob/main/proposals/csharp-10.0/extended-property-patterns.md

Initial PR: #52139

Compilers

  • Verify a conditional access is not allowed in place of the name
  • IOperation and CFG (using { Prop1: { Prop2: pattern } } translation, see ExtendedPropertyPatterns_IOperation_*, ExtendedPropertyPatterns_IOperationOnMissing)
  • Semantic Model (GetSymbolInfo, GetTypeInfo, see ExtendedPropertyPatterns_SymbolInfo_*)
  • nullable analysis
    • do we learn from member accesses, i.e. not null state for nested members?
    • do we learn from pure null tests? (see OtherComparisonsAsPureNullTests_ExtendedProperties_PureNullTest)
    • nullable value types
  • Pattern Explainer (do we give correct examples in a non-exhaustive match, see ExtendedPropertyPatterns_Explainer)
  • definite assignment (mark read fields, see ExtendedPropertyPatterns_05)
  • Verify all existing scenarios (where the name is optional or disallowed) work as expected with a member access (see ExtendedPropertyPatterns_ExpressionColonIn*)
  • inaccessible properties/fields (see ExtendedPropertyPatterns_Inaccessible*)
  • expression tree (see ExtendedPropertyPatterns_ExpressionTree)
  • Language Version
  • SyntaxNormalizer (see TestNormalizeExtendedPropertyPattern)
  • Obsolete (see ExtendedPropertyPatterns_Obsolete*)
  • Keep rejecting null-suppression and pointer access in patterns (issue Reject null-suppression operator in patterns #53484)
  • Count checked fields as used (issue False warning: pattern matching on a field doesn't count as a use #52956)
  • evaluation order
  • static properties/fields (errors)
  • API shape (unshipped, syntax)
  • EnC (nothing special)
  • exhaustiveness of switch expression
  • spec: no formal commitment to only evaluate once

IDE

  • Completion for nested members and patterns
    • Test completion with two possible bindings (see CompletionOnListPattern_FirstNested and test above)
  • QuickInfo/GoToDef
  • FindAllReferences on nested members
    • Add one highlight or rename test (see RenameExtendedProperty)
  • formatting
    • Add an indentation test (see ExtendedPropertyPattern_Before and ExtendedPropertyPattern_After)
  • TypeInferrer (see TestEnumInPatterns_SwitchStatement_ExtendedPropertyPattern)
  • GenerateVariable (see TestPropertyPatternInCasePattern2)
  • Add test for { A.B: MissingConstant$$ } (see TestConstantPatternInExtendedPropertyPattern)
  • Offer to collapse pattern (is { P1: { P2: ... } } => is { P1.P2: ... }) (issue Offer to refactor into extended property pattern  #55545)
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead labels Apr 7, 2021
@jaredpar jaredpar added Feature Request and removed untriaged Issues and PRs which have not yet been triaged by a lead labels Apr 20, 2021
@jaredpar jaredpar added this to the 16.10 milestone Apr 20, 2021
@alrz
Copy link
Contributor Author

alrz commented May 1, 2021

@333fred

chained member references for subpattern operation

Is this the right thing to do if we had nullable value types? In this case Member belongs to the underlying type, not the receiver. How do we want to reflect that in the operation tree?

@333fred
Copy link
Member

333fred commented May 3, 2021

Is this the right thing to do if we had nullable value types? In this case Member belongs to the underlying type, not the receiver. How do we want to reflect that in the operation tree?

We shouldn't represent these any differently in the operation tree from nested property patterns. It's a shorthand for writing, but the semantics are exactly the same as if the user wrote it out the long way. Thus, the IOperation tree should be identical. If a user cares about the syntax form used to write out the pattern, they can go back to syntax at that point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done Umbrellas
Development

No branches or pull requests

6 participants