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 "recursive patterns" #25935

Open
2 of 59 tasks
jcouv opened this issue Apr 4, 2018 · 3 comments
Open
2 of 59 tasks

Test plan for "recursive patterns" #25935

jcouv opened this issue Apr 4, 2018 · 3 comments
Assignees
Labels
Area-Compilers Feature - Pattern Matching Pattern Matching Test Test failures in roslyn-CI Test-Gap Describes a specific feature or scenario that does not have test coverage
Milestone

Comments

@jcouv
Copy link
Member

jcouv commented Apr 4, 2018

This is a place to collect test ideas for the v2 patterns work.

Championed issue: dotnet/csharplang#45
Open LDM issues: dotnet/csharplang#2095

Before Initial Merge

  • Specification checked into csharplang.
  • IOperation and CFG should not "blow up" on any pattern stuff
  • Disable switch expression in expression trees [See ErrorCode.ERR_ExpressionTreeContainsSwitchExpression]
  • EE test that uses switch expression
  • Update the compiler test plan (CFG, IOperation, switch expression, new category for patterns)

After initial merge

  • Need API get get Deconstruct method (like GetDeconstructionInfo). Are any conversions involved in a positional pattern? [See SymbolInfoForPositionalSubpattern. There are no conversions involved.]
  • Although the language assumes that Deconstruct and properties used in switch statement are idempotent/pure, the compiler tests should capture the actual evaluation order (to avoid inadvertent changes) [See RecordOrderOfEvaluation]
  • Test switch on (dynamic)someITupleInstance [See ITupleFromDynamic]
  • Verify IDE formatting on switch expressions (once syntax is finalized)
  • Verify new syntax nodes can be registered to be triggered in analyzers
  • edit-and-continue [see https://github.com/Debugging and edit-and-continue for pattern-matching: action items #25547]
  • Test the SemanticModel for the names referenced in patterns, including parameter names, tuple element names, field names, and property names.
  • IOperations
  • Discuss the "decompilation" feature in the IDE (likely broken)
  • 0- and 1- tuple patterns
  • Ref-struct types and lifetimes
  • Test capturing on recursive pattern variable
    • Worth noting when the closure class gets allocated here, even if it's not observable
  • Property pattern on anonymous type
  • Should we allow trailing commas? (issue Switch expressions currently disallow trailing comma csharplang#2098)

Missing tests (not exhaustive):

  • Test various combinations of omitted parts for recursive patterns.
  • Test recursive pattern matching in scripts (e.g. pattern variable promoted to field).
  • Tests should ensure code coverage of parsing, binding, lowering, and code generation changes. [Done]
  • Test flow analysis for recursive patterns.
  • Test flow analysis for switch expression.
  • Test type inference for switch expression.
  • Lazily binding types for variables declared in the var pattern
  • Scope of variables declared using the var pattern
  • Definite assignment for variables declared using the var pattern
  • Error when there is a type or constant named var in scope where the var pattern is used

Would like tests that ensure code coverage for

  • Building the decision dag [Done]

IDE scenarios:

  • How should we format is { }? (is there a space?)
  • Formatting should not insert a space between type and positional pattern (is Point(1, 2)) (issue Patterns: Formatting should not insert space between Type and positional sub-pattern #31975)
  • Convert switch statement to switch expression (PR Add feature to convert switch statement to switch expression #31812)
  • Should we have some refactoring between switch expression and switch statement? (a switch statement with returns or assignments in all branches, maybe?)
  • Should we have a refactoring from conditional e ? x : y to e switch { true: x, false: y} (so that you can then make e an enum instead of a bool
  • Test the name completion System.Array -> array in e is (System.Array $$ and e is (_, System.Array $$
  • Should some existing (or new) formatting options control formatting switch expressions?
  • Confirm syntax for property pattern: is { Prop: 0 } or is { Prop is 0 }?

BCL:

From the meeting:

  • Test for space in positional Deconstruct in formatter
  • Unsupported EnC items should be rude edits
  • Verify breakpoint design with IDE
  • IOperation support for switch expressions and recursive patterns, CFG support for switch expressions
  • await
    • await e switch { ... }
    • e switch { pat => await ... }
    • Other tests for unary & binary operator precedence in op e switch { }
  • Nullable reference types
    • Test for warnings appearing/disappearing based on null checks in patterns
  • FAR for Deconstruct should find patterns doing deconstruction
  • LanguageVersion check
  • Deconstruct extension method with null receiver
  • Lambda in switch expression and testing that common type inference works appropriately
  • Switch expression in LINQ query syntax
  • Switch expression with stackalloc expression
  • Update compiler test plan with new expression and pattern forms after merging (Eric's checklist)
  • is {} spacing in the formatter
@jcouv jcouv added Area-Compilers Test Test failures in roslyn-CI Feature - Pattern Matching Pattern Matching labels Apr 4, 2018
@jcouv jcouv added this to the 16.0 milestone Apr 4, 2018
@gafter
Copy link
Member

gafter commented Apr 9, 2018

@jcouv what is #25400? ;)

@alrz
Copy link
Member

alrz commented Dec 15, 2018

Convert switch statement to switch expression?

This is close to completion: #31812

@jcouv
Copy link
Member Author

jcouv commented May 10, 2019

@agocke @gafter Do you have some plan to verify and close this test plan?

@gafter gafter modified the milestones: 16.2, 16.3 Jun 3, 2019
@gafter gafter modified the milestones: 16.3, 16.4 Aug 4, 2019
@jaredpar jaredpar modified the milestones: 16.4, Compiler.Next Sep 9, 2019
@gafter gafter added the Test-Gap Describes a specific feature or scenario that does not have test coverage label Jan 2, 2020
@gafter gafter removed their assignment Mar 21, 2020
@jaredpar jaredpar modified the milestones: Compiler.Next, Backlog Sep 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers Feature - Pattern Matching Pattern Matching Test Test failures in roslyn-CI Test-Gap Describes a specific feature or scenario that does not have test coverage
Projects
None yet
Development

No branches or pull requests

5 participants