Skip to content

[CodeCompletion] Don't distinguish convertible and identical type relation #42211

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

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented Apr 6, 2022

I think that preferring identical over convertible makes sense in e.g. C++ where we have implicit user-defined type conversions but since we don’t have them in Swift, I think the distinction doesn’t make too much sense, because if we have a func foo(x: Int?), want don’t really want to prioritize variables of type Int? over Int Similarly if we have func foo(x: View), we don’t want to prioritize a variable of type View over e.g. Text.

rdar://91349364

@ahoppen ahoppen requested a review from rintaro April 6, 2022 13:27
@ahoppen
Copy link
Member Author

ahoppen commented Apr 6, 2022

@swift-ci Please smoke test

@ahoppen ahoppen force-pushed the pr/dont-distinguish-identical-convertible-type-relation branch from 3a07c07 to b782853 Compare April 7, 2022 06:26
@ahoppen
Copy link
Member Author

ahoppen commented Apr 7, 2022

@swift-ci Please smoke test

@ahoppen ahoppen changed the title [CodeCompletion] Don't distinguish convertible and idenical type relation [CodeCompletion] Don't distinguish convertible and identical type relation Apr 8, 2022
…tion

I think that preferring identical over convertible makes sense in e.g. C++ where we have implicit user-defined type conversions but since we don’t have them in Swift, I think the distinction doesn’t make too much sense, because if we have a `func foo(x: Int?)`, want don’t really want to  prioritize variables of type `Int?` over `Int` Similarly if we have `func foo(x: View)`, we don’t want to prioritize a variable of type `View` over e.g. `Text`.

rdar://91349364
@ahoppen ahoppen force-pushed the pr/dont-distinguish-identical-convertible-type-relation branch from b782853 to 5d01a09 Compare April 13, 2022 06:28
@ahoppen
Copy link
Member Author

ahoppen commented Apr 13, 2022

@swift-ci Please smoke test

@ahoppen ahoppen merged commit 11c3ff0 into swiftlang:main Apr 13, 2022
@ahoppen ahoppen deleted the pr/dont-distinguish-identical-convertible-type-relation branch April 13, 2022 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants