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-310] Int fails to convert to protocol adopted values on linux #42932

Closed
phausler opened this issue Dec 18, 2015 · 5 comments
Closed

[SR-310] Int fails to convert to protocol adopted values on linux #42932

phausler opened this issue Dec 18, 2015 · 5 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. runtime The Swift Runtime standard library Area: Standard library umbrella

Comments

@phausler
Copy link
Member

Previous ID SR-310
Radar None
Original Reporter @phausler
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Standard Library
Labels Bug, Runtime
Assignee @phausler
Priority Medium

md5: 2b0be59f3dc3ff323834379e44b7c7c2

is duplicated by:

  • SR-404 Loading Foundation protocol conformances fails

Issue Description:

This works on Darwin hosts but not linux:

protocol _NSObjectRepresentable {
func _nsObjectRepresentation() -> NSObject
}

extension Int : _NSObjectRepresentable {
func _nsObjectRepresentation() -> NSObject {
return _bridgeToObject()
}
}

if let obj = value as? _NSObjectRepresentable {
print("darwin gets here")
} else {
print("linux gets here")
}

see commit apple/swift-corelibs-foundation@877a052 to account for the failure case

@phausler
Copy link
Member Author

This issue is more than just Int:
```
if let copyable = self as? NSMutableCopying {
```
this condition fails on NSArray which adopts NSMutableCopying on linux but passes on mac os x.

@phausler
Copy link
Member Author

pushed a work-around to swift-corelibs-foundation/master apple/swift-corelibs-foundation@e35f973 for the copy case where NSCopying and NSMutableCopying protocol adopters were getting called differently on linux than on os x

@lhoward
Copy link
Contributor

lhoward commented Dec 30, 2015

@phausler
Copy link
Member Author

phausler commented Jan 4, 2016

This seems to definitely be resolved by that fix. verified by reverting 877a052

@phausler
Copy link
Member Author

phausler commented Jan 4, 2016

Configuration changed; linker script changes seems to have resolved the issue

@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. runtime The Swift Runtime standard library Area: Standard library umbrella
Projects
None yet
Development

No branches or pull requests

2 participants