rbs 3.6.0.dev.1 → 3.6.0.pre.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +28 -1
  3. data/CHANGELOG.md +87 -0
  4. data/Rakefile +8 -2
  5. data/core/basic_object.rbs +1 -1
  6. data/core/builtin.rbs +4 -4
  7. data/core/dir.rbs +1 -1
  8. data/core/enumerable.rbs +12 -12
  9. data/core/enumerator/product.rbs +1 -1
  10. data/core/enumerator.rbs +3 -3
  11. data/core/errors.rbs +1 -1
  12. data/core/exception.rbs +1 -1
  13. data/core/file.rbs +1 -1
  14. data/core/integer.rbs +4 -4
  15. data/core/kernel.rbs +3 -3
  16. data/core/module.rbs +1 -1
  17. data/core/random.rbs +1 -1
  18. data/core/rbs/unnamed/env_class.rbs +7 -7
  19. data/core/rbs/unnamed/random.rbs +14 -14
  20. data/core/regexp.rbs +2 -2
  21. data/core/thread.rbs +6 -5
  22. data/core/trace_point.rbs +2 -2
  23. data/docs/syntax.md +5 -3
  24. data/ext/rbs_extension/lexer.c +1 -1
  25. data/ext/rbs_extension/lexer.h +5 -0
  26. data/ext/rbs_extension/lexer.re +1 -1
  27. data/ext/rbs_extension/lexstate.c +16 -0
  28. data/ext/rbs_extension/location.c +27 -39
  29. data/ext/rbs_extension/location.h +7 -2
  30. data/ext/rbs_extension/parser.c +1 -1
  31. data/lib/rbs/buffer.rb +5 -0
  32. data/lib/rbs/cli/validate.rb +41 -1
  33. data/lib/rbs/errors.rb +1 -1
  34. data/lib/rbs/location_aux.rb +2 -6
  35. data/lib/rbs/prototype/rb.rb +2 -2
  36. data/lib/rbs/test/type_check.rb +7 -0
  37. data/lib/rbs/version.rb +1 -1
  38. data/sig/location.rbs +0 -3
  39. data/sig/types.rbs +12 -5
  40. data/stdlib/csv/0/csv.rbs +17 -6
  41. data/stdlib/digest/0/digest.rbs +22 -28
  42. data/stdlib/ipaddr/0/ipaddr.rbs +1 -1
  43. data/stdlib/kconv/0/kconv.rbs +166 -0
  44. data/stdlib/net-http/0/net-http.rbs +1 -1
  45. data/stdlib/psych/0/store.rbs +1 -1
  46. data/stdlib/uri/0/ldap.rbs +1 -1
  47. data/stdlib/zlib/0/deflate.rbs +1 -1
  48. metadata +4 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f9c653ea578000329720980ce7845237e8c49c9319a72c5a4f5bc315306cde02
4
- data.tar.gz: e9ccad52c36cd4ef0509ce78ab0d857810b80ed6489d8b6b1fcdac0af47f5e59
3
+ metadata.gz: f3986f50e40a03702c9472964ede255b11e28657c0e0814a250e58749efeb824
4
+ data.tar.gz: 6f1e5defc9e5d42c84c5692c50e5712ddc92bf51e89958f9bfa511e518e724e5
5
5
  SHA512:
6
- metadata.gz: c2468b174c0800686e77f26122898d84e2f2506b5b91074d30d18766ce60992257bd560843972ddf72c77e9b8bda26dfb58f012893dbae1585f994fecd480a7b
7
- data.tar.gz: 9c534d38496760cc1ad91f8776e83e61672305c564c6b14fc206fd202817a5be2d60d675558dfbe6b9fadbf9f980c595c2432c821cae38a5b447857d5601ab5e
6
+ metadata.gz: af34f7e1f8547abf07d7a888927aa3cc408480130fc6cc1b94b42c5069b4332b770df805968ff9b31ab957d6cff55601f07d08ce2ede84cec927531465806ad1
7
+ data.tar.gz: 1e6057a9ffcf93e86ea042aa5aa1061de95107678a1f485930e7a73f22321ba3fd0d7b8b7f8587cd1bc1a18a24a60e6d90768bad4f08f6ddaf8ba75133a37fab
data/.rubocop.yml CHANGED
@@ -1,4 +1,7 @@
1
- require: rubocop-rubycw
1
+ require:
2
+ - rubocop-rubycw
3
+ - rubocop-on-rbs
4
+
2
5
  AllCops:
3
6
  TargetRubyVersion: 3.0
4
7
  DisabledByDefault: true
@@ -8,6 +11,30 @@ Rubycw/Rubycw:
8
11
  Enabled: true
9
12
  Exclude:
10
13
  - 'test/**/*_test.rb'
