Skip to content

Commit 559c0fd

Browse files
committed
AST: Remove assertion in typo correction
CSDiag can try doing lookups on unbound generic types, so just remove this assertion.
1 parent 4878889 commit 559c0fd

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

lib/AST/LookupVisibleDecls.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -847,10 +847,6 @@ class OverrideFilteringConsumer : public VisibleDeclConsumer {
847847

848848
// Does it make sense to substitute types?
849849

850-
// Don't pass UnboundGenericType here. If you see this assertion
851-
// being hit, fix the caller, don't remove it.
852-
assert(IsTypeLookup || !BaseTy->hasUnboundGenericType());
853-
854850
// If the base type is AnyObject, we might be doing a dynamic
855851
// lookup, so the base type won't match the type of the member's
856852
// context type.

test/Sema/typo_correction.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,16 @@ struct Generic<T> {
112112
}
113113
}
114114

115+
protocol P { // expected-note {{'P' previously declared here}}
116+
typealias a = Generic
117+
}
118+
119+
protocol P {} // expected-error {{invalid redeclaration of 'P'}}
120+
121+
func hasTypo() {
122+
_ = P.a.a // expected-error {{value of type 'Generic' has no member 'a'}}
123+
}
124+
115125
// Typo correction with AnyObject.
116126
func takesAnyObject(_ t: AnyObject) {
117127
_ = t.rawPointer

validation-test/compiler_crashers/28814-basety-hasunboundgenerictype.swift renamed to validation-test/compiler_crashers_fixed/28814-basety-hasunboundgenerictype.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
// See https://swift.org/LICENSE.txt for license information
66
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
77

8-
// REQUIRES: asserts
9-
// RUN: not --crash %target-swift-frontend %s -emit-ir
8+
9+
// RUN: not %target-swift-frontend %s -emit-ir
1010
protocol P{typealias a=FlattenCollection}{{P.a.a}}protocol P

0 commit comments

Comments
 (0)