Explainer for list-patterns#57210
Explainer for list-patterns#57210jcouv wants to merge 5 commits intodotnet:features/list-patternsfrom
Conversation
| return null; | ||
| } | ||
|
|
||
| var indexes = new Dictionary<int, string>(); |
There was a problem hiding this comment.
Did not know you were working on this. I took a different approach to handle trailing patterns. Updated #55327 just in case. We should def go with your change since this is closer to completion. :)
There was a problem hiding this comment.
Sorry, I got a bit excited this weekend and gave it a try. Thanks
I'll probably steal some bits from your draft
| { | ||
| switch (eval) | ||
| { | ||
| case BoundDagPropertyEvaluation e when e.IsLengthOrCount: |
There was a problem hiding this comment.
It's unlikely to have multiple length tests in the shortest path. I suspect this doesn't need to be in the loop.
| indexes.Add(e.Index, subPattern); | ||
| } | ||
| break; | ||
| case BoundDagSliceEvaluation e: |
There was a problem hiding this comment.
This may produce multiple slice patterns in the list but since we won't construct a dag for invalid patterns that probably won't happen.
There was a problem hiding this comment.
Right, we don't get here when multiple slices. Added test
| tryHandleRecursivePattern(ref unnamedEnumValue) ?? | ||
| tryHandleListPattern(ref unnamedEnumValue) ?? |
There was a problem hiding this comment.
Doing this after recursive patterns will make it unnecessary to worry about [] or [..] but we may choose to generate those instead.
There was a problem hiding this comment.
Yes, that something I've been debating. Should we say { Length: 0 } or []?
7c98d01 to
89edb85
Compare
|
From offline chat, closing in favor of #55327 |
Co-authored-by: Julien Couvreur <jcouv@users.noreply.github.com>
Still work-in-progress (one test hits assertion, some tests remaining to add)
Relates to test plan #51289
FYI @alrz