-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Open
Labels
Area-CompilersFeature - Pattern MatchingPattern MatchingPattern MatchingTestTest failures in roslyn-CITest failures in roslyn-CITest-GapDescribes a specific feature or scenario that does not have test coverageDescribes a specific feature or scenario that does not have test coverage
Milestone
Description
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
Deconstructmethod (likeGetDeconstructionInfo). Are any conversions involved in a positional pattern? [SeeSymbolInfoForPositionalSubpattern. There are no conversions involved.] - Although the language assumes that
Deconstructand properties used in switch statement are idempotent/pure, the compiler tests should capture the actual evaluation order (to avoid inadvertent changes) [SeeRecordOrderOfEvaluation] - Test switch on
(dynamic)someITupleInstance[SeeITupleFromDynamic] - 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 : ytoe switch { true: x, false: y}(so that you can then makeeanenuminstead of abool - Test the name completion
System.Array->arrayine is (System.Array $$ande is (_, System.Array $$ - Should some existing (or new) formatting options control formatting switch expressions?
- Confirm syntax for property pattern:
is { Prop: 0 }oris { Prop is 0 }?
BCL:
- Add
MatchFailureExceptionto Core 3 (design https://github.com/dotnet/corefx/issues/33284) - Port
MatchFailureExceptionto mono
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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Area-CompilersFeature - Pattern MatchingPattern MatchingPattern MatchingTestTest failures in roslyn-CITest failures in roslyn-CITest-GapDescribes a specific feature or scenario that does not have test coverageDescribes a specific feature or scenario that does not have test coverage