rbs 3.4.4 → 3.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +12 -4
- data/.github/workflows/dependabot.yml +26 -0
- data/.github/workflows/ruby.yml +14 -1
- data/CHANGELOG.md +87 -1
- data/README.md +5 -3
- data/Rakefile +20 -3
- data/Steepfile +1 -1
- data/core/enumerator.rbs +1 -1
- data/core/float.rbs +2 -1
- data/core/gc.rbs +272 -150
- data/core/integer.rbs +6 -4
- data/core/io/wait.rbs +4 -4
- data/core/io.rbs +10 -3
- data/core/kernel.rbs +8 -7
- data/core/module.rbs +17 -4
- data/core/proc.rbs +1 -1
- data/core/range.rbs +2 -2
- data/core/rational.rbs +2 -1
- data/core/regexp.rbs +101 -90
- data/core/ruby_vm.rbs +107 -103
- data/core/rubygems/rubygems.rbs +1 -1
- data/core/set.rbs +13 -7
- data/core/string.rbs +3 -3
- data/core/symbol.rbs +2 -1
- data/core/thread.rbs +1 -1
- data/core/time.rbs +24 -4
- data/docs/architecture.md +110 -0
- data/docs/gem.md +0 -1
- data/docs/syntax.md +5 -1
- data/ext/rbs_extension/constants.c +2 -0
- data/ext/rbs_extension/constants.h +1 -0
- data/ext/rbs_extension/lexer.c +1338 -1341
- data/ext/rbs_extension/lexer.h +2 -0
- data/ext/rbs_extension/lexer.re +2 -3
- data/ext/rbs_extension/lexstate.c +5 -1
- data/ext/rbs_extension/location.c +80 -70
- data/ext/rbs_extension/location.h +25 -5
- data/ext/rbs_extension/parser.c +149 -43
- data/ext/rbs_extension/parserstate.c +12 -1
- data/ext/rbs_extension/parserstate.h +9 -0
- data/ext/rbs_extension/ruby_objs.c +13 -3
- data/ext/rbs_extension/ruby_objs.h +1 -0
- data/lib/rbs/cli/validate.rb +2 -2
- data/lib/rbs/cli.rb +4 -6
- data/lib/rbs/collection/config.rb +1 -1
- data/lib/rbs/collection/sources/git.rb +1 -6
- data/lib/rbs/definition_builder/method_builder.rb +1 -1
- data/lib/rbs/definition_builder.rb +8 -8
- data/lib/rbs/diff.rb +1 -1
- data/lib/rbs/environment_loader.rb +2 -1
- data/lib/rbs/errors.rb +0 -14
- data/lib/rbs/location_aux.rb +6 -1
- data/lib/rbs/parser/lex_result.rb +15 -0
- data/lib/rbs/parser/token.rb +23 -0
- data/lib/rbs/parser_aux.rb +12 -5
- data/lib/rbs/prototype/helpers.rb +22 -12
- data/lib/rbs/prototype/rb.rb +38 -4
- data/lib/rbs/prototype/rbi.rb +30 -20
- data/lib/rbs/test/errors.rb +19 -14
- data/lib/rbs/test/tester.rb +1 -1
- data/lib/rbs/test/type_check.rb +95 -16
- data/lib/rbs/types.rb +112 -13
- data/lib/rbs/unit_test/spy.rb +1 -1
- data/lib/rbs/version.rb +1 -1
- data/rbs.gemspec +7 -2
- data/sig/environment_loader.rbs +1 -1
- data/sig/errors.rbs +1 -1
- data/sig/manifest.yaml +0 -1
- data/sig/method_types.rbs +3 -3
- data/sig/parser.rbs +28 -0
- data/sig/prototype/helpers.rbs +4 -0
- data/sig/prototype/rbi.rbs +2 -0
- data/sig/types.rbs +54 -4
- data/sig/variance_calculator.rbs +2 -2
- data/stdlib/csv/0/csv.rbs +4 -1
- data/stdlib/fileutils/0/fileutils.rbs +1 -1
- data/stdlib/net-http/0/net-http.rbs +29 -27
- data/stdlib/socket/0/socket.rbs +2 -2
- data/stdlib/timeout/0/timeout.rbs +6 -0
- data/stdlib/uri/0/generic.rbs +2 -2
- data/stdlib/uri/0/http.rbs +2 -2
- data/stdlib/uri/0/mailto.rbs +84 -0
- metadata +7 -9
- data/Gemfile +0 -30
- data/Gemfile.lock +0 -117
- data/lib/rbs/parser_compat/lexer_error.rb +0 -6
- data/lib/rbs/parser_compat/located_value.rb +0 -7
- data/lib/rbs/parser_compat/semantics_error.rb +0 -6
- 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: (
|
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
|
-
#
|
1352
|
-
|
1353
|
-
|
1354
|
-
|
1355
|
-
|
1356
|
-
|
1357
|
-
|
1358
|
-
|
1359
|
-
|
1360
|
-
#
|
1361
|
-
#
|
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
|
-
|
1369
|
-
|
1370
|
-
#
|
1354
|
+
FIXEDENCODING: Integer
|
1355
|
+
|
1356
|
+
# <!-- rdoc-file=re.c -->
|
1357
|
+
# see Regexp.options and Regexp.new
|
1371
1358
|
#
|
1372
|
-
|
1373
|
-
|
1374
|
-
#
|
1359
|
+
IGNORECASE: Integer
|
1360
|
+
|
1361
|
+
# <!-- rdoc-file=re.c -->
|
1362
|
+
# see Regexp.options and Regexp.new
|
1375
1363
|
#
|
1376
|
-
|
1377
|
-
|
1378
|
-
#
|
1379
|
-
#
|
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
|
-
|
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
|
-
| (
|
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
|
-
|
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: (
|
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=: (
|
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
|
-
| (
|
1563
|
-
| (
|
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
|
-
|
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 =~: (
|
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
|
-
|
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: (
|
1778
|
-
| [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?: (
|
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: () ->
|
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: () ->
|
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
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
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
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
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
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
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
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
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
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
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
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
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
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
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
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
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
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
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
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
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
|
-
|
376
|
-
end
|
380
|
+
module RubyVM::RJIT
|
377
381
|
end
|
data/core/rubygems/rubygems.rbs
CHANGED
@@ -482,7 +482,7 @@ module Gem
|
|
482
482
|
# rdoc-file=lib/rubygems.rb
|
483
483
|
# - find_unresolved_default_spec(path)
|
484
484
|
# -->
|
485
|
-
# Find
|
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?: (
|
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) ->
|
462
|
-
| () { (A) ->
|
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?: (
|
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
|
-
|
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
|
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: (
|
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 =~: (
|
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, ?
|
1440
|
+
def wait: (Thread::Mutex mutex, ?Time::_Timeout? timeout) -> Integer?
|
1441
1441
|
end
|
1442
1442
|
|
1443
1443
|
# <!-- rdoc-file=thread_sync.c -->
|