Pattern: Missing use of Self
for static reference
Issue: -
Static references should be prefixed by Self
instead of the class name.
Examples of correct code:
class C {
static private(set) var i = 0, j = C.i
let h = C.i
@GreaterThan(C.j) var k: Int
}
class `Self` {
static let i = 0
func f() -> Int { Self.i }
}
Examples of incorrect code:
struct C {
static let i = 0
static let j = ↓C.i
}
struct S {
static let i = 0
func f() -> Int { ↓S.i }
}