-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Ensure a symbolic final impl has a definition produced
#6236
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
base: trunk
Are you sure you want to change the base?
Conversation
992322b to
f0f19d5
Compare
geoffromer
left a comment
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.
(I haven't reviewed all the testdata yet)
|
|
||
| auto EvalConstantInst(Context& context, SemIR::RequireSpecificDefinition inst) | ||
| -> ConstantEvalResult { | ||
| ResolveSpecificDefinition(context, SemIR::LocId::None, inst.specific_id); |
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.
This returns false on failure, right? Should we CHECK it?
| // TIP: To dump output, run: | ||
| // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/array/bound_values.carbon | ||
|
|
||
| // TODO |
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.
This looks incomplete?
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.
I'm guessing this is a case of a deleted file getting accidentally restored by the merge-then-autoupdate workflow?
| // CHECK:STDOUT: !definition: | ||
| // CHECK:STDOUT: <elided> | ||
| // CHECK:STDOUT: %Class.elem: type = unbound_element_type %Class, %T.binding.as_type [symbolic = %Class.elem (constants.%Class.elem.bc9)] | ||
| // CHECK:STDOUT: %.loc15_12.2: require_specific_def_type = require_specific_def @ptr.as.Copy.impl(%T.binding.as_type) [symbolic = %.loc15_12.2 (constants.%.d8a)] |
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.
The comment in impl_lookup.cpp says this is used when the impl is final, but I'm having trouble working out what final impl this is referring to. Am I misunderstanding something?
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.
Another restored _addr test, I think.
Right now, the impl lookup can both fail to resolve the specific definition because it's symbolic, and return a "final" constant because it's a
final impl. This is adding an instruction to help ensure the specific is resolved.The constant evaluation is fully recursive, but I'm not adding a TODO since that's a known issue with impl lookup in general.