14
+ - 'test/typecheck/**/*.rb'
15
+
16
+ RBS:
17
+ Enabled: true
18
+ RBS/Layout:
19
+ Enabled: true
20
+ Exclude:
21
+ - 'sig/**/*'
22
+ - 'test/**/*'
23
+ RBS/Layout/CommentIndentation:
24
+ Exclude:
25
+ - core/string.rbs
26
+ RBS/Lint:
27
+ Enabled: true
28
+ Exclude:
29
+ - 'sig/**/*'
30
+ - 'test/**/*'
31
+ RBS/Style:
32
+ Enabled: false
33
+ Exclude:
34
+ - 'sig/**/*'
35
+ - 'test/**/*'
36
+ RBS/Style/InitializeReturnType:
37
+ Enabled: true
11
38
 
12
39
  Lint/DuplicateMethods:
13
40
  Enabled: true
data/CHANGELOG.md CHANGED
@@ -1,5 +1,92 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 3.6.0.pre.2 (2024-09-18)
4
+
5
+ ### Signature updates
6
+
7
+ * `Kernel#class` ([#2017](https://github.com/ruby/rbs/pull/2017))
8
+ * `TracePoint#enable` ([#2015](https://github.com/ruby/rbs/pull/2015))
9
+
10
+ ### Miscellaneous
11
+
12
+ * Fix type definition and type errors ([#2016](https://github.com/ruby/rbs/pull/2016))
13
+
14
+ ## 3.6.0.pre.1 (2024-09-17)
15
+
16
+ ### Signature updates
17
+
18
+ * csv ([#2012](https://github.com/ruby/rbs/pull/2012), [#1864](https://github.com/ruby/rbs/pull/1864), [#2002](https://github.com/ruby/rbs/pull/2002), [#2003](https://github.com/ruby/rbs/pull/2003), [#1903](https://github.com/ruby/rbs/pull/1903))
19
+ * digest ([#1880](https://github.com/ruby/rbs/pull/1880))
20
+ * kconv ([#1857](https://github.com/ruby/rbs/pull/1857))
21
+ * zlib ([#1911](https://github.com/ruby/rbs/pull/1911))
22
+ * `_Each` ([#2006](https://github.com/ruby/rbs/pull/2006))
23
+ * `Array` ([#1921](https://github.com/ruby/rbs/pull/1921))
24
+ * `Enumerable` ([#1921](https://github.com/ruby/rbs/pull/1921))
25
+ * `Enumerator::_Each` ([#2006](https://github.com/ruby/rbs/pull/2006), [#1915](https://github.com/ruby/rbs/pull/1915))
26
+ * `Enumerator` ([#2004](https://github.com/ruby/rbs/pull/2004))
27
+ * `Kernel` ([#1945](https://github.com/ruby/rbs/pull/1945))
28
+ * `Method` ([#1939](https://github.com/ruby/rbs/pull/1939))
29
+ * `Module` ([#1921](https://github.com/ruby/rbs/pull/1921))
30
+ * `Net::HTTPHeader` ([#1932](https://github.com/ruby/rbs/pull/1932))
31
+ * `Proc` ([#1937](https://github.com/ruby/rbs/pull/1937))
32
+ * `Queue` ([#2004](https://github.com/ruby/rbs/pull/2004))
33
+ * `Range` ([#1921](https://github.com/ruby/rbs/pull/1921))
34
+ * `Refinement` ([#1931](https://github.com/ruby/rbs/pull/1931))
35
+ * `Symbol` ([#1930](https://github.com/ruby/rbs/pull/1930))
36
+ * `TracePoint` ([#1943](https://github.com/ruby/rbs/pull/1943))
37
+ * `#rand` ([#2007](https://github.com/ruby/rbs/pull/2007))
38
+ * Use untyped blocks ([#1935](https://github.com/ruby/rbs/pull/1935))
39
+ * Update docs for ruby-3.3.4 ([#1923](https://github.com/ruby/rbs/pull/1923))
40
+ * Update docs for ruby-3.3.3 ([#1889](https://github.com/ruby/rbs/pull/1889))
41
+
42
+ ### Language updates
43
+
44
+ * Fix position for default_type ([#1997](https://github.com/ruby/rbs/pull/1997))
45
+ * Update `syntax.md` ([#1995](https://github.com/ruby/rbs/pull/1995))
46
+ * Improve generics ([#1994](https://github.com/ruby/rbs/pull/1994))
47
+ * Allow alias to module-self-type from module ([#1948](https://github.com/ruby/rbs/pull/1948))
48
+ * Make it a syntax error when the keys of keyword and record are duplicated. ([#1883](https://github.com/ruby/rbs/pull/1883))
49
+
50
+ ### Library changes
51
+
52
+ * Omit unnecessary field from location range ([#1788](https://github.com/ruby/rbs/pull/1788))
53
+ * Handle ISEQs compiled by Prism ([#1983](https://github.com/ruby/rbs/pull/1983))
54
+ * Add AST Visitor ([#1975](https://github.com/ruby/rbs/pull/1975))
55
+ * Make the extension `GC.auto_compact` compatible ([#1971](https://github.com/ruby/rbs/pull/1971))
56
+ * Make `FileFinder` faster by globbing all possible files ([#1965](https://github.com/ruby/rbs/pull/1965))
57
+ * Fix #1905: Fix typo in `UntypedFunction` ([#1906](https://github.com/ruby/rbs/pull/1906))
58
+
59
+ #### rbs prototype
60
+
61
+ * [prototype] Remove redundant access modifier ([#1914](https://github.com/ruby/rbs/pull/1914))
62
+
63
+ ### Miscellaneous
64
+
65
+ * Allow RBS/Style/InitializeReturnType ([#2008](https://github.com/ruby/rbs/pull/2008))
66
+ * docs: An interface can include interfaces only and not modules ([#1996](https://github.com/ruby/rbs/pull/1996))
67
+ * Fix the portability of an external command ([#2001](https://github.com/ruby/rbs/pull/2001))
68
+ * Skip `AbstractSyntaxTree` test with ruby-3.4 ([#2005](https://github.com/ruby/rbs/pull/2005))
69
+ * Fix test ([#1972](https://github.com/ruby/rbs/pull/1972))
70
+ * Use `File.open` instead of `IO.sysopen` ([#1912](https://github.com/ruby/rbs/pull/1912))
71
+
72
+ ## 3.5.3 (2024-08-23)
73
+
74
+ ### Library changes
75
+
76
+ * Backport GC fix PR ([#1977](https://github.com/ruby/rbs/pull/1977))
77
+
78
+ ## 3.5.2 (2024-07-10)
79
+
80
+ ### Library changes
81
+
82
+ * Update docs for ruby-3.3.4 ([#1923](https://github.com/ruby/rbs/pull/1923), Backported in [#1925](https://github.com/ruby/rbs/pull/1925))
83
+ * Update docs for ruby-3.3.3 ([#1889](https://github.com/ruby/rbs/pull/1889), Backported in [#1925](https://github.com/ruby/rbs/pull/1925))
84
+ * Fix #1905: Fix typo in `UntypedFunction` ([#1906](https://github.com/ruby/rbs/pull/1906), Backported in [#1925](https://github.com/ruby/rbs/pull/1925))
85
+
86
+ ### Miscellaneous
87
+
88
+ * Use `File.open` instead of `IO.sysopen` ([#1913](https://github.com/ruby/rbs/pull/1913))
89
+
3
90
  ## 3.5.1 (2024-06-07)
4
91
 
5
92
  ### Library changes
data/Rakefile CHANGED
@@ -106,11 +106,17 @@ task :typecheck_test => :compile do
106
106
  end
107
107
 
108
108
  task :raap => :compile do
109
- sh %q[cat test/raap.txt | egrep -v '^#|^$' | xargs bundle exec raap]
109
+ sh %q[ruby test/raap.rb | xargs bundle exec raap -r digest/bubblebabble --library digest --allow-private]
110
110
  end
111
111
 
112
112
  task :rubocop do
113
- sh "rubocop --parallel"
113
+ format = if ENV["CI"]
114
+ "github"
115
+ else
116
+ "progress"
117
+ end
118
+
119
+ sh "rubocop --parallel --format #{format}"
114
120
  end
115
121
 
116
122
  namespace :generate do
@@ -256,7 +256,7 @@ class BasicObject
256
256
  # -->
257
257
  # Returns a new BasicObject.
258
258
  #
259
- def initialize: () -> nil
259
+ def initialize: () -> void
260
260
 
261
261
  private
262
262
 
data/core/builtin.rbs CHANGED
@@ -170,12 +170,12 @@ interface _Inspect
170
170
  def inspect: () -> String
171
171
  end
172
172
 
173
- interface _Each[out A]
174
- def each: () { (A) -> void } -> void
173
+ interface _Each[out E, out R = void]
174
+ def each: () { (E) -> void } -> R
175
175
  end
176
176
 
177
- interface _EachEntry[out A]
178
- def each_entry: () { (A) -> void } -> self
177
+ interface _EachEntry[out E]
178
+ def each_entry: () { (E) -> void } -> self
179
179
  end
180
180
 
181
181
  interface _Reader
data/core/dir.rbs CHANGED
@@ -182,7 +182,7 @@ class Dir
182
182
  # Dir.new('.').read.encoding # => #<Encoding:UTF-8>
183
183
  # Dir.new('.', encoding: 'US-ASCII').read.encoding # => #<Encoding:US-ASCII>
184
184
  #
185
- def initialize: (path dir, ?encoding: encoding?) -> self
185
+ def initialize: (path dir, ?encoding: encoding?) -> void
186
186
 
187
187
  # <!--
188
188
  # rdoc-file=dir.rb
data/core/enumerable.rbs CHANGED
@@ -529,7 +529,7 @@ module Enumerable[unchecked out Elem] : _Each[Elem]
529
529
  def entries: () -> ::Array[Elem]
530
530
 
531
531
  def enum_for: (Symbol method, *untyped, **untyped) ?{ (?) -> Integer } -> Enumerator[untyped, untyped]
532
- | () ?{ () -> Integer } -> Enumerator[Elem, self]
532
+ | () ?{ () -> Integer } -> Enumerator[Elem, self]
533
533
 
534
534
  %a{annotate:rdoc:skip}
535
535
  alias to_enum enum_for
@@ -1299,7 +1299,7 @@ module Enumerable[unchecked out Elem] : _Each[Elem]
1299
1299
  # With no block given, returns an Enumerator.
1300
1300
  #
1301
1301
  def reverse_each: () { (Elem arg0) -> untyped } -> void
1302
- | () -> ::Enumerator[Elem, void]
1302
+ | () -> ::Enumerator[Elem]
1303
1303
 
1304
1304
  # <!--
1305
1305
  # rdoc-file=enum.c
@@ -1760,7 +1760,7 @@ module Enumerable[unchecked out Elem] : _Each[Elem]
1760
1760
  # # show pythagorean triples less than 100
1761
1761
  # p pythagorean_triples.take_while { |*, z| z < 100 }.force
1762
1762
  #
1763
- def lazy: () -> Enumerator::Lazy[Elem, void]
1763
+ def lazy: () -> Enumerator::Lazy[Elem]
1764
1764
 
1765
1765
  # <!--
1766
1766
  # rdoc-file=enum.c
@@ -1846,7 +1846,7 @@ module Enumerable[unchecked out Elem] : _Each[Elem]
1846
1846
  # e = (1..3).chain([4, 5])
1847
1847
  # e.to_a #=> [1, 2, 3, 4, 5]
1848
1848
  #
1849
- def chain: (*self enumerables) -> ::Enumerator::Chain[Elem]
1849
+ def chain: [Elem2] (*_Each[Elem2] enumerables) -> ::Enumerator::Chain[Elem | Elem2]
1850
1850
 
1851
1851
  # <!--
1852
1852
  # rdoc-file=enum.c
@@ -2092,8 +2092,8 @@ module Enumerable[unchecked out Elem] : _Each[Elem]
2092
2092
  # pp lines
2093
2093
  # }
2094
2094
  #
2095
- def chunk: [U] () { (Elem elt) -> U } -> ::Enumerator[[ U, ::Array[Elem] ], void]
2096
- | () -> ::Enumerator[Elem, ::Enumerator[[ untyped, ::Array[Elem] ], void]]
2095
+ def chunk: [U] () { (Elem elt) -> U } -> ::Enumerator[[ U, ::Array[Elem] ]]
2096
+ | () -> ::Enumerator[Elem, ::Enumerator[[ untyped, ::Array[Elem] ]]]
2097
2097
 
2098
2098
  # <!--
2099
2099
  # rdoc-file=enum.c
@@ -2142,7 +2142,7 @@ module Enumerable[unchecked out Elem] : _Each[Elem]
2142
2142
  # Enumerable#slice_when does the same, except splitting when the block returns
2143
2143
  # `true` instead of `false`.
2144
2144
  #
2145
- def chunk_while: () { (Elem elt_before, Elem elt_after) -> boolish } -> ::Enumerator[::Array[Elem], void]
2145
+ def chunk_while: () { (Elem elt_before, Elem elt_after) -> boolish } -> ::Enumerator[::Array[Elem]]
2146
2146
 
2147
2147
  # <!--
2148
2148
  # rdoc-file=enum.c
@@ -2204,7 +2204,7 @@ module Enumerable[unchecked out Elem] : _Each[Elem]
2204
2204
  # Enumerable#chunk_while does the same, except splitting when the block returns
2205
2205
  # `false` instead of `true`.
2206
2206
  #
2207
- def slice_when: () { (Elem elt_before, Elem elt_after) -> boolish } -> ::Enumerator[::Array[Elem], void]
2207
+ def slice_when: () { (Elem elt_before, Elem elt_after) -> boolish } -> ::Enumerator[::Array[Elem]]
2208
2208
 
2209
2209
  # <!--
2210
2210
  # rdoc-file=enum.c
@@ -2239,8 +2239,8 @@ module Enumerable[unchecked out Elem] : _Each[Elem]
2239
2239
  # p e.map {|ll| ll[0...-1].map {|l| l.sub(/\\\n\z/, "") }.join + ll.last }
2240
2240
  # #=>["foo\n", "barbaz\n", "\n", "qux\n"]
2241
2241
  #
2242
- def slice_after: (untyped pattern) -> ::Enumerator[::Array[Elem], void]
2243
- | () { (Elem elt) -> boolish } -> ::Enumerator[::Array[Elem], void]
2242
+ def slice_after: (untyped pattern) -> ::Enumerator[::Array[Elem]]
2243
+ | () { (Elem elt) -> boolish } -> ::Enumerator[::Array[Elem]]
2244
2244
 
2245
2245
  # <!--
2246
2246
  # rdoc-file=enum.c
@@ -2396,6 +2396,6 @@ module Enumerable[unchecked out Elem] : _Each[Elem]
2396
2396
  # }
2397
2397
  # }
2398
2398
  #
2399
- def slice_before: (untyped pattern) -> ::Enumerator[::Array[Elem], void]
2400
- | () { (Elem elt) -> boolish } -> ::Enumerator[::Array[Elem], void]
2399
+ def slice_before: (untyped pattern) -> ::Enumerator[::Array[Elem]]
2400
+ | () { (Elem elt) -> boolish } -> ::Enumerator[::Array[Elem]]
2401
2401
  end
@@ -1,5 +1,5 @@
1
1
  %a{annotate:rdoc:skip}
2
- class Enumerator[unchecked out Elem, out Return]
2
+ class Enumerator[unchecked out Elem, out Return = void]
3
3
  # <!-- rdoc-file=enumerator.c -->
4
4
  # Enumerator::Product generates a Cartesian product of any number of enumerable
5
5
  # objects. Iterating over the product of enumerable objects is roughly
data/core/enumerator.rbs CHANGED
@@ -127,12 +127,12 @@
127
127
  # puts ext_each(o.to_enum) {|*x| puts x; [:b, *x] }
128
128
  # # => [], [:b], [1], [:b, 1], [1, 2], [:b, 1, 2], 3
129
129
  #
130
- class Enumerator[unchecked out Elem, out Return] < Object
130
+ class Enumerator[unchecked out Elem, out Return = void] < Object
131
131
  include Enumerable[Elem]
132
132
 
133
133
  # A convenience interface for `each` with optional block
134
134
  #
135
- interface _Each[out E, out R]
135
+ interface _Each[out E, out R = self]
136
136
  def each: () { (E) -> void } -> R
137
137
  | () -> Enumerator[E, R]
138
138
  end
@@ -567,7 +567,7 @@ end
567
567
  # # This returns an array of items like a normal enumerator does.
568
568
  # all_checked = active_items.select(&:checked)
569
569
  #
570
- class Enumerator::Lazy[out Elem, out Return] < Enumerator[Elem, Return]
570
+ class Enumerator::Lazy[out Elem, out Return = void] < Enumerator[Elem, Return]
571
571
  # <!-- rdoc-file=enumerator.c -->
572
572
  # Expands `lazy` enumerator to an array. See Enumerable#to_a.
573
573
  #
data/core/errors.rbs CHANGED
@@ -597,7 +597,7 @@ class SystemCallError < StandardError
597
597
  # SystemCallError object. The error number is subsequently available via the
598
598
  # #errno method.
599
599
  #
600
- def initialize: (string msg, Integer errno) -> SystemCallError
600
+ def initialize: (string msg, Integer errno) -> void
601
601
 
602
602
  # <!--
603
603
  # rdoc-file=error.c
data/core/exception.rbs CHANGED
@@ -250,7 +250,7 @@ class Exception
250
250
  # -->
251
251
  # Construct a new Exception object, optionally passing in a message.
252
252
  #
253
- def initialize: (?string | _ToS message) -> self
253
+ def initialize: (?string | _ToS message) -> void
254
254
 
255
255
  # <!--
256
256
  # rdoc-file=error.c
data/core/file.rbs CHANGED
@@ -875,7 +875,7 @@ class File < IO
875
875
  # * [Open Options](rdoc-ref:IO@Open+Options).
876
876
  # * [Encoding options](rdoc-ref:encodings.rdoc@Encoding+Options).
877
877
  #
878
- def initialize: (string | _ToPath | int file_name, ?string | int mode, ?int perm) -> File
878
+ def initialize: (string | _ToPath | int file_name, ?string | int mode, ?int perm) -> void
879
879
 
880
880
  # <!--
881
881
  # rdoc-file=file.c
data/core/integer.rbs CHANGED
@@ -1168,10 +1168,10 @@ class Integer < Numeric
1168
1168
  | (to: Numeric, ?by: Integer) { (Integer) -> void } -> void
1169
1169
  | (by: Numeric, ?to: Numeric) { (Numeric) -> void } -> void
1170
1170
  | () -> Enumerator[Integer, bot]
1171
- | (Numeric limit, ?Integer step) -> Enumerator[Integer, void]
1172
- | (Numeric limit, ?Numeric step) -> Enumerator[Numeric, void]
1173
- | (to: Numeric, ?by: Integer) -> Enumerator[Integer, void]
1174
- | (by: Numeric, ?to: Numeric) -> Enumerator[Numeric, void]
1171
+ | (Numeric limit, ?Integer step) -> Enumerator[Integer]
1172
+ | (Numeric limit, ?Numeric step) -> Enumerator[Numeric]
1173
+ | (to: Numeric, ?by: Integer) -> Enumerator[Integer]
1174
+ | (by: Numeric, ?to: Numeric) -> Enumerator[Numeric]
1175
1175
 
1176
1176
  # <!--
1177
1177
  # rdoc-file=numeric.c
data/core/kernel.rbs CHANGED
@@ -282,7 +282,7 @@ module Kernel : BasicObject
282
282
  # 1.class #=> Integer
283
283
  # self.class #=> Object
284
284
  #
285
- def class: () -> Class
285
+ def class: () -> class
286
286
 
287
287
  # <!--
288
288
  # rdoc-file=vm_eval.c
@@ -675,7 +675,7 @@ module Kernel : BasicObject
675
675
  | (int | _ToR rational_like, exception: bool) -> Rational?
676
676
  | (int | _ToR numer, ?int | _ToR denom, ?exception: true) -> Rational
677
677
  | (int | _ToR numer, ?int | _ToR denom, exception: bool) -> Rational?
678
- | [T] (Numeric&_RationalDiv[T] numer, Numeric denom, ?exception: bool) -> T
678
+ | [T] (Numeric & _RationalDiv[T] numer, Numeric denom, ?exception: bool) -> T
679
679
  | [T < Numeric] (T value, 1, ?exception: bool) -> T
680
680
  | (untyped, ?untyped, ?exception: bool) -> Rational?
681
681
 
@@ -1319,7 +1319,7 @@ module Kernel : BasicObject
1319
1319
  # See also Random.rand.
1320
1320
  #
1321
1321
  def self?.rand: (?0) -> Float
1322
- | (int arg0) -> (Integer | Float)
1322
+ | (int arg0) -> Integer
1323
1323
  | (::Range[Integer] arg0) -> Integer?
1324
1324
  | (::Range[Float] arg0) -> Float?
1325
1325
 
data/core/module.rbs CHANGED
@@ -904,7 +904,7 @@ class Module < Object
904
904
  # Assign the module to a constant (name starting uppercase) if you want to treat
905
905
  # it like a regular module.
906
906
  #
907
- def initialize: () -> Object
907
+ def initialize: () -> void
908
908
  | () { (Module arg0) -> untyped } -> void
909
909
 
910
910
  # <!--
data/core/random.rbs CHANGED
@@ -91,7 +91,7 @@ class Random < RBS::Unnamed::Random_Base
91
91
  #
92
92
  # See also Random#rand.
93
93
  #
94
- def self.rand: () -> Float
94
+ def self.rand: (?0) -> Float
95
95
  | (Integer | ::Range[Integer] max) -> Integer
96
96
  | (Float | ::Range[Float] max) -> Float
97
97
  | [T < Numeric] (::Range[T]) -> T
@@ -231,8 +231,8 @@ module RBS
231
231
  #
232
232
  %a{annotate:rdoc:copy:ENV.fetch}
233
233
  def fetch: (String name) -> String
234
- | [X] (String name, X default) -> (String | X)
235
- | [X] (String name) { (String) -> X } -> (String | X)
234
+ | [X] (String name, X default) -> (String | X)
235
+ | [X] (String name) { (String) -> X } -> (String | X)
236
236
 
237
237
  # <!--
238
238
  # rdoc-file=hash.c
@@ -382,7 +382,7 @@ module RBS
382
382
  #
383
383
  %a{annotate:rdoc:copy:ENV.each_pair}
384
384
  def each_pair: () -> ::Enumerator[[ String, String ], self]
385
- | () { ([ String, String ]) -> void } -> self
385
+ | () { ([ String, String ]) -> void } -> self
386
386
 
387
387
  # <!--
388
388
  # rdoc-file=hash.c
@@ -479,7 +479,7 @@ module RBS
479
479
  #
480
480
  %a{annotate:rdoc:copy:ENV.delete_if}
481
481
  def delete_if: () -> ::Enumerator[[ String, String ], self]
482
- | () { (String name, String value) -> boolish } -> self
482
+ | () { (String name, String value) -> boolish } -> self
483
483
 
484
484
  # <!--
485
485
  # rdoc-file=hash.c
@@ -501,7 +501,7 @@ module RBS
501
501
  #
502
502
  %a{annotate:rdoc:copy:ENV.keep_if}
503
503
  def keep_if: () -> ::Enumerator[[ String, String ], self]
504
- | () { (String name, String value) -> boolish } -> self
504
+ | () { (String name, String value) -> boolish } -> self
505
505
 
506
506
  # <!--
507
507
  # rdoc-file=hash.c
@@ -588,7 +588,7 @@ module RBS
588
588
  #
589
589
  %a{annotate:rdoc:copy:ENV.reject!}
590
590
  def reject!: () -> ::Enumerator[[ String, String ], self?]
591
- | () { (String name, String value) -> boolish } -> self?
591
+ | () { (String name, String value) -> boolish } -> self?
592
592
 
593
593
  # <!--
594
594
  # rdoc-file=hash.c
@@ -674,7 +674,7 @@ module RBS
674
674
  #
675
675
  %a{annotate:rdoc:copy:ENV.select!}
676
676
  def select!: () -> ::Enumerator[[ String, String ], self?]
677
- | () { (String name, String value) -> boolish } -> self?
677
+ | () { (String name, String value) -> boolish } -> self?
678
678
 
679
679
  # <!--
680
680
  # rdoc-file=hash.c
@@ -47,7 +47,7 @@ module RBS
47
47
  # (`-`) and add (`+`)methods, or rand will raise an ArgumentError.
48
48
  #
49
49
  %a{annotate:rdoc:copy:Random#rand}
50
- def rand: () -> Float
50
+ def rand: (?0) -> Float
51
51
  | (Integer | ::Range[Integer] max) -> Integer
52
52
  | (Float | ::Range[Float] max) -> Float
53
53
 
@@ -200,13 +200,13 @@ module RBS
200
200
  # Generates formatted random number from raw random bytes. See Random#rand.
201
201
  #
202
202
  %a{annotate:rdoc:copy:Random::Formatter#rand}
203
- def rand: () -> Float
204
- | (?Float? n) -> Float
205
- | (?Integer? n) -> Integer
206
- | (?Numeric? n) -> Numeric
207
- | (?::Range[Float]? n) -> Float
208
- | (?::Range[Integer]? n) -> Integer
209
- | (?::Range[Numeric]? n) -> Numeric
203
+ def rand: (?0) -> Float
204
+ | (Float? n) -> Float
205
+ | (Integer n) -> Integer
206
+ | (Numeric n) -> Numeric
207
+ | (::Range[Float] n) -> Float
208
+ | (::Range[Integer] n) -> Integer
209
+ | (::Range[Numeric] n) -> Numeric
210
210
 
211
211
  %a{annotate:rdoc:copy:Random::Formatter#random_byte}
212
212
  def random_bytes: (?Integer? n) -> String
@@ -224,12 +224,12 @@ module RBS
224
224
  #
225
225
  %a{annotate:rdoc:copy:Random::Formatter#random_number}
226
226
  def random_number: () -> Float
227
- | (?Float? n) -> Float
228
- | (?Integer? n) -> Integer
229
- | (?Numeric? n) -> Numeric
230
- | (?::Range[Float]? n) -> Float
231
- | (?::Range[Integer]? n) -> Integer
232
- | (?::Range[Numeric]? n) -> Numeric
227
+ | (?Float? n) -> Float
228
+ | (?Integer? n) -> Integer
229
+ | (?Numeric? n) -> Numeric
230
+ | (?::Range[Float]? n) -> Float
231
+ | (?::Range[Integer]? n) -> Integer
232
+ | (?::Range[Numeric]? n) -> Numeric
233
233
 
234
234
  # <!--
235
235
  # rdoc-file=lib/random/formatter.rb
data/core/regexp.rbs CHANGED
@@ -1596,8 +1596,8 @@ class Regexp
1596
1596
  # r3 = Regexp.new(r, timeout: 3.14) # => /foo/m
1597
1597
  # r3.timeout # => 3.14
1598
1598
  #
1599
- def initialize: (Regexp regexp, ?timeout: _ToF?) -> self
1600
- | (string pattern, ?int | string | bool | nil options, ?timeout: _ToF?) -> self
1599
+ def initialize: (Regexp regexp, ?timeout: _ToF?) -> void
1600
+ | (string pattern, ?int | string | bool | nil options, ?timeout: _ToF?) -> void
1601
1601
 
1602
1602
  def initialize_copy: (self object) -> self
1603
1603
 
data/core/thread.rbs CHANGED
@@ -1545,7 +1545,7 @@ end
1545
1545
  #
1546
1546
  # consumer.join
1547
1547
  #
1548
- class Thread::Queue < Object
1548
+ class Thread::Queue[Elem = untyped] < Object
1549
1549
  # <!-- rdoc-file=thread_sync.c -->
1550
1550
  # Pushes the given `object` to the queue.
1551
1551
  #
@@ -1661,7 +1661,7 @@ class Thread::Queue < Object
1661
1661
  # If `timeout` seconds have passed and no data is available `nil` is returned.
1662
1662
  # If `timeout` is `0` it returns immediately.
1663
1663
  #
1664
- def pop: (?boolish non_block, ?timeout: _ToF?) -> untyped
1664
+ def pop: (?boolish non_block, ?timeout: _ToF?) -> Elem?
1665
1665
 
1666
1666
  # <!--
1667
1667
  # rdoc-file=thread_sync.c
@@ -1671,7 +1671,7 @@ class Thread::Queue < Object
1671
1671
  # -->
1672
1672
  # Pushes the given `object` to the queue.
1673
1673
  #
1674
- def push: (untyped obj) -> void
1674
+ def push: (Elem obj) -> void
1675
1675
 
1676
1676
  # <!--
1677
1677
  # rdoc-file=thread_sync.rb
@@ -1692,7 +1692,7 @@ end
1692
1692
  #
1693
1693
  # See Thread::Queue for an example of how a Thread::SizedQueue works.
1694
1694
  #
1695
- class Thread::SizedQueue < Thread::Queue
1695
+ class Thread::SizedQueue[Elem = untyped] < Thread::Queue[Elem]
1696
1696
  # <!--
1697
1697
  # rdoc-file=thread_sync.rb
1698
1698
  # - <<(object, non_block = false, timeout: nil)
@@ -1755,7 +1755,8 @@ class Thread::SizedQueue < Thread::Queue
1755
1755
  # If `timeout` seconds have passed and no space is available `nil` is returned.
1756
1756
  # If `timeout` is `0` it returns immediately. Otherwise it returns `self`.
1757
1757
  #
1758
- def push: (untyped obj, ?boolish non_block, timeout: _ToF?) -> void
1758
+ def push: (Elem obj, ?boolish non_block) -> void
1759
+ | (Elem obj, timeout: _ToF?) -> self?
1759
1760
  end
1760
1761
 
1761
1762
  class ConditionVariable = Thread::ConditionVariable
data/core/trace_point.rbs CHANGED
@@ -352,8 +352,8 @@ class TracePoint
352
352
  # trace.enable { p tp.lineno }
353
353
  # #=> RuntimeError: access from outside
354
354
  #
355
- def enable: (?target: Method | RubyVM::InstructionSequence | Proc | nil, ?target_line: int?, ?target_thread: Thread | :default | nil) -> bool
356
- | [T] (?target: Method | RubyVM::InstructionSequence | Proc | nil, ?target_line: int?, ?target_thread: Thread | :default | nil) { () -> T } -> T
355
+ def enable: (?target: Method | UnboundMethod | RubyVM::InstructionSequence | Proc | nil, ?target_line: int?, ?target_thread: Thread | :default | nil) -> bool
356
+ | [T] (?target: Method | UnboundMethod | RubyVM::InstructionSequence | Proc | nil, ?target_line: int?, ?target_thread: Thread | :default | nil) { () -> T } -> T
357
357
 
358
358
  # <!--
359
359
  # rdoc-file=trace_point.rb
data/docs/syntax.md CHANGED
@@ -424,8 +424,10 @@ _visibility_ ::= `public` | `private`
424
424
 
425
425
  _attribute-type_ ::= `attr_reader` | `attr_writer` | `attr_accessor`
426
426
 
427
- _include-member_ ::= `include` _class-name_ _type-arguments_
428
- | `include` _interface-name_ _type-arguments_
427
+ _include-member_ ::= _include-class-member_
428
+ | _include-interface-member_
429
+ _include-class-member_ ::= `include` _class-name_ _type-arguments_
430
+ _include-interface-member_ :== `include` _interface-name_ _type-arguments_
429
431
  _extend-member_ ::= `extend` _class-name_ _type-arguments_
430
432
  | `extend` _interface-name_ _type-arguments_
431
433
  _prepend-member_ ::= `prepend` _class-name_ _type-arguments_
@@ -621,7 +623,7 @@ _module-self-types_ ::= _class-name_ _type-arguments_ `,` _module-self-types_
621
623
  _interface-decl_ ::= `interface` _interface-name_ _module-type-parameters_ _interface-members_ `end`
622
624
 
623
625
  _interface-members_ ::= _method-member_ # Method
624
- | _include-member_ # Mixin (include)
626
+ | _include-interface-member_ # Mixin (include)
625
627
  | _alias-member_ # Alias
626
628
 
627
629
  _type-alias-decl_ ::= `type` _alias-name_ _module-type-parameters_ `=` _type_
@@ -116,7 +116,7 @@ token rbsparser_next_token(lexstate *state) {
116
116
  yy1:
117
117
  rbs_skip(state);
118
118
  #line 144 "ext/rbs_extension/lexer.re"
119
- { return next_token(state, pEOF); }
119
+ { return next_eof_token(state); }
120
120
  #line 121 "ext/rbs_extension/lexer.c"
121
121
  yy2:
122
122
  rbs_skip(state);
@@ -167,6 +167,11 @@ void skipn(lexstate *state, size_t size);
167
167
  * */
168
168
  token next_token(lexstate *state, enum TokenType type);
169
169
 
170
+ /**
171
+ * Return new token with EOF type.
172
+ * */
173
+ token next_eof_token(lexstate *state);
174
+
170
175
  token rbsparser_next_token(lexstate *state);
171
176
 
172
177
  void print_token(token tok);
@@ -141,7 +141,7 @@ token rbsparser_next_token(lexstate *state) {
141
141
  skip = ([ \t]+|[\r\n]);
142
142
 
143
143
  skip { return next_token(state, tTRIVIA); }
144
- "\x00" { return next_token(state, pEOF); }
144
+ "\x00" { return next_eof_token(state); }
145
145
  * { return next_token(state, ErrorToken); }
146
146
  */
147
147
  }