rbs 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +34 -0
  3. data/Rakefile +2 -0
  4. data/core/array.rbs +1 -1
  5. data/core/enumerable.rbs +1 -1
  6. data/core/hash.rbs +13 -5
  7. data/core/io.rbs +3 -3
  8. data/core/module.rbs +1 -1
  9. data/core/numeric.rbs +10 -0
  10. data/core/proc.rbs +1 -1
  11. data/core/random.rbs +4 -2
  12. data/core/range.rbs +2 -2
  13. data/core/struct.rbs +3 -2
  14. data/core/thread.rbs +1 -1
  15. data/docs/CONTRIBUTING.md +5 -3
  16. data/docs/sigs.md +18 -1
  17. data/docs/syntax.md +11 -11
  18. data/lib/rbs.rb +1 -0
  19. data/lib/rbs/ast/annotation.rb +2 -2
  20. data/lib/rbs/ast/comment.rb +2 -2
  21. data/lib/rbs/ast/declarations.rb +37 -22
  22. data/lib/rbs/ast/members.rb +26 -26
  23. data/lib/rbs/cli.rb +3 -0
  24. data/lib/rbs/constant_table.rb +4 -1
  25. data/lib/rbs/definition.rb +1 -1
  26. data/lib/rbs/definition_builder.rb +14 -0
  27. data/lib/rbs/definition_builder/ancestor_builder.rb +1 -0
  28. data/lib/rbs/definition_builder/method_builder.rb +4 -2
  29. data/lib/rbs/location.rb +106 -2
  30. data/lib/rbs/locator.rb +205 -0
  31. data/lib/rbs/method_type.rb +2 -2
  32. data/lib/rbs/parser.rb +1050 -713
  33. data/lib/rbs/parser.y +403 -71
  34. data/lib/rbs/test/hook.rb +8 -2
  35. data/lib/rbs/type_name.rb +2 -3
  36. data/lib/rbs/type_name_resolver.rb +1 -1
  37. data/lib/rbs/types.rb +36 -34
  38. data/lib/rbs/version.rb +1 -1
  39. data/lib/rbs/writer.rb +4 -2
  40. data/sig/annotation.rbs +1 -1
  41. data/sig/cli.rbs +31 -21
  42. data/sig/comment.rbs +1 -1
  43. data/sig/declarations.rbs +106 -21
  44. data/sig/environment.rbs +2 -2
  45. data/sig/location.rbs +84 -3
  46. data/sig/locator.rbs +44 -0
  47. data/sig/members.rbs +76 -12
  48. data/sig/method_builder.rbs +1 -1
  49. data/sig/method_types.rbs +1 -1
  50. data/sig/polyfill.rbs +13 -8
  51. data/sig/rbs.rbs +8 -4
  52. data/sig/typename.rbs +1 -1
  53. data/sig/types.rbs +60 -19
  54. data/sig/util.rbs +0 -4
  55. data/sig/writer.rbs +8 -2
  56. data/stdlib/rubygems/0/requirement.rbs +84 -2
  57. data/stdlib/rubygems/0/version.rbs +2 -1
  58. data/stdlib/shellwords/0/shellwords.rbs +252 -0
  59. data/steep/Gemfile.lock +16 -13
  60. metadata +5 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8d83588e6a5f96ce5953f7c94eaf6f745eddadd1446e91946f18d4b81efb70bc
4
- data.tar.gz: 3d7c3148afbe2a6041de6c909ddf08d7991e17c6fa2cebd4393a920582539263
3
+ metadata.gz: 3be8bb7e853829dddbff29b1a3337a33fd61e2860f6c83771dfdbe2ad097eb75
4
+ data.tar.gz: e569b69fe73f92c80e621521be85e8292fdb43a14d4f1fdc8f7537cdd04efbb5
5
5
  SHA512:
