rbs 3.4.4 → 3.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +12 -4
  3. data/.github/workflows/dependabot.yml +26 -0
  4. data/.github/workflows/ruby.yml +14 -1
  5. data/CHANGELOG.md +87 -1
  6. data/README.md +5 -3
  7. data/Rakefile +20 -3
  8. data/Steepfile +1 -1
  9. data/core/enumerator.rbs +1 -1
  10. data/core/float.rbs +2 -1
  11. data/core/gc.rbs +272 -150
  12. data/core/integer.rbs +6 -4
  13. data/core/io/wait.rbs +4 -4
  14. data/core/io.rbs +10 -3
  15. data/core/kernel.rbs +8 -7
  16. data/core/module.rbs +17 -4
  17. data/core/proc.rbs +1 -1
  18. data/core/range.rbs +2 -2
  19. data/core/rational.rbs +2 -1
  20. data/core/regexp.rbs +101 -90
  21. data/core/ruby_vm.rbs +107 -103
  22. data/core/rubygems/rubygems.rbs +1 -1
  23. data/core/set.rbs +13 -7
  24. data/core/string.rbs +3 -3
  25. data/core/symbol.rbs +2 -1
  26. data/core/thread.rbs +1 -1
  27. data/core/time.rbs +24 -4
  28. data/docs/architecture.md +110 -0
  29. data/docs/gem.md +0 -1
  30. data/docs/syntax.md +5 -1
  31. data/ext/rbs_extension/constants.c +2 -0
  32. data/ext/rbs_extension/constants.h +1 -0
  33. data/ext/rbs_extension/lexer.c +1338 -1341
  34. data/ext/rbs_extension/lexer.h +2 -0
  35. data/ext/rbs_extension/lexer.re +2 -3
  36. data/ext/rbs_extension/lexstate.c +5 -1
  37. data/ext/rbs_extension/location.c +80 -70
  38. data/ext/rbs_extension/location.h +25 -5
  39. data/ext/rbs_extension/parser.c +149 -43
  40. data/ext/rbs_extension/parserstate.c +12 -1
  41. data/ext/rbs_extension/parserstate.h +9 -0
  42. data/ext/rbs_extension/ruby_objs.c +13 -3
  43. data/ext/rbs_extension/ruby_objs.h +1 -0
  44. data/lib/rbs/cli/validate.rb +2 -2
  45. data/lib/rbs/cli.rb +4 -6
  46. data/lib/rbs/collection/config.rb +1 -1
  47. data/lib/rbs/collection/sources/git.rb +1 -6
  48. data/lib/rbs/definition_builder/method_builder.rb +1 -1
  49. data/lib/rbs/definition_builder.rb +8 -8
  50. data/lib/rbs/diff.rb +1 -1
  51. data/lib/rbs/environment_loader.rb +2 -1
  52. data/lib/rbs/errors.rb +0 -14
  53. data/lib/rbs/location_aux.rb +6 -1
  54. data/lib/rbs/parser/lex_result.rb +15 -0
  55. data/lib/rbs/parser/token.rb +23 -0
  56. data/lib/rbs/parser_aux.rb +12 -5
  57. data/lib/rbs/prototype/helpers.rb +22 -12
  58. data/lib/rbs/prototype/rb.rb +38 -4
  59. data/lib/rbs/prototype/rbi.rb +30 -20
  60. data/lib/rbs/test/errors.rb +19 -14
  61. data/lib/rbs/test/tester.rb +1 -1
  62. data/lib/rbs/test/type_check.rb +95 -16
  63. data/lib/rbs/types.rb +112 -13
  64. data/lib/rbs/unit_test/spy.rb +1 -1
  65. data/lib/rbs/version.rb +1 -1
  66. data/rbs.gemspec +7 -2
  67. data/sig/environment_loader.rbs +1 -1
  68. data/sig/errors.rbs +1 -1
  69. data/sig/manifest.yaml +0 -1
  70. data/sig/method_types.rbs +3 -3
  71. data/sig/parser.rbs +28 -0
  72. data/sig/prototype/helpers.rbs +4 -0
  73. data/sig/prototype/rbi.rbs +2 -0
  74. data/sig/types.rbs +54 -4
  75. data/sig/variance_calculator.rbs +2 -2
  76. data/stdlib/csv/0/csv.rbs +4 -1
  77. data/stdlib/fileutils/0/fileutils.rbs +1 -1
  78. data/stdlib/net-http/0/net-http.rbs +29 -27
  79. data/stdlib/socket/0/socket.rbs +2 -2
  80. data/stdlib/timeout/0/timeout.rbs +6 -0
  81. data/stdlib/uri/0/generic.rbs +2 -2
  82. data/stdlib/uri/0/http.rbs +2 -2
  83. data/stdlib/uri/0/mailto.rbs +84 -0
  84. metadata +7 -9
  85. data/Gemfile +0 -30
  86. data/Gemfile.lock +0 -117
  87. data/lib/rbs/parser_compat/lexer_error.rb +0 -6
  88. data/lib/rbs/parser_compat/located_value.rb +0 -7
  89. data/lib/rbs/parser_compat/semantics_error.rb +0 -6
  90. data/lib/rbs/parser_compat/syntax_error.rb +0 -6
data/core/rational.rbs CHANGED
@@ -245,7 +245,8 @@ class Rational < Numeric
245
245
 
246
246
  def div: (Numeric) -> Integer
247
247
 
248
- def divmod: (Numeric) -> [ Numeric, Numeric ]
248
+ def divmod: (Integer | Float | Rational) -> [ Integer, Rational ]
249
+ | (Numeric) -> [ Numeric, Numeric ]
249
250
 
250
251
  def dup: () -> self
251
252
 
data/core/regexp.rbs CHANGED
@@ -1332,56 +1332,41 @@
1332
1332
  # * [Rubular](https://rubular.com/).
1333
1333
  #
1334
1334
  class Regexp
1335
- # <!--
1336
- # rdoc-file=re.c
1337
- # - Regexp.new(string, options = 0, timeout: nil) -> regexp
1338
- # - Regexp.new(regexp, timeout: nil) -> regexp
1339
- # -->
1340
- # With argument `string` given, returns a new regexp with the given string and
1341
- # options:
1342
- #
1343
- # r = Regexp.new('foo') # => /foo/
1344
- # r.source # => "foo"
1345
- # r.options # => 0
1346
- #
1347
- # Optional argument `options` is one of the following:
1348
- #
1349
- # * A String of options:
1335
+ # Represents an object's ability to be converted to a `Regexp`.
1350
1336
  #
1351
- # Regexp.new('foo', 'i') # => /foo/i
1352
- # Regexp.new('foo', 'im') # => /foo/im
1353
- #
1354
- # * The bit-wise OR of one or more of the constants Regexp::EXTENDED,
1355
- # Regexp::IGNORECASE, Regexp::MULTILINE, and Regexp::NOENCODING:
1356
- #
1357
- # Regexp.new('foo', Regexp::IGNORECASE) # => /foo/i
1358
- # Regexp.new('foo', Regexp::EXTENDED) # => /foo/x
1359
- # Regexp.new('foo', Regexp::MULTILINE) # => /foo/m
1360
- # Regexp.new('foo', Regexp::NOENCODING) # => /foo/n
1361
- # flags = Regexp::IGNORECASE | Regexp::EXTENDED | Regexp::MULTILINE
1362
- # Regexp.new('foo', flags) # => /foo/mix
1363
- #
1364
- # * `nil` or `false`, which is ignored.
1365
- # * Any other truthy value, in which case the regexp will be case-insensitive.
1337
+ # This is only used in `Regexp.try_convert` and `Regexp.union` within the standard library.
1338
+ interface _ToRegexp
1339
+ # Converts `self` to a `Regexp`.
1340
+ def to_regexp: () -> Regexp
1341
+ end
1342
+
1343
+ class TimeoutError < RegexpError
1344
+ end
1345
+
1346
+ # <!-- rdoc-file=re.c -->
1347
+ # see Regexp.options and Regexp.new
1366
1348
  #
1349
+ EXTENDED: Integer
1350
+
1351
+ # <!-- rdoc-file=re.c -->
1352
+ # see Regexp.options and Regexp.new
1367
1353
  #
1368
- # If optional keyword argument `timeout` is given, its float value overrides the
1369
- # timeout interval for the class, Regexp.timeout. If `nil` is passed as
1370
- # +timeout, it uses the timeout interval for the class, Regexp.timeout.
1354
+ FIXEDENCODING: Integer
1355
+
1356
+ # <!-- rdoc-file=re.c -->
1357
+ # see Regexp.options and Regexp.new
1371
1358
  #
