Skip to content

Take the IUO-ness of a parameter declaration into account in ranking. #15490

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

Merged
merged 1 commit into from
Mar 25, 2018
Merged

Take the IUO-ness of a parameter declaration into account in ranking. #15490

merged 1 commit into from
Mar 25, 2018

Conversation

rudkx
Copy link
Contributor

@rudkx rudkx commented Mar 24, 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.

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.
@rudkx
Copy link
Contributor Author

rudkx commented Mar 24, 2018

@swift-ci Please smoke test

@rudkx
Copy link
Contributor Author

rudkx commented Mar 24, 2018

@swift-ci Please test source compatibility

@rudkx rudkx merged commit a5956a2 into swiftlang:master Mar 25, 2018
@rudkx rudkx deleted the rdar38719575 branch March 25, 2018 01:52
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