-
Notifications
You must be signed in to change notification settings - Fork 62
feat: Validate if
statements
#1137
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
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1137 +/- ##
=======================================
Coverage 95.74% 95.75%
=======================================
Files 147 147
Lines 43286 43305 +19
=======================================
+ Hits 41446 41465 +19
Misses 1840 1840 ☔ View full report in Codecov by Sentry. |
for block in &statement.blocks { | ||
let kind = context.annotations.get_type_or_void(&block.condition, context.index); | ||
|
||
if !kind.get_type_information().is_bool() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not that this is wrong, but i'm interested to see how often people also use integers here the C way..
I would just accept this for now and and we discuss later if it might need to become a warning. In which case it will need its own error code btw.
Also note to self, when merging the diagnostics make sure this becomes E094
error: Expected a boolean, got `DINT` | ||
┌─ <internal>:12:21 | ||
│ | ||
12 │ ELSIF 0 THEN |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think IF 1 and IF 0 are fine.. not because i like them but because 0 and 1 are common I think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I initially also wanted to support them but I thought if someone is using 0 or 1 they could also just use FALSE or TRUE instead. But also I just replicated what Rust does, though comparing with C makes more sense generally speaking. Anyhow, do we proceed with supporting 0 and 1s here?
Closing this in favor of #1140 |
Resolves #1136