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-5584] KeyPath error: type 'R' has no subscript members #48156

Open
dabrahams opened this issue Jul 30, 2017 · 2 comments
Open

[SR-5584] KeyPath error: type 'R' has no subscript members #48156

dabrahams opened this issue Jul 30, 2017 · 2 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself diagnostics QoI Bug: Diagnostics Quality of Implementation type checker Area → compiler: Semantic analysis

Comments

@dabrahams
Copy link
Collaborator

Previous ID SR-5584
Radar rdar://problem/33615754
Original Reporter @dabrahams
Type Bug
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, DiagnosticsQoI, TypeChecker
Assignee None
Priority Medium

md5: 52d8e2405f4d21c6c01060794b6be5de

is duplicated by:

  • SR-7416 Near miss diagnostics for key path subscript

relates to:

  • SR-10826 can we make this keyPath subscript error message better?

Issue Description:

This looks like it should compile but doesn't. Turns out I misspelled the argument label to the subscript; it should be keyPath.

struct X {
  let y = 3
}
let p = \X.y
let r = X()
let q = r[keypath: p] // error: type 'X' has no subscript members

func apply<R,V>(_ path: KeyPath<R,V>, to root: R) -> V {
  return root[keypath: path] // error: type 'R' has no subscript members
}
@dabrahams
Copy link
Collaborator Author

@swift-ci create

@swift-ci
Copy link
Collaborator

swift-ci commented Dec 1, 2017

Comment by Matias Pequeno (JIRA)

`s/keypath/keyPath/g`

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
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 diagnostics QoI Bug: Diagnostics Quality of Implementation type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

2 participants