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-13766] Index store does not correctly relate variable type #56163
Comments
Comment by Ian Leitch (JIRA) /cc @benlangmuir |
What is your use case for this new relation? Keep in mind it would not be sufficient for determining the type of the variable in general, because we do not have a representation of structured types in the index. For example, the following all reference var a: (Int, String)
var b: (Int) -> ()
var c: Array<Int>
var d: Int? |
It should have 'container' relationship with the property. This is what clang is doing. |
Though @benlangmuir's point still stands that even with 'container' relationship it's not enough to determine the actual type. |
Comment by Ian Leitch (JIRA) My use case is detecting unused code. I'm not interested in the type information so much, I just need to know that `someVar` references `MyClass1`, which isn't currently possible since the reference isn't contained under the `someVar` declaration. |
@swift-ci create |
Comment by Ian Leitch (JIRA) I've started a discussion on the forums regarding this issue: https://forums.swift.org/t/why-isnt-patternbindingdecl-scoped-within-vardecl/50994 @benlangmuir @akyrtzi perhaps you've some thoughts to share? |
Environment
Apple Swift version 5.3.1 (swiftlang-1200.0.41 clang-1200.0.32.8)
Target: x86_64-apple-darwin19.6.0
Additional Detail from JIRA
md5: 13adb7e503bedbfaa01d84ad75c17d0f
Issue Description:
The index store contains an occurrence for `MyClass1` with a `reference` role, however said occurrence does not have any associated relations that tie it to `someVar`. The occurrence is therefore "dangling" or "toplevel", however you want to call it.
The full dependency graph is as follows:
I'm expecting the dependency graph for 'MyClass2' to be as follows:
The text was updated successfully, but these errors were encountered: