-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Overloaded operator support. #3796
Merged
zygoloid
merged 10 commits into
carbon-language:trunk
from
zygoloid:toolchain-operators
Mar 19, 2024
Merged
Overloaded operator support. #3796
zygoloid
merged 10 commits into
carbon-language:trunk
from
zygoloid:toolchain-operators
Mar 19, 2024
Commits on Mar 19, 2024
-
Support is added for all overloaded operator interfaces in the current design apart from `Assign`, which is going to require some more work to properly handle, given that primitive assignment currently has a special implementation for quite a few builtin types. As we don't have support for generics yet -- in particular, generic interfaces -- there is no support for `*With` interfaces, but homogenous interfaces such as `Add` are supported instead. Factor out building of call expressions so that overloaded operators can generate calls. Switch a few places from using specific kinds of NodeId to a general NodeId. Because overloaded operators and other things like implicit conversions can result in member access and function calls, those operations can't require a specific kind of NodeId. Add import support for associated entities, and fix import support for interfaces and symbolic bindings. We now import interfaces in two steps, first importing a forward declaration then a definition, just like we do for classes. For symbolic bindings, we ensure that each BindSymbolicName is imported only once, because its ID is used as its symbolic identity. This is necessary because we (only) support operator interfaces that are defined in an imported Carbon package for now. The entire contents of `check/operator.cpp` should probably be rethought. In particular, doing a lot of name lookups on each operator is likely to be bad for performance. But this gets us to the point where overloaded operators are basically working, which seems like a good place to iterate from.
Configuration menu - View commit details
-
Copy full SHA for 900d010 - Browse repository at this point
Copy the full SHA 900d010View commit details -
Apply suggestions from code review
Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
Configuration menu - View commit details
-
Copy full SHA for 3ee7364 - Browse repository at this point
Copy the full SHA 3ee7364View commit details -
Apply suggestions from code review
Co-authored-by: Carbon Infra Bot <carbon-external-infra@google.com>
Configuration menu - View commit details
-
Copy full SHA for a172817 - Browse repository at this point
Copy the full SHA a172817View commit details -
Configuration menu - View commit details
-
Copy full SHA for bbe57f5 - Browse repository at this point
Copy the full SHA bbe57f5View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0dd01fa - Browse repository at this point
Copy the full SHA 0dd01faView commit details -
Configuration menu - View commit details
-
Copy full SHA for 67d30b5 - Browse repository at this point
Copy the full SHA 67d30b5View commit details -
Configuration menu - View commit details
-
Copy full SHA for e98e8ac - Browse repository at this point
Copy the full SHA e98e8acView commit details -
Configuration menu - View commit details
-
Copy full SHA for d2ebc9b - Browse repository at this point
Copy the full SHA d2ebc9bView commit details -
Add TODO to remove script. Minimize size of generated tests.
Configuration menu - View commit details
-
Copy full SHA for bbab251 - Browse repository at this point
Copy the full SHA bbab251View commit details -
Configuration menu - View commit details
-
Copy full SHA for 64bf90d - Browse repository at this point
Copy the full SHA 64bf90dView commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.