1372
- # With argument `regexp` given, returns a new regexp. The source, options,
1373
- # timeout are the same as `regexp`. `options` and `n_flag` arguments are
1374
- # ineffective. The timeout can be overridden by `timeout` keyword.
1359
+ IGNORECASE: Integer
1360
+
1361
+ # <!-- rdoc-file=re.c -->
1362
+ # see Regexp.options and Regexp.new
1375
1363
  #
1376
- # options = Regexp::MULTILINE
1377
- # r = Regexp.new('foo', options, timeout: 1.1) # => /foo/m
1378
- # r2 = Regexp.new(r) # => /foo/m
1379
- # r2.timeout # => 1.1
1380
- # r3 = Regexp.new(r, timeout: 3.14) # => /foo/m
1381
- # r3.timeout # => 3.14
1364
+ MULTILINE: Integer
1365
+
1366
+ # <!-- rdoc-file=re.c -->
1367
+ # see Regexp.options and Regexp.new
1382
1368
  #
1383
- def initialize: (String string, ?String | Integer | nil | false options, ?timeout: Float?) -> Object
1384
- | (Regexp regexp, ?timeout: Float?) -> void
1369
+ NOENCODING: Integer
1385
1370
 
1386
1371
  # <!--
1387
1372
  # rdoc-file=re.c
@@ -1444,8 +1429,7 @@ class Regexp
1444
1429
  # Regexp.last_match('foo') # Raises IndexError.
1445
1430
  #
1446
1431
  def self.last_match: () -> MatchData?
1447
- | (Integer n) -> String?
1448
- | (interned n) -> String?
1432
+ | (MatchData::capture capture) -> String?
1449
1433
 
1450
1434
  # <!--
1451
1435
  # rdoc-file=re.c
@@ -1466,7 +1450,8 @@ class Regexp
1466
1450
  #
1467
1451
  # (*1): https://doi.org/10.1109/SP40001.2021.00032
1468
1452
  #
1469
- def self.linear_time?: () -> bool
1453
+ def self.linear_time?: (Regexp regex, ?nil, ?timeout: untyped) -> bool
1454
+ | (string regex, ?int | string | bool | nil options, ?timeout: untyped) -> bool
1470
1455
 
1471
1456
  # <!--
1472
1457
  # rdoc-file=re.c
@@ -1482,7 +1467,7 @@ class Regexp
1482
1467
  # r = Regexp.new(Regexp.escape(s)) # => /\\\\\\\*\\\?\\\{\\\}\\\./
1483
1468
  # r.match(s) # => #<MatchData "\\\\\\*\\?\\{\\}\\.">
1484
1469
  #
1485
- def self.quote: (interned str) -> String
1470
+ alias self.quote self.escape
1486
1471
 
1487
1472
  # <!--
1488
1473
  # rdoc-file=re.c
@@ -1501,7 +1486,8 @@ class Regexp
1501
1486
  #
1502
1487
  # Raises an exception unless `object.to_regexp` returns a regexp.
1503
1488
  #
1504
- def self.try_convert: (untyped obj) -> Regexp?
1489
+ def self.try_convert: (Regexp | _ToRegexp regexp_like) -> Regexp
1490
+ | (untyped other) -> Regexp?
1505
1491
 
1506
1492
  # <!--
1507
1493
  # rdoc-file=re.c
@@ -1524,7 +1510,7 @@ class Regexp
1524
1510
  # Regexp.timeout = 1
1525
1511
  # /^a*b?a*$/ =~ "a" * 100000 + "x" #=> regexp match timeout (RuntimeError)
1526
1512
  #
1527
- def self.timeout=: (Float?) -> Float?
1513
+ def self.timeout=: [T < _ToF] (T timeout) -> T
1528
1514
 
1529
1515
  # <!--
1530
1516
  # rdoc-file=re.c
@@ -1558,11 +1544,62 @@ class Regexp
1558
1544
  #
1559
1545
  # If any regexp pattern contains captures, the behavior is unspecified.
1560
1546
  #
1561
- def self.union: () -> Regexp
1562
- | (String | Regexp pat1, *String | Regexp pat2) -> Regexp
1563
- | (::Array[String | Regexp]) -> Regexp
1547
+ def self.union: (*Regexp | _ToRegexp | string patterns) -> Regexp
1548
+ | (array[Regexp | _ToRegexp | string] patterns) -> Regexp
1549
+ | (Symbol | [Symbol] symbol_pattern) -> Regexp
1564
1550
 
