rbs 3.1.3 → 3.2.0
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 +0 -6
- data/CHANGELOG.md +82 -0
- data/Gemfile +0 -6
- data/Gemfile.lock +12 -21
- data/README.md +1 -1
- data/Rakefile +45 -1
- data/Steepfile +3 -3
- data/core/array.rbs +0 -8
- data/core/binding.rbs +7 -69
- data/core/builtin.rbs +33 -8
- data/core/constants.rbs +13 -5
- data/core/dir.rbs +25 -25
- data/core/errno.rbs +474 -590
- data/core/exception.rbs +1 -1
- data/core/global_variables.rbs +27 -27
- data/core/io.rbs +163 -172
- data/core/kernel.rbs +58 -38
- data/core/module.rbs +34 -32
- data/core/object.rbs +3 -7
- data/core/string_io.rbs +9 -0
- data/core/thread.rbs +25 -1
- data/core/time.rbs +3 -3
- data/core/warning.rbs +3 -1
- data/docs/CONTRIBUTING.md +1 -1
- data/docs/rbs_by_example.md +16 -35
- data/docs/repo.md +1 -1
- data/docs/sigs.md +7 -7
- data/docs/stdlib.md +2 -3
- data/docs/syntax.md +40 -40
- data/lib/rbs/cli.rb +15 -4
- data/lib/rbs/collection/config/lockfile_generator.rb +6 -2
- data/lib/rbs/collection/installer.rb +5 -2
- data/lib/rbs/collection/sources/stdlib.rb +5 -1
- data/lib/rbs/errors.rb +8 -1
- data/lib/rbs/file_finder.rb +1 -1
- data/lib/rbs/prototype/rb.rb +64 -6
- data/lib/rbs/prototype/rbi.rb +2 -6
- data/lib/rbs/prototype/runtime.rb +29 -8
- data/lib/rbs/subtractor.rb +17 -0
- data/lib/rbs/type_name.rb +4 -4
- data/lib/rbs/version.rb +1 -1
- data/rbs.gemspec +1 -1
- data/schema/decls.json +1 -1
- data/sig/errors.rbs +54 -0
- data/sig/parser.rbs +2 -2
- data/sig/prototype/rb.rbs +9 -1
- data/sig/subtractor.rbs +4 -0
- data/stdlib/logger/0/logger.rbs +1 -1
- data/stdlib/observable/0/observable.rbs +219 -0
- data/stdlib/uri/0/common.rbs +24 -0
- data/stdlib/zlib/0/buf_error.rbs +79 -0
- data/stdlib/zlib/0/data_error.rbs +79 -0
- data/stdlib/zlib/0/deflate.rbs +276 -0
- data/stdlib/zlib/0/error.rbs +89 -0
- data/stdlib/zlib/0/gzip_file/crc_error.rbs +115 -0
- data/stdlib/zlib/0/gzip_file/error.rbs +128 -0
- data/stdlib/zlib/0/gzip_file/length_error.rbs +115 -0
- data/stdlib/zlib/0/gzip_file/no_footer.rbs +114 -0
- data/stdlib/zlib/0/gzip_file.rbs +228 -0
- data/stdlib/zlib/0/gzip_reader.rbs +362 -0
- data/stdlib/zlib/0/gzip_writer.rbs +237 -0
- data/stdlib/zlib/0/inflate.rbs +249 -0
- data/stdlib/zlib/0/mem_error.rbs +79 -0
- data/stdlib/zlib/0/need_dict.rbs +82 -0
- data/stdlib/zlib/0/stream_end.rbs +80 -0
- data/stdlib/zlib/0/stream_error.rbs +80 -0
- data/stdlib/zlib/0/version_error.rbs +80 -0
- data/stdlib/zlib/0/zstream.rbs +270 -0
- metadata +22 -6
- data/stdlib/prime/0/integer-extension.rbs +0 -41
- data/stdlib/prime/0/manifest.yaml +0 -2
- data/stdlib/prime/0/prime.rbs +0 -372
data/core/kernel.rbs
CHANGED
@@ -300,7 +300,7 @@ module Kernel : BasicObject
|
|
300
300
|
# eval "str + ' Fred'" #=> "hello Fred"
|
301
301
|
# eval "str + ' Fred'", get_binding("bye") #=> "bye Fred"
|
302
302
|
#
|
303
|
-
def self?.eval: (
|
303
|
+
def self?.eval: (string src, ?Binding? scope, ?string filename, ?int lineno) -> untyped
|
304
304
|
|
305
305
|
# <!--
|
306
306
|
# rdoc-file=vm_eval.c
|
@@ -358,7 +358,7 @@ module Kernel : BasicObject
|
|
358
358
|
# srand 1234 # => 1234
|
359
359
|
# [ rand, rand ] # => [0.1915194503788923, 0.6221087710398319]
|
360
360
|
#
|
361
|
-
def self?.srand: (?
|
361
|
+
def self?.srand: (?int number) -> Integer
|
362
362
|
|
363
363
|
# <!--
|
364
364
|
# rdoc-file=process.c
|
@@ -383,7 +383,7 @@ module Kernel : BasicObject
|
|
383
383
|
# 4. Therefore you should use spawn() instead of fork().
|
384
384
|
#
|
385
385
|
def self?.fork: () -> Integer?
|
386
|
-
| () { () ->
|
386
|
+
| () { () -> void } -> Integer
|
387
387
|
|
388
388
|
def initialize_copy: (self object) -> self
|
389
389
|
|
@@ -403,12 +403,10 @@ module Kernel : BasicObject
|
|
403
403
|
#
|
404
404
|
# Array(:foo) # => [:foo]
|
405
405
|
#
|
406
|
-
def self?.Array: (
|
407
|
-
| [T] (
|
408
|
-
| [T] (
|
409
|
-
| [T] (
|
410
|
-
| [K, V] (::Hash[K, V] x) -> ::Array[[ K, V ]]
|
411
|
-
| [T] (T x) -> ::Array[T]
|
406
|
+
def self?.Array: (nil) -> []
|
407
|
+
| [T] (Array[T] ary) -> Array[T]
|
408
|
+
| [T] (_ToAry[T] | _ToA[T] array_like) -> Array[T]
|
409
|
+
| [T] (T ele) -> [T]
|
412
410
|
|
413
411
|
# <!--
|
414
412
|
# rdoc-file=complex.c
|
@@ -446,7 +444,11 @@ module Kernel : BasicObject
|
|
446
444
|
#
|
447
445
|
# See String#to_c.
|
448
446
|
#
|
449
|
-
def self?.Complex: (
|
447
|
+
def self?.Complex: (_ToC complex_like, ?exception: true) -> Complex
|
448
|
+
| (_ToC complex_like, exception: bool) -> Complex?
|
449
|
+
| (Numeric | String real, ?Numeric | String imag, ?exception: true) -> Complex
|
450
|
+
| (Numeric | String real, ?Numeric | String imag, exception: bool) -> Complex?
|
451
|
+
| (untyped, ?untyped, exception: false) -> nil
|
450
452
|
|
451
453
|
# <!--
|
452
454
|
# rdoc-file=kernel.rb
|
@@ -464,7 +466,9 @@ module Kernel : BasicObject
|
|
464
466
|
# Float(nil) #=> TypeError: can't convert nil into Float
|
465
467
|
# Float("123.0_badstring", exception: false) #=> nil
|
466
468
|
#
|
467
|
-
def self?.Float: (
|
469
|
+
def self?.Float: (_ToF float_like, ?exception: true) -> Float
|
470
|
+
| (_ToF float_like, exception: bool) -> Float?
|
471
|
+
| (untyped, exception: false) -> nil
|
468
472
|
|
469
473
|
# <!--
|
470
474
|
# rdoc-file=object.c
|
@@ -488,7 +492,8 @@ module Kernel : BasicObject
|
|
488
492
|
# Hash(nil) # => {}
|
489
493
|
# Hash([]) # => {}
|
490
494
|
#
|
491
|
-
def self?.Hash: [K, V] (
|
495
|
+
def self?.Hash: [K, V] (nil | [] _empty) -> Hash[K, V]
|
496
|
+
| [K, V] (_ToHash[K, V] hash_like) -> Hash[K, V]
|
492
497
|
|
493
498
|
# <!--
|
494
499
|
# rdoc-file=object.c
|
@@ -574,8 +579,11 @@ module Kernel : BasicObject
|
|
574
579
|
# With `exception` given as `false`, an exception of any kind is suppressed and
|
575
580
|
# `nil` is returned.
|
576
581
|
#
|
577
|
-
def self?.Integer: (
|
578
|
-
| (
|
582
|
+
def self?.Integer: (_ToInt | _ToI int_like, ?exception: true) -> Integer
|
583
|
+
| (_ToInt | _ToI int_like, exception: bool) -> Integer?
|
584
|
+
| (string str, ?int base, ?exception: true) -> Integer
|
585
|
+
| (string str, ?int base, exception: bool) -> Integer?
|
586
|
+
| (untyped, ?untyped, exception: false) -> nil
|
579
587
|
|
580
588
|
# <!--
|
581
589
|
# rdoc-file=rational.c
|
@@ -614,7 +622,17 @@ module Kernel : BasicObject
|
|
614
622
|
#
|
615
623
|
# See also String#to_r.
|
616
624
|
#
|
617
|
-
def self?.Rational: (
|
625
|
+
def self?.Rational: (_ToInt | _ToR rational_like, ?exception: true) -> Rational
|
626
|
+
| (_ToInt | _ToR rational_like, exception: bool) -> Rational?
|
627
|
+
| (_ToInt | _ToR numer, ?_ToInt | _ToR denom, ?exception: true) -> Rational
|
628
|
+
| (_ToInt | _ToR numer, ?_ToInt | _ToR denom, exception: bool) -> Rational?
|
629
|
+
| [T] (Numeric&_RationalDiv[T] numer, Numeric denom, ?exception: bool) -> T
|
630
|
+
| [T < Numeric] (T value, 1, ?exception: bool) -> T
|
631
|
+
| (untyped, ?untyped, exception: false) -> nil
|
632
|
+
|
633
|
+
interface _RationalDiv[T]
|
634
|
+
def /: (Numeric) -> T
|
635
|
+
end
|
618
636
|
|
619
637
|
# <!--
|
620
638
|
# rdoc-file=object.c
|
@@ -630,7 +648,7 @@ module Kernel : BasicObject
|
|
630
648
|
#
|
631
649
|
# Raises `TypeError` if `object` cannot be converted to a string.
|
632
650
|
#
|
633
|
-
def self?.String: (
|
651
|
+
def self?.String: (string | _ToS string_like) -> String
|
634
652
|
|
635
653
|
# <!--
|
636
654
|
# rdoc-file=eval.c
|
@@ -691,7 +709,7 @@ module Kernel : BasicObject
|
|
691
709
|
# Terminate execution immediately, effectively by calling `Kernel.exit(false)`.
|
692
710
|
# If *msg* is given, it is written to STDERR prior to terminating.
|
693
711
|
#
|
694
|
-
def self?.abort: (?
|
712
|
+
def self?.abort: (?string msg) -> bot
|
695
713
|
|
696
714
|
# <!--
|
697
715
|
# rdoc-file=eval_jump.c
|
@@ -712,7 +730,7 @@ module Kernel : BasicObject
|
|
712
730
|
#
|
713
731
|
# goodbye cruel world
|
714
732
|
#
|
715
|
-
def self?.at_exit: () { () ->
|
733
|
+
def self?.at_exit: () { () -> void } -> Proc
|
716
734
|
|
717
735
|
# <!--
|
718
736
|
# rdoc-file=load.c
|
@@ -795,8 +813,7 @@ module Kernel : BasicObject
|
|
795
813
|
# at_exit function
|
796
814
|
# in finalizer
|
797
815
|
#
|
798
|
-
def self?.exit: () -> bot
|
799
|
-
| (?Integer | TrueClass | FalseClass status) -> bot
|
816
|
+
def self?.exit: (?int | bool status) -> bot
|
800
817
|
|
801
818
|
# <!--
|
802
819
|
# rdoc-file=process.c
|
@@ -807,7 +824,7 @@ module Kernel : BasicObject
|
|
807
824
|
#
|
808
825
|
# Process.exit!(true)
|
809
826
|
#
|
810
|
-
def self?.exit!: (
|
827
|
+
def self?.exit!: (?int | bool status) -> bot
|
811
828
|
|
812
829
|
# <!-- rdoc-file=eval.c -->
|
813
830
|
# With no arguments, raises the exception in `$!` or raises a RuntimeError if
|
@@ -828,8 +845,8 @@ module Kernel : BasicObject
|
|
828
845
|
# raise ArgumentError, "No parameters", caller
|
829
846
|
#
|
830
847
|
def self?.fail: () -> bot
|
831
|
-
| (
|
832
|
-
| (_Exception exception, ?
|
848
|
+
| (string message, ?cause: Exception?) -> bot
|
849
|
+
| (_Exception exception, ?_ToS? message, ?nil | String | Array[String] backtrace, ?cause: Exception?) -> bot
|
833
850
|
|
834
851
|
# <!--
|
835
852
|
# rdoc-file=eval.c
|
@@ -988,7 +1005,7 @@ module Kernel : BasicObject
|
|
988
1005
|
# puts enum.next
|
989
1006
|
# } #=> :ok
|
990
1007
|
#
|
991
|
-
def self?.loop: () { (
|
1008
|
+
def self?.loop: () { () -> void } -> bot
|
992
1009
|
| () -> ::Enumerator[nil, bot]
|
993
1010
|
|
994
1011
|
# <!--
|
@@ -1137,7 +1154,7 @@ module Kernel : BasicObject
|
|
1137
1154
|
# gets # Sets $_ to the most recent user input.
|
1138
1155
|
# print # Prints $_.
|
1139
1156
|
#
|
1140
|
-
def self?.print: (*
|
1157
|
+
def self?.print: (*_ToS args) -> nil
|
1141
1158
|
|
1142
1159
|
# <!--
|
1143
1160
|
# rdoc-file=io.c
|
@@ -1171,9 +1188,9 @@ module Kernel : BasicObject
|
|
1171
1188
|
#
|
1172
1189
|
# With no arguments, does nothing.
|
1173
1190
|
#
|
1174
|
-
def self?.printf: (
|
1175
|
-
| (String
|
1176
|
-
| () -> nil
|
1191
|
+
def self?.printf: () -> nil
|
1192
|
+
| (String fmt, *untyped args) -> nil
|
1193
|
+
| (_Writer io, string fmt, *untyped args) -> nil
|
1177
1194
|
|
1178
1195
|
# <!--
|
1179
1196
|
# rdoc-file=proc.c
|
@@ -1202,8 +1219,8 @@ module Kernel : BasicObject
|
|
1202
1219
|
#
|
1203
1220
|
# See IO#putc for important information regarding multi-byte characters.
|
1204
1221
|
#
|
1205
|
-
def self?.putc: (
|
1206
|
-
| (String
|
1222
|
+
def self?.putc: [T < _ToInt] (T chr) -> T
|
1223
|
+
| (String chr) -> String
|
1207
1224
|
|
1208
1225
|
# <!--
|
1209
1226
|
# rdoc-file=io.c
|
@@ -1213,7 +1230,7 @@ module Kernel : BasicObject
|
|
1213
1230
|
#
|
1214
1231
|
# $stdout.puts(objects)
|
1215
1232
|
#
|
1216
|
-
def self?.puts: (*
|
1233
|
+
def self?.puts: (*_ToS objects) -> nil
|
1217
1234
|
|
1218
1235
|
# <!--
|
1219
1236
|
# rdoc-file=io.c
|
@@ -1240,8 +1257,9 @@ module Kernel : BasicObject
|
|
1240
1257
|
# 0..4
|
1241
1258
|
# [0..4, 0..4, 0..4]
|
1242
1259
|
#
|
1243
|
-
def self?.p: [T] (T arg0) -> T
|
1244
|
-
| (*
|
1260
|
+
def self?.p: [T < _Inspect] (T arg0) -> T
|
1261
|
+
| (_Inspect arg0, _Inspect arg1, *_Inspect rest) -> Array[_Inspect]
|
1262
|
+
| () -> nil
|
1245
1263
|
|
1246
1264
|
# <!--
|
1247
1265
|
# rdoc-file=lib/pp.rb
|
@@ -1252,7 +1270,8 @@ module Kernel : BasicObject
|
|
1252
1270
|
# pp returns argument(s).
|
1253
1271
|
#
|
1254
1272
|
def self?.pp: [T] (T arg0) -> T
|
1255
|
-
| (*untyped
|
1273
|
+
| (untyped, untyped, *untyped) -> Array[untyped]
|
1274
|
+
| () -> nil
|
1256
1275
|
|
1257
1276
|
# <!--
|
1258
1277
|
# rdoc-file=random.c
|
@@ -1548,7 +1567,7 @@ module Kernel : BasicObject
|
|
1548
1567
|
# sleep 1.9 #=> 2
|
1549
1568
|
# Time.new #=> 2008-03-08 19:56:22 +0900
|
1550
1569
|
#
|
1551
|
-
def self?.sleep: () -> bot
|
1570
|
+
def self?.sleep: (?nil) -> bot
|
1552
1571
|
| ((Integer | Float | _Divmod) duration) -> Integer
|
1553
1572
|
|
1554
1573
|
interface _Divmod
|
@@ -1648,7 +1667,7 @@ module Kernel : BasicObject
|
|
1648
1667
|
# optional second parameter supplies a return value for the `catch` block, which
|
1649
1668
|
# otherwise defaults to `nil`. For examples, see Kernel::catch.
|
1650
1669
|
#
|
1651
|
-
def self?.throw: (
|
1670
|
+
def self?.throw: (untyped tag, ?untyped obj) -> bot
|
1652
1671
|
|
1653
1672
|
# <!--
|
1654
1673
|
# rdoc-file=warning.rb
|
@@ -1695,7 +1714,7 @@ module Kernel : BasicObject
|
|
1695
1714
|
# :experimental
|
1696
1715
|
# : Used for experimental features that may change in future releases.
|
1697
1716
|
#
|
1698
|
-
def self?.warn: (*
|
1717
|
+
def self?.warn: (*_ToS msg, ?uplevel: int?, ?category: Warning::category?) -> nil
|
1699
1718
|
|
1700
1719
|
# <!--
|
1701
1720
|
# rdoc-file=process.c
|
@@ -1770,7 +1789,8 @@ module Kernel : BasicObject
|
|
1770
1789
|
# exec "echo", "*" # echoes an asterisk
|
1771
1790
|
# # never get here
|
1772
1791
|
#
|
1773
|
-
def self?.exec: (*String args) -> bot
|
1792
|
+
def self?.exec: (String command, *String args, ?unsetenv_others: boolish, ?pgroup: true | Integer, ?umask: Integer, ?in: redirect_fd, ?out: redirect_fd, ?err: redirect_fd, ?close_others: boolish, ?chdir: String) -> bot
|
1793
|
+
| (Hash[string, string?] env, String command, *String args, ?unsetenv_others: boolish, ?pgroup: true | Integer, ?umask: Integer, ?in: redirect_fd, ?out: redirect_fd, ?err: redirect_fd, ?close_others: boolish, ?chdir: String) -> bot
|
1774
1794
|
|
1775
1795
|
type redirect_fd = Integer | :in | :out | :err | IO | String | [ String ] | [ String, string | int ] | [ String, string | int, int ] | [ :child, int ] | :close
|
1776
1796
|
|
data/core/module.rbs
CHANGED
@@ -235,7 +235,7 @@ class Module < Object
|
|
235
235
|
#
|
236
236
|
# Exiting with code 99
|
237
237
|
#
|
238
|
-
def alias_method: (
|
238
|
+
def alias_method: (id new_name, id old_name) -> ::Symbol
|
239
239
|
|
240
240
|
# <!--
|
241
241
|
# rdoc-file=object.c
|
@@ -284,7 +284,7 @@ class Module < Object
|
|
284
284
|
# end
|
285
285
|
# Mod.instance_methods.sort #=> [:one, :one=, :two, :two=]
|
286
286
|
#
|
287
|
-
def attr_accessor: (*
|
287
|
+
def attr_accessor: (*id arg0) -> Array[Symbol]
|
288
288
|
|
289
289
|
# <!--
|
290
290
|
# rdoc-file=object.c
|
@@ -298,7 +298,7 @@ class Module < Object
|
|
298
298
|
# in turn. String arguments are converted to symbols. Returns an array of
|
299
299
|
# defined method names as symbols.
|
300
300
|
#
|
301
|
-
def attr_reader: (*
|
301
|
+
def attr_reader: (*id arg0) -> Array[Symbol]
|
302
302
|
|
303
303
|
# <!--
|
304
304
|
# rdoc-file=object.c
|
@@ -309,7 +309,7 @@ class Module < Object
|
|
309
309
|
# *symbol*`.id2name`. String arguments are converted to symbols. Returns an
|
310
310
|
# array of defined method names as symbols.
|
311
311
|
#
|
312
|
-
def attr_writer: (*
|
312
|
+
def attr_writer: (*id arg0) -> Array[Symbol]
|
313
313
|
|
314
314
|
# <!--
|
315
315
|
# rdoc-file=load.c
|
@@ -328,7 +328,7 @@ class Module < Object
|
|
328
328
|
# replaced with *filename*. If *const* is defined but not as autoload, does
|
329
329
|
# nothing.
|
330
330
|
#
|
331
|
-
def autoload: (
|
331
|
+
def autoload: (id _module, String filename) -> NilClass
|
332
332
|
|
333
333
|
# <!--
|
334
334
|
# rdoc-file=load.c
|
@@ -354,7 +354,7 @@ class Module < Object
|
|
354
354
|
# B.autoload?(:CONST) #=> "const.rb", found in A (ancestor)
|
355
355
|
# B.autoload?(:CONST, false) #=> nil, not found in B itself
|
356
356
|
#
|
357
|
-
def autoload?: (
|
357
|
+
def autoload?: (id name, ?boolish inherit) -> String?
|
358
358
|
|
359
359
|
# <!-- rdoc-file=vm_eval.c -->
|
360
360
|
# Evaluates the string or block in the context of *mod*, except that when a
|
@@ -412,7 +412,7 @@ class Module < Object
|
|
412
412
|
# Fred.class_variable_defined?(:@@foo) #=> true
|
413
413
|
# Fred.class_variable_defined?(:@@bar) #=> false
|
414
414
|
#
|
415
|
-
def class_variable_defined?: (
|
415
|
+
def class_variable_defined?: (id arg0) -> bool
|
416
416
|
|
417
417
|
# <!--
|
418
418
|
# rdoc-file=object.c
|
@@ -428,7 +428,7 @@ class Module < Object
|
|
428
428
|
# end
|
429
429
|
# Fred.class_variable_get(:@@foo) #=> 99
|
430
430
|
#
|
431
|
-
def class_variable_get: (
|
431
|
+
def class_variable_get: (id arg0) -> untyped
|
432
432
|
|
433
433
|
# <!--
|
434
434
|
# rdoc-file=object.c
|
@@ -447,7 +447,7 @@ class Module < Object
|
|
447
447
|
# Fred.class_variable_set(:@@foo, 101) #=> 101
|
448
448
|
# Fred.new.foo #=> 101
|
449
449
|
#
|
450
|
-
def class_variable_set: (
|
450
|
+
def class_variable_set: (id arg0, untyped arg1) -> untyped
|
451
451
|
|
452
452
|
# <!--
|
453
453
|
# rdoc-file=object.c
|
@@ -527,7 +527,7 @@ class Module < Object
|
|
527
527
|
#
|
528
528
|
# Hash.const_defined? 'foobar' #=> NameError: wrong constant name foobar
|
529
529
|
#
|
530
|
-
def const_defined?: (
|
530
|
+
def const_defined?: (id name, ?boolish inherit) -> bool
|
531
531
|
|
532
532
|
# <!--
|
533
533
|
# rdoc-file=object.c
|
@@ -566,7 +566,7 @@ class Module < Object
|
|
566
566
|
#
|
567
567
|
# Object.const_get 'foobar' #=> NameError: wrong constant name foobar
|
568
568
|
#
|
569
|
-
def const_get: (
|
569
|
+
def const_get: (id name, ?boolish inherit) -> untyped
|
570
570
|
|
571
571
|
# <!--
|
572
572
|
# rdoc-file=object.c
|
@@ -618,7 +618,7 @@ class Module < Object
|
|
618
618
|
#
|
619
619
|
# Object.const_set('foobar', 42) #=> NameError: wrong constant name foobar
|
620
620
|
#
|
621
|
-
def const_set: (
|
621
|
+
def const_set: (id arg0, untyped arg1) -> untyped
|
622
622
|
|
623
623
|
# <!--
|
624
624
|
# rdoc-file=object.c
|
@@ -668,7 +668,7 @@ class Module < Object
|
|
668
668
|
# p Object.const_source_location('A::C1') # => ["test.rb", 2] -- nesting is supported
|
669
669
|
# p Object.const_source_location('String') # => [] -- constant is defined in C code
|
670
670
|
#
|
671
|
-
def const_source_location: (
|
671
|
+
def const_source_location: (id name, ?boolish inherit) -> ([ String, Integer ] | [ ] | nil)
|
672
672
|
|
673
673
|
# <!--
|
674
674
|
# rdoc-file=object.c
|
@@ -726,8 +726,8 @@ class Module < Object
|
|
726
726
|
# I'm Dino!
|
727
727
|
# #<B:0x401b39e8>
|
728
728
|
#
|
729
|
-
def define_method: (
|
730
|
-
| (
|
729
|
+
def define_method: (id symbol, Proc | Method | UnboundMethod method) -> Symbol
|
730
|
+
| (id symbol) { () -> untyped } -> Symbol
|
731
731
|
|
732
732
|
# <!--
|
733
733
|
# rdoc-file=object.c
|
@@ -746,7 +746,7 @@ class Module < Object
|
|
746
746
|
# HTTP::NOT_FOUND
|
747
747
|
# # warning: constant HTTP::NOT_FOUND is deprecated
|
748
748
|
#
|
749
|
-
def deprecate_constant: (*
|
749
|
+
def deprecate_constant: (*id) -> self
|
750
750
|
|
751
751
|
def eql?: (untyped other) -> bool
|
752
752
|
|
@@ -936,7 +936,7 @@ class Module < Object
|
|
936
936
|
#
|
937
937
|
# Hello there, Dave!
|
938
938
|
#
|
939
|
-
def instance_method: (
|
939
|
+
def instance_method: (id arg0) -> UnboundMethod
|
940
940
|
|
941
941
|
# <!--
|
942
942
|
# rdoc-file=object.c
|
@@ -1029,7 +1029,7 @@ class Module < Object
|
|
1029
1029
|
# C.method_defined? "method4" #=> false
|
1030
1030
|
# C.method_defined? "private_method2" #=> false
|
1031
1031
|
#
|
1032
|
-
def method_defined?: (
|
1032
|
+
def method_defined?: (id name, ?boolish inherit) -> bool
|
1033
1033
|
|
1034
1034
|
# <!--
|
1035
1035
|
# rdoc-file=object.c
|
@@ -1147,7 +1147,7 @@ class Module < Object
|
|
1147
1147
|
# Mod.one #=> "This is one"
|
1148
1148
|
# c.call_one #=> "This is the new one"
|
1149
1149
|
#
|
1150
|
-
def module_function: (*
|
1150
|
+
def module_function: (*id arg0) -> self
|
1151
1151
|
|
1152
1152
|
# <!--
|
1153
1153
|
# rdoc-file=object.c
|
@@ -1246,7 +1246,7 @@ class Module < Object
|
|
1246
1246
|
# end
|
1247
1247
|
# end
|
1248
1248
|
#
|
1249
|
-
def private_class_method: (*
|
1249
|
+
def private_class_method: (*id arg0) -> self
|
1250
1250
|
|
1251
1251
|
# <!--
|
1252
1252
|
# rdoc-file=object.c
|
@@ -1254,7 +1254,7 @@ class Module < Object
|
|
1254
1254
|
# -->
|
1255
1255
|
# Makes a list of existing constants private.
|
1256
1256
|
#
|
1257
|
-
def private_constant: (*
|
1257
|
+
def private_constant: (*id arg0) -> self
|
1258
1258
|
|
1259
1259
|
# <!--
|
1260
1260
|
# rdoc-file=object.c
|
@@ -1301,7 +1301,7 @@ class Module < Object
|
|
1301
1301
|
# C.private_method_defined? "method2", false #=> false
|
1302
1302
|
# C.method_defined? "method2" #=> false
|
1303
1303
|
#
|
1304
|
-
def private_method_defined?: (
|
1304
|
+
def private_method_defined?: (id name, ?boolish inherit) -> bool
|
1305
1305
|
|
1306
1306
|
# <!--
|
1307
1307
|
# rdoc-file=vm_method.c
|
@@ -1365,7 +1365,7 @@ class Module < Object
|
|
1365
1365
|
# C.protected_method_defined? "method2", false #=> false
|
1366
1366
|
# C.method_defined? "method2" #=> true
|
1367
1367
|
#
|
1368
|
-
def protected_method_defined?: (
|
1368
|
+
def protected_method_defined?: (id name, ?boolish inherit) -> bool
|
1369
1369
|
|
1370
1370
|
# <!--
|
1371
1371
|
# rdoc-file=vm_method.c
|
@@ -1398,7 +1398,7 @@ class Module < Object
|
|
1398
1398
|
# String arguments are converted to symbols. An Array of Symbols and/or Strings
|
1399
1399
|
# is also accepted.
|
1400
1400
|
#
|
1401
|
-
def public_class_method: (*
|
1401
|
+
def public_class_method: (*id arg0) -> self
|
1402
1402
|
|
1403
1403
|
# <!--
|
1404
1404
|
# rdoc-file=object.c
|
@@ -1406,7 +1406,7 @@ class Module < Object
|
|
1406
1406
|
# -->
|
1407
1407
|
# Makes a list of existing constants public.
|
1408
1408
|
#
|
1409
|
-
def public_constant: (*
|
1409
|
+
def public_constant: (*id arg0) -> self
|
1410
1410
|
|
1411
1411
|
# <!--
|
1412
1412
|
# rdoc-file=proc.c
|
@@ -1414,7 +1414,7 @@ class Module < Object
|
|
1414
1414
|
# -->
|
1415
1415
|
# Similar to *instance_method*, searches public method only.
|
1416
1416
|
#
|
1417
|
-
def public_instance_method: (
|
1417
|
+
def public_instance_method: (id arg0) -> UnboundMethod
|
1418
1418
|
|
1419
1419
|
# <!--
|
1420
1420
|
# rdoc-file=object.c
|
@@ -1453,7 +1453,7 @@ class Module < Object
|
|
1453
1453
|
# C.public_method_defined? "method2" #=> false
|
1454
1454
|
# C.method_defined? "method2" #=> true
|
1455
1455
|
#
|
1456
|
-
def public_method_defined?: (
|
1456
|
+
def public_method_defined?: (id name, ?boolish inherit) -> bool
|
1457
1457
|
|
1458
1458
|
# <!--
|
1459
1459
|
# rdoc-file=eval.c
|
@@ -1505,7 +1505,7 @@ class Module < Object
|
|
1505
1505
|
# 99
|
1506
1506
|
# nil
|
1507
1507
|
#
|
1508
|
-
def remove_class_variable: (
|
1508
|
+
def remove_class_variable: (id arg0) -> untyped
|
1509
1509
|
|
1510
1510
|
# <!--
|
1511
1511
|
# rdoc-file=object.c
|
@@ -1515,7 +1515,7 @@ class Module < Object
|
|
1515
1515
|
# previous value. If that constant referred to a module, this will not change
|
1516
1516
|
# that module's name and can lead to confusion.
|
1517
1517
|
#
|
1518
|
-
def remove_const: (
|
1518
|
+
def remove_const: (id arg0) -> untyped
|
1519
1519
|
|
1520
1520
|
# <!--
|
1521
1521
|
# rdoc-file=vm_method.c
|
@@ -1525,7 +1525,7 @@ class Module < Object
|
|
1525
1525
|
# Removes the method identified by *symbol* from the current class. For an
|
1526
1526
|
# example, see Module#undef_method. String arguments are converted to symbols.
|
1527
1527
|
#
|
1528
|
-
def remove_method: (*
|
1528
|
+
def remove_method: (*id arg0) -> self
|
1529
1529
|
|
1530
1530
|
# <!--
|
1531
1531
|
# rdoc-file=object.c
|
@@ -1591,7 +1591,7 @@ class Module < Object
|
|
1591
1591
|
# In parent
|
1592
1592
|
# prog.rb:23: undefined method `hello' for #<Child:0x401b3bb4> (NoMethodError)
|
1593
1593
|
#
|
1594
|
-
def undef_method: (*
|
1594
|
+
def undef_method: (*id arg0) -> self
|
1595
1595
|
|
1596
1596
|
# <!--
|
1597
1597
|
# rdoc-file=object.c
|
@@ -1629,5 +1629,7 @@ class Module < Object
|
|
1629
1629
|
# `attr_reader(name)` but deprecated. Returns an array of defined method names
|
1630
1630
|
# as symbols.
|
1631
1631
|
#
|
1632
|
-
def attr: (*
|
1632
|
+
def attr: (*id arg0) -> Array[Symbol]
|
1633
|
+
|
1634
|
+
type id = Symbol | string
|
1633
1635
|
end
|
data/core/object.rbs
CHANGED
@@ -205,7 +205,7 @@ class Object < BasicObject
|
|
205
205
|
# chris.define_singleton_method(:greet) {|greeting| "#{greeting}, I'm Chris!" }
|
206
206
|
# chris.greet("Hi") #=> "Hi, I'm Chris!"
|
207
207
|
#
|
208
|
-
def define_singleton_method: (name, Method | UnboundMethod) -> Symbol
|
208
|
+
def define_singleton_method: (name, Method | UnboundMethod | Proc method) -> Symbol
|
209
209
|
| (name) { (*untyped) -> untyped } -> Symbol
|
210
210
|
|
211
211
|
# <!--
|
@@ -223,7 +223,7 @@ class Object < BasicObject
|
|
223
223
|
#
|
224
224
|
# 1cat[4, 5, 6]
|
225
225
|
#
|
226
|
-
def display: (?
|
226
|
+
def display: (?_Writer port) -> void
|
227
227
|
|
228
228
|
# <!--
|
229
229
|
# rdoc-file=object.c
|
@@ -320,7 +320,7 @@ class Object < BasicObject
|
|
320
320
|
# enum.first(4) # => [1, 1, 1, 2]
|
321
321
|
# enum.size # => 42
|
322
322
|
#
|
323
|
-
def enum_for: (Symbol method, *untyped
|
323
|
+
def enum_for: (Symbol method, *untyped, **untyped) ?{ (*untyped, **untyped) -> Integer } -> Enumerator[untyped, untyped]
|
324
324
|
| () ?{ () -> Integer } -> Enumerator[untyped, self]
|
325
325
|
|
326
326
|
# <!--
|
@@ -1074,8 +1074,4 @@ class Object < BasicObject
|
|
1074
1074
|
alias then yield_self
|
1075
1075
|
end
|
1076
1076
|
|
1077
|
-
interface _Writeable
|
1078
|
-
def write: (untyped) -> void
|
1079
|
-
end
|
1080
|
-
|
1081
1077
|
type Object::name = Symbol | string
|
data/core/string_io.rbs
CHANGED
@@ -495,6 +495,15 @@ class StringIO
|
|
495
495
|
#
|
496
496
|
def tell: () -> Integer
|
497
497
|
|
498
|
+
# <!--
|
499
|
+
# rdoc-file=ext/stringio/stringio.c
|
500
|
+
# - strio.truncate(integer) -> 0
|
501
|
+
# -->
|
502
|
+
# Truncates the buffer string to at most *integer* bytes. The stream must be
|
503
|
+
# opened for writing.
|
504
|
+
#
|
505
|
+
def truncate: (Integer) -> 0
|
506
|
+
|
498
507
|
# <!-- rdoc-file=ext/stringio/stringio.c -->
|
499
508
|
# Returns `false`. Just for compatibility to IO.
|
500
509
|
#
|
data/core/thread.rbs
CHANGED
@@ -971,6 +971,30 @@ class Thread < Object
|
|
971
971
|
#
|
972
972
|
def self.handle_interrupt: (untyped hash) -> untyped
|
973
973
|
|
974
|
+
# <!--
|
975
|
+
# rdoc-file=thread.c
|
976
|
+
# - thr.raise
|
977
|
+
# - thr.raise(string)
|
978
|
+
# - thr.raise(exception [, string [, array]])
|
979
|
+
# -->
|
980
|
+
# Raises an exception from the given thread. The caller does not have to be
|
981
|
+
# `thr`. See Kernel#raise for more information.
|
982
|
+
#
|
983
|
+
# Thread.abort_on_exception = true
|
984
|
+
# a = Thread.new { sleep(200) }
|
985
|
+
# a.raise("Gotcha")
|
986
|
+
#
|
987
|
+
# This will produce:
|
988
|
+
#
|
989
|
+
# prog.rb:3: Gotcha (RuntimeError)
|
990
|
+
# from prog.rb:2:in `initialize'
|
991
|
+
# from prog.rb:2:in `new'
|
992
|
+
# from prog.rb:2
|
993
|
+
#
|
994
|
+
def self?.raise: () -> bot
|
995
|
+
| (String message, ?cause: Exception?) -> bot
|
996
|
+
| (_Exception exception, ?untyped message, ?::Array[String] backtrace, ?cause: Exception?) -> bot
|
997
|
+
|
974
998
|
# <!--
|
975
999
|
# rdoc-file=thread.c
|
976
1000
|
# - Thread.kill(thread) -> thread
|
@@ -1414,7 +1438,7 @@ class Thread::ConditionVariable < Object
|
|
1414
1438
|
#
|
1415
1439
|
# Returns the slept result on `mutex`.
|
1416
1440
|
#
|
1417
|
-
def wait: (Thread::Mutex mutex, ?Integer timeout) -> self
|
1441
|
+
def wait: (Thread::Mutex mutex, ?Integer | Float? timeout) -> self
|
1418
1442
|
end
|
1419
1443
|
|
1420
1444
|
# <!-- rdoc-file=thread_sync.c -->
|
data/core/time.rbs
CHANGED
@@ -1093,7 +1093,7 @@ class Time < Object
|
|
1093
1093
|
#
|
1094
1094
|
# Related: Time#ceil, Time#floor.
|
1095
1095
|
#
|
1096
|
-
def round: (?
|
1096
|
+
def round: (?int ndigits) -> Time
|
1097
1097
|
|
1098
1098
|
# <!--
|
1099
1099
|
# rdoc-file=time.c
|
@@ -1503,7 +1503,7 @@ class Time < Object
|
|
1503
1503
|
#
|
1504
1504
|
# Related: Time#ceil, Time#round.
|
1505
1505
|
#
|
1506
|
-
def floor: (?
|
1506
|
+
def floor: (?int ndigits) -> Time
|
1507
1507
|
|
1508
1508
|
# <!--
|
1509
1509
|
# rdoc-file=time.c
|
@@ -1530,7 +1530,7 @@ class Time < Object
|
|
1530
1530
|
#
|
1531
1531
|
# Related: Time#floor, Time#round.
|
1532
1532
|
#
|
1533
|
-
def ceil: (?
|
1533
|
+
def ceil: (?int ndigits) -> Time
|
1534
1534
|
end
|
1535
1535
|
|
1536
1536
|
Time::RFC2822_DAY_NAME: Array[String]
|
data/core/warning.rbs
CHANGED
@@ -29,6 +29,8 @@
|
|
29
29
|
# The `warning` gem provides convenient ways to customize Warning.warn.
|
30
30
|
#
|
31
31
|
module Warning
|
32
|
+
type category = :deprecated | :experimental
|
33
|
+
|
32
34
|
# <!--
|
33
35
|
# rdoc-file=error.c
|
34
36
|
# - warn(msg, category: nil) -> nil
|
@@ -38,5 +40,5 @@ module Warning
|
|
38
40
|
#
|
39
41
|
# See the documentation of the Warning module for how to customize this.
|
40
42
|
#
|
41
|
-
def self?.warn: (String message, ?category:
|
43
|
+
def self?.warn: (String message, ?category: category?) -> nil
|
42
44
|
end
|
data/docs/CONTRIBUTING.md
CHANGED
@@ -69,7 +69,7 @@ We define the standard members order so that ordering doesn't bother reading dif
|
|
69
69
|
5. `public` & public instance methods
|
70
70
|
6. `private` & private instance methods
|
71
71
|
|
72
|
-
```
|
72
|
+
```rbs
|
73
73
|
class HelloWorld[X]
|
74
74
|
def self.new: [A] () { (void) -> A } -> HelloWorld[A] # new or initialize comes first
|
75
75
|
def initialize: () -> void
|