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-15064] Index store does not relate types used in variable closure type. #57391

Closed
swift-ci opened this issue Aug 13, 2021 · 3 comments
Closed
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-15064
Radar None
Original Reporter Leitch (JIRA User)
Type Bug
Status Closed
Resolution Invalid
Environment

Swift @ 861f47f (5.6)

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

md5: a1c0283a58d068010a066cf1c0a5eeb3

Issue Description:

Given the following code:

let a: ((Int) -> Void) = {}

I'd expect to see a reference to `Int`, yet one does not exist.

1:5 | variable/Swift | a | s:14swift_ide_test1aXevp | Def | rel: 0
1:5 | function/acc-get/Swift | getter:a | s:14swift_ide_test1aXevg | Def,Impl,RelChild,RelAcc | rel: 1
  RelChild,RelAcc | variable/Swift | a | s:14swift_ide_test1aXevp
1:5 | function/acc-set/Swift | setter:a | s:14swift_ide_test1aXevs | Def,Impl,RelChild,RelAcc | rel: 1
  RelChild,RelAcc | variable/Swift | a | s:14swift_ide_test1aXevp
@swift-ci
Copy link
Collaborator Author

Comment by Ian Leitch (JIRA)

\cc @benlangmuir seems like a bug to me? I'll attempt to fix this myself at some point, just want to document it and confirm it's a bug.

@benlangmuir
Copy link
Member

This does seem like a bug, but I haven't been able to reproduce it. I tried 5.5 as well as recent build of main branch. I see references to both `Int` and `Void` as expected:

$ cat /tmp/t.swift
let a: ((Int) -> Void) = {}%                                                                                            

$ bin/swift-ide-test -print-indexed-symbols -source-filename /tmp/t.swift                                           
/tmp/t.swift:1:26: error: contextual type for closure argument list expects 1 argument, which cannot be implicitly ignored
let a: ((Int) -> Void) = {}
                         ^
                          _ in 
t.swift
------------
module | system | Swift | /.../lib/swift/macosx/Swift.swiftmodule/x86_64-apple-macos.swiftmodule
module | system | _Concurrency | /.../lib/swift/macosx/_Concurrency.swiftmodule/x86_64-apple-macos.swiftmodule
module | system | Swift | /.../lib/swift/macosx/Swift.swiftmodule/x86_64-apple-macos.swiftmodule
------------
1:5 | variable/Swift | a | s:14swift_ide_test1ayySicvp | Def | rel: 0
1:5 | function/acc-get/Swift | getter:a | s:14swift_ide_test1ayySicvg | Def,Impl,RelChild,RelAcc | rel: 1
  RelChild,RelAcc | variable/Swift | a | s:14swift_ide_test1ayySicvp
1:5 | function/acc-set/Swift | setter:a | s:14swift_ide_test1ayySicvs | Def,Impl,RelChild,RelAcc | rel: 1
  RelChild,RelAcc | variable/Swift | a | s:14swift_ide_test1ayySicvp
1:10 | struct/Swift | Int | s:Si | Ref | rel: 0
1:18 | type-alias/Swift | Void | s:s4Voida | Ref | rel: 0

I tried a few variants, including "in a function", "global variable", "using swift-ide-test", "using compiler with index store", but they all seemed to work. Any idea what might be different?

@swift-ci
Copy link
Collaborator Author

Comment by Ian Leitch (JIRA)

False alarm, somehow my local build got messed up. Doing a full rebuild fixed it. Sorry for the noise!

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

No branches or pull requests

2 participants