Skip to content

[5.1][Sema] Treat static methods as always applying their curried self param #25288

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

Conversation

hamishknight
Copy link
Contributor

  • Explanation: Currently areConservativelyCompatibleArgumentLabels treats a reference to a declaration as not having its curried self parameter applied if the choice doesn't have a base type. However this isn't correct for operators defined as static methods, which have their Self.Type parameter applied but their choice doesn't have a base type.

    This PR changes areConservativelyCompatibleArgumentLabels to always treat static methods as having their Self.Type parameters applied, as there's currently no way to form an unapplied curried reference to them.

  • Scope: Resolves a 5.1 regression.

  • SR Issue: SR-10843.

  • Risk: Low, the fix is fairly narrow.

  • Testing: Added a regression test.

  • Reviewers: @slavapestov @xedin.

Currently `areConservativelyCompatibleArgumentLabels` treats a reference
to a declaration as not applying its curried self parameter if it
doesn't have a base type. However this isn't correct for static
operators, which have their Self.Type parameter applied but don't have
a base type.

This commit changes `areConservativelyCompatibleArgumentLabels` to
always treat static methods as having their Self.Type parameters
applied, as there's currently no way to form an unapplied curried
reference to them.

Resolves SR-10843.
@hamishknight
Copy link
Contributor Author

Ping @slavapestov @xedin

@xedin
Copy link
Contributor

xedin commented Jun 21, 2019

@swift-ci please test and merge

@hamishknight
Copy link
Contributor Author

Test failures look unrelated as far as I can tell

@xedin
Copy link
Contributor

xedin commented Jun 21, 2019

@swift-ci please test and merge

@hamishknight
Copy link
Contributor Author

Unrelated build failures this time... hopefully third time lucky!

@xedin
Copy link
Contributor

xedin commented Jun 21, 2019

@swift-ci please test and merge

@swift-ci swift-ci merged commit 574d302 into swiftlang:swift-5.1-branch Jun 22, 2019
@hamishknight hamishknight deleted the selfish-operators-5.1 branch June 22, 2019 00:56
@hamishknight
Copy link
Contributor Author

Thanks @xedin!

@xedin
Copy link
Contributor

xedin commented Jun 22, 2019

No problem!

@xedin
Copy link
Contributor

xedin commented Jun 22, 2019

Thank you for fixing this!

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.

3 participants