mirror of
https://github.com/microsoft/regorus.git
synced 2026-08-05 02:16:11 +00:00
fix: Disallow else blocks for set rules (#403)
else blocks following contains and old-style sets will raise a parse error. Consistent with OPA. Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
This commit is contained in:
committed by
GitHub
parent
6719456468
commit
b11007a1be
@@ -1617,6 +1617,12 @@ impl<'source> Parser<'source> {
|
||||
let bodies = self.parse_rule_bodies()?;
|
||||
span.end = self.end;
|
||||
|
||||
if let RuleHead::Set { .. } = &head {
|
||||
if let Some(RuleBody { span, .. }) = bodies.get(1) {
|
||||
bail!(span.error("else cannot be used with set rules"));
|
||||
}
|
||||
}
|
||||
|
||||
if self.rego_v1 && bodies.is_empty() {
|
||||
match &head {
|
||||
RuleHead::Compr { assign, .. } | RuleHead::Func { assign, .. }
|
||||
|
||||
Reference in New Issue
Block a user