WebSharper

The following code:

1
2
3
4
5
type testtype = { mutable r: int }
let test_ws_bug t =
  let old = t.r in
  t.r <- 1;
  old

Gets translated to:

1
2
3
4
5
 test_ws_bug=function(t)
 {
  t.r=1;
  return t.r;
 };

Which is wrong. The original code returns the previous value of the mutable, while the translated code will always return 1. That temp variable "old" cannot just be replaced with t.r, because t.r is mutable.

Tested in Zafir 4.0.160.40-beta6.