funky icon indicating copy to clipboard operation
funky copied to clipboard

Type annotations on some literals ignored

Open fmease opened this issue 7 years ago • 0 comments

Per definition, the literal 0 is of type Int and the literal 0.0 is of type Float. Thus, both lines below correctly fail to type-check:

(self : Int -> Int) 0.0
(self : Float -> Float) 0

For some reason though, type annotations directly placed on the literals seem to be ignored:

0.0 : Int # the whole expression is of type Float
0 : Float # the whole expression is of type Int

The expressions above pass the type-checker but clearly, they should not!

Edit: There might still be more cases like this. Another case:

'c' : Bool # type-checks
'c' : a # type-checks

Weirdly, this does not apply to string literals ("s" : Bool is an error). Edit: I assume this bug only applies to primitive values (types Int, Float, Char)!

fmease avatar Apr 01 '19 22:04 fmease