Skip to content

Commit bae0481

Browse files
authored
Merge pull request #18279 from rintaro/ide-complete-rdar41234606
[AST] Fix a crash in UnqualifiedLookup
2 parents ef67c04 + bcb83ac commit bae0481

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

lib/AST/NameLookup.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,7 @@ UnqualifiedLookup::UnqualifiedLookup(DeclName Name, DeclContext *DC,
811811
return;
812812
}
813813

814-
if (BaseDC && !ExtendedType->hasError()) {
814+
if (BaseDC && ExtendedType && !ExtendedType->hasError()) {
815815
NLOptions options = baseNLOptions;
816816
if (isCascadingUse.getValue())
817817
options |= NL_KnownCascadingDependency;

test/IDE/complete_crashes.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,3 +345,15 @@ func test_42452085(any: Any, obj: cls_42452085?) throws {
345345
_ = try obj?.canThrow() #^RDAR_42452085_3^#
346346
}
347347
// RDAR_42452085: Begin completions
348+
349+
// rdar://problem/41234606
350+
// RUN: %target-swift-ide-test -code-completion -code-completion-token=RDAR_41234606 -source-filename=%s | %FileCheck %s -check-prefix=RDAR_41234606
351+
#if false
352+
extension Foo {
353+
func foo<T: Collection #^RDAR_41234606^#>(x: T) {}
354+
}
355+
#endif
356+
// RDAR_41234606: Begin completion
357+
// RDAR_41234606-DAG: Decl[AssociatedType]/Super: .Element; name=Element
358+
// RDAR_41234606-DAG: Decl[AssociatedType]/Super: .Iterator; name=Iterator
359+
// RDAR_41234606: End completions

0 commit comments

Comments
 (0)