1565
- public
1551
+ # <!--
1552
+ # rdoc-file=re.c
1553
+ # - Regexp.new(string, options = 0, timeout: nil) -> regexp
1554
+ # - Regexp.new(regexp, timeout: nil) -> regexp
1555
+ # -->
1556
+ # With argument `string` given, returns a new regexp with the given string and
1557
+ # options:
1558
+ #
1559
+ # r = Regexp.new('foo') # => /foo/
1560
+ # r.source # => "foo"
1561
+ # r.options # => 0
1562
+ #
1563
+ # Optional argument `options` is one of the following:
1564
+ #
1565
+ # * A String of options:
1566
+ #
1567
+ # Regexp.new('foo', 'i') # => /foo/i
1568
+ # Regexp.new('foo', 'im') # => /foo/im
1569
+ #
1570
+ # * The bit-wise OR of one or more of the constants Regexp::EXTENDED,
1571
+ # Regexp::IGNORECASE, Regexp::MULTILINE, and Regexp::NOENCODING:
1572
+ #
1573
+ # Regexp.new('foo', Regexp::IGNORECASE) # => /foo/i
1574
+ # Regexp.new('foo', Regexp::EXTENDED) # => /foo/x
1575
+ # Regexp.new('foo', Regexp::MULTILINE) # => /foo/m
1576
+ # Regexp.new('foo', Regexp::NOENCODING) # => /foo/n
1577
+ # flags = Regexp::IGNORECASE | Regexp::EXTENDED | Regexp::MULTILINE
1578
+ # Regexp.new('foo', flags) # => /foo/mix
1579
+ #
1580
+ # * `nil` or `false`, which is ignored.
1581
+ # * Any other truthy value, in which case the regexp will be case-insensitive.
1582
+ #
1583
+ #
1584
+ # If optional keyword argument `timeout` is given, its float value overrides the
1585
+ # timeout interval for the class, Regexp.timeout. If `nil` is passed as
1586
+ # +timeout, it uses the timeout interval for the class, Regexp.timeout.
1587
+ #
1588
+ # With argument `regexp` given, returns a new regexp. The source, options,
1589
+ # timeout are the same as `regexp`. `options` and `n_flag` arguments are
1590
+ # ineffective. The timeout can be overridden by `timeout` keyword.
1591
+ #
1592
+ # options = Regexp::MULTILINE
1593
+ # r = Regexp.new('foo', options, timeout: 1.1) # => /foo/m
1594
+ # r2 = Regexp.new(r) # => /foo/m
1595
+ # r2.timeout # => 1.1
1596
+ # r3 = Regexp.new(r, timeout: 3.14) # => /foo/m
1597
+ # r3.timeout # => 3.14
1598
+ #
1599
+ def initialize: (Regexp regexp, ?timeout: _ToF?) -> self
1600
+ | (string pattern, ?int | string | bool | nil options, ?timeout: _ToF?) -> self
1601
+
1602
+ def initialize_copy: (self object) -> self
1566
1603
 
1567
1604
  # <!-- rdoc-file=re.c -->
1568
1605
  # Returns `true` if `object` is another Regexp whose pattern, flags, and
@@ -1648,7 +1685,8 @@ class Regexp
1648
1685
  # /(?<foo>\w+)\s*=\s*#{r}/ =~ 'x = y'
1649
1686
  # p foo # Undefined local variable
1650
1687
  #
1651
- def =~: (String? | Symbol | _ToStr str) -> Integer?
1688
+ def =~: (interned? string) -> Integer?
1689
+ | (nil) -> nil
1652
1690
 
1653
1691
  # <!--
1654
1692
  # rdoc-file=re.c
@@ -1683,7 +1721,7 @@ class Regexp
1683
1721
  # /foo/ == Regexp.new('food') # => false
1684
1722
  # /foo/ == Regexp.new("abc".force_encoding("euc-jp")) # => false
1685
1723
  #
1686
- def eql?: (untyped other) -> bool
1724
+ alias eql? ==
1687
1725
 
1688
1726
  # <!--
1689
1727
  # rdoc-file=re.c
@@ -1774,8 +1812,9 @@ class Regexp
1774
1812
  # /(.)(.)(.)/.match("abc")[2] # => "b"
1775
1813
  # /(.)(.)/.match("abc", 1)[2] # => "c"
1776
1814
  #
