Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type annotations on some literals ignored #2

Open
fmease opened this issue Apr 1, 2019 · 0 comments
Open

Type annotations on some literals ignored #2

fmease opened this issue Apr 1, 2019 · 0 comments

Comments

@fmease
Copy link

fmease commented Apr 1, 2019

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 fmease changed the title Type annotations on number literals ignored Type annotations on some literals ignored Apr 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant