Skip to content

Commit 55af87f

Browse files
authored
Merge pull request #71372 from apple/function-keypath-follow-ups
Follow ups for keypath function conversion PR
2 parents 09991db + aedf854 commit 55af87f

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

include/swift/AST/DiagnosticsSema.def

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -697,10 +697,10 @@ ERROR(expr_smart_keypath_application_type_mismatch,none,
697697
"key path of type %0 cannot be applied to a base of type %1",
698698
(Type, Type))
699699
ERROR(expr_keypath_root_type_mismatch, none,
700-
"key path root type %0 cannot be converted to contextual type %1",
700+
"cannot convert key path root type %0 to contextual type %1",
701701
(Type, Type))
702702
ERROR(expr_keypath_type_mismatch, none,
703-
"key path of type %0 cannot be converted to contextual type %1",
703+
"cannot convert key path of type %0 to contextual type %1",
704704
(Type, Type))
705705
ERROR(expr_keypath_application_root_type_mismatch, none,
706706
"key path with root type %0 cannot be applied to a base of type %1",

lib/Sema/CSSimplify.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12286,8 +12286,8 @@ ConstraintSystem::simplifyKeyPathConstraint(
1228612286
auto paramFnTy = FunctionType::get(paramParam, fnTy->getResult(),
1228712287
fnTy->getExtInfo());
1228812288

12289-
return matchTypes(kpFnTy, paramFnTy, ConstraintKind::Conversion, subflags,
12290-
locator).isSuccess();
12289+
return !matchTypes(kpFnTy, paramFnTy, ConstraintKind::Conversion,
12290+
subflags, locator).isFailure();
1229112291
}
1229212292

1229312293
assert(contextualRootTy && contextualValueTy);

test/Constraints/keypath.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ func testVariadicKeypathAsFunc() {
8181

8282
// These are not okay, the KeyPath should have a base that matches the
8383
// internal parameter type of the function, i.e (S...).
84-
let _: (S...) -> Int = \S.i // expected-error {{key path root type 'S' cannot be converted to contextual type 'S...'}}
85-
takesVariadicFnWithGenericRet(\S.i) // expected-error {{key path root type 'S' cannot be converted to contextual type 'S...'}}
84+
let _: (S...) -> Int = \S.i // expected-error {{cannot convert key path root type 'S' to contextual type 'S...'}}
85+
takesVariadicFnWithGenericRet(\S.i) // expected-error {{cannot convert key path root type 'S' to contextual type 'S...'}}
8686
}
8787

8888
// rdar://problem/54322807

0 commit comments

Comments
 (0)