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-5667] Type inference for Swift 4 KeyPaths fails within collections #48237

Closed
swift-ci opened this issue Aug 9, 2017 · 2 comments
Closed
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself type checker Area → compiler: Semantic analysis

Comments

@swift-ci
Copy link
Collaborator

swift-ci commented Aug 9, 2017

Previous ID SR-5667
Radar rdar://problem/32365183
Original Reporter mhuusko5 (JIRA User)
Type Bug
Status Resolved
Resolution Done
Environment

Version 9.0 beta 5 (9M202q)

Additional Detail from JIRA
Votes 2
Component/s Compiler
Labels Bug, TypeChecker
Assignee None
Priority Medium

md5: 30e8a42641bd40762de23592175d06d8

is duplicated by:

  • SR-5578 Partial key paths don't provide enough type context to omit the base of a key path literal
  • SR-6740 KeyPath: should infer class from argument types
  • SR-8382 Contextual typing for key path literals in PartialKeyPath context doesn't work.
  • SR-8383 Can't infer Root type of key path expression for PartialKeyPath parameter
  • SR-12390 Cannot use shorthand key path syntax on PartialKeyPath argument
  • SR-14549 Function call gives an error "Type of expression is ambiguous without more context".

relates to:

  • SR-5217 Protocol creates ambiguity around KeyPath roots

Issue Description:

struct Parameters {
    var orderByDate: Bool?
}

let key: PartialKeyPath<Parameters> = \.orderByDate // works!
let keys: [PartialKeyPath<Parameters>] = [\.orderByDate] // ambiguous :(
@rudkx
Copy link
Member

rudkx commented Aug 9, 2017

@swift-ci create

@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 type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

3 participants