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

continue not working in while loop #1171

Open
Tracked by #706
franziskuskiefer opened this issue Dec 7, 2024 · 3 comments
Open
Tracked by #706

continue not working in while loop #1171

franziskuskiefer opened this issue Dec 7, 2024 · 3 comments

Comments

@franziskuskiefer
Copy link
Member

It looks like #196 is not fully working. The following example fails to lax.

fn while_continue() {
    let mut attempt = 0;
    let mut value = None;

    while attempt < 5 {
        attempt += 1;

        if attempt < 3 {
            continue;
        }

        value = Some(1);
    }
}

Open this code snippet in the playground


* Error 12 at Playground.fst(40,10-45,19):
  - Expected type
        o:
        (Rust_primitives.Integers.i32 &
          Core.Option.t_Option Rust_primitives.Integers.i32){o << temp_0_}
    but
        Core.Ops.Control_flow.ControlFlow_Continue (attempt, value)
        <:
        Core.Ops.Control_flow.t_ControlFlow (Prims.unit &
            (Rust_primitives.Integers.i32 &
            Core.Option.t_Option Rust_primitives.Integers.i32))
          (Rust_primitives.Integers.i32 &
            Core.Option.t_Option Rust_primitives.Integers.i32)
    has type
        Core.Ops.Control_flow.t_ControlFlow (Prims.unit &
            (Rust_primitives.Integers.i32 &
            Core.Option.t_Option Rust_primitives.Integers.i32))
          (Rust_primitives.Integers.i32 &
            Core.Option.t_Option Rust_primitives.Integers.i32)
1 error was reported (see above)
make[1]: *** [Makefile:79: Playground.fst.checked] Error 1
make: *** [Makefile:12: all] Error 2
@karthikbhargavan
Copy link
Contributor

Not sure how well we support while-loops in general, so this may be part of a larger issue.

@franziskuskiefer
Copy link
Member Author

If this is not supported for while loops, the description of the other issues has been incomplete.

@maximebuyse
Copy link
Contributor

If this is not supported for while loops, the description of the other issues has been incomplete.

While loops should be supported but it seems like the issue described here is a bug in the translation (I am not sure it is specific to while loops by the way). #1204 is also needed to make the translation usable but it is different.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants