I have the colon
rule enabled and I expect it to fail when an associated value declared in an enum
case doesn't insert the space between the identifier and the type. As of version 0.30.0, SwiftLint doesn't not fail.
// This does not trigger a violation:
enum Token {
case invalid
case valid(token:String)
}
opt_in_rules:
- colon
xcode-select -p
)? Xcode 10.1This seems a bug in SourceKit.
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"
}
]
Filled SR-9740 to track this.
https://github.com/apple/swift/pull/22090 was merged, so this should be fixed in a future Swift release (but not in 5.0).
This was fixed as part of Swift 5.1 馃帀
Most helpful comment
https://github.com/apple/swift/pull/22090 was merged, so this should be fixed in a future Swift release (but not in 5.0).