Skip to content
New issue

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

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

Already on GitHub? # to your account

Implement simple warning system based on type deduction #22

Closed
ikskuh opened this issue Aug 25, 2020 · 1 comment
Closed

Implement simple warning system based on type deduction #22

ikskuh opened this issue Aug 25, 2020 · 1 comment
Labels
compiler This issue is related to the compiler. feature New feature or request

Comments

@ikskuh
Copy link
Owner

ikskuh commented Aug 25, 2020

As all operators in LoLa are strictly type safe and don't do implicit conversions, the compiler can deduce a lot of variable types when compiling, even when no type annotation is given.

This allows the compiler to emit warnings/errors when type mismatches are possible:

var a = 10; // a is number
var b = a > 15; // b is boolen
return a + b; // this is a guaranteed type error as number != boolean
@ikskuh ikskuh added feature New feature or request compiler This issue is related to the compiler. labels Aug 25, 2020
@ikskuh
Copy link
Owner Author

ikskuh commented Sep 3, 2020

This is partially implemented already in the zig based compiler. Annotating variables doesn't work yet.

@ikskuh ikskuh closed this as completed in 90dc674 Sep 3, 2020
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
compiler This issue is related to the compiler. feature New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant