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

loop bug #2071

Open
piotmag769 opened this issue Jun 12, 2023 · 1 comment
Open

loop bug #2071

piotmag769 opened this issue Jun 12, 2023 · 1 comment

Comments

@piotmag769
Copy link
Contributor

piotmag769 commented Jun 12, 2023

It bugs when compiling from sierra to casm.
Protostar 0.13.0, Cairo 1.1.0, minimal reproducible example:

use array::ArrayTrait;

#[test]
fn essa() {
   let mut calldata = ArrayTrait::new();
   calldata.append(1);
   loop {
        match calldata.pop_front() {
            Option::Some(call) => {},
            Option::None(_) => {
                break ();
            }
        };
    };
   assert(1 == 1, '');
}

Console output:

Collected 1 suite, and 1 test case (3.03)
  0%|                                                                      [0/1]
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: UnrecognizedToken { token: (1238, Token(13, "["), 1239), expected: ["\"(\"", "\")\"", "\",\"", "\":\"", "\"::\"", "\";\"", "\"<\"", "\"=\"", "\">\"", "\"@\"", "\"with_info\""] }', crates/cairo-lang-protostar/src/lib.rs:39:73
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[UNEXPECTED_EXCEPTION] tests/test_hello_starknet.cairo
Traceback (most recent call last):
  File "protostar/cairo/bindings/cairo_bindings.py", line 142, in handle_bindings_errors
  File "protostar/cairo/bindings/cairo_bindings.py", line 132, in compile_protostar_sierra_to_casm
pyo3_runtime.PanicException: called `Result::unwrap()` on an `Err` value: UnrecognizedToken { token: (1238, Token(13, "["), 1239), expected: ["\"(\"", "\")\"", "\",\"", "\":\"", "\"::\"", "\";\"", "\"<\"", "\"=\"", "\">\"", "\"@\"", "\"with_info\""] }

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "protostar/cairo_testing/cairo1_test_runner.py", line 222, in suite_exception_handling
  File "protostar/cairo_testing/cairo1_test_runner.py", line 199, in run_test_suite
  File "protostar/cairo/bindings/cairo_bindings.py", line 136, in compile_protostar_sierra_to_casm
  File "contextlib.py", line 137, in __exit__
  File "protostar/cairo/bindings/cairo_bindings.py", line 148, in handle_bindings_errors
protostar.cairo.bindings.cairo_bindings_exception.CairoBindingException: A unexpected type of error occurred in binding compile_protostar_sierra_to_casm: called `Result::unwrap()` on an `Err` value: UnrecognizedToken { token: (1238, Token(13, "["), 1239), expected: ["\"(\"", "\")\"", "\",\"", "\":\"", "\"::\"", "\";\"", "\"<\"", "\"=\"", "\">\"", "\"@\"", "\"with_info\""] }

Unexpected Protostar error. Report it here:
https://github.com/software-mansion/protostar/issues

A unexpected type of error occurred in binding compile_protostar_sierra_to_casm: called `Result::unwrap()` on an `Err` value: UnrecognizedToken { token: (1238, Token(13, "["), 1239), expected: ["\"(\"", "\")\"", "\",\"", "\":\"", "\"::\"", "\";\"", "\"<\"", "\"=\"", "\">\"", "\"@\"", "\"with_info\""] }
@abulenok
Copy link
Contributor

abulenok commented Jun 19, 2023

It seems that this bug is about adding a loop
This should be enough to reproduce it

#[test]
fn please_dont_fail() {
    loop {
        break ();
    };
    assert(1 == 1, '');
}

@piotmag769 piotmag769 changed the title pop_front bug loop bug Jun 21, 2023
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

2 participants