Open zilinc opened 7 years ago
How can it be improved specifically?
Suggest using upcast
maybe? The constraint U16 :< U32
is actually satisfiable.
Ah, if you use upcast
, right. OK, I can add that.
Oh btw, we still have functions like u16_to_u32
etc...in ext2 and bilbyfs; should use upcast
instead...
Ummm. let a : U32 = 1
doesn't upcast.
It shouldn't... it should infer that 1 : U32.
interestingly if I put 0
to a U32
field in a record, it seems ok
The type of a numeric literal is inferred from context.. so of course that would work??
Ah, I might have misunderstood you. Should let a : U32 = 1
typecheck?
Yes.
I see. upcast
is only for variables (and constants).
Yes, the literals are no longer given the smallest integer type possible. They are now given whatever integer type is inferred from context (so long as it's big enough to fit the literal).
Now it says something like:
Can be better.