Skip to content

Commit b2e8a60

Browse files
[TypeCheckType] Lift malformed type check for fnType in resolveASTFunctionType
1 parent 0c33206 commit b2e8a60

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/Sema/TypeCheckType.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2700,13 +2700,16 @@ Type TypeResolver::resolveASTFunctionType(
27002700
}
27012701

27022702
auto fnTy = FunctionType::get(params, outputTy, extInfo);
2703+
2704+
if (fnTy->hasError())
2705+
return fnTy;
2706+
27032707
// If the type is a block or C function pointer, it must be representable in
27042708
// ObjC.
27052709
switch (representation) {
27062710
case AnyFunctionType::Representation::Block:
27072711
case AnyFunctionType::Representation::CFunctionPointer:
2708-
if (!fnTy->hasError() &&
2709-
!fnTy->isRepresentableIn(ForeignLanguage::ObjectiveC, DC)) {
2712+
if (!fnTy->isRepresentableIn(ForeignLanguage::ObjectiveC, DC)) {
27102713
StringRef strName =
27112714
(representation == AnyFunctionType::Representation::Block)
27122715
? "block"

0 commit comments

Comments
 (0)