Xcode 9.3 (9E145)
Swiflint 0.25.1
struct SomeError: Error { }
struct SomeError1: Error { }
let error: Error = Error()
switch error {
case let error as SomeError:
// some code
case let error as SomeError1:
// some code
}
On every case line I get an error:
"Explicit Type Interface Violation: Properties should have a type interface (explicit_type_interface)".
I can't add here error type. Swift doesn't get it.
I am not sure if this is a bug or I'm doing something wrong.
Maybe we should ignore variables inside cases (source.lang.swift.stmt.case)?
This is the structure that SourceKit returns:
{
"key.elements" : [
{
"key.kind" : "source.lang.swift.structure.elem.pattern",
"key.length" : 23,
"key.offset" : 164
}
],
"key.kind" : "source.lang.swift.stmt.case",
"key.length" : 29,
"key.namelength" : 0,
"key.nameoffset" : 0,
"key.offset" : 159,
"key.substructure" : [
{
"key.kind" : "source.lang.swift.decl.var.local",
"key.length" : 5,
"key.name" : "error",
"key.namelength" : 5,
"key.nameoffset" : 168,
"key.offset" : 168
}
]
}
There is also a problem with [weak self] in closures.
Feel free to send a PR!
There is a error on case .failure(let error):, Swiftlint warns to set a type, but it is not possible.
There is still error on case X.value(let val) but not on case .value(let val)
Most helpful comment
There is also a problem with
[weak self]in closures.