Skip to content

Commit 71b15e9

Browse files
committed
[AST] Improve ErrorType handling in TypeBase::getMemberSubstitutions()
Historical note: a similar change was made in 0033bda.
1 parent 3e5ce67 commit 71b15e9

File tree

103 files changed

+113
-103
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+113
-103
lines changed

lib/AST/Type.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2517,7 +2517,17 @@ TypeSubstitutionMap TypeBase::getMemberSubstitutions(DeclContext *dc) {
25172517
}
25182518

25192519
// Continue looking into the parent.
2520-
baseTy = baseTy->castTo<NominalType>()->getParent();
2520+
auto nominalTy = baseTy->getAs<NominalType>();
2521+
if (!nominalTy || nominalTy->is<ErrorType>()) {
2522+
baseTy = nullptr;
2523+
break;
2524+
}
2525+
2526+
baseTy = nominalTy->getParent();
2527+
if (!baseTy || baseTy->is<ErrorType>()) {
2528+
baseTy = nullptr;
2529+
break;
2530+
}
25212531
}
25222532

25232533
return substitutions;

validation-test/compiler_crashers/24900-swift-typebase-getmembersubstitutions.swift renamed to validation-test/compiler_crashers_fixed/24900-swift-typebase-getmembersubstitutions.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/25329-swift-typebase-getmembersubstitutions.swift renamed to validation-test/compiler_crashers_fixed/25329-swift-typebase-getmembersubstitutions.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/25704-vtable.swift renamed to validation-test/compiler_crashers_fixed/25704-vtable.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/26096-llvm-errs.swift renamed to validation-test/compiler_crashers_fixed/26096-llvm-errs.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
// Distributed under the terms of the MIT license
33
// Test case submitted to project by https://github.com/practicalswift (practicalswift)
44
// Test case found by fuzzing

validation-test/compiler_crashers/26112-swift-genericsignature-get.swift renamed to validation-test/compiler_crashers_fixed/26112-swift-genericsignature-get.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
// Distributed under the terms of the MIT license
33
// Test case submitted to project by https://github.com/practicalswift (practicalswift)
44
// Test case found by fuzzing

validation-test/compiler_crashers/26118-swift-lexer-leximpl.swift renamed to validation-test/compiler_crashers_fixed/26118-swift-lexer-leximpl.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
// Distributed under the terms of the MIT license
33
// Test case submitted to project by https://github.com/practicalswift (practicalswift)
44
// Test case found by fuzzing

validation-test/compiler_crashers/26130-swift-tupletype-get.swift renamed to validation-test/compiler_crashers_fixed/26130-swift-tupletype-get.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
// Distributed under the terms of the MIT license
33
// Test case submitted to project by https://github.com/practicalswift (practicalswift)
44
// Test case found by fuzzing

validation-test/compiler_crashers/26143-swift-declattribute-canattributeappearondeclkind.swift renamed to validation-test/compiler_crashers_fixed/26143-swift-declattribute-canattributeappearondeclkind.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
// Distributed under the terms of the MIT license
33
// Test case submitted to project by https://github.com/practicalswift (practicalswift)
44
// Test case found by fuzzing

validation-test/compiler_crashers/26147-llvm-foldingset-swift-classtype-nodeequals.swift renamed to validation-test/compiler_crashers_fixed/26147-llvm-foldingset-swift-classtype-nodeequals.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
// Distributed under the terms of the MIT license
33
// Test case submitted to project by https://github.com/practicalswift (practicalswift)
44
// Test case found by fuzzing

0 commit comments

Comments
 (0)