Skip to content

Conversation

@rudkx
Copy link
Contributor

@rudkx rudkx commented Mar 25, 2018

Normally we wouldn't need this because we do not allow overloading by
parameter optionality. In this case, though, we import two Objective-C
methods that end up getting renamed to the same name in Swift, one of
which has a nullability annotation and the other of which doesn't.

Before IUOs were removed from the type system, we would have failed a
subtype test when ranking overloads, but now that subtype test passes
because we're comparing two optionals of the same type. So the change
here is to compare the optionality of the parameters and reject cases
where we are testing whether a plain optional is a subtype of
something declared to be an IUO.

Fixes rdar://problem/38719575.

(cherry picked from commit 0959f0c)

Normally we wouldn't need this because we do not allow overloading by
parameter optionality. In this case, though, we import two Objective-C
methods that end up getting renamed to the same name in Swift, one of
which has a nullability annotation and the other of which doesn't.

Before IUOs were removed from the type system, we would have failed a
subtype test when ranking overloads, but now that subtype test passes
because we're comparing two optionals of the same type. So the change
here is to compare the optionality of the parameters and reject cases
where we are testing whether a plain optional is a subtype of
something declared to be an IUO.

Fixes rdar://problem/38719575.

(cherry picked from commit 0959f0c)
@rudkx
Copy link
Contributor Author

rudkx commented Mar 25, 2018

@swift-ci Please test

1 similar comment
@rudkx
Copy link
Contributor Author

rudkx commented Mar 25, 2018

@swift-ci Please test

@rudkx
Copy link
Contributor Author

rudkx commented Mar 25, 2018

@swift-ci Please test source compatibility

@rudkx
Copy link
Contributor Author

rudkx commented Mar 25, 2018

The source compatibility suite failures are unrelated to my changes, and I've opened a PR to XFAIL most of them: swiftlang/swift-source-compat-suite#169

@rudkx rudkx merged commit 9bce119 into swiftlang:swift-4.2-branch Mar 25, 2018
@rudkx rudkx deleted the rdar38719575-4.2 branch March 25, 2018 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant