Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-10916] DarwinCompatibility: Method call bridging behaviour on String/NSString differs between Linux and macOS #3305

Open
spevans opened this issue Jun 11, 2019 · 1 comment

Comments

@spevans
Copy link
Collaborator

spevans commented Jun 11, 2019

Previous ID SR-10916
Radar None
Original Reporter @spevans
Type Bug
Environment

Xcode 11.0 beta

Toolchain: Swift Development Snapshot 2019-06-06

macOS 10.14.5

Linux: Ubuntu18, master branch

Additional Detail from JIRA
Votes 0
Component/s Foundation
Labels Bug
Assignee None
Priority Medium

md5: 7032c235831ed1e8dcd7a24ae66eec4a

Issue Description:

The following will compile and run on Linux but fails to compile on Darwin.

import Foundation

let str = "String"
let nsstr = NSString("NSString")
print(str.isEqual(to: "String"))
print(nsstr.isEqual(to: "NSString"))

isEqual(to: ) is a method on NSString and on Linux is written in Swift, on Darwin in Objective-C.

However if the method on NSString is written in Swift, it will work on Darwin and Linux:

import Foundation

extension NSString {
    func isEqual2(to: NSString) -> Bool {
        return self == to
    }
}

let str = "String"
let nsstr = NSString("NSString")
print(str.isEqual2(to: "String"))
print(nsstr.isEqual2(to: "NSString"))
@spevans
Copy link
Collaborator Author

spevans commented Jun 11, 2019

cc @millenomi

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant