Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-13392] Can't use as to coerce KeyPath to function #55832

Closed
lilyball mannequin opened this issue Aug 14, 2020 · 0 comments
Closed

[SR-13392] Can't use as to coerce KeyPath to function #55832

lilyball mannequin opened this issue Aug 14, 2020 · 0 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@lilyball
Copy link
Mannequin

lilyball mannequin commented Aug 14, 2020

Previous ID SR-13392
Radar None
Original Reporter @lilyball
Type Bug
Status Resolved
Resolution Duplicate
Environment

Apple Swift version 5.3 (swiftlang-1200.0.25.2 clang-1200.0.27.1)
Target: x86_64-apple-darwin19.6.0

Also exists with Swift 5.2 but the error is less helpful (it's an "type is ambiguous" error there).

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee None
Priority Medium

md5: a169f50c73eec734ab09085321cb0520

duplicates:

  • SR-12991 Type checker doesn't take context from " as " - Examples in Key Path Expressions as Functions proposal don't compile

Issue Description:

KeyPaths can be used where functions are expected. But this doesn't work with the as operator.

let f: (Point) -> Int = \Point.x

{code:swift|title=This doesn't}
let f = \Point.x as (Point) -> Int

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself
Projects
None yet
Development

No branches or pull requests

0 participants