-
Notifications
You must be signed in to change notification settings - Fork 63
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
Allow empty target properties block #551
Conversation
This is especially handy when you comment out a target property. For now if the block happens to be empty you get a really unfriendly error: lfc: fatal error: Unable to validate resource. Reason: no viable alternative at input '}' missing '}' at ';' Unrecognized target parameter: null. Recognized parameters are: build, build-type, clock-sync, clock-sync-options, cmake-include, compiler, docker, external-runtime-path, fast, files, flags, coordination, coordination-options, keepalive, logging, no-compile, no-runtime-validation, protobufs, runtime-version, threads, timeout, tracing.
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.
This was bugging me as well, but I never got to opening an issue or fixing it. Thanks!
I think we should be aware that this grammar rule also allows target Foo { , }
, but this is probably fine.
Codecov Report
@@ Coverage Diff @@
## master #551 +/- ##
============================================
+ Coverage 66.36% 66.39% +0.02%
- Complexity 3462 3465 +3
============================================
Files 132 132
Lines 22294 22321 +27
Branches 2883 2886 +3
============================================
+ Hits 14795 14819 +24
- Misses 6352 6354 +2
- Partials 1147 1148 +1
Continue to review full report at Codecov.
|
Thanks for fixing this rather annoying issue. |
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.
This is a good idea! I left a suggestion for improvement.
Co-authored-by: Marten Lohstroh <[email protected]>
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.
Awesome! Let's merge this.
This is especially handy when you comment out a target property. For now if the block happens to be empty you get a really unfriendly parsing error:
With this change, this produces no error anymore. If there is a need to produce an error (which here, I don't think there is) it should be produced by the validator instead.
Note that this also allows empty dictionary values, eg
I think this is fine for the same reasons (commenting out bindings).
I think it would be nice to make arrays in target properties accept empty arrays too. But this would require that the value of target properties be checked more thoroughly, so I'm leaving this for later.
Note: this branch is also merged in the PR #488