extension T { static func foo() -> T { ... } }
extension Optional where Wrapped == T { static func foo() -> T? { ... } }