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-15063] Subscript and keypath expression argument labels are not annotated #57390

Open
benlangmuir opened this issue Aug 13, 2021 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.

Comments

@benlangmuir
Copy link
Member

Previous ID SR-15063
Radar rdar://81906149
Original Reporter @benlangmuir
Type Bug
Additional Detail from JIRA
Votes 0
Component/s Source Tooling
Labels Bug
Assignee None
Priority Medium

md5: e77d7f514f32917c91e5ba7be1c8988b

Issue Description:

We annotate argument labels for function calls, but not for keypath expressions or subscripts.

$ cat /tmp/t.swift
struct S {
  var x: Int = 0
  func foo(label: Int) {}
  subscript(label _: Int) -> Int { return 0 }
}

let s = S()
s.foo(label: 1)
_ = s[label: 2]
_ = s[keyPath: \.x]%                                                                                                    


$ xcrun swift-ide-test -annotate -source-filename /tmp/t.swift
struct <Struct>S</Struct> {
  var <Var>x</Var>: <iStruct@>Int</iStruct> = 0
  func <Func>foo</Func>(<Param>label</Param>: <iStruct@>Int</iStruct>) {}
  <Subscript>subscript</Subscript>(label _: <iStruct@>Int</iStruct>) -> <iStruct@>Int</iStruct> { return 0 }
}

let <Var>s</Var> = <Ctor@1:8-Struct@1:8>S</Ctor>()
<Var@7:5>s</Var>.<Func@3:8>foo</Func>(<Func@3:8#label>label</Func>: 1)
_ = <Var@7:5>s</Var><Subscript@4:3>[</Subscript>label: 2<Subscript@4:3>]</Subscript>
_ = <Var@7:5>s</Var>[keyPath: \.<Var@2:7>x</Var>]%   
@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@benlangmuir
Copy link
Member Author

Reproduced in 5.6

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.
Projects
None yet
Development

No branches or pull requests

1 participant