internal enum SyntacticSugarRuleExamples { static let nonTriggering = [ Example("let x: [Int]"), Example("let x: [Int: String]"), Example("let x: Int?"), Example("func x(a: [Int], b: Int) -> [Int: Any]"), Example("let x: Int!"), Example(""" extension Array { func x() { } } """), Example(""" extension Dictionary { func x() { } } """), Example("let x: CustomArray"), Example("var currentIndex: Array.Index?"), Example("func x(a: [Int], b: Int) -> Array.Index"), Example("unsafeBitCast(nonOptionalT, to: Optional.self)"), Example("unsafeBitCast(someType, to: Swift.Array.self)"), Example("IndexingIterator>>.self"), Example("let y = Optional.Type"), Example("type is Optional.Type"), Example("let x: Foo.Optional"), Example("let x = case Optional.none = obj"), Example("let a = Swift.Optional.none"), Example("func f() -> [Array.Index] { [Array.Index]() }", excludeFromDocumentation: true), ] static let triggering = [ Example("let x: ↓Array"), Example("let x: ↓Dictionary"), Example("let x: ↓Optional"), Example("let x: ↓Swift.Array"), Example("func x(a: ↓Array, b: Int) -> [Int: Any]"), Example("func x(a: ↓Swift.Array, b: Int) -> [Int: Any]"), Example("func x(a: [Int], b: Int) -> ↓Dictionary"), Example("let x = y as? ↓Array<[String: Any]>"), Example("let x = Box>()"), Example("func x() -> Box<↓Array>"), Example("func x() -> ↓Dictionary?"), Example("typealias Document = ↓Dictionary"), Example("func x(_ y: inout ↓Array)"), Example("let x:↓Dictionary>"), Example("func x() -> Any { return ↓Dictionary()}"), Example("let x = ↓Array.array(of: object)"), Example("let x = ↓Swift.Array.array(of: object)"), Example(""" @_specialize(where S == ↓Array) public init(_ elements: S) """), Example(""" let dict: [String: Any] = [:] _ = dict["key"] as? ↓Optional ?? Optional.none """), ] static let corrections = [ Example("let x: Array"): Example("let x: [String]"), Example("let x: Array< String >"): Example("let x: [String]"), Example("let x: Dictionary"): Example("let x: [Int: String]"), Example("let x: Optional"): Example("let x: Int?"), Example("let x: Optional< Int >"): Example("let x: Int?"), Example("func f() -> Optional {}"): Example("func f() -> (any Foo)? {}"), Example("func f() -> Optional {}"): Example("func f() -> (some Foo)? {}"), Example("let x: Dictionary"): Example("let x: [Int: String]"), Example("let x: Swift.Optional"): Example("let x: String?"), Example("let x:↓Dictionary>"): Example("let x:[String: [Int: Int]]"), Example("let x:↓Dictionary<↓Dictionary, String>"): Example("let x:[[Int: Int]: String]"), Example("let x:↓Dictionary<↓Dictionary<↓Dictionary, Int>, String>"): Example("let x:[[[Int: Int]: Int]: String]"), Example("let x:↓Array<↓Dictionary>"): Example("let x:[[Int: Int]]"), Example("let x:↓Optional<↓Dictionary>"): Example("let x:[Int: Int]?"), ] }