mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
36 lines
1.2 KiB
Swift
36 lines
1.2 KiB
Swift
//===--- MixedStringNSStringOperations.swift.gyb --------------*- swift -*-===//
|
|
//
|
|
// This source file is part of the Swift.org open source project
|
|
//
|
|
// Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
|
|
// Licensed under Apache License v2.0 with Runtime Library Exception
|
|
//
|
|
// See http://swift.org/LICENSE.txt for license information
|
|
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
// Mixed-type comparisons between String and NSString.
|
|
// Since the compiler will implicitly bridge String to NSString, these more
|
|
// refined overloads exist to disable invalid bridging from happening.
|
|
// For example, swiftString < nsString will bridge swiftString to NSString
|
|
// and perform incorrect unicode comparison.
|
|
//
|
|
|
|
% for op in [ '==', '!=', '<', '<=', '>=', '>' ]:
|
|
|
|
@availability(*, unavailable,
|
|
message="Comparing Swift.String and NSString is ambiguous")
|
|
public func ${op} (lhs: String, rhs: NSString) -> Bool {
|
|
fatalError("impossible")
|
|
}
|
|
|
|
@availability(*, unavailable,
|
|
message="Comparing Swift.String and NSString is ambiguous")
|
|
public func ${op} (lhs: NSString, rhs: String) -> Bool {
|
|
fatalError("impossible")
|
|
}
|
|
|
|
% end
|