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-7346] ReactiveCocoa source breakage: error: value of optional type 'IMP??' (aka 'Optional<Optional<OpaquePointer>>') not unwrapped #49894
Comments
This looks like another case of disallowed IUOs, like in SR-7273. |
Was able to reproduce this locally, but it failed with the 4.0 configurations in addition to 3.2. FAIL: ReactiveCocoa, 4.0, 72dd20, ReactiveCocoa-watchOS, generic/platform=watchOS |
I've reached out to the ReactiveCocoa maintainer for an updated hash. |
Comment by Anders Ha (JIRA) @clackary It seems to be a legit regression. There is no IUO involved here at least from a language user POV (according to Xcode Quick Tips). `method` is `Method?`. `method_getImplementation` is `(Method) -> IMP`. `_rac_objc_msgForward` is `IMP`. So the resulting line should have produced `IMP`. The interesting bit is that it compiles fine if I explicitly declare the result type to be `IMP`. So it seems more like a type inference issue to me. |
@swift-ci create |
When compiling with import Foundation
func test(m: Method?, i: IMP) {
let r = m.map(method_getImplementation) ?? i
let _: IMP = r
} This is a simplified example that demonstrates the problem. I'll take a closer look at this soon, but what it looks like is happening is that for some reason the type checker is now selecting the |
I've attached a reduced test case that more closely represents the original code. |
For now I would suggest working around the issue when compiling with compilers built from swift-4.1-branch by explicitly typing 'impl' as 'IMP'. Compilers built with swift-4.2-branch and master appear to compile this without error. |
Attachment: Download
Additional Detail from JIRA
md5: b800acddc7c117f5ac027e393586049a
Issue Description:
To reproduce:
To build Swift from scratch before testing:
4. $ ./reproduce.py swift-4.1-branch --project-path ReactiveCocoa
Or if you've already built Swift:
4. $ ./reproduce.py swift-4.1-branch --project-path ReactiveCocoa --swiftc path/to/swiftc
Build #264 of swift-4.1-source-compat-suite
FAIL_ReactiveCocoa_3.2_BuildXcodeWorkspaceScheme_ReactiveCocoa-iOS_generic-platform-iOS.log
FAIL_ReactiveCocoa_3.2_BuildXcodeWorkspaceScheme_ReactiveCocoa-macOS_generic-platform-macOS.log
FAIL_ReactiveCocoa_3.2_BuildXcodeWorkspaceScheme_ReactiveCocoa-tvOS_generic-platform-tvOS.log
FAIL_ReactiveCocoa_3.2_BuildXcodeWorkspaceScheme_ReactiveCocoa-watchOS_generic-platform-watchOS.log
The text was updated successfully, but these errors were encountered: