Add compiler warnings #837
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "ghallak/331"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Currently added warnings:
stateful
annotationsnon-exhaustive patterns(this will be tricky and should better be done in a separate PR)Currently supported options:
Things that still need to be done:
Testing:
@hanssv @radrow I'm looking for a way to properly report the warnings. Right now, the warnings are all stored in an ets_table called
warnings
in theaeso_ast_infer_types.erl
file.Do you think I should keep forwarding the warnings as strings upwards until they get to the
aeso_compiler:from_string
function and then I can return them along with the compilation result? or is there another way to do that?Created by: radrow
I think that warnings should be returned as renderable structures as a result of the compilation/infer function
Created by: hanssv
Yes, keeping them in some warning structure (similar to the errors) and passing them upwards sounds like the best alternative. Then we can present them, or return them (or ignore them) according to options I guess.
Created by: dincho
(_"_"_)
🤷🏻♂️For negative spends and division by zero, the warning will only show when using a literal.
I think it won't be very difficult to add warning for the second case
1 / zero
since this will only need to lookup the value of the variableszero
, but the third case will requires evaluating the expression1 - 1
, which will make things more complicated and I'm not sure if I should try to add that.Created by: dincho
I guess if the compiler have a optimization phase to evaluate that and you run the warning check in a step/phase after it it would be covered by case 1
Created by: radrow
there could be a second pass of warning check after additional constant propagation
Created by: hanssv
Review: Approved
👍 Looks good!
Created by: radrow
Review: Approved
Created by: radrow
Would be nice to reflect it in the cli and http interface too
Created by: radrow
@nikita-fuchs would be great to see it working in aestudio :)
Created by: nikita-fuchs
dayumn, thanks for bringing this up.
Merged by: ghallak at 2021-11-24 09:46:22 UTC