rbs 1.1.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +5 -1
  3. data/.gitignore +2 -0
  4. data/CHANGELOG.md +81 -0
  5. data/README.md +1 -1
  6. data/Rakefile +11 -0
  7. data/Steepfile +1 -0
  8. data/core/array.rbs +2 -2
  9. data/core/basic_object.rbs +1 -1
  10. data/core/enumerable.rbs +1 -1
  11. data/core/hash.rbs +13 -5
  12. data/core/io.rbs +4 -4
  13. data/core/kernel.rbs +2 -2
  14. data/core/marshal.rbs +4 -3
  15. data/core/module.rbs +1 -1
  16. data/core/numeric.rbs +10 -0
  17. data/core/proc.rbs +1 -1
  18. data/core/random.rbs +4 -2
  19. data/core/range.rbs +2 -2
  20. data/core/struct.rbs +3 -2
  21. data/core/thread.rbs +1 -1
  22. data/docs/CONTRIBUTING.md +5 -3
  23. data/docs/rbs_by_example.md +328 -0
  24. data/docs/sigs.md +21 -2
  25. data/docs/stdlib.md +1 -1
  26. data/docs/syntax.md +11 -14
  27. data/lib/rbs.rb +1 -0
  28. data/lib/rbs/ast/annotation.rb +2 -2
  29. data/lib/rbs/ast/comment.rb +2 -2
  30. data/lib/rbs/ast/declarations.rb +37 -22
  31. data/lib/rbs/ast/members.rb +26 -26
  32. data/lib/rbs/cli.rb +3 -0
  33. data/lib/rbs/constant_table.rb +4 -1
  34. data/lib/rbs/definition.rb +1 -1
  35. data/lib/rbs/definition_builder.rb +16 -18
  36. data/lib/rbs/definition_builder/ancestor_builder.rb +10 -2
  37. data/lib/rbs/definition_builder/method_builder.rb +4 -2
  38. data/lib/rbs/errors.rb +36 -0
  39. data/lib/rbs/location.rb +106 -2
  40. data/lib/rbs/locator.rb +205 -0
  41. data/lib/rbs/method_type.rb +2 -2
  42. data/lib/rbs/parser.rb +1315 -962
  43. data/lib/rbs/parser.y +411 -75
  44. data/lib/rbs/prototype/rb.rb +7 -3
  45. data/lib/rbs/prototype/runtime.rb +118 -42
  46. data/lib/rbs/test/hook.rb +8 -2
  47. data/lib/rbs/type_name.rb +2 -3
  48. data/lib/rbs/type_name_resolver.rb +1 -1
  49. data/lib/rbs/types.rb +36 -34
  50. data/lib/rbs/version.rb +1 -1
  51. data/lib/rbs/writer.rb +4 -2
  52. data/rbs.gemspec +1 -1
  53. data/sig/ancestor_builder.rbs +2 -0
  54. data/sig/annotation.rbs +1 -1
  55. data/sig/cli.rbs +31 -21
  56. data/sig/comment.rbs +1 -1
  57. data/sig/declarations.rbs +106 -21
  58. data/sig/environment.rbs +2 -2
  59. data/sig/errors.rbs +15 -0
  60. data/sig/location.rbs +84 -3
  61. data/sig/locator.rbs +44 -0
  62. data/sig/members.rbs +76 -12
  63. data/sig/method_builder.rbs +1 -1
  64. data/sig/method_types.rbs +1 -1
  65. data/sig/namespace.rbs +1 -1
  66. data/sig/polyfill.rbs +4 -17
  67. data/sig/rbs.rbs +8 -4
  68. data/sig/typename.rbs +1 -1
  69. data/sig/types.rbs +67 -20
  70. data/sig/util.rbs +0 -4
  71. data/sig/writer.rbs +8 -2
  72. data/stdlib/dbm/0/dbm.rbs +43 -30
  73. data/stdlib/mutex_m/0/mutex_m.rbs +1 -1
  74. data/stdlib/net-http/0/net-http.rbs +1846 -0
  75. data/stdlib/optparse/0/optparse.rbs +1214 -0
  76. data/stdlib/resolv/0/resolv.rbs +1504 -0
  77. data/stdlib/rubygems/0/requirement.rbs +84 -2
  78. data/stdlib/rubygems/0/rubygems.rbs +2 -2
  79. data/stdlib/rubygems/0/version.rbs +2 -1
  80. data/stdlib/shellwords/0/shellwords.rbs +252 -0
  81. data/stdlib/socket/0/addrinfo.rbs +469 -0
  82. data/stdlib/socket/0/basic_socket.rbs +503 -0
  83. data/stdlib/socket/0/ip_socket.rbs +72 -0
  84. data/stdlib/socket/0/socket.rbs +2687 -0
  85. data/stdlib/socket/0/tcp_server.rbs +177 -0
  86. data/stdlib/socket/0/tcp_socket.rbs +35 -0
  87. data/stdlib/socket/0/udp_socket.rbs +111 -0
  88. data/stdlib/socket/0/unix_server.rbs +154 -0
  89. data/stdlib/socket/0/unix_socket.rbs +132 -0
  90. data/stdlib/timeout/0/timeout.rbs +5 -0
  91. data/steep/Gemfile.lock +19 -16
  92. metadata +18 -11
  93. data/bin/annotate-with-rdoc +0 -153
  94. data/bin/console +0 -14
  95. data/bin/query-rdoc +0 -103
  96. data/bin/rbs-prof +0 -9
  97. data/bin/run_in_md.rb +0 -49
  98. data/bin/setup +0 -8
  99. data/bin/sort +0 -89
  100. data/bin/steep +0 -4
  101. data/bin/test_runner.rb +0 -29
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e7a862e1af5773b464ebf201344cf823512ca551df1f827825328863225a26c8
4
- data.tar.gz: 2853162048f342a1dad949b518887e82bc4ede46d79d57626fabb49e2edf920d
3
+ metadata.gz: ab99593166ee140ca3ffc517eddcd872c6798dcb41a991c1e67c0c16a2a86fc9
4
+ data.tar.gz: a4e5cdd454fb49ddd499ba3382e118f8789b5413d0607ad9e3652551839c0ca3
5
5
  SHA512:
6
- metadata.gz: 99fbc15297542d7d0bd952806556b128e071a7f31e0f175b573f77c00db3ec4a6ddd473f33aaf170f2a08f99991939cbcc0484d4287413c9e2b55dfbadc7dff0
7
- data.tar.gz: 3553c8cc89269a9579ccd52d3c9f61bd44f4f6117856da23726930c5c5b17f5aa5da7f1d69a9748fffc1b2fe62587149856a2c1ddee0fed79fb155be6aee6037
6
+ metadata.gz: 8d660c0dd7796bad07fac8e2ee85968e91259af0a4c9fed2c8668f0d6e385a517160d5792702181e18923929a3de7ded420c84e2184cb83a852d2133c1f34050
7
+ data.tar.gz: 4991d9a71cd0bd2bd2832d7764a8d65a73de146fecf76d3ccd67a41599326ca45b091e559acededcd095a44cdef6e32cc01fbb742e04bba945269b4e21a6444c
@@ -18,7 +18,11 @@ jobs:
18
18
  job:
19
19
  - test
20
20
  - stdlib_test
21
- - rubocop validate test_doc build test_generate_stdlib confirm_parser
21
+ - rubocop validate test_doc build test_generate_stdlib
22
+ - confirm_parser
23
+ exclude:
24
+ - container_tag: master-nightly-focal
25
+ job: confirm_parser
22
26
  container:
23
27
  image: rubylang/ruby:${{ matrix.container_tag }}
24
28
  steps:
data/.gitignore CHANGED
@@ -1,4 +1,5 @@
1
1
  /.bundle/
2
+ /steep/.bundle/
2
3
  /.yardoc
3
4
  /_yardoc/
4
5
  /coverage/
@@ -9,3 +10,4 @@
9
10
  /lib/rbs/parser.output
10
11
  /vendor/sigs
11
12
  /Gemfile.lock
13
+
data/CHANGELOG.md CHANGED
@@ -2,6 +2,87 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## 1.3.0 (2021-07-20)
6
+
7
+ ### Summary
8
+
9
+ RBS 1.3.0 includes bug fixees of the parser and class/module definition validations.
10
+
11
+ ### Signature updates
12
+
13
+ * dbm ([#718](https://github.com/ruby/rbs/pull/718))
14
+ * net-http ([#686](https://github.com/ruby/rbs/pull/686))
15
+ * optparse ([#693](https://github.com/ruby/rbs/pull/693))
16
+ * resolv ([#697](https://github.com/ruby/rbs/pull/697))
17
+ * socket ([#699](https://github.com/ruby/rbs/pull/699))
18
+ * `IO` ([#698](https://github.com/ruby/rbs/pull/698))
19
+ * `Marshal` ([#684](https://github.com/ruby/rbs/pull/684))
20
+ * `Mutex` ([#683](https://github.com/ruby/rbs/pull/683))
21
+ * `Array#shift` ([#707](https://github.com/ruby/rbs/pull/707))
22
+ * `BasicObject#method_missing` ([#707](https://github.com/ruby/rbs/pull/706), [#710](https://github.com/ruby/rbs/pull/710))
23
+ * `Kernel#caller` ([#705](https://github.com/ruby/rbs/pull/705))
24
+
25
+ ### Library changes
26
+
27
+ * Interface names starting with lower case characters are now syntax error ([#678](https://github.com/ruby/rbs/pull/678), [#720](https://github.com/ruby/rbs/pull/720))
28
+ * Mixins of classes are rejected ([#681](https://github.com/ruby/rbs/pull/681))
29
+ * Generate prototype of `initialize` method with return type `void` ([#685](https://github.com/ruby/rbs/pull/685))
30
+ * Let `prototype runtime` generate class/module declarations in nested syntax ([#700](https://github.com/ruby/rbs/pull/700))
31
+ * Fix race condition for multi-thread support ([#702](https://github.com/ruby/rbs/pull/702))
32
+
33
+ ### Miscellaneous
34
+
35
+ * Add new doc `docs/rbs_by_example.md` ([#694](https://github.com/ruby/rbs/pull/694))
36
+
37
+ ## 1.2.1 (2021-05-27)
38
+
39
+ This release includes the following minor changes:
40
+
41
+ * Fix test to run the tests in ruby repository. ([#679](https://github.com/ruby/rbs/pull/679))
42
+ * Remove unnecessary files from the gem package. ([#675](https://github.com/ruby/rbs/pull/675))
43
+ * Suppress unused variable warning ([#674](https://github.com/ruby/rbs/pull/674))
44
+ * Update documents ([#672](https://github.com/ruby/rbs/pull/672))
45
+
46
+ ## 1.2.0 (2021-04-21)
47
+
48
+ ### Summary
49
+
50
+ 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.
51
+
52
+ ### Signature updates
53
+
54
+ * 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), )
55
+ * Module ([\#645](https://github.com/ruby/rbs/pull/645))
56
+ * Enumerable ([\#647](https://github.com/ruby/rbs/pull/647))
57
+ * Array ([\#648](https://github.com/ruby/rbs/pull/648))
58
+ * Proc ([\#649](https://github.com/ruby/rbs/pull/649))
59
+ * Struct ([\#650](https://github.com/ruby/rbs/pull/650), [\#668](https://github.com/ruby/rbs/pull/668))
60
+ * Thread ([\#651](https://github.com/ruby/rbs/pull/651))
61
+ * Random ([\#669](https://github.com/ruby/rbs/pull/669))
62
+ * Shellwords ([\#665](https://github.com/ruby/rbs/pull/665))
63
+ * IO ([\#659](https://github.com/ruby/rbs/pull/659))
64
+
65
+ ### Language updates
66
+
67
+ * Module self type syntax update ([\#653](https://github.com/ruby/rbs/pull/653))
68
+
69
+ ### Library changes
70
+
71
+ * Token locations ([\#666](https://github.com/ruby/rbs/pull/666))
72
+ * Add RBS::Locator ([\#667](https://github.com/ruby/rbs/pull/667))
73
+ * Fix runtime type checker ([\#644](https://github.com/ruby/rbs/pull/644))
74
+
75
+ ### Miscellaneous
76
+
77
+ * Update documentation for overloading ([\#658](https://github.com/ruby/rbs/pull/658))
78
+ * Update target ruby version ([\#633](https://github.com/ruby/rbs/pull/633))
79
+
80
+ ## 1.1.1 (2021-03-12)
81
+
82
+ ### Signature updates
83
+
84
+ * rubygem ([#630](https://github.com/ruby/rbs/pull/630))
85
+
5
86
  ## 1.1.0 (2021-03-08)
6
87
 
7
88
  ### Summary
data/README.md CHANGED
@@ -7,7 +7,7 @@ It also allows declaring constants and global variables.
7
7
  The following is a small example of RBS for a chat app.
8
8
 
9
9
  <!-- run-start:a.rbs:bundle exec rbs -I a.rbs validate -->
10
- ```rbs
10
+ ```rb
11
11
  module ChatApp
12
12
  VERSION: String
13
13
 
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")
@@ -52,6 +54,15 @@ task :validate => :parser do
52
54
  lib << "singleton"
53
55
  end
54
56
 
57
+ if lib == ["net-http"]
58
+ lib << "uri"
59
+ end
60
+
61
+ if lib == ["resolv"]
62
+ lib << "socket"
63
+ lib << "timeout"
64
+ end
65
+
55
66
  sh "#{ruby} #{rbs} #{lib.map {|l| "-r #{l}"}.join(" ")} validate --silent"
56
67
  end
57
68
  end
data/Steepfile CHANGED
@@ -7,6 +7,7 @@ target :lib do
7
7
  library "set", "pathname", "json", "logger", "monitor", "tsort"
8
8
  signature "stdlib/strscan/0/"
9
9
  signature "stdlib/rubygems/0/"
10
+ signature "stdlib/optparse/0/"
10
11
  end
11
12
 
12
13
  # target :lib do
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
  #
@@ -1637,7 +1637,7 @@ class Array[unchecked out Elem] < Object
1637
1637
  # args #=> ["filename"]
1638
1638
  #
1639
1639
  def shift: () -> Elem?
1640
- | (?int n) -> ::Array[Elem]
1640
+ | (int n) -> ::Array[Elem]
1641
1641
 
1642
1642
  # Returns a new array with elements of `self` shuffled.
1643
1643
  #
@@ -215,7 +215,7 @@ class BasicObject
215
215
  # r.xxiii #=> 23
216
216
  # r.mm #=> 2000
217
217
  #
218
- def method_missing: (Symbol, *untyped) -> untyped
218
+ def method_missing: (Symbol, *untyped, **untyped) ?{ (*untyped, **untyped) -> untyped } -> untyped
219
219
 
220
220
  # Invoked as a callback whenever a singleton method is added to the receiver.
221
221
  #
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
 
@@ -746,7 +746,7 @@ class IO < Object
746
746
 
747
747
  def self.readlines: (String name, ?String sep, ?Integer limit, ?external_encoding: String external_encoding, ?internal_encoding: String internal_encoding, ?encoding: String encoding, ?textmode: untyped textmode, ?binmode: untyped binmode, ?autoclose: untyped autoclose, ?mode: String mode) -> ::Array[String]
748
748
 
749
- def self.select: (::Array[io]? read_array, ?::Array[io]? write_array, ?::Array[io]? error_array, ?Integer? timeout) -> ::Array[::Array[io]]?
749
+ def self.select: (::Array[io]? read_array, ?::Array[io]? write_array, ?::Array[io]? error_array, ?Numeric? timeout) -> ::Array[::Array[io]]?
750
750
 
751
751
  def self.sysopen: (String path, ?String mode, ?String perm) -> Integer
752
752
 
data/core/kernel.rbs CHANGED
@@ -13,8 +13,8 @@
13
13
  module Kernel : BasicObject
14
14
  private
15
15
 
16
- def self?.caller: (?Integer start_or_range, ?Integer length) -> ::Array[String]?
17
- | (?::Range[Integer] start_or_range) -> ::Array[String]?
16
+ def self?.caller: (Integer start_or_range, ?Integer length) -> ::Array[String]?
17
+ | (::Range[Integer] start_or_range) -> ::Array[String]?
18
18
  | () -> ::Array[String]
19
19
 
20
20
  def self?.caller_locations: (?Integer start_or_range, ?Integer length) -> ::Array[Thread::Backtrace::Location]?
data/core/marshal.rbs CHANGED
@@ -136,8 +136,8 @@ module Marshal
136
136
  # ThreadGroup, Continuation
137
137
  # * objects which define singleton methods
138
138
  #
139
- def self.dump: (Object arg0, ?IO arg1, ?Integer arg2) -> Object
140
- | (Object arg0, ?Integer arg1) -> Object
139
+ def self.dump: (untyped obj, untyped port, ?Integer limit) -> untyped
140
+ | (untyped obj, ?Integer limit) -> String
141
141
 
142
142
  # Returns the result of converting the serialized data in source into a Ruby
143
143
  # object (possibly with associated subordinate objects). source may be either an
@@ -147,7 +147,8 @@ module Marshal
147
147
  # Never pass untrusted data (including user supplied input) to this method.
148
148
  # Please see the overview for further details.
149
149
  #
150
- def self.load: (String arg0, ?Proc arg1) -> Object
150
+ def self.load: (String | untyped port) -> untyped
151
+ | [A] (String | untyped port, ^(untyped) -> A) -> A
151
152
 
152
153
  alias self.restore self.load
153
154
  end
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