1777
- def match: (String? | Symbol | _ToStr str, ?Integer pos) -> MatchData?
1778
- | [T] (String? | Symbol | _ToStr str, ?Integer pos) { (MatchData) -> T } -> T?
1815
+ def match: (interned? str, ?int offset) -> MatchData?
1816
+ | [T] (interned? str, ?int offset) { (MatchData matchdata) -> T } -> T?
1817
+ | (nil, ?int offset) ?{ (MatchData matchdata) -> void } -> nil
1779
1818
 
1780
1819
  # <!--
1781
1820
  # rdoc-file=re.c
@@ -1791,7 +1830,8 @@ class Regexp
1791
1830
  # /P.../.match?("Ruby") # => false
1792
1831
  # $& # => nil
1793
1832
  #
1794
- def match?: (String? | Symbol | _ToStr str, ?Integer pos) -> bool
1833
+ def match?: (interned str, ?int offset) -> bool
1834
+ | (nil, ?int offset) -> false
1795
1835
 
1796
1836
  # <!--
1797
1837
  # rdoc-file=re.c
@@ -1810,7 +1850,7 @@ class Regexp
1810
1850
  # /(?<foo>.)(?<foo>.)/.named_captures # => {"foo"=>[1, 2]}
1811
1851
  # /(.)(.)/.named_captures # => {}
1812
1852
  #
1813
- def named_captures: () -> ::Hash[String, ::Array[Integer]]
1853
+ def named_captures: () -> Hash[String, Array[Integer]]
1814
1854
 
1815
1855
  # <!--
1816
1856
  # rdoc-file=re.c
@@ -1823,7 +1863,7 @@ class Regexp
1823
1863
  # /(?<foo>.)(?<foo>.)/.names # => ["foo"]
1824
1864
  # /(.)(.)/.names # => []
1825
1865
  #
1826
- def names: () -> ::Array[String]
1866
+ def names: () -> Array[String]
1827
1867
 
1828
1868
  # <!--
1829
1869
  # rdoc-file=re.c
@@ -1933,33 +1973,4 @@ class Regexp
1933
1973
  # ~ /at/ # => 7
1934
1974
  #
1935
1975
  def ~: () -> Integer?
1936
-
1937
- private
1938
-
1939
- def initialize_copy: (self object) -> self
1940
1976
  end
1941
-
1942
- # <!-- rdoc-file=re.c -->
1943
- # see Regexp.options and Regexp.new
1944
- #
1945
- Regexp::EXTENDED: Integer
1946
-
1947
- # <!-- rdoc-file=re.c -->
1948
- # see Regexp.options and Regexp.new
1949
- #
1950
- Regexp::FIXEDENCODING: Integer
1951
-
1952
- # <!-- rdoc-file=re.c -->
1953
- # see Regexp.options and Regexp.new
1954
- #
1955
- Regexp::IGNORECASE: Integer
1956
-
1957
- # <!-- rdoc-file=re.c -->
1958
- # see Regexp.options and Regexp.new
1959
- #
1960
- Regexp::MULTILINE: Integer
1961
-
1962
- # <!-- rdoc-file=re.c -->
1963
- # see Regexp.options and Regexp.new
1964
- #
1965
- Regexp::NOENCODING: Integer
data/core/ruby_vm.rbs CHANGED
@@ -260,118 +260,122 @@ module RubyVM::AbstractSyntaxTree
260
260
  #
261
261
  def children: () -> Array[untyped]
262
262
  end
263
+ end
263
264
 
264
- # <!-- rdoc-file=yjit.rb -->
265
- # This module allows for introspection of YJIT, CRuby's just-in-time compiler.
266
- # Everything in the module is highly implementation specific and the API might
267
- # be less stable compared to the standard library.
268
- # This module may not exist if YJIT does not support the particular platform
269
- # for which CRuby is built.
270
- #
271
- module YJIT
272
- # <!--
273
- # rdoc-file=yjit.rb
274
- # - code_gc()
275
- # -->
276
- # Discard existing compiled code to reclaim memory
277
- # and allow for recompilations in the future.
278
- #
279
- def self.code_gc: () -> void
265
+ # <!-- rdoc-file=yjit.rb -->
266
+ # This module allows for introspection of YJIT, CRuby's just-in-time compiler.
267
+ # Everything in the module is highly implementation specific and the API might
268
+ # be less stable compared to the standard library.
269
+ # This module may not exist if YJIT does not support the particular platform
270
+ # for which CRuby is built.
271
+ #
272
+ module RubyVM::YJIT
273
+ # <!--
274
+ # rdoc-file=yjit.rb
275
+ # - code_gc()
276
+ # -->
277
+ # Discard existing compiled code to reclaim memory
278
+ # and allow for recompilations in the future.
279
+ #
280
+ def self.code_gc: () -> void
280
281
 
