Skip to content
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

[DSLX:BC] Fix disagreement between typechecker and interpreter on whether trace returns its operand #1819

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

cdleary
Copy link
Collaborator

@cdleary cdleary commented Dec 31, 2024

Previously the bytecode interpreter thought it returned like trace_fmt! does, but historically trace! acted as an identity function so you could easily wrap it around any given subexpression, like:

let binding = f(a * b + c);

instrumenting the interior subexpression like so:

let binding = f(trace!(a*b)+c);

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! and trace! 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.

xls/dslx/bytecode/bytecode.h Outdated Show resolved Hide resolved
@cdleary cdleary force-pushed the cdleary/2024-12-30-trace-returns-nil branch from 8ae7cb1 to a430ac7 Compare January 2, 2025 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants