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-8383] Can't infer Root type of key path expression for PartialKeyPath parameter #50910

Closed
natecook1000 opened this issue Jul 26, 2018 · 9 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself key paths Feature: key paths (both native and Objective-C)

Comments

@natecook1000
Copy link
Member

Previous ID SR-8383
Radar rdar://problem/42737031
Original Reporter @natecook1000
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 4
Component/s Compiler
Labels Bug, KeyPaths
Assignee None
Priority Medium

md5: 5c1aa5f3211b0a576cba0956635705a1

duplicates:

  • SR-5667 Type inference for Swift 4 KeyPaths fails within collections

Issue Description:

I get an ambiguity error for the function with a PartialKeyPath parameter in this example:

struct Bar {
  var baz: Int
}

func full<T>(_ k: KeyPath<Bar, T>) {}
full(\.baz) // ok

func partial(_ k: PartialKeyPath<Bar>) {}
partial(\.baz) // error: type of expression is ambiguous without more context
@belkadan
Copy link
Contributor

cc @jckarter, @rudkx

@belkadan
Copy link
Contributor

Oh, is this the same as SR-8382?

@jckarter
Copy link
Member

Yeah, I think @mdiep might've fixed this on master recently.

@jckarter
Copy link
Member

This particular case still fails, though, so it might be a different issue.

@jckarter
Copy link
Member

@swift-ci create

@swift-ci
Copy link
Collaborator

Comment by Vatsal Manot (JIRA)

I can replicate this on Xcode 12b4.

@swift-ci
Copy link
Collaborator

Comment by Caleb Friden (JIRA)

Just ran into this issue on Xcode 12.1 release.

@swift-ci
Copy link
Collaborator

swift-ci commented May 7, 2021

Comment by Basem Emara (JIRA)

Still an issue with Xcode 12.5 / Swift 5.4. Please include a fix in Swift 6 ⚑

@StevenSorial
Copy link

Works in Swift 5.6

Probably fixed in #37679

@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 key paths Feature: key paths (both native and Objective-C)
Projects
None yet
Development

No branches or pull requests

5 participants