6
- metadata.gz: e8a99b1a837a8cf4c7f1ce6b148c25e66433db2800d356a51ad58cc9b41280b097d3db7a3138679bc34f3c536415473a1b5423fac44f1048359d8556c938c298
7
- data.tar.gz: 145caea219b5fb1d209e37f03ae0d4999f788895cf6a6dc4150d9ee4864be46ee7dc1126b95d0ddb0b1f1a4576c46f502c415aef56143900be61b726f81a291f
6
+ metadata.gz: 53895724feba94cfc7695ee7013f7cfa83618d566f4eec14fab0b5bed00074cda0394668a92d1f9eaa572bc3f0d8099a2f0bf201b05a444b3b2b8201c797ed48
7
+ data.tar.gz: 924a8b04e9b88464b5443fc1b8269cd20cfbfb25e04cc93737d52bbe1b4a895ac389371e373129ac6238a1152369ce71c3cca9183608fc9cebca4f571effc018
data/CHANGELOG.md CHANGED
@@ -2,6 +2,40 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## 1.2.0 (2021-04-21)
6
+
7
+ ### Summary
8
+
9
+ RBS 1.2 ships with better support for AST/token locations and `Locator` utility class. The AST objects now keep the locations of tokens. The `Locator` class is to translate the text position (line and column) to semantic object at the location. The class allows to find if a text position is on the class name of a class declaration.
10
+
11
+ ### Signature updates
12
+
13
+ * Hash ([#631](https://github.com/ruby/rbs/pull/631), [#632](https://github.com/ruby/rbs/pull/632), [\#637](https://github.com/ruby/rbs/pull/637), [\#638](https://github.com/ruby/rbs/pull/638), [\#639](https://github.com/ruby/rbs/pull/639), )
14
+ * Module ([\#645](https://github.com/ruby/rbs/pull/645))
15
+ * Enumerable ([\#647](https://github.com/ruby/rbs/pull/647))
16
+ * Array ([\#648](https://github.com/ruby/rbs/pull/648))
17
+ * Proc ([\#649](https://github.com/ruby/rbs/pull/649))
18
+ * Struct ([\#650](https://github.com/ruby/rbs/pull/650), [\#668](https://github.com/ruby/rbs/pull/668))
19
+ * Thread ([\#651](https://github.com/ruby/rbs/pull/651))
20
+ * Random ([\#669](https://github.com/ruby/rbs/pull/669))
21
+ * Shellwords ([\#665](https://github.com/ruby/rbs/pull/665))
22
+ * IO ([\#659](https://github.com/ruby/rbs/pull/659))
23
+
24
+ ### Language updates
25
+
26
+ * Module self type syntax update ([\#653](https://github.com/ruby/rbs/pull/653))
27
+
28
+ ### Library changes
29
+
30
+ * Token locations ([\#666](https://github.com/ruby/rbs/pull/666))
31
+ * Add RBS::Locator ([\#667](https://github.com/ruby/rbs/pull/667))
32
+ * Fix runtime type checker ([\#644](https://github.com/ruby/rbs/pull/644))
33
+
34
+ ### Miscellaneous
35
+
36
+ * Update documentation for overloading ([\#658](https://github.com/ruby/rbs/pull/658))
37
+ * Update target ruby version ([\#633](https://github.com/ruby/rbs/pull/633))
38
+
5
39
  ## 1.1.1 (2021-03-12)
6
40
 
7
41
  ### Signature updates
data/Rakefile CHANGED
@@ -2,6 +2,8 @@ require "bundler/gem_tasks"
2
2
  require "rake/testtask"
3
3
  require "rbconfig"
4
4
 
5
+ $LOAD_PATH << File.join(__dir__, "test")
6
+
5
7
  ruby = ENV["RUBY"] || RbConfig.ruby
6
8
  racc = ENV.fetch("RACC", "racc")
7
9
  rbs = File.join(__dir__, "exe/rbs")
data/core/array.rbs CHANGED
@@ -682,7 +682,7 @@ class Array[unchecked out Elem] < Object
682
682
  #
683
683
  # See also Array#+.
684
684
  #
685
- def concat: (*::Array[Elem] arrays) -> ::Array[Elem]
685
+ def concat: (*::Array[Elem] arrays) -> self
686
686
 
687
687
  # Returns the number of elements.
688
688
  #
data/core/enumerable.rbs CHANGED
@@ -118,7 +118,7 @@ module Enumerable[unchecked out Elem]: _Each[Elem]
118
118
  # [].first(10) #=> []
119
119
  # ```
120
120
  def first: () -> Elem?
121
- | (Integer n) -> ::Array[Elem]?
121
+ | (_ToInt n) -> ::Array[Elem]
122
122
 
123
123
  def grep: (untyped arg0) -> ::Array[Elem]
124
124
  | [U] (untyped arg0) { (Elem arg0) -> U } -> ::Array[U]
data/core/hash.rbs CHANGED
@@ -256,7 +256,7 @@ class Hash[unchecked out K, unchecked out V] < Object
256
256
  # h.compact #=> { a: 1, b: false }
257
257
  # h #=> { a: 1, b: false, c: nil }
258
258
  #
259
- def compact: () -> self
259
+ def compact: () -> ::Hash[K, V]
260
260
 
261
261
  # Removes all nil values from the hash. Returns nil if no changes were made,
262
262
  # otherwise returns the hash.
@@ -450,6 +450,14 @@ class Hash[unchecked out K, unchecked out V] < Object
450
450
  #
451
451
  def eql?: (untyped) -> bool
452
452
 
453
+ # Returns a hash excluded given keys and the values.
454
+ #
455
+ # h = { a: 100, b: 200, c: 300 }
456
+ # h.except(:a) #=> {:b=>200, :c=>300}
457
+ # h.except(:b, :c, :d) #=> {:a=>100}
458
+ #
459
+ def except: (*K) -> ::Hash[K, V]
460
+
453
461
  # Returns a value from the hash for the given key. If the key can't be found,
454
462
  # there are several options: With no other arguments, it will raise a KeyError
455
463
  # exception; if *default* is given, then that will be returned; if the optional
@@ -498,8 +506,8 @@ class Hash[unchecked out K, unchecked out V] < Object
498
506
  #
499
507
  # Hash#filter is an alias for Hash#select.
500
508
  #
501
- def filter: () { (K, V) -> boolish } -> self
502
- | () -> ::Enumerator[[ K, V ], self]
509
+ def filter: () { (K, V) -> boolish } -> ::Hash[K, V]
510
+ | () -> ::Enumerator[[ K, V ], ::Hash[K, V]]
503
511
 
504
512
  # Equivalent to Hash#keep_if, but returns `nil` if no changes were made.
505
513
  #
@@ -815,7 +823,7 @@ class Hash[unchecked out K, unchecked out V] < Object
815
823
  # h.slice(:a) #=> {:a=>100}
816
824
  # h.slice(:b, :c, :d) #=> {:b=>200, :c=>300}
817
825
  #
818
- def slice: (*K) -> self
826
+ def slice: (*K) -> ::Hash[K, V]
819
827
 
820
828
  # ## Element Assignment
821
829
  #
@@ -857,7 +865,7 @@ class Hash[unchecked out K, unchecked out V] < Object
857
865
 
858
866
  # Returns `self`.
859
867
  #
860
- def to_hash: () -> ::Hash[K, V]
868
+ def to_hash: () -> self
861
869
 
862
870
  # Returns a Proc which maps keys to values.
863
871
  #
data/core/io.rbs CHANGED
@@ -181,7 +181,7 @@ class IO < Object
181
181
  # # ...
182
182
  # f.gets # won't cause Errno::EBADF
183
183
  #
184
- def autoclose=: (bool) -> bool
184
+ def autoclose=: (boolish) -> untyped
185
185
 
186
186
  # Returns `true` if the underlying file descriptor of *ios* will be closed
187
187
  # automatically at its finalization, otherwise `false`.
@@ -212,7 +212,7 @@ class IO < Object
212
212
  # just ignored since Ruby 2.3.
213
213
  def close: () -> NilClass
214
214
 
215
- def close_on_exec=: (boolish) -> bool
215
+ def close_on_exec=: (boolish) -> untyped
216
216
 
217
217
  # Returns `true` if *ios* will be closed on exec.
218
218
  #
@@ -656,7 +656,7 @@ class IO < Object
656
656
  # ```
657
657
  def sync: () -> bool
658
658
 
659
- def sync=: (boolish) -> bool
659
+ def sync=: (boolish) -> untyped
660
660
 
661
661
  def sysread: (Integer maxlen, String outbuf) -> String
662
662
 
data/core/module.rbs CHANGED
@@ -158,7 +158,7 @@ class Module < Object
158
158
  #
159
159
  # Exiting with code 99
160
160
  #
161
- def alias_method: (Symbol new_name, Symbol old_name) -> self
161
+ def alias_method: (::Symbol | ::String new_name, ::Symbol | ::String old_name) -> ::Symbol
162
162
 
163
163
  # Returns a list of modules included/prepended in *mod* (including *mod*
164
164
  # itself).
data/core/numeric.rbs CHANGED
@@ -82,10 +82,20 @@ class Numeric
82
82
  #
83
83
  def %: (Numeric) -> Numeric
84
84
 
85
+ # Performs addition: the class of the resulting object depends on the class of
86
+ # `numeric`.
87
+ #
88
+ def +: (Numeric) -> Numeric
89
+
85
90
  # Unary Plus---Returns the receiver.
86
91
  #
87
92
  def +@: () -> Numeric
88
93
 
94
+ # Performs subtraction: the class of the resulting object depends on the class
95
+ # of `numeric`.
96
+ #
97
+ def -: (Numeric) -> Numeric
98
+
89
99
  # Unary Minus---Returns the receiver, negated.
90
100
  #
91
101
  def -@: () -> Numeric
data/core/proc.rbs CHANGED
@@ -262,7 +262,7 @@ class Proc < Object
262
262
 
263
263
  def []: (*untyped arg0) -> untyped
264
264
 
265
- def curry: (?Integer arity) -> Proc
265
+ def curry: (?_ToInt arity) -> Proc
266
266
 
267
267
  # Returns a hash value corresponding to proc body.
268
268
  #
data/core/random.rbs CHANGED
@@ -106,7 +106,9 @@ class Random < Object
106
106
 
107
107
  # Alias of Random::DEFAULT.rand.
108
108
  #
109
- def self.rand: (?Integer max) -> Numeric
109
+ def self.rand: () -> Float
110
+ | (Integer | ::Range[Integer] max) -> Integer
111
+ | (Float | ::Range[Float] max) -> Float
110
112
 
111
113
  # Seeds the system pseudo-random number generator, Random::DEFAULT, with
112
114
  # `number`. The previous seed value is returned.
@@ -126,7 +128,7 @@ class Random < Object
126
128
  # srand 1234 # => 1234
127
129
  # [ rand, rand ] # => [0.1915194503788923, 0.6221087710398319]
128
130
  #
129
- def self.srand: (?Integer number) -> Numeric
131
+ def self.srand: (?Integer number) -> Integer
130
132
  end
131
133
 
132
134
  # The default Pseudorandom number generator. Used by class methods of Random.
data/core/range.rbs CHANGED
@@ -99,7 +99,7 @@ class Range[out Elem] < Object
99
99
  # ```ruby
100
100
  # (1..10).begin #=> 1
101
101
  # ```
102
- def begin: () -> Elem
102
+ def begin: () -> Elem # Begin-less ranges have type of Range[Integer?]
103
103
 
104
104
  def bsearch: [U] () { (Elem) -> boolish } -> U?
105
105
 
@@ -114,7 +114,7 @@ class Range[out Elem] < Object
114
114
  # (1..10).end #=> 10
115
115
  # (1...10).end #=> 10
116
116
  # ```
117
- def `end`: () -> Elem
117
+ def `end`: () -> Elem # End-less ranges have type of Range[Integer?]
118
118
 
119
119
  # Returns `true` if the range excludes its end value.
120
120
  #
data/core/struct.rbs CHANGED
@@ -27,13 +27,14 @@
27
27
  # struct member which is either a quoted string ( `"name"` ) or a
28
28
  # [Symbol](https://ruby-doc.org/core-2.6.3/Symbol.html) ( `:name` ).
29
29
  class Struct[Elem] < Object
30
- include Enumerable[Elem]
30
+ include Enumerable[Elem?]
31
31
 
32
32
  type attribute_name = Symbol | String
33
33
 
34
34
  def initialize: (attribute_name, *attribute_name, ?keyword_init: boolish) ?{ () -> void } -> void
35
35
 
36
- def each: () { (Elem) -> untyped } -> untyped
36
+ def each: () -> ::Enumerator[Elem?, self]
37
+ | () { (Elem? item) -> void } -> self
37
38
 
38
39
  def self.members: () -> ::Array[Symbol]
39
40
  end
data/core/thread.rbs CHANGED
@@ -842,7 +842,7 @@ class Thread < Object
842
842
  # However, if class [Thread](Thread.downloaded.ruby_doc) is subclassed,
843
843
  # then calling `start` in that subclass will not invoke the subclass’s
844
844
  # `initialize` method.
845
- def self.start: (*untyped args) -> untyped
845
+ def self.start: (*untyped args) { (*untyped) -> void } -> instance
846
846
 
847
847
  # Stops execution of the current thread, putting it into a “sleep” state,
848
848
  # and schedules execution of another thread.
data/docs/CONTRIBUTING.md CHANGED
@@ -28,8 +28,8 @@
28
28
 
29
29
  ## The Target Version
30
30
 
31
- * The standard library signatures targets Ruby 2.7 for now.
32
- * The library code targets Ruby 2.6, 2.7, and 3.0.
31
+ * The standard library signatures targets Ruby 3.0 for now.
32
+ * The library code targets Ruby 2.7 and 3.0.
33
33
 
34
34
  ## Stdlib Worksheet
35
35
 
@@ -60,6 +60,8 @@ You may find the *Good for first contributor* column where you can find some cla
60
60
  Validate the syntax and some of the semantics.
61
61
  * `rake generate:stdlib_test[String]`
62
62
  Scaffold the stdlib test.
63
+ * `rake test/stdlib/Array_test.rb`
64
+ Run specific stdlib test with the path.
63
65
 
64
66
  ## Standard STDLIB Members Order
65
67
 
@@ -85,7 +87,7 @@ class HelloWorld[X]
85
87
 
86
88
  public # Public instance methods
87
89
 
88
- def each: () { (A) -> void } -> void # Members are sorted dicionary order
90
+ def each: () { (A) -> void } -> void # Members are sorted dictionary order
89
91
 
90
92
  def to_s: (?Locale) -> String
91
93
 
data/docs/sigs.md CHANGED
@@ -26,7 +26,7 @@ The test installs instrumentations to spy the method calls and check if argument
26
26
  If errors are reported by the test, you will fix the signature.
27
27
  You will be sure that you ship a correct signature finally.
28
28
 
29
- The instrumentations are implemneted using `Module#prepend`.
29
+ The instrumentations are implemented using `Module#prepend`.
30
30
  It defines a module with same name of methods, which asserts the type of arguments/return values and calls `super`.
31
31
 
32
32
  ## Type errors
@@ -70,6 +70,23 @@ ERROR -- : [Kaigi::Conference#speakers] UnexpectedBlockError: unexpected block i
70
70
  The error means there is a type error on overloaded methods.
71
71
  The `rbs` test framework tries to the best error message for overloaded methods too, but it reports the `UnresolvedOverloadingError` when it fails.
72
72
 
73
+ ### DuplicatedMethodDefinitionError
74
+
75
+ The error is reported when a method is defined multiple times, as RBS does not allow duplicate method definitions. When you need to overload a method, use the `...` syntax:
76
+
77
+ ```ruby
78
+ # First definition
79
+ class C
80
+ def foo: () -> untyped
81
+ end
82
+
83
+ # Second definition, use `...` syntax to tell RBS that we're overloading the method
84
+ class C
85
+ def foo: () -> untyped
86
+ | ...
87
+ end
88
+ ```
89
+
73
90
  ## Setting up the test
74
91
 
75
92
  The design of the signature testing aims to be non-intrusive. The setup is done in two steps:
data/docs/syntax.md CHANGED
@@ -11,8 +11,8 @@ _type_ ::= _class-name_ _type-arguments_ (Class instance type)
11
11
  | _type_ `|` _type_ (Union type)
12
12
  | _type_ `&` _type_ (Intersection type)
13
13
  | _type_ `?` (Optional type)
14
- | `{` _record-name_ `:` _type_ `,` ... `}` (Record type)
15
- | `[]` | `[` _type_ `,` ... `]` (Tuples)
14
+ | `{` _record-name_ `:` _type_ `,` etc. `}` (Record type)
15
+ | `[]` | `[` _type_ `,` etc. `]` (Tuples)
16
16
  | _type-variable_ (Type variables)
17
17
  | `^(` _parameters_ `) ->` _type_ (Proc type)
18
18
  | `self`
@@ -36,7 +36,7 @@ _namespace_ ::= (Empty namespace)
36
36
  | _namespace_ /[A-Z]\w*/ `::` (Namespace)
37
37
 
38
38
  _type-arguments_ ::= (No application)
39
- | `[` _type_ `,` ... `]` (Type application)
39
+ | `[` _type_ `,` etc. `]` (Type application)
40
40
 
41
41
  _literal_ ::= _string-literal_
42
42
  | _symbol-literal_
@@ -203,7 +203,6 @@ We can see an example at the definition of `Enumerable#find`:
203
203
  ```
204
204
  module Enumerable[Elem, Return]
205
205
  def find: () { (Elem) -> boolish } -> Elem?
206
- ...
207
206
  end
208
207
  ```
209
208
 
@@ -233,11 +232,11 @@ _parameters_ ::= _required-positionals_ _optional-positionals_ _rest-positional_
233
232
 
234
233
  _parameter_ ::= _type_ _var-name_ # Parameter with var name
235
234
  | _type_ # Parameter without var name
236
- _required-positionals_ ::= _parameter_ `,` ...
237
- _optional-positionals_ ::= `?` _parameter_ `,` ...
235
+ _required-positionals_ ::= _parameter_ `,` etc.
236
+ _optional-positionals_ ::= `?` _parameter_ `,` etc.
238
237
  _rest-positional_ ::= # Empty
239
238
  | `*` _parameter_
240
- _trailing-positionals_ ::= _parameter_ `,` ...
239
+ _trailing-positionals_ ::= _parameter_ `,` etc.
241
240
  _keywords_ ::= # Empty
242
241
  | `**` _parameter_ # Rest keyword
243
242
  | _keyword_ `:` _parameter_ `,` _keywords_ # Required keyword
@@ -292,9 +291,10 @@ _method-member_ ::= `def` _method-name_ `:` _method-types_ # Instance
292
291
  _method-types_ ::= # Empty
293
292
  | `super` # `super` overloading
294
293
  | _type-parameters_ _method-type_ `|` _method-types_ # Overloading types
294
+ | `...` # Overloading for duplicate definitions
295
295
 
296
296
  _type-parameters_ ::= # Empty
297
- | `[` _type-variable_ `,` ... `]`
297
+ | `[` _type-variable_ `,` etc. `]`
298
298
 
299
299
  _attribute-member_ ::= _attribute-type_ _method-name_ `:` _type_ # Attribute
300
300
  | _attribute-type_ _method-name_ `(` _ivar-name_ `) :` _type_ # Attribute with variable name specification
@@ -450,7 +450,7 @@ _const-name_ ::= _namespace_ /[A-Z]\w*/
450
450
  _global-name_ ::= /$[a-zA-Z]\w+/ | ...
451
451
 
452
452
  _module-type-parameters_ ::= # Empty
453
- | `[` _module-type-parameter_ `,` ... `]`
453
+ | `[` _module-type-parameter_ `,` etc. `]`
454
454
 
455
455
  _module-type-parameter_ ::= _check_ _variance_ _type-variable_
456
456
  _variance_ ::= `out` | `in`
@@ -475,7 +475,7 @@ For example, an `Array` of `String` can almost be considered to be an `Array` of
475
475
 
476
476
  ```
477
477
  class Array[out T]
478
- # ...
478
+ # etc.
479
479
  end
480
480
  ```
481
481
 
@@ -486,7 +486,7 @@ In those cases, one must use the `unchecked` keyword:
486
486
 
487
487
  ```
488
488
  class Array[unchecked out T]
489
- # ...
489
+ # etc.
490
490
  end
491
491
  ```
492
492
 
data/lib/rbs.rb CHANGED
@@ -43,6 +43,7 @@ require "rbs/validator"
43
43
  require "rbs/factory"
44
44
  require "rbs/repository"
45
45
  require "rbs/ancestor_graph"
46
+ require "rbs/locator"
46
47
 
47
48
  begin
48
49
  require "rbs/parser"
@@ -19,8 +19,8 @@ module RBS
19
19
  self.class.hash ^ string.hash
20
20
  end
21
21
 
22
- def to_json(*a)
23
- { string: string, location: location }.to_json(*a)
22
+ def to_json(state = _ = nil)
23
+ { string: string, location: location }.to_json(state)
24
24
  end
25
25
  end
26
26
  end
@@ -19,8 +19,8 @@ module RBS
19
19
  self.class.hash ^ string.hash
20
20
  end
21
21
 
22
- def to_json(*a)
23
- { string: string, location: location }.to_json(*a)
22
+ def to_json(state = _ = nil)
23
+ { string: string, location: location }.to_json(state)
24
24
  end
25
25
 
26
26
  def concat(string:, location:)