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-309] Unable to coerce String -> NSString #42931

Closed
briancroom opened this issue Dec 18, 2015 · 2 comments
Closed

[SR-309] Unable to coerce String -> NSString #42931

briancroom opened this issue Dec 18, 2015 · 2 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@briancroom
Copy link
Collaborator

Previous ID SR-309
Radar None
Original Reporter @briancroom
Type Bug
Status Resolved
Resolution Duplicate
Environment

Ubuntu 14.04, with the swift-2.2-SNAPSHOT-2015-12-10-a toolchain.

$ swiftc --version
Swift version 2.2-dev (LLVM 7bae82deaa, Clang 53d04af5ce, Swift 5995ef2acd)
Target: x86_64-unknown-linux-gnu
Additional Detail from JIRA
Votes 2
Component/s Compiler
Labels Bug
Assignee None
Priority Medium

md5: 1dd46996777811aa1e18784b21eadbf9

duplicates:

  • SR-138 Foundation objects are not bridged on Linux as they are on OS X.

Issue Description:

The following code compiles on Mac but produces an error on Linux:

import Foundation

let string: String = "str"
let nsString = string as NSString

The compiler output is:

$ swiftc CoerceToNSString.swift 
CoerceToNSString.swift:4:16: error: cannot convert value of type 'String' to type 'NSString' in coercion
let nsString = string as NSString
               ^~~~~~
@ffried
Copy link
Contributor

ffried commented Mar 1, 2017

Probably the same issue as SR-138

@belkadan
Copy link
Contributor

belkadan commented Jun 9, 2017

Consolidating.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself
Projects
None yet
Development

No branches or pull requests

3 participants