281
- # <!--
282
- # rdoc-file=yjit.rb
283
- # - dump_exit_locations(filename)
284
- # -->
285
- # Marshal dumps exit locations to the given filename.
286
- # Usage:
287
- # If `--yjit-exit-locations` is passed, a file named
288
- # "yjit_exit_locations.dump" will automatically be generated.
289
- # If you want to collect traces manually, call `dump_exit_locations`
290
- # directly.
291
- # Note that calling this in a script will generate stats after the
292
- # dump is created, so the stats data may include exits from the
293
- # dump itself.
294
- # In a script call:
295
- # at_exit do
296
- # RubyVM::YJIT.dump_exit_locations("my_file.dump")
297
- # end
298
- #
299
- # Then run the file with the following options:
300
- # ruby --yjit --yjit-trace-exits test.rb
301
- #
302
- # Once the code is done running, use Stackprof to read the dump file.
303
- # See Stackprof documentation for options.
304
- #
305
- def self.dump_exit_locations: (untyped filename) -> void
282
+ # <!--
283
+ # rdoc-file=yjit.rb
284
+ # - dump_exit_locations(filename)
285
+ # -->
286
+ # Marshal dumps exit locations to the given filename.
287
+ # Usage:
288
+ # If `--yjit-exit-locations` is passed, a file named
289
+ # "yjit_exit_locations.dump" will automatically be generated.
290
+ # If you want to collect traces manually, call `dump_exit_locations`
291
+ # directly.
292
+ # Note that calling this in a script will generate stats after the
293
+ # dump is created, so the stats data may include exits from the
294
+ # dump itself.
295
+ # In a script call:
296
+ # at_exit do
297
+ # RubyVM::YJIT.dump_exit_locations("my_file.dump")
298
+ # end
299
+ #
300
+ # Then run the file with the following options:
301
+ # ruby --yjit --yjit-trace-exits test.rb
302
+ #
303
+ # Once the code is done running, use Stackprof to read the dump file.
304
+ # See Stackprof documentation for options.
305
+ #
306
+ def self.dump_exit_locations: (untyped filename) -> void
306
307
 
307
- # <!--
308
- # rdoc-file=yjit.rb
309
- # - enable()
310
- # -->
311
- # Enable YJIT compilation.
312
- #
313
- def self.enable: () -> void
308
+ # <!--
309
+ # rdoc-file=yjit.rb
310
+ # - enable(stats: false)
311
+ # -->
312
+ # Enable YJIT compilation. `stats` option decides whether to enable YJIT stats
313
+ # or not.
314
+ # * `false`: Disable stats.
315
+ # * `true`: Enable stats. Print stats at exit.
316
+ # * `:quiet`: Enable stats. Do not print stats at exit.
317
+ #
318
+ def self.enable: (?stats: false | true | :quiet) -> void
314
319
 
315
- # <!--
316
- # rdoc-file=yjit.rb
317
- # - enabled?()
318
- # -->
319
- # Check if YJIT is enabled.
320
- #
321
- def self.enabled?: () -> bool
320
+ # <!--
321
+ # rdoc-file=yjit.rb
322
+ # - enabled?()
323
+ # -->
324
+ # Check if YJIT is enabled.
325
+ #
326
+ def self.enabled?: () -> bool
322
327
 
323
- # <!--
324
- # rdoc-file=yjit.rb
325
- # - format_number(pad, number)
326
- # -->
327
- # Format large numbers with comma separators for readability
328
- #
329
- def self.format_number: (untyped pad, untyped number) -> untyped
328
+ # <!--
329
+ # rdoc-file=yjit.rb
330
+ # - format_number(pad, number)
331
+ # -->
332
+ # Format large numbers with comma separators for readability
333
+ #
334
+ def self.format_number: (untyped pad, untyped number) -> untyped
330
335
 
