Skip to content

Commit

Permalink
Fix a Ruby::AnnotationSyntaxError
Browse files Browse the repository at this point in the history
The following changes caused the error.
- soutaro/steep#1384

```
lib/lrama/state/reduce.rb:30:36: [error] Type annotation has a syntax error: Failed to parse a type in annotation
│ Diagnostic ID: Ruby::AnnotationSyntaxError
│
└           # @type ivar @look_ahead: Array<Grammar::Symbol>
                                      ~~~~~~~~~~~~~~~~~~~~~~
```
  • Loading branch information
ydah committed Dec 9, 2024
1 parent 1776e4b commit 1e146f9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions lib/lrama/state/reduce.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Reduce

def initialize(item)
@item = item
@look_ahead = nil
@look_ahead = []
@not_selected_symbols = []
end

Expand All @@ -26,8 +26,7 @@ def add_not_selected_symbol(sym)
end

def selected_look_ahead
if @look_ahead
# @type ivar @look_ahead: Array<Grammar::Symbol>
if @look_ahead.any?
@look_ahead - @not_selected_symbols
else
[]
Expand Down
4 changes: 2 additions & 2 deletions sig/lrama/state/reduce.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ module Lrama
class State
class Reduce
@item: States::Item
@look_ahead: Array[Grammar::Symbol]?
@look_ahead: Array[Grammar::Symbol]
@not_selected_symbols: Array[Grammar::Symbol]

attr_reader item: States::Item
attr_reader look_ahead: Array[Grammar::Symbol]?
attr_reader look_ahead: Array[Grammar::Symbol]
attr_reader not_selected_symbols: Array[Grammar::Symbol]
attr_accessor default_reduction: bool

Expand Down

0 comments on commit 1e146f9

Please sign in to comment.