This:
var a:int = 0
var b:int = 1
val () = ( a :=: b )
… does not type‑check. I get an error about an unsolved constraint [0 == 1].
However this:
var a = 0:int
var b = 1:int
val () = ( a :=: b )
… type‑check with no error.
It’s like if the former was interpreted like this:
var a:int(0) = 0
var b:int(1) = 1
val () = ( a :=: b )
Is this expected?
Here is what I got in my notes, not about `var` but about `val`, and I expected it to be the same with `var`.
> `val x = e:T`: typical of annotations, checks `e` is of type `T`.
> `val x:T = e`: checks type of `e` is of a subtype of `T`.
Instead of checking 0 or 1 is a subtype of int, it seems to assign `a` the `int(0)` subtype and `b`, the `int(1)` subtype.
Surprisingly, the JSON data says `a` and `b` are of type int, not `int(0)` and `int(1)`. This suggests the type annotation is modified at a later stage. Is this a bug or is this expected?