Skip to content

Commit 0d64703

Browse files
committed
Sema: Fix crash on invalid code in isOverrideBasedOnType()
1 parent ef5e286 commit 0d64703

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

lib/Sema/TypeCheckDeclOverride.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,9 @@ bool swift::isOverrideBasedOnType(const ValueDecl *decl, Type declTy,
217217
return false;
218218
}
219219

220+
if (declTy->is<ErrorType>())
221+
return false;
222+
220223
auto fnType1 = declTy->castTo<AnyFunctionType>();
221224
auto fnType2 = parentDeclTy->castTo<AnyFunctionType>();
222225
return AnyFunctionType::equalParams(fnType1->getParams(),

validation-test/compiler_crashers_2/90773c979d435f7.swift renamed to validation-test/compiler_crashers_2_fixed/90773c979d435f7.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// {"signature":"swift::isOverrideBasedOnType(swift::ValueDecl const*, swift::Type, swift::ValueDecl const*)"}
2-
// RUN: not --crash %target-swift-frontend -typecheck %s
2+
// RUN: not %target-swift-frontend -typecheck %s
33
struct a < b {
44
protocol c { associatedtype d init(e : d
55
}

0 commit comments

Comments
 (0)