[DSLX:BC] Fix disagreement between typechecker and interpreter on whether trace
returns its operand
#1819
+52
−12
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.
Previously the bytecode interpreter thought it returned like
trace_fmt!
does, but historicallytrace!
acted as an identity function so you could easily wrap it around any given subexpression, like:instrumenting the interior subexpression like so:
The fact they disagreed led to typecheck flagging a program through but then getting a bytecode interpreter error in the bowels of InterpValue.
Note that
trace_fmt!
andtrace!
are different in that the latter requires and operand but the former can just take a format string and zero operand args, so they are implemented as two bytecode ops that call into common functionality.