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-7125] Swift 4.1 Xcode 9.3b4 regression #49673
Comments
cc @rudkx, @xedin. It seems to me this has a legitimate reason for compiling previously, and still should be able to compile using `compactMap`. Working backward from the contextual result type `[Bar]`, we should be able to infer `[Bar?]` for the array literal type, which is a supertype of all of the elements of the array literal. |
@swift-ci create |
Does it also work if you use |
It does compile with that in the closure body, that's the last example above. It also compiles with this:
|
Sorry, I read that you had |
Ah sorry I misread that! No that fails with this error:
|
@rudkx It seems like we do something very wrong here since with `$0 as? Bar` the result of the closure is inferred to be `Superclass` and `$0` to be `Superclass?` instead of `Bar` and `Bar?`. I'm going to take a look, it might be an easy fix. |
@swift-ci create |
@xedin I tested the master snapshot from 3/8 and it does compile now. Thanks! What's the process for getting that fixed in the 4.1 branch? |
Environment
Xcode 9.3b4
Additional Detail from JIRA
md5: c85e0d6950ba1dfcfa34d061adc53271
Issue Description:
This code compiles successfully in Xcode 9.2 with Swift 4:
With Swift 4.1 this fails with this error:
If I change the `flatMap` to the new `compactMap` I get a slightly different error:
Changing it to this works as expected:
This is new code in our codebase since Xcode 9.3b3, so I'm not sure if this is new in beta 4 or not.
The text was updated successfully, but these errors were encountered: