Skip to content

Commit 0033bda

Browse files
committed
AST: Correct handling of ErrorType in TypeBase::getMemberSubstitutions()
Swift SVN r30531
1 parent 3fae9ff commit 0033bda

7 files changed

+9
-8
lines changed

lib/AST/Type.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2640,8 +2640,9 @@ TypeSubstitutionMap TypeBase::getMemberSubstitutions(DeclContext *dc) {
26402640
LazyResolver *resolver = dc->getASTContext().getLazyResolver();
26412641

26422642
// Find the superclass type with the context matching that of the member.
2643-
auto ownerNominal = dc->getDeclaredTypeOfContext()->getAnyNominal();
2644-
while (baseTy->getAnyNominal() != ownerNominal) {
2643+
auto ownerNominal = dc->isNominalTypeOrNominalTypeExtensionContext();
2644+
while (!baseTy->is<ErrorType>() &&
2645+
baseTy->getAnyNominal() != ownerNominal) {
26452646
baseTy = baseTy->getSuperclass(resolver);
26462647
assert(baseTy && "Couldn't find appropriate context");
26472648
}

validation-test/compiler_crashers/1003-swift-nominaltypedecl-getdeclaredtypeincontext.swift renamed to validation-test/compiler_crashers_fixed/1003-swift-nominaltypedecl-getdeclaredtypeincontext.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: not --crash %target-swift-frontend %s -parse
1+
// RUN: not %target-swift-frontend %s -parse
22

33
// Distributed under the terms of the MIT license
44
// Test case submitted to project by https://github.com/practicalswift (practicalswift)

validation-test/compiler_crashers/1520-llvm-bitstreamcursor-readrecord.swift renamed to validation-test/compiler_crashers_fixed/1520-llvm-bitstreamcursor-readrecord.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: not --crash %target-swift-frontend %s -parse
1+
// RUN: not %target-swift-frontend %s -parse
22

33
// Distributed under the terms of the MIT license
44
// Test case submitted to project by https://github.com/practicalswift (practicalswift)

validation-test/compiler_crashers/2128-swift-nominaltypedecl-getdeclaredtypeincontext.swift renamed to validation-test/compiler_crashers_fixed/2128-swift-nominaltypedecl-getdeclaredtypeincontext.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: not --crash %target-swift-frontend %s -parse
1+
// RUN: not %target-swift-frontend %s -parse
22

33
// Distributed under the terms of the MIT license
44
// Test case submitted to project by https://github.com/practicalswift (practicalswift)

validation-test/compiler_crashers/2231-swift-nominaltypedecl-getdeclaredtypeincontext.swift renamed to validation-test/compiler_crashers_fixed/2231-swift-nominaltypedecl-getdeclaredtypeincontext.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: not --crash %target-swift-frontend %s -parse
1+
// RUN: not %target-swift-frontend %s -parse
22

33
// Distributed under the terms of the MIT license
44
// Test case submitted to project by https://github.com/practicalswift (practicalswift)

validation-test/compiler_crashers/25410-swift-typechecker-resolvetypeincontext.swift renamed to validation-test/compiler_crashers_fixed/25410-swift-typechecker-resolvetypeincontext.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: not --crash %target-swift-frontend %s -parse
1+
// RUN: not %target-swift-frontend %s -parse
22

33
// Distributed under the terms of the MIT license
44
// Test case submitted to project by https://github.com/practicalswift (practicalswift)

validation-test/compiler_crashers/25429-swift-typechecker-resolvetypeincontext.swift renamed to validation-test/compiler_crashers_fixed/25429-swift-typechecker-resolvetypeincontext.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: not --crash %target-swift-frontend %s -parse
1+
// RUN: not %target-swift-frontend %s -parse
22

33
// Distributed under the terms of the MIT license
44
// Test case submitted to project by https://github.com/practicalswift (practicalswift)

0 commit comments

Comments
 (0)