Skip to content

Commit d01e80d

Browse files
authored
Merge pull request #23308 from rintaro/ide-completion-rdar48896424
[CodeCompletion] Fix an assertion failure
2 parents 1e0414d + 71aeea9 commit d01e80d

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

lib/IDE/CodeCompletion.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1948,6 +1948,10 @@ class CompletionLookup final : public swift::VisibleDeclConsumer {
19481948
if (!MaybeNominalType->mayHaveMembers())
19491949
return T;
19501950

1951+
// We can't do anything if the base type has unbound generic parameters.
1952+
if (MaybeNominalType->hasUnboundGenericType())
1953+
return T;
1954+
19511955
// For everything else, substitute in the base type.
19521956
auto Subs = MaybeNominalType->getMemberSubstitutionMap(M, VD);
19531957

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// RUN: %target-swift-ide-test -code-completion -code-completion-token=COMPLETE -source-filename=%s
2+
3+
class Foo<T> {
4+
}
5+
6+
extension Foo where T: Comparable {
7+
func foo() {}
8+
}
9+
10+
protocol P {
11+
typealias alias = Foo
12+
}
13+
protocol P {}
14+
15+
func Test() {
16+
P.alias.#^COMPLETE^#
17+
}

0 commit comments

Comments
 (0)