331
- # <!--
332
- # rdoc-file=yjit.rb
333
- # - format_number_pct(pad, number, total)
334
- # -->
335
- # Format a number along with a percentage over a total value
336
- #
337
- def self.format_number_pct: (untyped pad, untyped number, untyped total) -> untyped
336
+ # <!--
337
+ # rdoc-file=yjit.rb
338
+ # - format_number_pct(pad, number, total)
339
+ # -->
340
+ # Format a number along with a percentage over a total value
341
+ #
342
+ def self.format_number_pct: (untyped pad, untyped number, untyped total) -> untyped
338
343
 
339
- # <!--
340
- # rdoc-file=yjit.rb
341
- # - reset_stats!()
342
- # -->
343
- # Discard statistics collected for `--yjit-stats`.
344
- #
345
- def self.reset_stats!: () -> void
344
+ # <!--
345
+ # rdoc-file=yjit.rb
346
+ # - reset_stats!()
347
+ # -->
348
+ # Discard statistics collected for `--yjit-stats`.
349
+ #
350
+ def self.reset_stats!: () -> void
346
351
 
347
- # <!--
348
- # rdoc-file=yjit.rb
349
- # - runtime_stats(context: false)
350
- # -->
351
- # Return a hash for statistics generated for the `--yjit-stats` command line
352
- # option.
353
- # Return `nil` when option is not passed or unavailable.
354
- #
355
- def self.runtime_stats: (?context: bool) -> Hash[untyped, untyped]?
352
+ # <!--
353
+ # rdoc-file=yjit.rb
354
+ # - runtime_stats(context: false)
355
+ # -->
356
+ # Return a hash for statistics generated for the `--yjit-stats` command line
357
+ # option.
358
+ # Return `nil` when option is not passed or unavailable.
359
+ #
360
+ def self.runtime_stats: (?context: bool) -> Hash[untyped, untyped]?
356
361
 
357
- # <!--
358
- # rdoc-file=yjit.rb
359
- # - stats_enabled?()
360
- # -->
361
- # Check if `--yjit-stats` is used.
362
- #
363
- def self.stats_enabled?: () -> bool
362
+ # <!--
363
+ # rdoc-file=yjit.rb
364
+ # - stats_enabled?()
365
+ # -->
366
+ # Check if `--yjit-stats` is used.
367
+ #
368
+ def self.stats_enabled?: () -> bool
364
369
 
365
- # <!--
366
- # rdoc-file=yjit.rb
367
- # - stats_string()
368
- # -->
369
- # Format and print out counters as a String. This returns a non-empty
370
- # content only when `--yjit-stats` is enabled.
371
- #
372
- def self.stats_string: () -> String
373
- end
370
+ # <!--
371
+ # rdoc-file=yjit.rb
372
+ # - stats_string()
373
+ # -->
374
+ # Format and print out counters as a String. This returns a non-empty
375
+ # content only when `--yjit-stats` is enabled.
376
+ #
377
+ def self.stats_string: () -> String
378
+ end
374
379
 
375
- module RJIT
376
- end
380
+ module RubyVM::RJIT
377
381
  end
@@ -482,7 +482,7 @@ module Gem
482
482
  # rdoc-file=lib/rubygems.rb
483
483
  # - find_unresolved_default_spec(path)
484
484
  # -->
485
- # Find a Gem::Specification of default gem from `path`
485
+ # Find an unresolved Gem::Specification of default gem from `path`
486
486
  #
487
487
  def self.find_unresolved_default_spec: (String path) -> Specification?
488
488
 
data/core/set.rbs CHANGED
@@ -415,7 +415,7 @@ class Set[unchecked out A]
415
415
  # Equivalent to Set#delete_if, but returns nil if no changes were
416
416
  # made. Returns an enumerator if no block is given.
417
417
  #
418
- def reject!: () { (A) -> untyped } -> self
418
+ def reject!: () { (A) -> untyped } -> self?
419
419
 
420
420
  # <!--
421
421
  # rdoc-file=lib/set.rb
@@ -437,7 +437,7 @@ class Set[unchecked out A]
437
437
  # Set[1, 2, 3].disjoint? [3, 4] #=> false
438
438
  # Set[1, 2, 3].disjoint? 4..5 #=> true
439
439
  #
440
- def disjoint?: (_Each[A]) -> bool
440
+ def disjoint?: (Set[A] | Enumerable[A]) -> bool
441
441
 
442
442
  # <!--
443
443
  # rdoc-file=lib/set.rb
@@ -458,8 +458,8 @@ class Set[unchecked out A]
458
458
  #
459
459
  # Returns an enumerator if no block is given.
