diff --git a/lib/IDE/CodeCompletion.cpp b/lib/IDE/CodeCompletion.cpp index 71522b474635c..db732618b2ee2 100644 --- a/lib/IDE/CodeCompletion.cpp +++ b/lib/IDE/CodeCompletion.cpp @@ -1948,6 +1948,10 @@ class CompletionLookup final : public swift::VisibleDeclConsumer { if (!MaybeNominalType->mayHaveMembers()) return T; + // We can't do anything if the base type has unbound generic parameters. + if (MaybeNominalType->hasUnboundGenericType()) + return T; + // For everything else, substitute in the base type. auto Subs = MaybeNominalType->getMemberSubstitutionMap(M, VD); diff --git a/validation-test/IDE/crashers_2_fixed/rdar48896424.swift b/validation-test/IDE/crashers_2_fixed/rdar48896424.swift new file mode 100644 index 0000000000000..8e43d7dcc812b --- /dev/null +++ b/validation-test/IDE/crashers_2_fixed/rdar48896424.swift @@ -0,0 +1,17 @@ +// RUN: %target-swift-ide-test -code-completion -code-completion-token=COMPLETE -source-filename=%s + +class Foo { +} + +extension Foo where T: Comparable { + func foo() {} +} + +protocol P { + typealias alias = Foo +} +protocol P {} + +func Test() { + P.alias.#^COMPLETE^# +}