Closed palisarbaro closed 5 months ago
export function add(a: u8): f64 { let x:u8 = 128 x = x + a return x; }
This function compiles to
(module (type $0 (func (param i32) (result f64))) (memory $0 0) (export "add" (func $assembly/index/add)) (export "memory" (memory $0)) (func $assembly/index/add (param $0 i32) (result f64) local.get $0 i32.const 128 i32.add ;; i32.const 255 missing cast to u8 ;; i32.and f64.convert_i32_u ) )
From js
add(129) // actual 257; expected 1
0.27.22
I'd assume this is a problem involving a missing Constraints.MustWrap.
Constraints.MustWrap
Bug description
This function compiles to
Steps to reproduce
From js
AssemblyScript version
0.27.22