Closed
Description
Bug description
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
)
)
Steps to reproduce
export function add(a: u8): f64 {
let x:u8 = 128
x = x + a
return x;
}
From js
add(129) // actual 257; expected 1
AssemblyScript version
0.27.22