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

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f9c653ea578000329720980ce7845237e8c49c9319a72c5a4f5bc315306cde02
4
- data.tar.gz: e9ccad52c36cd4ef0509ce78ab0d857810b80ed6489d8b6b1fcdac0af47f5e59
3
+ metadata.gz: 6884f033b29e9db43f782ee20e91a89d329fa51271d015fe0d25d4f4c1dd8166
4
+ data.tar.gz: 11db8e1f37cae5204b74d126c80e7b6b75990a33dec81f00519967a517cdf17e
5
5
  SHA512:
6
- metadata.gz: c2468b174c0800686e77f26122898d84e2f2506b5b91074d30d18766ce60992257bd560843972ddf72c77e9b8bda26dfb58f012893dbae1585f994fecd480a7b
7
- data.tar.gz: 9c534d38496760cc1ad91f8776e83e61672305c564c6b14fc206fd202817a5be2d60d675558dfbe6b9fadbf9f980c595c2432c821cae38a5b447857d5601ab5e
6
+ metadata.gz: 9193fb829e1503c2179cc802c20b37bd1b8ed25417bf032a642da25689e0709a753525f5bf2424c57caf4bc57aeb9a5cf03c0062b11e2d36632b1e8b6ae77c31
7
+ data.tar.gz: 13a766ee6f81f3ad426af8e6de51289fea8d656b848d038afc15fc21eda0fabc3f525e5035df02b09948113ae0f8ada0965ede862cd17efb52a72ce42631862a
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,81 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 3.6.0.pre.1 (2024-09-17)
4
+
5
+ ### Signature updates
6
+
7
+ * 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))
8
+ * digest ([#1880](https://github.com/ruby/rbs/pull/1880))
9
+ * kconv ([#1857](https://github.com/ruby/rbs/pull/1857))
10
+ * zlib ([#1911](https://github.com/ruby/rbs/pull/1911))
11
+ * `_Each` ([#2006](https://github.com/ruby/rbs/pull/2006))
12
+ * `Array` ([#1921](https://github.com/ruby/rbs/pull/1921))
13
+ * `Enumerable` ([#1921](https://github.com/ruby/rbs/pull/1921))
14
+ * `Enumerator::_Each` ([#2006](https://github.com/ruby/rbs/pull/2006), [#1915](https://github.com/ruby/rbs/pull/1915))
15
+ * `Enumerator` ([#2004](https://github.com/ruby/rbs/pull/2004))
16
+ * `Kernel` ([#1945](https://github.com/ruby/rbs/pull/1945))
17
+ * `Method` ([#1939](https://github.com/ruby/rbs/pull/1939))
18
+ * `Module` ([#1921](https://github.com/ruby/rbs/pull/1921))
19
+ * `Net::HTTPHeader` ([#1932](https://github.com/ruby/rbs/pull/1932))
20
+ * `Proc` ([#1937](https://github.com/ruby/rbs/pull/1937))
21
+ * `Queue` ([#2004](https://github.com/ruby/rbs/pull/2004))
22
+ * `Range` ([#1921](https://github.com/ruby/rbs/pull/1921))
23
+ * `Refinement` ([#1931](https://github.com/ruby/rbs/pull/1931))
24
+ * `Symbol` ([#1930](https://github.com/ruby/rbs/pull/1930))
25
+ * `TracePoint` ([#1943](https://github.com/ruby/rbs/pull/1943))
26
+ * `#rand` ([#2007](https://github.com/ruby/rbs/pull/2007))
27
+ * Use untyped blocks ([#1935](https://github.com/ruby/rbs/pull/1935))
28
+ * Update docs for ruby-3.3.4 ([#1923](https://github.com/ruby/rbs/pull/1923))
29
+ * Update docs for ruby-3.3.3 ([#1889](https://github.com/ruby/rbs/pull/1889))
30
+
31
+ ### Language updates
32
+
33
+ * Fix position for default_type ([#1997](https://github.com/ruby/rbs/pull/1997))
34
+ * Update `syntax.md` ([#1995](https://github.com/ruby/rbs/pull/1995))
35
+ * Improve generics ([#1994](https://github.com/ruby/rbs/pull/1994))
36
+ * Allow alias to module-self-type from module ([#1948](https://github.com/ruby/rbs/pull/1948))
37
+ * Make it a syntax error when the keys of keyword and record are duplicated. ([#1883](https://github.com/ruby/rbs/pull/1883))
38
+
39
+ ### Library changes
40
+
41
+ * Omit unnecessary field from location range ([#1788](https://github.com/ruby/rbs/pull/1788))
42
+ * Handle ISEQs compiled by Prism ([#1983](https://github.com/ruby/rbs/pull/1983))
43
+ * Add AST Visitor ([#1975](https://github.com/ruby/rbs/pull/1975))
44
+ * Make the extension `GC.auto_compact` compatible ([#1971](https://github.com/ruby/rbs/pull/1971))
45
+ * Make `FileFinder` faster by globbing all possible files ([#1965](https://github.com/ruby/rbs/pull/1965))
46
+ * Fix #1905: Fix typo in `UntypedFunction` ([#1906](https://github.com/ruby/rbs/pull/1906))
47
+
48
+ #### rbs prototype
49
+
50
+ * [prototype] Remove redundant access modifier ([#1914](https://github.com/ruby/rbs/pull/1914))
51
+
52
+ ### Miscellaneous
53
+
54
+ * Allow RBS/Style/InitializeReturnType ([#2008](https://github.com/ruby/rbs/pull/2008))
55
+ * docs: An interface can include interfaces only and not modules ([#1996](https://github.com/ruby/rbs/pull/1996))
56
+ * Fix the portability of an external command ([#2001](https://github.com/ruby/rbs/pull/2001))
57
+ * Skip `AbstractSyntaxTree` test with ruby-3.4 ([#2005](https://github.com/ruby/rbs/pull/2005))
58
+ * Fix test ([#1972](https://github.com/ruby/rbs/pull/1972))
59
+ * Use `File.open` instead of `IO.sysopen` ([#1912](https://github.com/ruby/rbs/pull/1912))
60
+
61
+ ## 3.5.3 (2024-08-23)
62
+
63
+ ### Library changes
64
+
65
+ * Backport GC fix PR ([#1977](https://github.com/ruby/rbs/pull/1977))
66
+
67
+ ## 3.5.2 (2024-07-10)
68
+
69
+ ### Library changes
70
+
71
+ * 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))
72
+ * 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))
73
+ * Fix #1905: Fix typo in `UntypedFunction` ([#1906](https://github.com/ruby/rbs/pull/1906), Backported in [#1925](https://github.com/ruby/rbs/pull/1925))
74
+
75
+ ### Miscellaneous
76
+
77
+ * Use `File.open` instead of `IO.sysopen` ([#1913](https://github.com/ruby/rbs/pull/1913))
78
+
3
79
  ## 3.5.1 (2024-06-07)
4
80
 
5
81
  ### 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
@@ -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/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
  }
@@ -129,6 +129,22 @@ token next_token(lexstate *state, enum TokenType type) {
129
129
  return t;
130
130
  }
131
131
 
132
+ token next_eof_token(lexstate *state) {
133
+ if (state->current.byte_pos == RSTRING_LEN(state->string)+1) {
134
+ // End of String
135
+ token t;
136
+ t.type = pEOF;
137
+ t.range.start = state->start;
138
+ t.range.end = state->start;
139
+ state->start = state->current;
140
+
141
+ return t;
142
+ } else {
143
+ // NULL byte in the middle of the string
144
+ return next_token(state, pEOF);
145
+ }
146
+ }
147
+
132
148
  void rbs_skip(lexstate *state) {
133
149
  if (!state->last_char) {
134
150
  peek(state);