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-5057] SourceKit doesn't include some variables in structure sometimes #47633

Closed
marcelofabri opened this issue May 31, 2017 · 2 comments
Closed
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.

Comments

@marcelofabri
Copy link
Contributor

Previous ID SR-5057
Radar None
Original Reporter @marcelofabri
Type Bug
Status Resolved
Resolution Done
Environment

Apple Swift version 3.1 (swiftlang-802.0.53 clang-802.0.42)
Target: x86_64-apple-macosx10.9

Additional Detail from JIRA
Votes 1
Component/s Source Tooling
Labels Bug
Assignee @marcelofabri
Priority Medium

md5: 93c970439ebee04975f12c52c62948b8

Issue Description:

In some cases, SourceKit doesn't include some variables in the structure.

For example:

func fooBar() { let x = 1 }
{
  "key.offset": 0,
  "key.length": 28,
  "key.diagnostic_stage": "source.diagnostic.stage.swift.parse",
  "key.syntaxmap": [
    {
      "key.kind": "source.lang.swift.syntaxtype.keyword",
      "key.offset": 0,
      "key.length": 4
    },
    {
      "key.kind": "source.lang.swift.syntaxtype.identifier",
      "key.offset": 5,
      "key.length": 6
    },
    {
      "key.kind": "source.lang.swift.syntaxtype.keyword",
      "key.offset": 16,
      "key.length": 3
    },
    {
      "key.kind": "source.lang.swift.syntaxtype.identifier",
      "key.offset": 20,
      "key.length": 1
    },
    {
      "key.kind": "source.lang.swift.syntaxtype.number",
      "key.offset": 24,
      "key.length": 1
    }
  ],
  "key.substructure": [
    {
      "key.kind": "source.lang.swift.decl.function.free",
      "key.accessibility": "source.lang.swift.accessibility.internal",
      "key.name": "fooBar()",
      "key.offset": 0,
      "key.length": 27,
      "key.nameoffset": 5,
      "key.namelength": 8,
      "key.bodyoffset": 15,
      "key.bodylength": 11
    }
  ]
}

I'd expect that the fooBar() entry would include a key.substructure containing a source.lang.swift.decl.var.local entry.

Check realm/SwiftLint#136 for more context on how this affects SwiftLint.

@marcelofabri
Copy link
Contributor Author

#11262

@marcelofabri
Copy link
Contributor Author

Merged in #11431.

@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

1 participant