-
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
Use As
and ImplicitAs
interfaces for conversions.
#4209
Use As
and ImplicitAs
interfaces for conversions.
#4209
Conversation
Add Convert method to ImplicitAs for now, given `extend` support is missing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally looks good, although there's a lot more reuse of locations, which got me to look at the TODO that'd hamper that. #4211 for the relevant changes.
I'm approving, if you want to merge before heading out and leave the locations for me to clean up, that's fine by me. Though if you object to the location stuff, please comment on #4211 before going. :)
This comment was marked as resolved.
This comment was marked as resolved.
Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
@@ -23,6 +23,8 @@ ExitingStream::~ExitingStream() { | |||
|
|||
auto ExitingStream::Done() -> void { | |||
buffer_ << "\n"; | |||
buffer_.flush(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How did this come up for the change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A lifetime issue with the array of interface arguments caused the tests to fail with opt builds but not with dbg or fastbuild, and the opt builds also seemed to lose the end of the check failure diagnostic if I didn't explicitly flush the stream.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Giving this a fresh look because it's been a bit, sorry if I've touched on things that were sitting around for a bit.
Conversion can trigger new entities to be imported, which can invalidate the reference it holds to an EntityWithParamBase. Instead of holding such a reference, pull the information we need out of the entity early and only pass that into ConvertCallArgs. I couldn't find a good standalone way to test this, but this fixes the test failure we otherwise see on MacOS after #4209, so it will be tested once that PR lands.
b8272f1
to
db8a466
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Glad to get this in. :)
…4277) Conversion can trigger new entities to be imported, which can invalidate the reference it holds to an EntityWithParamBase. Instead of holding such a reference, pull the information we need out of the entity early and only pass that into ConvertCallArgs. I couldn't find a good standalone way to test this, but this fixes the test failure we otherwise see on MacOS after carbon-language#4209, so it will be tested once that PR lands.
…e#4209) Add these interfaces to the core library. For now, they're two separate interfaces because we don't yet support one interface extending another. This collapses a lot of the layering in check: for example, the call building logic depends on implicit conversions, conversions now depend on the overloaded operator machinery, and that machinery depends on building calls. In passing, improve the diagnostics for failing to find a name required from the prelude. Also convert all the transitively-called code from `NodeId` to `LocId` given the latter is what the conversion machinery has available. --------- Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
…4277) Conversion can trigger new entities to be imported, which can invalidate the reference it holds to an EntityWithParamBase. Instead of holding such a reference, pull the information we need out of the entity early and only pass that into ConvertCallArgs. I couldn't find a good standalone way to test this, but this fixes the test failure we otherwise see on MacOS after carbon-language#4209, so it will be tested once that PR lands.
…e#4209) Add these interfaces to the core library. For now, they're two separate interfaces because we don't yet support one interface extending another. This collapses a lot of the layering in check: for example, the call building logic depends on implicit conversions, conversions now depend on the overloaded operator machinery, and that machinery depends on building calls. In passing, improve the diagnostics for failing to find a name required from the prelude. Also convert all the transitively-called code from `NodeId` to `LocId` given the latter is what the conversion machinery has available. --------- Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
Add these interfaces to the core library. For now, they're two separate interfaces because we don't yet support one interface extending another.
This collapses a lot of the layering in check: for example, the call building logic depends on implicit conversions, conversions now depend on the overloaded operator machinery, and that machinery depends on building calls.
In passing, improve the diagnostics for failing to find a name required from the prelude. Also convert all the transitively-called code from
NodeId
toLocId
given the latter is what the conversion machinery has available.