Skip to content

Commit 4f5123e

Browse files
committed
[CSDiagnostics] Make contextual key path type mismatch diagnostic consistent
1 parent 3c69f4d commit 4f5123e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/Sema/CSDiagnostics.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2604,6 +2604,11 @@ bool ContextualFailure::diagnoseAsError() {
26042604
if (diagnoseYieldByReferenceMismatch())
26052605
return true;
26062606

2607+
if (isExpr<KeyPathExpr>(anchor)) {
2608+
diagnostic = diag::expr_keypath_type_covert_to_contextual_type;
2609+
break;
2610+
}
2611+
26072612
if (isExpr<OptionalTryExpr>(anchor) ||
26082613
isExpr<OptionalEvaluationExpr>(anchor)) {
26092614
auto objectType = fromType->getOptionalObjectType();

0 commit comments

Comments
 (0)