clarinet icon indicating copy to clipboard operation
clarinet copied to clipboard

Arithmetic underflow crashes clarity-repl instead of displaying error

Open criadoperez opened this issue 4 years ago • 1 comments

If you try to subtract two unsigned values clarity-repl panics and crashes. Example of (- u5 u7) below. Shouldn't a more correct behavior be to report the "Arithmetic Underflow" like it reports other errors, but without crashing the application?

` clarity-repl v0.16.0 Enter "::help" for usage hints. Connected to a transient in-memory database.

(- 5 u7) Analysis error: expecting expression of type 'int', found 'uint' (- 5 u7) (- u5 7) Analysis error: expecting expression of type 'uint', found 'int' (- u5 7) (- u5 u7) thread 'main' panicked at 'called Result::unwrap() on an Err value: Runtime(ArithmeticUnderflow, Some([]))', src/repl/interpreter.rs:215:89 note: run with RUST_BACKTRACE=1 environment variable to display a backtrace `

criadoperez avatar Dec 09 '21 22:12 criadoperez

Thanks for raising this issue. These are exactly the kind of rough edges that we would like to be addressed before considering this lib as a 1.0.0.

lgalabru avatar Dec 13 '21 20:12 lgalabru

Addressed with https://github.com/hirosystems/clarinet/pull/535

lgalabru avatar Sep 20 '22 21:09 lgalabru