rbs 3.2.2 → 3.3.0.pre.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/comments.yml +1 -1
  3. data/.github/workflows/ruby.yml +7 -2
  4. data/CHANGELOG.md +85 -0
  5. data/Gemfile.lock +14 -14
  6. data/README.md +11 -2
  7. data/Rakefile +10 -7
  8. data/Steepfile +7 -7
  9. data/core/basic_object.rbs +7 -7
  10. data/core/binding.rbs +3 -3
  11. data/core/builtin.rbs +171 -5
  12. data/core/constants.rbs +17 -17
  13. data/core/dir.rbs +3 -3
  14. data/core/encoding.rbs +434 -628
  15. data/core/enumerator.rbs +37 -0
  16. data/core/exception.rbs +11 -11
  17. data/core/false_class.rbs +5 -11
  18. data/core/fiber.rbs +3 -3
  19. data/core/file_test.rbs +28 -26
  20. data/core/kernel.rbs +900 -21
  21. data/core/marshal.rbs +24 -14
  22. data/core/match_data.rbs +8 -8
  23. data/core/math.rbs +57 -53
  24. data/core/method.rbs +3 -1
  25. data/core/module.rbs +38 -36
  26. data/core/nil_class.rbs +7 -13
  27. data/core/object.rbs +3 -966
  28. data/core/process.rbs +3 -3
  29. data/core/ractor.rbs +2 -2
  30. data/core/rb_config.rbs +64 -43
  31. data/core/regexp.rbs +3 -3
  32. data/core/signal.rbs +10 -4
  33. data/core/struct.rbs +1 -1
  34. data/core/thread.rbs +7 -7
  35. data/core/thread_group.rbs +9 -9
  36. data/core/true_class.rbs +5 -11
  37. data/core/unbound_method.rbs +56 -7
  38. data/core/warning.rbs +33 -0
  39. data/docs/collection.md +56 -6
  40. data/docs/data_and_struct.md +57 -0
  41. data/docs/stdlib.md +61 -2
  42. data/docs/syntax.md +123 -2
  43. data/ext/rbs_extension/lexer.c +624 -569
  44. data/ext/rbs_extension/lexer.h +1 -0
  45. data/ext/rbs_extension/lexer.re +1 -0
  46. data/ext/rbs_extension/lexstate.c +1 -0
  47. data/ext/rbs_extension/parser.c +6 -0
  48. data/goodcheck.yml +2 -2
  49. data/lib/rbs/annotate/formatter.rb +13 -3
  50. data/lib/rbs/annotate/rdoc_source.rb +10 -1
  51. data/lib/rbs/cli/colored_io.rb +48 -0
  52. data/lib/rbs/cli/diff.rb +80 -0
  53. data/lib/rbs/cli.rb +151 -16
  54. data/lib/rbs/collection/config/lockfile.rb +0 -25
  55. data/lib/rbs/collection/config/lockfile_generator.rb +0 -6
  56. data/lib/rbs/collection/installer.rb +1 -1
  57. data/lib/rbs/collection/sources/git.rb +6 -4
  58. data/lib/rbs/collection/sources/local.rb +7 -5
  59. data/lib/rbs/diff.rb +104 -0
  60. data/lib/rbs/environment.rb +1 -1
  61. data/lib/rbs/method_type.rb +23 -0
  62. data/lib/rbs/prototype/rb.rb +2 -9
  63. data/lib/rbs/prototype/runtime/helpers.rb +59 -0
  64. data/lib/rbs/prototype/runtime/value_object_generator.rb +236 -0
  65. data/lib/rbs/prototype/runtime.rb +234 -150
  66. data/lib/rbs/sorter.rb +144 -117
  67. data/lib/rbs/test/guaranteed.rb +31 -0
  68. data/lib/rbs/test/type_check.rb +4 -4
  69. data/lib/rbs/test.rb +3 -0
  70. data/lib/rbs/types.rb +184 -3
  71. data/lib/rbs/version.rb +1 -1
  72. data/lib/rbs/writer.rb +4 -4
  73. data/lib/rbs.rb +1 -0
  74. data/rbs.gemspec +1 -0
  75. data/sig/annotate/formatter.rbs +2 -2
  76. data/sig/annotate/rdoc_annotater.rbs +1 -1
  77. data/sig/cli/colored_io.rbs +15 -0
  78. data/sig/cli/diff.rbs +21 -0
  79. data/sig/cli.rbs +2 -0
  80. data/sig/collection/config/lockfile.rbs +0 -6
  81. data/sig/diff.rbs +23 -0
  82. data/sig/errors.rbs +1 -5
  83. data/sig/method_types.rbs +6 -0
  84. data/sig/prototype/runtime.rbs +108 -0
  85. data/sig/rdoc/rbs.rbs +4 -0
  86. data/sig/shims/bundler.rbs +5 -0
  87. data/sig/sorter.rbs +23 -5
  88. data/sig/types.rbs +29 -0
  89. data/stdlib/benchmark/0/benchmark.rbs +1 -1
  90. data/stdlib/cgi/0/core.rbs +2 -2
  91. data/stdlib/did_you_mean/0/did_you_mean.rbs +2 -2
  92. data/stdlib/digest/0/digest.rbs +1 -1
  93. data/stdlib/fileutils/0/fileutils.rbs +1 -1
  94. data/stdlib/forwardable/0/forwardable.rbs +4 -4
  95. data/stdlib/io-console/0/io-console.rbs +1 -1
  96. data/stdlib/json/0/json.rbs +37 -0
  97. data/stdlib/logger/0/logger.rbs +2 -2
  98. data/stdlib/net-http/0/manifest.yaml +1 -1
  99. data/stdlib/net-http/0/net-http.rbs +16 -63
  100. data/stdlib/net-protocol/0/manifest.yaml +2 -0
  101. data/stdlib/net-protocol/0/net-protocol.rbs +56 -0
  102. data/stdlib/openssl/0/openssl.rbs +1 -1
  103. data/stdlib/pp/0/manifest.yaml +2 -0
  104. data/stdlib/pp/0/pp.rbs +301 -0
  105. data/stdlib/{yaml → psych}/0/dbm.rbs +3 -3
  106. data/stdlib/psych/0/manifest.yaml +3 -0
  107. data/stdlib/psych/0/psych.rbs +391 -0
  108. data/stdlib/{yaml → psych}/0/store.rbs +2 -2
  109. data/stdlib/rdoc/0/code_object.rbs +55 -0
  110. data/stdlib/rdoc/0/comment.rbs +60 -0
  111. data/stdlib/rdoc/0/context.rbs +153 -0
  112. data/stdlib/rdoc/0/markup.rbs +119 -0
  113. data/stdlib/rdoc/0/parser.rbs +56 -0
  114. data/stdlib/rdoc/0/rdoc.rbs +0 -372
  115. data/stdlib/rdoc/0/ri.rbs +17 -0
  116. data/stdlib/rdoc/0/store.rbs +48 -0
  117. data/stdlib/rdoc/0/top_level.rbs +97 -0
  118. data/stdlib/socket/0/basic_socket.rbs +1 -1
  119. data/stdlib/socket/0/socket.rbs +1 -1
  120. data/stdlib/uri/0/common.rbs +1 -1
  121. data/stdlib/yaml/0/manifest.yaml +1 -2
  122. data/stdlib/yaml/0/yaml.rbs +1 -199
  123. metadata +46 -9
  124. data/sig/shims/pp.rbs +0 -3
  125. data/sig/shims.rbs +0 -47
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: (id new_name, id old_name) -> ::Symbol
238
+ def alias_method: (interned new_name, interned 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: (*id arg0) -> Array[Symbol]
287
+ def attr_accessor: (*interned 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: (*id arg0) -> Array[Symbol]
301
+ def attr_reader: (*interned 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: (*id arg0) -> Array[Symbol]
312
+ def attr_writer: (*interned 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: (id _module, String filename) -> NilClass
331
+ def autoload: (interned _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?: (id name, ?boolish inherit) -> String?
357
+ def autoload?: (interned 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?: (id arg0) -> bool
415
+ def class_variable_defined?: (interned 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: (id arg0) -> untyped
431
+ def class_variable_get: (interned 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: (id arg0, untyped arg1) -> untyped
450
+ def class_variable_set: (interned 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?: (id name, ?boolish inherit) -> bool
530
+ def const_defined?: (interned 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: (id name, ?boolish inherit) -> untyped
569
+ def const_get: (interned 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: (id arg0, untyped arg1) -> untyped
621
+ def const_set: (interned 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: (id name, ?boolish inherit) -> ([ String, Integer ] | [ ] | nil)
671
+ def const_source_location: (interned 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: (id symbol, Proc | Method | UnboundMethod method) -> Symbol
730
- | (id symbol) { () -> untyped } -> Symbol
729
+ def define_method: (interned symbol, ^() [self: instance] -> untyped | Method | UnboundMethod method) -> Symbol
730
+ | (interned symbol) { () [self: instance] -> 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: (*id) -> self
749
+ def deprecate_constant: (*interned) -> 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: (id arg0) -> UnboundMethod
939
+ def instance_method: (interned 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?: (id name, ?boolish inherit) -> bool
1032
+ def method_defined?: (interned 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: (*id arg0) -> self
1150
+ def module_function: (*interned arg0) -> self
1151
1151
 
1152
1152
  # <!--
1153
1153
  # rdoc-file=object.c
@@ -1224,7 +1224,7 @@ class Module < Object
1224
1224
  | (Symbol method_name) -> Symbol
1225
1225
  | (Symbol, Symbol, *Symbol method_name) -> Array[Symbol]
1226
1226
  | (string method_name) -> string
1227
- | (string | Symbol, string | Symbol, *string | Symbol method_name) -> Array[string | Symbol]
1227
+ | (interned, interned, *interned method_name) -> Array[interned]
1228
1228
 
1229
1229
  # <!--
1230
1230
  # rdoc-file=vm_method.c
@@ -1246,7 +1246,7 @@ class Module < Object
1246
1246
  # end
1247
1247
  # end
1248
1248
  #
1249
- def private_class_method: (*id arg0) -> self
1249
+ def private_class_method: (*interned 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: (*id arg0) -> self
1257
+ def private_constant: (*interned 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?: (id name, ?boolish inherit) -> bool
1304
+ def private_method_defined?: (interned name, ?boolish inherit) -> bool
1305
1305
 
1306
1306
  # <!--
1307
1307
  # rdoc-file=vm_method.c
@@ -1326,7 +1326,7 @@ class Module < Object
1326
1326
  #
1327
1327
  # To show a private method on RDoc, use `:doc:` instead of this.
1328
1328
  #
1329
- def protected: (*Symbol | String arg0) -> self
1329
+ def protected: (*interned arg0) -> self
1330
1330
 
1331
1331
  # <!--
1332
1332
  # rdoc-file=object.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?: (id name, ?boolish inherit) -> bool
1368
+ def protected_method_defined?: (interned name, ?boolish inherit) -> bool
1369
1369
 
1370
1370
  # <!--
1371
1371
  # rdoc-file=vm_method.c
@@ -1385,7 +1385,7 @@ class Module < Object
1385
1385
  | (Symbol method_name) -> Symbol
1386
1386
  | (Symbol, Symbol, *Symbol method_name) -> Array[Symbol]
1387
1387
  | (string method_name) -> string
1388
- | (string | Symbol, string | Symbol, *string | Symbol method_name) -> Array[string | Symbol]
1388
+ | (interned, interned, *interned method_name) -> Array[interned]
1389
1389
 
1390
1390
  # <!--
1391
1391
  # 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: (*id arg0) -> self
1401
+ def public_class_method: (*interned 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: (*id arg0) -> self
1409
+ def public_constant: (*interned 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: (id arg0) -> UnboundMethod
1417
+ def public_instance_method: (interned 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?: (id name, ?boolish inherit) -> bool
1456
+ def public_method_defined?: (interned 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: (id arg0) -> untyped
1508
+ def remove_class_variable: (interned 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: (id arg0) -> untyped
1518
+ def remove_const: (interned 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: (*id arg0) -> self
1528
+ def remove_method: (*interned 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: (*id arg0) -> self
1594
+ def undef_method: (*interned arg0) -> self
1595
1595
 
1596
1596
  # <!--
1597
1597
  # rdoc-file=object.c
@@ -1629,7 +1629,9 @@ 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: (*id arg0) -> Array[Symbol]
1632
+ def attr: (*interned arg0) -> Array[Symbol]
1633
1633
 
1634
- type id = Symbol | string
1634
+ # A previous incarnation of `interned` for backward-compatibility (see #1499)
1635
+ %a{steep:deprecated}
1636
+ type id = interned
1635
1637
  end
data/core/nil_class.rbs CHANGED
@@ -2,8 +2,6 @@
2
2
  # The class of the singleton object `nil`.
3
3
  #
4
4
  class NilClass
5
- public
6
-
7
5
  def !: () -> true
8
6
 
9
7
  # <!--
@@ -25,7 +23,7 @@ class NilClass
25
23
  # statements.
26
24
  #
27
25
  def ===: (nil) -> true
28
- | (untyped obj) -> false
26
+ | (untyped obj) -> bool
29
27
 
30
28
  # <!--
31
29
  # rdoc-file=object.c
@@ -45,9 +43,8 @@ class NilClass
45
43
  # Exclusive Or---If *obj* is `nil` or `false`, returns `false`; otherwise,
46
44
  # returns `true`.
47
45
  #
48
- def ^: (nil) -> false
49
- | (false) -> false
50
- | (untyped obj) -> true
46
+ def ^: (false | nil) -> false
47
+ | (untyped obj) -> bool
51
48
 
52
49
  # <!--
53
50
  # rdoc-file=object.c
@@ -81,7 +78,7 @@ class NilClass
81
78
  #
82
79
  # nil.to_a #=> []
83
80
  #
84
- def to_a: () -> [ ]
81
+ def to_a: () -> []
85
82
 
86
83
  # <!--
87
84
  # rdoc-file=complex.c
@@ -109,7 +106,7 @@ class NilClass
109
106
  #
110
107
  # nil.to_h #=> {}
111
108
  #
112
- def to_h: () -> ::Hash[untyped, untyped]
109
+ def to_h: () -> {}
113
110
 
114
111
  # <!--
115
112
  # rdoc-file=nilclass.rb
@@ -144,9 +141,6 @@ class NilClass
144
141
  # -->
145
142
  # Or---Returns `false` if *obj* is `nil` or `false`; `true` otherwise.
146
143
  #
147
- def |: (nil) -> false
148
- | (false) -> false
149
- | (untyped obj) -> true
150
-
151
- def clone: (?freeze: true?) -> self
144
+ def |: (nil | false) -> false
145
+ | (untyped obj) -> bool
152
146
  end