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
[CodeCompletion] Suggest typealias on protocols #38054
Conversation
@swift-ci Please smoke test |
@@ -156,6 +156,12 @@ static bool isMemberDeclAppliedInternal(const DeclContext *DC, Type BaseTy, | |||
GenericSignature genericSig = genericDecl->getGenericSignature(); | |||
if (!genericSig) | |||
return true; | |||
if (isa<TypeAliasDecl>(VD) && BaseTy->is<ProtocolType>()) { |
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.
Could we do this before line 153, before getting the generic signature?
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.
Good catch, makes sense as it’s cheaper to check. Moved it up
// RUN: %target-swift-ide-test -batch-code-completion -source-filename %s -filecheck %raw-FileCheck -completion-output-dir %t | ||
|
||
protocol MyProto { | ||
typealias Content = Int |
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 you add a typealias
with generic arguments? e.g. typealias Storage<T> = Array<T>
. I don't this your change affects this case, but still.
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.
Added a test case. Seems to not be an issue.
Previously, we were never suggesting typealias declarations when completing on a protocol type. Fixes rdar://78780638 [SR-14688]
3a17aba
to
088a331
Compare
@swift-ci Please smoke test |
Windows failures is unrelated. |
Previously, we were never suggesting typealias declarations when completing on a protocol type.
Fixes rdar://78780638 [SR-14688]