-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Collection literals: type inference #68703
Changes from all commits
d3f0043
183999a
c4e3e1a
cad8374
dd075f8
dc92b4f
2b012fa
f8673ba
5f1e143
72c7946
69f6b5a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7228,9 +7228,11 @@ private static NullableAnnotation GetNullableAnnotation(BoundExpression expr) | |
case BoundKind.UnboundLambda: | ||
case BoundKind.UnconvertedObjectCreationExpression: | ||
case BoundKind.ConvertedTupleLiteral: | ||
case BoundKind.UnconvertedCollectionLiteralExpression: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note that this will crash IOperation There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It wasn't clear to me why this is OK for UnconvertedObjectCreationExpression, but not for UnconvertedCollectionLiteralExpression. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not. That codepath is either never hit, or only hit during initial nullable analysis of something like an unbound lambda (and if so, we really should have left a comment). If |
||
return NullableAnnotation.NotAnnotated; | ||
default: | ||
Debug.Assert(false); // unexpected value | ||
// PROTOTYPE: Re-enable | ||
//Debug.Assert(false); // unexpected value | ||
return NullableAnnotation.Oblivious; | ||
} | ||
} | ||
|
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.
Once we have natural typing, this (and the corresponding elements in output type inference) are going to need to change, as we are not making any type inferences from the entire collection type to T at the moment. Future work though.