-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Update list-patterns.md #5364
Update list-patterns.md #5364
Conversation
proposals/list-patterns.md
Outdated
The following assumptions are made on the members being used: | ||
|
||
- `Length` or `Count` properties are assumed to always return a non-negative value, if and only if the type is *indexable*. For instance, the pattern `{ Length: -1 }` can never match an array. | ||
- The `Slice` method or the range indexer is assumed to be well-behaved, that is, the return value is never null and that it is a proper subslice of the containing list. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that this only affects the codegen and nullability exhaustiveness.
We never produce an error if an unannotated type is matched with null
.
Additionally, if the type is annotated (which is not what we'd expect), a slice variable remains annotated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done with review pass (iteration 1)
Thanks for the follow-through (remembering to document the assumptions) :-) |
Almost. |
Oops. I may have merged too soon. |
Notes say: "If a Slice method is annotated, we will treat it as potentially returning null for the purposes of subsumption and exhaustiveness." |
No, that's not what's been discussed in LDM. |
Details to discuss: #5364 (comment) |
Relates to the PR dotnet/roslyn#57457