Skip to content

Commit

Permalink
Fix Ruby::UnannotatedEmptyCollection error
Browse files Browse the repository at this point in the history
  • Loading branch information
Little-Rubyist committed Dec 20, 2024
1 parent 2f18c94 commit 12c75e3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions lib/lrama/counterexamples.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def setup_transitions
@reverse_transitions = {}

@states.states.each do |src_state|
trans = {}
trans = {} #: Hash[Grammar::Symbol, State]

src_state.transitions.each do |shift, next_state|
trans[shift.next_sym] = next_state
Expand Down Expand Up @@ -85,7 +85,7 @@ def setup_productions

@states.states.each do |state|
# LHS => Set(Item)
h = {}
h = {} #: Hash[Grammar::Symbol, Set[States::Item]]

state.closure.each do |item|
sym = item.lhs
Expand Down Expand Up @@ -165,7 +165,7 @@ def find_shift_conflict_shortest_state_items(reduce_path, conflict_state, confli
end

if target_state_item.item.beginning_of_rule?
queue = []
queue = [] #: Array[Array[StateItem]]
queue << [target_state_item]

# Find reverse production
Expand Down Expand Up @@ -234,8 +234,8 @@ def build_paths_from_state_items(state_items)

def shortest_path(conflict_state, conflict_reduce_item, conflict_term)
# queue: is an array of [Triple, [Path]]
queue = []
visited = {}
queue = [] #: Array[[Triple, Array[StartPath|TransitionPath|ProductionPath]]]
visited = {} #: Hash[Triple, true]
start_state = @states.states.first #: Lrama::State
raise "BUG: Start state should be just one kernel." if start_state.kernels.count != 1

Expand Down
2 changes: 1 addition & 1 deletion lib/lrama/counterexamples/derivation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def to_s
alias :inspect :to_s

def render_strings_for_report
result = []
result = [] #: Array[String]
_render_for_report(self, 0, result, 0)
result.map(&:rstrip)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/lrama/counterexamples/example.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def _derivations(paths)
end

def find_derivation_for_symbol(state_item, sym)
queue = []
queue = [] #: Array[Array[StateItem]]
queue << [state_item]

while (sis = queue.shift)
Expand Down

0 comments on commit 12c75e3

Please sign in to comment.