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

Top-level behaviour of interpreter differs from compiled #316

Closed
krl opened this issue Jan 26, 2024 · 1 comment · Fixed by #348
Closed

Top-level behaviour of interpreter differs from compiled #316

krl opened this issue Jan 26, 2024 · 1 comment · Fixed by #348
Assignees
Labels
bug Something isn't working

Comments

@krl
Copy link
Collaborator

krl commented Jan 26, 2024

(+ 3 4)

(define-private (foo) 42)

Returns Some(7) in the interpreter, when it should return None

@obycode obycode added the bug Something isn't working label Jan 31, 2024
@obycode
Copy link
Collaborator

obycode commented Feb 7, 2024

The interpreter saves the result from the last top-level expression with a return value (DefineResult::NoDefine). We can do something similar when initializing the contract.

@obycode obycode self-assigned this Feb 7, 2024
obycode added a commit that referenced this issue Feb 21, 2024
To match the behavior of the interpreter, if there are multiple
top-level expressions and the last expression has no return value (e.g.
a `define-` function) but an earlier expression does have a return
value, the last value should be returned.

Fixes #316
obycode added a commit that referenced this issue Feb 21, 2024
To match the behavior of the interpreter, if there are multiple
top-level expressions and the last expression has no return value (e.g.
a `define-` function) but an earlier expression does have a return
value, the last value should be returned.

Fixes #316
obycode added a commit that referenced this issue Feb 21, 2024
To match the behavior of the interpreter, if there are multiple
top-level expressions and the last expression has no return value (e.g.
a `define-` function) but an earlier expression does have a return
value, the last value should be returned.

Fixes #316
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants