Skip to content

Add support for parsing designated protocols in operator declarations. #19145

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
Sep 7, 2018
Merged

Add support for parsing designated protocols in operator declarations. #19145

merged 2 commits into from
Sep 7, 2018

Conversation

rudkx
Copy link
Contributor

@rudkx rudkx commented Sep 5, 2018

The support is gated by a frontend option, -enable-operator-designated-protocols.

This means that in an operator declaration we can declare a protocol
which has one or more requirements specifying this operator. The
operators from that designated protocol will be the first ones we try
when type checking an expression. If we successfully typecheck using
the operators specified in that protocol, we do not attempt any other
overloads of the same operator.

This makes it possible to dramatically speed up successful
typechecking.

The support is gated by a frontend option,
-enable-operator-designated-protocols.

This means that in an operator declaration we can declare a protocol
which has one or more requirements specifying this operator. The
operators from that designated protocol will be the first ones we try
when type checking an expression. If we successfully typecheck using
the operators specified in that protocol, we do not attempt any other
overloads of the same operator.

This makes it possible to dramatically speed up successful
typechecking.
@rudkx
Copy link
Contributor Author

rudkx commented Sep 5, 2018

@swift-ci Please smoke test

@rudkx rudkx merged commit 1e7dae3 into swiftlang:master Sep 7, 2018
@rudkx rudkx deleted the parse-designated-protocol branch September 7, 2018 05:01
@jrose-apple
Copy link
Contributor

Yeah, I don't think parsing two identifiers is a good idea. Instead, you should be parsing two TypeLocs, and deciding later if one of them is an identifier that names a precedence group.

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