460
460
  #
461
- def divide: () { (A, A) -> untyped } -> Set[self]
462
- | () { (A) -> untyped } -> Set[self]
461
+ def divide: () { (A, A) -> Hash::_Key } -> Set[self]
462
+ | () { (A) -> Hash::_Key } -> Set[self]
463
463
 
464
464
  # <!--
465
465
  # rdoc-file=lib/set.rb
@@ -500,7 +500,7 @@ class Set[unchecked out A]
500
500
  # Set[1, 2, 3].intersect? 4..5 #=> false
501
501
  # Set[1, 2, 3].intersect? [3, 4] #=> true
502
502
  #
503
- def intersect?: (_Each[A]) -> bool
503
+ def intersect?: (Set[A] | Enumerable[A]) -> bool
504
504
 
505
505
  # <!--
506
506
  # rdoc-file=lib/set.rb
@@ -534,7 +534,7 @@ class Set[unchecked out A]
534
534
  # Merges the elements of the given enumerable objects to the set and
535
535
  # returns self.
536
536
  #
537
- def merge: (_Each[A]) -> self
537
+ def merge: (*_Each[A]) -> self
538
538
 
539
539
  # <!--
540
540
  # rdoc-file=lib/set.rb
@@ -544,7 +544,13 @@ class Set[unchecked out A]
544
544
  #
545
545
  def subset?: (self) -> bool
546
546
 
547
- def proper_subst?: (self) -> bool
547
+ # <!--
548
+ # rdoc-file=lib/set.rb
549
+ # - proper_subset?(set)
550
+ # -->
551
+ # Returns true if the set is a proper subset of the given set.
552
+ #
553
+ def proper_subset?: (self) -> bool
548
554
 
549
555
  # <!--
550
556
  # rdoc-file=lib/set.rb
data/core/string.rbs CHANGED
@@ -703,7 +703,7 @@ class String
703
703
  #
704
704
  # String.new('hello', encoding: 'UTF-8', capacity: 25)
705
705
  #
706
- def initialize: (?string source, ?encoding: encoding?, ?capacity: int?) -> self
706
+ def initialize: (?string source, ?encoding: encoding, ?capacity: int) -> void
707
707
 
708
708
  # <!--
709
709
  # rdoc-file=string.c
@@ -1185,7 +1185,7 @@ class String
1185
1185
  # offset does not land on character (codepoint) boundary, an IndexError will be
1186
1186
  # raised.
1187
1187
  #
1188
- def bytesplice: (int start, int length, string str) -> String
1188
+ def bytesplice: (Integer start, int length, string str) -> String
1189
1189
  | (int start, int length, string str, int str_start, int str_length) -> String
1190
1190
  | (range[int?] range, string str, ?range[int?] str_range) -> String
1191
1191
 
@@ -2098,7 +2098,7 @@ class String
2098
2098
  # Related: String#sub, String#gsub, String#sub!.
2099
2099
  #
2100
2100
  def gsub!: (Regexp | string pattern, string | hash[String, _ToS] replacement) -> self?
2101
- | (Regexp | string pattern) -> Enumerator[String, self]
2101
+ | (Regexp | string pattern) -> Enumerator[String, self?]
2102
2102
  | (Regexp | string pattern) { (String match) -> _ToS } -> self?
2103
2103
 
2104
2104
  # <!--
data/core/symbol.rbs CHANGED
@@ -175,7 +175,8 @@ class Symbol
175
175
  # Equivalent to `symbol.to_s =~ object`, including possible updates to global
176
176
  # variables; see String#=~.
177
177
  #
178
- def =~: (untyped obj) -> Integer?
178
+ def =~: (Regexp regex) -> Integer?
179
+ | [T] (String::_MatchAgainst[self, T] object) -> T
179
180
 
180
181
  # <!--
181
182
  # rdoc-file=string.c
data/core/thread.rbs CHANGED
@@ -1437,7 +1437,7 @@ class Thread::ConditionVariable < Object
1437
1437
  #
1438
1438
  # Returns the slept result on `mutex`.
1439
1439
  #
1440
- def wait: (Thread::Mutex mutex, ?Integer | Float? timeout) -> Integer?
1440
+ def wait: (Thread::Mutex mutex, ?Time::_Timeout? timeout) -> Integer?
1441
1441
  end
1442
1442
 
1443
1443
  # <!-- rdoc-file=thread_sync.c -->