-
Notifications
You must be signed in to change notification settings - Fork 2
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
Recursive continuation type crashes the interpreter #17
Comments
@rossberg, I would expect this program to fail due to I noticed it is possible to define a function type in terms of itself, e.g. the following program type checks and runs: (module
(type $ft (func (param (ref $ft))))
(func $f (param $f (ref $ft))
(call_ref $ft
(local.get $f)
(local.get $f)))
(elem declare func $f)
(func (export "main")
(call $f (ref.func $f)))
)
(assert_exhaustion (invoke "main") "call stack exhausted") This construction leads me to think that singly typedefs are implicitly recursive. Is this construction intended? |
A type without rec is simply a short-hand for a singleton recursion group, so the latter is well-typed. As for the OP, I'm surprised the type definition passes validation. AFAICS, we do check type definitions, and we do check that cont is given a function type. |
I was looking at the version in the effect-handlers repo, the one here does indeed seem to miss that check: specfx/interpreter/valid/valid.ml Line 186 in 4310c76
|
aha, so this has been lost in a merge sometime ago. I will reinstall the check. Thanks! |
* [interpreter] Handle custom sections and annotations Co-authored-by: Yuri Iozzelli <[email protected]> * Fix merge conflict * Fix lexer priorities * Fix wast.ml * Oops * Update wast.ml --------- Co-authored-by: Andreas Rossberg <[email protected]>
* [interpreter] Handle custom sections and annotations Co-authored-by: Yuri Iozzelli <[email protected]> * Fix merge conflict * Fix lexer priorities * Fix wast.ml * Oops * Update wast.ml --------- Co-authored-by: Andreas Rossberg <[email protected]>
Using a recursive continuation type triggers an assertion failure in the interpreter. Minimal repo:
Output:
The text was updated successfully, but these errors were encountered: