[SR-12422] Identity KeyPath literal is not working properly according to SE-0249 #54861
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler in itself
expressions
Feature: expressions
implicit conversions
Feature: implicit conversions
key paths
Feature: key paths (both native and Objective-C)
swift 5.10
type checker
Area → compiler: Semantic analysis
unexpected error
Bug: Unexpected error
Attachment: Download
Environment
Xcode 11.4 (11E146)
macOS 10.15.3 (19D76)
Additional Detail from JIRA
md5: dff283ffe45d137ca02f1f96d564a0f1
Issue Description:
When attempting to use the identity
KeyPath
literal (.self
) as a function according to functionality in SE-0249, the code fails to compile. Example:However if one assigns an identity
KeyPath
to a variable of type(Root) -> Root
, it succeeds:It also succeeds if we define an operator on
KeyPath
:More examples can be found on the attached playground.
From my very basic understanding of this (and please excuse me if I'm saying something stupid!), could it be that the Identity
KeyPath
's special handling (from SE-0227 is not playing well with the new logic implemented in SE-0249 to convertKeyPath
's to functions? Because if.self
is translated to aMutableKeyPath<T, T>
andMutableKeyPath: KeyPath
, it should work like any otherKeyPath
.Thanks!
The text was updated successfully, but these errors were encountered: