Cast from decimal to uint8
, uint16
, uint32
, uint
, uint64
, int
, etc. don't follow .NET behaviour
#4049
Labels
uint8
, uint16
, uint32
, uint
, uint64
, int
, etc. don't follow .NET behaviour
#4049
Running this code in .NET will throw exceptions:
Exceptions looks like
Value was either too large or too small for a UInt16.
On Fable, the code succeeds and output:
I am not sure how to approach fixing this.
My first idea was to apply a fix in
toLong
function here:Fable/src/Fable.Transforms/Replacements.fs
Lines 299 to 303 in 204d30d
But I think this would be to wide because in some scenario .NET allows to do that:
I believe we should only fix portion of the code when we call
Decimal.op_explicit
at:Fable/src/Fable.Transforms/Replacements.fs
Lines 2445 to 2454 in 204d30d
Should we add function like that to
Decimal.ts
?Is it the right approach / place to store them? @ncave @alfonsogarciacaro
The text was updated successfully, but these errors were encountered: