rbs 1.1.1 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +5 -1
- data/.gitignore +2 -0
- data/CHANGELOG.md +81 -0
- data/README.md +1 -1
- data/Rakefile +11 -0
- data/Steepfile +1 -0
- data/core/array.rbs +2 -2
- data/core/basic_object.rbs +1 -1
- data/core/enumerable.rbs +1 -1
- data/core/hash.rbs +13 -5
- data/core/io.rbs +4 -4
- data/core/kernel.rbs +2 -2
- data/core/marshal.rbs +4 -3
- data/core/module.rbs +1 -1
- data/core/numeric.rbs +10 -0
- data/core/proc.rbs +1 -1
- data/core/random.rbs +4 -2
- data/core/range.rbs +2 -2
- data/core/struct.rbs +3 -2
- data/core/thread.rbs +1 -1
- data/docs/CONTRIBUTING.md +5 -3
- data/docs/rbs_by_example.md +328 -0
- data/docs/sigs.md +21 -2
- data/docs/stdlib.md +1 -1
- data/docs/syntax.md +11 -14
- data/lib/rbs.rb +1 -0
- data/lib/rbs/ast/annotation.rb +2 -2
- data/lib/rbs/ast/comment.rb +2 -2
- data/lib/rbs/ast/declarations.rb +37 -22
- data/lib/rbs/ast/members.rb +26 -26
- data/lib/rbs/cli.rb +3 -0
- data/lib/rbs/constant_table.rb +4 -1
- data/lib/rbs/definition.rb +1 -1
- data/lib/rbs/definition_builder.rb +16 -18
- data/lib/rbs/definition_builder/ancestor_builder.rb +10 -2
- data/lib/rbs/definition_builder/method_builder.rb +4 -2
- data/lib/rbs/errors.rb +36 -0
- data/lib/rbs/location.rb +106 -2
- data/lib/rbs/locator.rb +205 -0
- data/lib/rbs/method_type.rb +2 -2
- data/lib/rbs/parser.rb +1315 -962
- data/lib/rbs/parser.y +411 -75
- data/lib/rbs/prototype/rb.rb +7 -3
- data/lib/rbs/prototype/runtime.rb +118 -42
- data/lib/rbs/test/hook.rb +8 -2
- data/lib/rbs/type_name.rb +2 -3
- data/lib/rbs/type_name_resolver.rb +1 -1
- data/lib/rbs/types.rb +36 -34
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs/writer.rb +4 -2
- data/rbs.gemspec +1 -1
- data/sig/ancestor_builder.rbs +2 -0
- data/sig/annotation.rbs +1 -1
- data/sig/cli.rbs +31 -21
- data/sig/comment.rbs +1 -1
- data/sig/declarations.rbs +106 -21
- data/sig/environment.rbs +2 -2
- data/sig/errors.rbs +15 -0
- data/sig/location.rbs +84 -3
- data/sig/locator.rbs +44 -0
- data/sig/members.rbs +76 -12
- data/sig/method_builder.rbs +1 -1
- data/sig/method_types.rbs +1 -1
- data/sig/namespace.rbs +1 -1
- data/sig/polyfill.rbs +4 -17
- data/sig/rbs.rbs +8 -4
- data/sig/typename.rbs +1 -1
- data/sig/types.rbs +60 -19
- data/sig/util.rbs +0 -4
- data/sig/writer.rbs +8 -2
- data/stdlib/dbm/0/dbm.rbs +43 -30
- data/stdlib/mutex_m/0/mutex_m.rbs +1 -1
- data/stdlib/net-http/0/net-http.rbs +1846 -0
- data/stdlib/optparse/0/optparse.rbs +1214 -0
- data/stdlib/resolv/0/resolv.rbs +1504 -0
- data/stdlib/rubygems/0/requirement.rbs +84 -2
- data/stdlib/rubygems/0/version.rbs +2 -1
- data/stdlib/shellwords/0/shellwords.rbs +252 -0
- data/stdlib/socket/0/addrinfo.rbs +469 -0
- data/stdlib/socket/0/basic_socket.rbs +503 -0
- data/stdlib/socket/0/ip_socket.rbs +72 -0
- data/stdlib/socket/0/socket.rbs +2687 -0
- data/stdlib/socket/0/tcp_server.rbs +177 -0
- data/stdlib/socket/0/tcp_socket.rbs +35 -0
- data/stdlib/socket/0/udp_socket.rbs +111 -0
- data/stdlib/socket/0/unix_server.rbs +154 -0
- data/stdlib/socket/0/unix_socket.rbs +132 -0
- data/stdlib/timeout/0/timeout.rbs +5 -0
- data/steep/Gemfile.lock +19 -16
- metadata +18 -11
- data/bin/annotate-with-rdoc +0 -153
- data/bin/console +0 -14
- data/bin/query-rdoc +0 -103
- data/bin/rbs-prof +0 -9
- data/bin/run_in_md.rb +0 -49
- data/bin/setup +0 -8
- data/bin/sort +0 -89
- data/bin/steep +0 -4
- data/bin/test_runner.rb +0 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '018869df02515c1d7d1194b7b577e87c2dae8c01dc8fba577252b87bd41cc6d8'
|
4
|
+
data.tar.gz: 0c96d33f71b40d62ed5f5e082b0fec5780f6abb63343fcc5b8eb163f9504b8d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3380f6f0558ab9d9052ce6da093c03e3e11a96ebbc29f67d4c88ae4fcad222b980e884527fd741d2a698e77d7fa53f144857eb045b785de20d008a4839b3cc87
|
7
|
+
data.tar.gz: 19d98bbcf5ea0ce420ddd0191cdc9042f4b8a7aa329d9bc455205f7c6b5c0300aede0864b7f86f307b10e72c46b9809414997b244ce2564be1e8b3898df81e52
|
data/.github/workflows/ruby.yml
CHANGED
@@ -18,7 +18,11 @@ jobs:
|
|
18
18
|
job:
|
19
19
|
- test
|
20
20
|
- stdlib_test
|
21
|
-
- rubocop validate test_doc build test_generate_stdlib
|
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
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,87 @@
|
|
2
2
|
|
3
3
|
## master
|
4
4
|
|
5
|
+
## 1.3.1 (2021-07-21)
|
6
|
+
|
7
|
+
This release is to fix a bug introduced by parser update in 1.3.0.
|
8
|
+
|
9
|
+
* Fix parser to accept param names starting with `_` ([#721](https://github.com/ruby/rbs/pull/721))
|
10
|
+
|
11
|
+
## 1.3.0 (2021-07-20)
|
12
|
+
|
13
|
+
### Summary
|
14
|
+
|
15
|
+
RBS 1.3.0 includes bug fixees of the parser and class/module definition validations.
|
16
|
+
|
17
|
+
### Signature updates
|
18
|
+
|
19
|
+
* dbm ([#718](https://github.com/ruby/rbs/pull/718))
|
20
|
+
* net-http ([#686](https://github.com/ruby/rbs/pull/686))
|
21
|
+
* optparse ([#693](https://github.com/ruby/rbs/pull/693))
|
22
|
+
* resolv ([#697](https://github.com/ruby/rbs/pull/697))
|
23
|
+
* socket ([#699](https://github.com/ruby/rbs/pull/699))
|
24
|
+
* `IO` ([#698](https://github.com/ruby/rbs/pull/698))
|
25
|
+
* `Marshal` ([#684](https://github.com/ruby/rbs/pull/684))
|
26
|
+
* `Mutex` ([#683](https://github.com/ruby/rbs/pull/683))
|
27
|
+
* `Array#shift` ([#707](https://github.com/ruby/rbs/pull/707))
|
28
|
+
* `BasicObject#method_missing` ([#707](https://github.com/ruby/rbs/pull/706), [#710](https://github.com/ruby/rbs/pull/710))
|
29
|
+
* `Kernel#caller` ([#705](https://github.com/ruby/rbs/pull/705))
|
30
|
+
|
31
|
+
### Library changes
|
32
|
+
|
33
|
+
* 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))
|
34
|
+
* Mixins of classes are rejected ([#681](https://github.com/ruby/rbs/pull/681))
|
35
|
+
* Generate prototype of `initialize` method with return type `void` ([#685](https://github.com/ruby/rbs/pull/685))
|
36
|
+
* Let `prototype runtime` generate class/module declarations in nested syntax ([#700](https://github.com/ruby/rbs/pull/700))
|
37
|
+
* Fix race condition for multi-thread support ([#702](https://github.com/ruby/rbs/pull/702))
|
38
|
+
|
39
|
+
### Miscellaneous
|
40
|
+
|
41
|
+
* Add new doc `docs/rbs_by_example.md` ([#694](https://github.com/ruby/rbs/pull/694))
|
42
|
+
|
43
|
+
## 1.2.1 (2021-05-27)
|
44
|
+
|
45
|
+
This release includes the following minor changes:
|
46
|
+
|
47
|
+
* Fix test to run the tests in ruby repository. ([#679](https://github.com/ruby/rbs/pull/679))
|
48
|
+
* Remove unnecessary files from the gem package. ([#675](https://github.com/ruby/rbs/pull/675))
|
49
|
+
* Suppress unused variable warning ([#674](https://github.com/ruby/rbs/pull/674))
|
50
|
+
* Update documents ([#672](https://github.com/ruby/rbs/pull/672))
|
51
|
+
|
52
|
+
## 1.2.0 (2021-04-21)
|
53
|
+
|
54
|
+
### Summary
|
55
|
+
|
56
|
+
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.
|
57
|
+
|
58
|
+
### Signature updates
|
59
|
+
|
60
|
+
* 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), )
|
61
|
+
* Module ([\#645](https://github.com/ruby/rbs/pull/645))
|
62
|
+
* Enumerable ([\#647](https://github.com/ruby/rbs/pull/647))
|
63
|
+
* Array ([\#648](https://github.com/ruby/rbs/pull/648))
|
64
|
+
* Proc ([\#649](https://github.com/ruby/rbs/pull/649))
|
65
|
+
* Struct ([\#650](https://github.com/ruby/rbs/pull/650), [\#668](https://github.com/ruby/rbs/pull/668))
|
66
|
+
* Thread ([\#651](https://github.com/ruby/rbs/pull/651))
|
67
|
+
* Random ([\#669](https://github.com/ruby/rbs/pull/669))
|
68
|
+
* Shellwords ([\#665](https://github.com/ruby/rbs/pull/665))
|
69
|
+
* IO ([\#659](https://github.com/ruby/rbs/pull/659))
|
70
|
+
|
71
|
+
### Language updates
|
72
|
+
|
73
|
+
* Module self type syntax update ([\#653](https://github.com/ruby/rbs/pull/653))
|
74
|
+
|
75
|
+
### Library changes
|
76
|
+
|
77
|
+
* Token locations ([\#666](https://github.com/ruby/rbs/pull/666))
|
78
|
+
* Add RBS::Locator ([\#667](https://github.com/ruby/rbs/pull/667))
|
79
|
+
* Fix runtime type checker ([\#644](https://github.com/ruby/rbs/pull/644))
|
80
|
+
|
81
|
+
### Miscellaneous
|
82
|
+
|
83
|
+
* Update documentation for overloading ([\#658](https://github.com/ruby/rbs/pull/658))
|
84
|
+
* Update target ruby version ([\#633](https://github.com/ruby/rbs/pull/633))
|
85
|
+
|
5
86
|
## 1.1.1 (2021-03-12)
|
6
87
|
|
7
88
|
### Signature updates
|
data/README.md
CHANGED
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
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) ->
|
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
|
-
| (
|
1640
|
+
| (int n) -> ::Array[Elem]
|
1641
1641
|
|
1642
1642
|
# Returns a new array with elements of `self` shuffled.
|
1643
1643
|
#
|
data/core/basic_object.rbs
CHANGED
@@ -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
|
-
| (
|
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: () ->
|
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 } ->
|
502
|
-
| () -> ::Enumerator[[ K, V ],
|
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) ->
|
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: () ->
|
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=: (
|
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) ->
|
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) ->
|
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, ?
|
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: (
|
17
|
-
| (
|
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: (
|
140
|
-
| (
|
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
|
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) ->
|
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
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: (
|
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) ->
|
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: ()
|
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) ->
|
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
|
32
|
-
* The library code targets Ruby 2.
|
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
|
90
|
+
def each: () { (A) -> void } -> void # Members are sorted dictionary order
|
89
91
|
|
90
92
|
def to_s: (?Locale) -> String
|
91
93
|
|