repl-legacy
repl-legacy copied to clipboard
UInt64.MaxValue = 0UL (at fable.io/repl) #1359
Description
UInt64.MaxValue = 0UL holds true in Fable as imported on fable.io/repl:
Repro code
repl.it - F# 4 vs fable.io/repl
open System
open Fable.Import.Browser
[<Literal>]
let Z = 0UL
[<Literal>]
let I = 1UL
let R = UInt64.MaxValue
let X = UInt64.MaxValue - if Environment.OSVersion = null then I else Z
let init() =
let e = document.querySelector("pre") :?> HTMLCanvasElement
let t x = e.textContent <- e.textContent + "\n" + sprintf "%A" x
t <| (R,X,System.Environment.OSVersion)
init()
Expected and actual results
UInt64.MaxValue = 0UL holds true; it should not.
Related information
https://github.com/fable-compiler/Fable/blob/master/src/js/fable-core/Long.ts
https://github.com/dcodeIO/long.js/blob/master/src/long.js - testing this
Long.MAX_UNSIGNED_VALUE.toString() = "18446744073709551615"
For reference, https://github.com/fable-compiler/Fable/issues/1359
@MangelMaxime @alfonsogarciacaro what is the recommended way to know if a piece of code is running in Fable?