Skip to content

[SR-9740] [SourceKit] Syntax map with wrong token type for type inside enum case declaration #52171

@marcelofabri

Description

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

Apple Swift version 4.2.1 (swiftlang-1000.11.42 clang-1000.11.45.1)
Target: x86_64-apple-darwin18.2.0

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

md5: 0727b3719c59bd3fbfa618f80cc07f70

Issue Description:

enum A {
    case b(c: String)
}

Running sourcekitten syntax --file file.swift:

[
  {
    "length" : 4,
    "offset" : 0,
    "type" : "source.lang.swift.syntaxtype.keyword"
  },
  {
    "length" : 1,
    "offset" : 5,
    "type" : "source.lang.swift.syntaxtype.identifier"
  },
  {
    "length" : 4,
    "offset" : 13,
    "type" : "source.lang.swift.syntaxtype.keyword"
  },
  {
    "length" : 1,
    "offset" : 18,
    "type" : "source.lang.swift.syntaxtype.identifier"
  },
  {
    "length" : 1,
    "offset" : 20,
    "type" : "source.lang.swift.syntaxtype.identifier"
  },
  {
    "length" : 6,
    "offset" : 23,
    "type" : "source.lang.swift.syntaxtype.identifier"
  }
]

The last token should be a typeidentifier, not an identifier.

Related issue: realm/SwiftLint#2582

Metadata

Metadata

Assignees

Labels

bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions