Skip to content

Commit 7370523

Browse files
authored
Merge pull request #6910 from xedin/crasher-28636
[Diagnostics] Don't attempt member lookup if base type has unresolved type parameters
2 parents 51d9254 + 671d470 commit 7370523

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lib/Sema/CSDiag.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2430,6 +2430,12 @@ bool FailureDiagnosis::diagnoseGeneralMemberFailure(Constraint *constraint) {
24302430
}
24312431
}
24322432

2433+
// If base type has unresolved generic parameters, such might mean
2434+
// that it's initializer with erroneous argument, otherwise this would
2435+
// be a simple ambigious archetype case, neither can be diagnosed here.
2436+
if (baseTy->hasTypeParameter() && baseTy->hasUnresolvedType())
2437+
return false;
2438+
24332439
MemberLookupResult result = CS->performMemberLookup(
24342440
constraint->getKind(), memberName, baseTy,
24352441
constraint->getFunctionRefKind(), constraint->getLocator(),

validation-test/compiler_crashers/28636-base-base-hastypeparameter.swift renamed to validation-test/compiler_crashers_fixed/28636-base-base-hastypeparameter.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
77

88
// REQUIRES: asserts
9-
// RUN: not --crash %target-swift-frontend %s -emit-ir
9+
// RUN: not %target-swift-frontend %s -emit-ir
1010
Array(.n).init(

0 commit comments

Comments
 (0)