-
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 expressions: use iteration type for convertibility of element types #71397
Changes from 3 commits
de50319
389e1d6
4802f03
92d180f
74ed4a7
257af7b
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 |
---|---|---|
|
@@ -1650,11 +1650,6 @@ internal static CollectionExpressionTypeKind GetCollectionExpressionTypeKind(CSh | |
{ | ||
return CollectionExpressionTypeKind.CollectionBuilder; | ||
} | ||
else if (implementsSpecialInterface(compilation, destination, SpecialType.System_Collections_Generic_IEnumerable_T)) | ||
{ | ||
elementType = default; | ||
return CollectionExpressionTypeKind.ImplementsIEnumerableT; | ||
} | ||
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. Discussed offline: 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. Thanks for the suggestion. I agree, we should refactor these two methods, possibly moving calculation of iteration type to |
||
else if (implementsSpecialInterface(compilation, destination, SpecialType.System_Collections_IEnumerable)) | ||
{ | ||
// ^ This implementation differs from Binder.CollectionInitializerTypeImplementsIEnumerable(). | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
consider adding assertion that
elementType
is not null (we already have such assertion in caller, but I think it would make sense here) #Closed