-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Completion] Remove uses of unbounded generic types #79585
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
9f6e822
to
e5e3732
Compare
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.
Thanks!
@@ -395,8 +395,7 @@ static TypeRelation calculateTypeRelation(Type Ty, Type ExpectedTy, | |||
|
|||
// Equality/Conversion of GenericTypeParameterType won't account for | |||
// requirements – ignore them | |||
if (!Ty->hasTypeParameter() && !ExpectedTy->hasTypeParameter() && | |||
!Ty->hasUnboundGenericType() && !ExpectedTy->hasUnboundGenericType()) { | |||
if (!Ty->hasTypeParameter() && !ExpectedTy->hasTypeParameter()) { |
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.
Can we also get rid of type parameters at some point too, in favor of the caller mapping the type into the correct environment?
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.
Yup I'm leaving that for a future PR
Ensure we always produce bounded generic type annotations and contextual types.
We allow the unqualifed use of the enclosing nominal type in a where clause, but only when it isn't a nested type, e.g: ``` struct S<T> { typealias T = T struct R<U> { typealias U = U } } extension S where S.T == Int {} // allowed extension S.R where R.U == Int {} // not allowed ``` Tweak the completion logic such that we don't suggest the type for the nested case, instead it must be qualified.
Ensure we call `getTypeOfMember` for nested nominals and typealiases.
e5e3732
to
8975bf6
Compare
@swift-ci please test |
@swift-ci please SourceKit stress test |
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.
LGTM. Some nice improvements in the tests as well 😄
@swift-ci please SourceKit stress test |
Ensure we always produce bounded generic type annotations and contextual types. While here, also make sure we substitute the base type for nested type completions.