Skip to content

Commit fc49af2

Browse files
[CSSimplify] Handle coercion to wrong type for function result locator
1 parent 0e1a03d commit fc49af2

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

lib/Sema/CSSimplify.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2842,8 +2842,8 @@ bool ConstraintSystem::repairFailures(
28422842

28432843
// If it has a deep equality restriction, defer the diagnostic to
28442844
// GenericMismatch.
2845-
if (hasConversionOrRestriction(ConversionRestrictionKind::DeepEquality)) {
2846-
if (!lhs->getOptionalObjectType() && !rhs->getOptionalObjectType())
2845+
if (hasConversionOrRestriction(ConversionRestrictionKind::DeepEquality) &&
2846+
!lhs->getOptionalObjectType() && !rhs->getOptionalObjectType()) {
28472847
return false;
28482848
}
28492849

@@ -3503,6 +3503,13 @@ bool ConstraintSystem::repairFailures(
35033503
break;
35043504
}
35053505
}
3506+
// Handle function result coerce expression wrong type conversion.
3507+
if (isa<CoerceExpr>(anchor)) {
3508+
auto *fix =
3509+
ContextualMismatch::create(*this, lhs, rhs, loc);
3510+
conversionsOrFixes.push_back(fix);
3511+
break;
3512+
}
35063513
LLVM_FALLTHROUGH;
35073514
}
35083515

0 commit comments

Comments
 (0)