AssemblyScript/assemblyscript

Date.now is documented as `i64` but wasm module expects a `f64`

nguterresn opened this issue · 2 comments

Bug description

As the title states, the documentation state Date.now() returns a i64 value but the wasm module actually expects a f64.

(type (;18;) (func (result f64)))
(import "env" "Date.now" (func (;95;) (type 18)))

Steps to reproduce

Check the wat file.

AssemblyScript version

v0.27.32

It's binded import. Actual Date.now() in AssemblyScript will reuse it and cast to i64. See https://github.com/AssemblyScript/assemblyscript/blob/main/std/assembly/date.ts#L40

@MaxGraey what does that mean?

From the native side I've tried to bind to a int64 function but it didn't work. It only worked when I change it to f64.