You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using syntactic_sugar, it appears to incorrectly warn about something like:
extensionSequencewhere Element:Collection{func foo()->[Array<Element.Element>.Index]{varindices=[Array<Element.Element>.Index]() // ⚠️ Syntactic Sugar Violation: Shorthand syntactic sugar should be used, i.e. [Int] instead of Array<Int>. (syntactic_sugar)
return indices
}}
However, Swift (5.3.2) won’t let you write what SwiftLint is suggesting in this case:
extensionSequencewhere Element:Collection{func foo()->[Array<Element.Element>.Index]{varindices=[[Element.Element].Index]() // 🛑 Cannot call value of non-function type '[Array<Self.Element.Element>.Index.Type]' (aka 'Array<Int.Type>')
return indices
}}
SwiftLint v0.34.0
The text was updated successfully, but these errors were encountered:
I think I'm seeing the same issue when accessing the Element typealias in dictionaries - I get the syntactic sugar warning, but using it causes a compile error. However it only occurs in the context of a closure for example:
dictionary.reduce(0, {(count: Int, element: Dictionary<String, Any>.Element) -> Int in
if let subdictionary = element.value as? [String: Any] {
return subdictionary["field"] != nil ? count + 1 : count
}
return count
})
When using
syntactic_sugar
, it appears to incorrectly warn about something like:However, Swift (5.3.2) won’t let you write what SwiftLint is suggesting in this case:
SwiftLint v0.34.0
The text was updated successfully, but these errors were encountered: