Skip to content

Commit

Permalink
Fix a warning for Ruby::UnannotatedEmptyCollection
Browse files Browse the repository at this point in the history
```
lib/lrama/grammar.rb:385:15: [warning] Empty array doesn't have type annotation
│ Diagnostic ID: Ruby::UnannotatedEmptyCollection
│
└       errors = []
                 ~~
```
  • Loading branch information
ydah committed Dec 9, 2024
1 parent a904279 commit 1507cf9
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/lrama/grammar.rb
Original file line number Diff line number Diff line change
Expand Up @@ -382,12 +382,10 @@ def fill_sym_to_rules
end

def validate_rule_lhs_is_nterm!
errors = []

rules.each do |rule|
errors = rules.each_with_object(Array.new) do |rule, list|
next if rule.lhs.nterm?

errors << "[BUG] LHS of #{rule.display_name} (line: #{rule.lineno}) is term. It should be nterm."
list << "[BUG] LHS of #{rule.display_name} (line: #{rule.lineno}) is term. It should be nterm."
end

return if errors.empty?
Expand Down

0 comments on commit 1507cf9

Please sign in to comment.