Skip to content

Extend operator decls to allow any designated nominal type for lookup. #19756

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 2 commits into from
Oct 8, 2018
Merged

Extend operator decls to allow any designated nominal type for lookup. #19756

merged 2 commits into from
Oct 8, 2018

Conversation

rudkx
Copy link
Contributor

@rudkx rudkx commented Oct 7, 2018

Rather than limiting this to protocols, allow any nominal type.

Rename -enable-operator-designated-protocols to
-enable-operator-designated-types to reflect the change.

Rather than limiting this to protocols, allow any nominal type.

Rename -enable-operator-designated-protocols to
-enable-operator-designated-types to reflect the change.
@rudkx
Copy link
Contributor Author

rudkx commented Oct 7, 2018

@swift-ci Please smoke test

@rudkx rudkx requested a review from xedin October 7, 2018 20:16
Copy link
Contributor

@xedin xedin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides minor renaming nits, LGTM!

enableOperatorDesignatedProtocols) {
auto protocolIdLoc = OD->getDesignatedProtocolNameLoc();
checkDesignatedProtocol(OD, protocolId, protocolIdLoc, *this, Context);
auto *protocol = OD->getDesignatedNominalType();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably needs renaming too?

@@ -2127,20 +2120,20 @@ void TypeChecker::validateDecl(OperatorDecl *OD) {
}

auto secondId = IOD->getSecondIdentifier();
auto *protocol = IOD->getDesignatedProtocol();
if (!protocol && enableOperatorDesignatedProtocols) {
auto *protocol = IOD->getDesignatedNominalType();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is as well...

@@ -2878,7 +2878,7 @@ void Serializer::writeDecl(const Decl *D) {
auto contextID = addDeclContextRef(op->getDeclContext());
auto nameID = addDeclBaseNameRef(op->getName());
auto groupID = addDeclRef(op->getPrecedenceGroup());
auto protoID = addDeclRef(op->getDesignatedProtocol());
auto protoID = addDeclRef(op->getDesignatedNominalType());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of names here have to be nominalID?

@rudkx
Copy link
Contributor Author

rudkx commented Oct 8, 2018

@xedin Thanks for catching those. I have other edits to extend this further, but I've fixed up the naming prior to merging.

@rudkx
Copy link
Contributor Author

rudkx commented Oct 8, 2018

@swift-ci Please smoke test

@rudkx rudkx merged commit 25c02ce into swiftlang:master Oct 8, 2018
@rudkx rudkx deleted the extend-operator-designated-type branch October 8, 2018 17:12
gparker42 pushed a commit that referenced this pull request Oct 10, 2018
…BE-61E65F8A7618

[test] Fix a solver flag rename that was missed in #19756.
modelorganism pushed a commit to modelorganism/swift that referenced this pull request Oct 11, 2018
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.

2 participants