rbs 4.0.3 → 4.1.0.pre.2

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/c-check.yml +3 -0
  3. data/.github/workflows/dependabot.yml +1 -1
  4. data/.github/workflows/jruby.yml +67 -0
  5. data/.github/workflows/milestone.yml +4 -1
  6. data/.github/workflows/ruby.yml +40 -0
  7. data/.github/workflows/rust.yml +3 -2
  8. data/.github/workflows/truffleruby.yml +54 -0
  9. data/.github/workflows/typecheck.yml +3 -0
  10. data/.github/workflows/wasm.yml +53 -0
  11. data/.github/workflows/windows.yml +3 -0
  12. data/.gitignore +7 -0
  13. data/CHANGELOG.md +0 -8
  14. data/README.md +3 -3
  15. data/Rakefile +118 -3
  16. data/Steepfile +7 -0
  17. data/config.yml +24 -0
  18. data/core/array.rbs +144 -144
  19. data/core/builtin.rbs +7 -6
  20. data/core/class.rbs +5 -3
  21. data/core/enumerable.rbs +109 -109
  22. data/core/enumerator/product.rbs +5 -5
  23. data/core/enumerator.rbs +28 -28
  24. data/core/file.rbs +24 -1018
  25. data/core/file_constants.rbs +463 -0
  26. data/core/file_stat.rbs +534 -0
  27. data/core/hash.rbs +117 -101
  28. data/core/integer.rbs +21 -58
  29. data/core/io.rbs +25 -7
  30. data/core/kernel.rbs +26 -11
  31. data/core/module.rbs +88 -74
  32. data/core/numeric.rbs +3 -0
  33. data/core/object_space/weak_key_map.rbs +7 -7
  34. data/core/range.rbs +23 -23
  35. data/core/rbs/ops.rbs +154 -0
  36. data/core/rbs/unnamed/argf.rbs +3 -3
  37. data/core/ruby_vm.rbs +40 -0
  38. data/core/set.rbs +3 -3
  39. data/core/struct.rbs +16 -16
  40. data/core/thread.rbs +6 -6
  41. data/docs/CONTRIBUTING.md +2 -1
  42. data/docs/inline.md +65 -7
  43. data/docs/rbs_by_example.md +20 -20
  44. data/docs/syntax.md +2 -2
  45. data/docs/wasm_serialization.md +80 -0
  46. data/ext/rbs_extension/ast_translation.c +1298 -956
  47. data/ext/rbs_extension/ast_translation.h +4 -0
  48. data/ext/rbs_extension/class_constants.c +2 -0
  49. data/ext/rbs_extension/class_constants.h +1 -0
  50. data/ext/rbs_extension/extconf.rb +1 -0
  51. data/ext/rbs_extension/main.c +139 -4
  52. data/include/rbs/ast.h +323 -298
  53. data/include/rbs/defines.h +13 -0
  54. data/include/rbs/lexer.h +1 -0
  55. data/include/rbs/serialize.h +39 -0
  56. data/lib/rbs/annotate/rdoc_annotator.rb +27 -31
  57. data/lib/rbs/ast/ruby/annotations.rb +42 -0
  58. data/lib/rbs/ast/ruby/comment_block.rb +6 -4
  59. data/lib/rbs/ast/ruby/declarations.rb +11 -1
  60. data/lib/rbs/ast/ruby/helpers/location_helper.rb +1 -1
  61. data/lib/rbs/ast/ruby/members.rb +40 -1
  62. data/lib/rbs/buffer.rb +48 -11
  63. data/lib/rbs/cli.rb +3 -5
  64. data/lib/rbs/collection/config/lockfile_generator.rb +14 -1
  65. data/lib/rbs/collection/sources/git.rb +6 -0
  66. data/lib/rbs/definition_builder/method_builder.rb +12 -6
  67. data/lib/rbs/environment.rb +10 -3
  68. data/lib/rbs/inline_parser.rb +54 -28
  69. data/lib/rbs/namespace.rb +47 -11
  70. data/lib/rbs/prototype/runtime.rb +2 -0
  71. data/lib/rbs/resolver/type_name_resolver.rb +12 -14
  72. data/lib/rbs/rewriter.rb +70 -0
  73. data/lib/rbs/test/type_check.rb +6 -1
  74. data/lib/rbs/type_name.rb +33 -13
  75. data/lib/rbs/unit_test/type_assertions.rb +9 -0
  76. data/lib/rbs/version.rb +1 -1
  77. data/lib/rbs/wasm/deserializer.rb +213 -0
  78. data/lib/rbs/wasm/location.rb +61 -0
  79. data/lib/rbs/wasm/parser.rb +137 -0
  80. data/lib/rbs/wasm/runtime.rb +217 -0
  81. data/lib/rbs/wasm/serialization_schema.rb +110 -0
  82. data/lib/rbs.rb +14 -2
  83. data/rbs.gemspec +19 -2
  84. data/sig/annotate/rdoc_annotater.rbs +12 -9
  85. data/sig/ast/ruby/annotations.rbs +49 -0
  86. data/sig/ast/ruby/members.rbs +21 -1
  87. data/sig/buffer.rbs +19 -1
  88. data/sig/collection/config/lockfile_generator.rbs +2 -0
  89. data/sig/inline_parser.rbs +2 -0
  90. data/sig/manifest.yaml +0 -1
  91. data/sig/namespace.rbs +20 -0
  92. data/sig/parser.rbs +10 -0
  93. data/sig/resolver/type_name_resolver.rbs +2 -4
  94. data/sig/rewriter.rbs +45 -0
  95. data/sig/typename.rbs +15 -0
  96. data/sig/unit_test/type_assertions.rbs +4 -0
  97. data/sig/wasm/deserializer.rbs +66 -0
  98. data/sig/wasm/serialization_schema.rbs +13 -0
  99. data/src/ast.c +186 -162
  100. data/src/lexer.c +137 -114
  101. data/src/lexer.re +1 -0
  102. data/src/lexstate.c +6 -1
  103. data/src/parser.c +55 -5
  104. data/src/serialize.c +958 -0
  105. data/src/util/rbs_allocator.c +1 -4
  106. data/stdlib/abbrev/0/array.rbs +1 -1
  107. data/stdlib/csv/0/csv.rbs +5 -5
  108. data/stdlib/digest/0/digest.rbs +1 -1
  109. data/stdlib/etc/0/etc.rbs +18 -4
  110. data/stdlib/fileutils/0/fileutils.rbs +21 -21
  111. data/stdlib/json/0/json.rbs +6 -6
  112. data/stdlib/openssl/0/openssl.rbs +7 -7
  113. data/stdlib/resolv/0/resolv.rbs +1 -1
  114. data/stdlib/shellwords/0/shellwords.rbs +1 -1
  115. data/stdlib/stringio/0/stringio.rbs +32 -10
  116. data/stdlib/strscan/0/string_scanner.rbs +74 -55
  117. data/stdlib/tsort/0/cyclic.rbs +1 -1
  118. data/stdlib/tsort/0/interfaces.rbs +8 -8
  119. data/stdlib/tsort/0/tsort.rbs +9 -9
  120. data/stdlib/zlib/0/gzip_reader.rbs +2 -2
  121. data/wasm/README.md +59 -0
  122. data/wasm/rbs_wasm.c +411 -0
  123. metadata +23 -5
  124. data/.vscode/extensions.json +0 -5
  125. data/.vscode/settings.json +0 -19
data/core/module.rbs CHANGED
@@ -19,7 +19,7 @@
19
19
  # Mod.constants #=> [:CONST, :PI, :E]
20
20
  # Mod.instance_methods #=> [:meth]
21
21
  #
22
- class Module < Object
22
+ class Module
23
23
  # <!--
24
24
  # rdoc-file=eval.c
25
25
  # - Module.constants -> array
@@ -40,7 +40,7 @@ class Module < Object
40
40
  #
41
41
  # The second form calls the instance method `constants`.
42
42
  #
43
- def self.constants: () -> ::Array[Integer]
43
+ def self.constants: (?boolish inherit) -> Array[Symbol]
44
44
 
45
45
  # <!--
46
46
  # rdoc-file=eval.c
@@ -56,7 +56,7 @@ class Module < Object
56
56
  # $a #=> [M1::M2, M1]
57
57
  # $a[0].name #=> "M1::M2"
58
58
  #
59
- def self.nesting: () -> ::Array[Module]
59
+ def self.nesting: () -> Array[Module]
60
60
 
61
61
  # <!--
62
62
  # rdoc-file=eval.c
@@ -83,7 +83,7 @@ class Module < Object
83
83
  #
84
84
  # [B, A]
85
85
  #
86
- def self.used_modules: () -> ::Array[Module]
86
+ def self.used_modules: () -> Array[Module]
87
87
 
88
88
  # <!--
89
89
  # rdoc-file=eval.c
@@ -163,7 +163,7 @@ class Module < Object
163
163
  # # Class File has no relationship to class String.
164
164
  # File <=> String # => nil
165
165
  #
166
- def <=>: (untyped other) -> Integer?
166
+ def <=>: (untyped other) -> (-1 | 0 | 1)?
167
167
 
168
168
  # <!--
169
169
  # rdoc-file=object.c
@@ -254,7 +254,7 @@ class Module < Object
254
254
  #
255
255
  # Exiting with code 99
256
256
  #
257
- def alias_method: (interned new_name, interned old_name) -> ::Symbol
257
+ def alias_method: (interned new_name, interned old_name) -> Symbol
258
258
 
259
259
  # <!--
260
260
  # rdoc-file=object.c
@@ -273,7 +273,7 @@ class Module < Object
273
273
  # Math.ancestors #=> [Math]
274
274
  # Enumerable.ancestors #=> [Enumerable]
275
275
  #
276
- def ancestors: () -> ::Array[Module]
276
+ def ancestors: () -> Array[Module]
277
277
 
278
278
  # <!--
279
279
  # rdoc-file=eval.c
@@ -285,7 +285,7 @@ class Module < Object
285
285
  # module to *mod* if this module has not already been added to *mod* or one of
286
286
  # its ancestors. See also Module#include.
287
287
  #
288
- private def append_features: (Module arg0) -> self
288
+ private def append_features: (Module mod) -> self
289
289
 
290
290
  # <!--
291
291
  # rdoc-file=object.c
@@ -303,7 +303,7 @@ class Module < Object
303
303
  # end
304
304
  # Mod.instance_methods.sort #=> [:one, :one=, :two, :two=]
305
305
  #
306
- def attr_accessor: (*interned arg0) -> Array[Symbol]
306
+ def attr_accessor: (*interned names) -> Array[Symbol]
307
307
 
308
308
  # <!--
309
309
  # rdoc-file=object.c
@@ -317,7 +317,7 @@ class Module < Object
317
317
  # name in turn. String arguments are converted to symbols. Returns an array of
318
318
  # defined method names as symbols.
319
319
  #
320
- def attr_reader: (*interned arg0) -> Array[Symbol]
320
+ def attr_reader: (*interned names) -> Array[Symbol]
321
321
 
322
322
  # <!--
323
323
  # rdoc-file=object.c
@@ -328,7 +328,7 @@ class Module < Object
328
328
  # *symbol*<code>.id2name</code>. String arguments are converted to symbols.
329
329
  # Returns an array of defined method names as symbols.
330
330
  #
331
- def attr_writer: (*interned arg0) -> Array[Symbol]
331
+ def attr_writer: (*interned names) -> Array[Symbol]
332
332
 
333
333
  # <!--
334
334
  # rdoc-file=load.c
@@ -349,7 +349,7 @@ class Module < Object
349
349
  #
350
350
  # Files that are currently being loaded must not be registered for autoload.
351
351
  #
352
- def autoload: (interned _module, String filename) -> NilClass
352
+ def autoload: (interned constant, path filename) -> nil
353
353
 
354
354
  # <!--
355
355
  # rdoc-file=load.c
@@ -397,8 +397,7 @@ class Module < Object
397
397
  # dummy:123:in `module_eval': undefined local variable
398
398
  # or method `code' for Thing:Class
399
399
  #
400
- def class_eval: (String arg0, ?String filename, ?Integer lineno) -> untyped
401
- | [U] () { (self m) [self: self] -> U } -> U
400
+ alias class_eval module_eval
402
401
 
403
402
  # <!-- rdoc-file=vm_eval.c -->
404
403
  # Evaluates the given block in the context of the class/module. The method
@@ -417,7 +416,7 @@ class Module < Object
417
416
  #
418
417
  # Hello there!
419
418
  #
420
- def class_exec: [U] (*untyped, **untyped) { (?) [self: self] -> U } -> U
419
+ alias class_exec module_exec
421
420
 
422
421
  # <!--
423
422
  # rdoc-file=object.c
@@ -433,7 +432,7 @@ class Module < Object
433
432
  # Fred.class_variable_defined?(:@@foo) #=> true
434
433
  # Fred.class_variable_defined?(:@@bar) #=> false
435
434
  #
436
- def class_variable_defined?: (interned arg0) -> bool
435
+ def class_variable_defined?: (interned name) -> bool
437
436
 
438
437
  # <!--
439
438
  # rdoc-file=object.c
@@ -449,7 +448,7 @@ class Module < Object
449
448
  # end
450
449
  # Fred.class_variable_get(:@@foo) #=> 99
451
450
  #
452
- def class_variable_get: (interned arg0) -> untyped
451
+ def class_variable_get: (interned name) -> untyped
453
452
 
454
453
  # <!--
455
454
  # rdoc-file=object.c
@@ -468,7 +467,7 @@ class Module < Object
468
467
  # Fred.class_variable_set(:@@foo, 101) #=> 101
469
468
  # Fred.new.foo #=> 101
470
469
  #
471
- def class_variable_set: (interned arg0, untyped arg1) -> untyped
470
+ def class_variable_set: [T] (interned name, T value) -> T
472
471
 
473
472
  # <!--
474
473
  # rdoc-file=object.c
@@ -488,7 +487,7 @@ class Module < Object
488
487
  # Two.class_variables #=> [:@@var2, :@@var1]
489
488
  # Two.class_variables(false) #=> [:@@var2]
490
489
  #
491
- def class_variables: (?boolish inherit) -> ::Array[Symbol]
490
+ def class_variables: (?boolish inherit) -> Array[Symbol]
492
491
 
493
492
  # <!--
494
493
  # rdoc-file=object.c
@@ -533,7 +532,7 @@ class Module < Object
533
532
  # :const_added
534
533
  # :inherited
535
534
  #
536
- private def const_added: (Symbol) -> void
535
+ private def const_added: (Symbol const_name) -> void
537
536
 
538
537
  # <!--
539
538
  # rdoc-file=object.c
@@ -652,7 +651,7 @@ class Module < Object
652
651
  # const_get(name, false)
653
652
  # end
654
653
  #
655
- def const_missing: (Symbol arg0) -> untyped
654
+ def const_missing: (Symbol name) -> untyped
656
655
 
657
656
  # <!--
658
657
  # rdoc-file=object.c
@@ -670,7 +669,7 @@ class Module < Object
670
669
  #
671
670
  # Object.const_set('foobar', 42) #=> NameError: wrong constant name foobar
672
671
  #
673
- def const_set: (interned arg0, untyped arg1) -> untyped
672
+ def const_set: [T] (interned name, T value) -> T
674
673
 
675
674
  # <!--
676
675
  # rdoc-file=object.c
@@ -739,7 +738,7 @@ class Module < Object
739
738
  #
740
739
  # Also see Module#const_defined?.
741
740
  #
742
- def constants: (?boolish inherit) -> ::Array[Symbol]
741
+ def constants: (?boolish inherit) -> Array[Symbol]
743
742
 
744
743
  # <!--
745
744
  # rdoc-file=proc.c
@@ -799,7 +798,7 @@ class Module < Object
799
798
  # HTTP::NOT_FOUND
800
799
  # # warning: constant HTTP::NOT_FOUND is deprecated
801
800
  #
802
- def deprecate_constant: (*interned) -> self
801
+ def deprecate_constant: (*interned names) -> self
803
802
 
804
803
  def equal?: (untyped other) -> bool
805
804
 
@@ -829,7 +828,7 @@ class Module < Object
829
828
  # Picky added to Array
830
829
  # Can't add Picky to a String
831
830
  #
832
- private def extend_object: (untyped arg0) -> untyped
831
+ private def extend_object: [T] (T object) -> T
833
832
 
834
833
  # <!--
835
834
  # rdoc-file=object.c
@@ -847,7 +846,7 @@ class Module < Object
847
846
  # end
848
847
  # # => prints "A extended in Enumerable"
849
848
  #
850
- private def extended: (Module othermod) -> untyped
849
+ private def extended: (untyped othermod) -> void
851
850
 
852
851
  # <!--
853
852
  # rdoc-file=object.c
@@ -865,7 +864,7 @@ class Module < Object
865
864
  # -->
866
865
  # Invokes Module.append_features on each parameter in reverse order.
867
866
  #
868
- def include: (Module, *Module arg0) -> self
867
+ def include: (Module module, *Module additional_modules) -> self
869
868
 
870
869
  # <!--
871
870
  # rdoc-file=object.c
@@ -905,7 +904,7 @@ class Module < Object
905
904
  # end
906
905
  # # => prints "A included in Enumerable"
907
906
  #
908
- private def included: (Module othermod) -> untyped
907
+ private def included: (Module othermod) -> void
909
908
 
910
909
  # <!--
911
910
  # rdoc-file=object.c
@@ -928,7 +927,7 @@ class Module < Object
928
927
  # Mixin.included_modules #=> [Sub]
929
928
  # Outer.included_modules #=> [Sub, Mixin]
930
929
  #
931
- def included_modules: () -> ::Array[Module]
930
+ def included_modules: () -> Array[Module]
932
931
 
933
932
  # <!--
934
933
  # rdoc-file=object.c
@@ -955,8 +954,9 @@ class Module < Object
955
954
  # Assign the module to a constant (name starting uppercase) if you want to treat
956
955
  # it like a regular module.
957
956
  #
958
- def initialize: () -> void
959
- | () { (Module arg0) -> untyped } -> void
957
+ def initialize: () ?{ (Module mod) [self: self] -> void } -> void
958
+
959
+ def initialize_clone: (Module source, ?freeze: bool?) -> void
960
960
 
961
961
  # <!--
962
962
  # rdoc-file=proc.c
@@ -987,7 +987,7 @@ class Module < Object
987
987
  #
988
988
  # Hello there, Dave!
989
989
  #
990
- def instance_method: (interned arg0) -> UnboundMethod
990
+ def instance_method: (interned name) -> UnboundMethod
991
991
 
992
992
  # <!--
993
993
  # rdoc-file=object.c
@@ -1024,7 +1024,7 @@ class Module < Object
1024
1024
  # end
1025
1025
  # C.instance_methods(false).sort #=> [:method2, :method3, :method4]
1026
1026
  #
1027
- def instance_methods: (?boolish include_super) -> ::Array[Symbol]
1027
+ def instance_methods: (?boolish include_super) -> Array[Symbol]
1028
1028
 
1029
1029
  # <!--
1030
1030
  # rdoc-file=object.c
@@ -1044,7 +1044,7 @@ class Module < Object
1044
1044
  #
1045
1045
  # Adding :some_instance_method
1046
1046
  #
1047
- private def method_added: (Symbol meth) -> untyped
1047
+ private def method_added: (Symbol method_name) -> void
1048
1048
 
1049
1049
  # <!--
1050
1050
  # rdoc-file=vm_method.c
@@ -1105,7 +1105,7 @@ class Module < Object
1105
1105
  #
1106
1106
  # Removing :some_instance_method
1107
1107
  #
1108
- private def method_removed: (Symbol method_name) -> untyped
1108
+ private def method_removed: (Symbol method_name) -> void
1109
1109
 
1110
1110
  # <!--
1111
1111
  # rdoc-file=object.c
@@ -1130,7 +1130,7 @@ class Module < Object
1130
1130
  #
1131
1131
  # Undefining :some_instance_method
1132
1132
  #
1133
- private def method_undefined: (Symbol method_name) -> untyped
1133
+ private def method_undefined: (Symbol method_name) -> void
1134
1134
 
1135
1135
  # <!--
1136
1136
  # rdoc-file=vm_eval.c
@@ -1158,8 +1158,8 @@ class Module < Object
1158
1158
  # dummy:123:in `module_eval': undefined local variable
1159
1159
  # or method `code' for Thing:Class
1160
1160
  #
1161
- def module_eval: (String arg0, ?String filename, ?Integer lineno) -> untyped
1162
- | [U] () { (self m) [self: self] -> U } -> U
1161
+ def module_eval: (string code, ?string? filename, ?int lineno) -> untyped
1162
+ | [U] () { (self mod) [self: self] -> U } -> U
1163
1163
 
1164
1164
  # <!--
1165
1165
  # rdoc-file=vm_eval.c
@@ -1225,9 +1225,11 @@ class Module < Object
1225
1225
  #
1226
1226
  private def module_function: () -> nil
1227
1227
  | (Symbol method_name) -> Symbol
1228
- | (Symbol, Symbol, *Symbol method_name) -> Array[Symbol]
1229
- | (string method_name) -> string
1230
- | (interned, interned, *interned method_name) -> Array[interned]
1228
+ | [T < _ToStr] (T method_name) -> T
1229
+ | (interned method_name) -> interned
1230
+ | (Symbol, Symbol, *Symbol method_names) -> Array[Symbol]
1231
+ | [T < _ToStr] (T, T, *T method_names) -> Array[T]
1232
+ | (interned, interned, *interned method_names) -> Array[interned]
1231
1233
 
1232
1234
  # <!--
1233
1235
  # rdoc-file=object.c
@@ -1243,7 +1245,7 @@ class Module < Object
1243
1245
  # -->
1244
1246
  # Invokes Module.prepend_features on each parameter in reverse order.
1245
1247
  #
1246
- def prepend: (Module, *Module arg0) -> self
1248
+ def prepend: (Module module, *Module additional_modules) -> self
1247
1249
 
1248
1250
  # <!--
1249
1251
  # rdoc-file=eval.c
@@ -1255,7 +1257,7 @@ class Module < Object
1255
1257
  # this module to *mod* if this module has not already been added to *mod* or one
1256
1258
  # of its ancestors. See also Module#prepend.
1257
1259
  #
1258
- private def prepend_features: (Module arg0) -> self
1260
+ private def prepend_features: (Module mod) -> self
1259
1261
 
1260
1262
  # <!--
1261
1263
  # rdoc-file=object.c
@@ -1273,7 +1275,7 @@ class Module < Object
1273
1275
  # end
1274
1276
  # # => prints "A prepended to Enumerable"
1275
1277
  #
1276
- private def prepended: (Module othermod) -> untyped
1278
+ private def prepended: (Module othermod) -> void
1277
1279
 
1278
1280
  # <!--
1279
1281
  # rdoc-file=vm_method.c
@@ -1302,10 +1304,14 @@ class Module < Object
1302
1304
  #
1303
1305
  private def private: () -> nil
1304
1306
  | (Symbol method_name) -> Symbol
1305
- | (Symbol, Symbol, *Symbol method_name) -> Array[Symbol]
1306
- | (string method_name) -> string
1307
- | (interned, interned, *interned method_name) -> Array[interned]
1308
- | (Array[interned]) -> Array[interned]
1307
+ | [T < _ToStr] (T method_name) -> T
1308
+ | (interned method_name) -> interned
1309
+ | (Symbol, Symbol, *Symbol method_names) -> Array[Symbol]
1310
+ | [T < _ToStr] (T, T, *T method_names) -> Array[T]
1311
+ | (interned, interned, *interned method_names) -> Array[interned]
1312
+ | (Array[Symbol] method_names) -> Array[Symbol]
1313
+ | [T < _ToStr] (Array[T] method_names) -> Array[T]
1314
+ | (Array[interned] method_names) -> Array[interned]
1309
1315
 
1310
1316
  # <!--
1311
1317
  # rdoc-file=vm_method.c
@@ -1327,8 +1333,8 @@ class Module < Object
1327
1333
  # end
1328
1334
  # end
1329
1335
  #
1330
- def private_class_method: (*interned arg0) -> self
1331
- | (Array[interned] arg0) -> self
1336
+ def private_class_method: (*interned method_names) -> self
1337
+ | (Array[interned] method_names) -> self
1332
1338
 
1333
1339
  # <!--
1334
1340
  # rdoc-file=object.c
@@ -1336,7 +1342,7 @@ class Module < Object
1336
1342
  # -->
1337
1343
  # Makes a list of existing constants private.
1338
1344
  #
1339
- def private_constant: (*interned arg0) -> self
1345
+ def private_constant: (*interned names) -> self
1340
1346
 
1341
1347
  # <!--
1342
1348
  # rdoc-file=object.c
@@ -1353,7 +1359,7 @@ class Module < Object
1353
1359
  # Mod.instance_methods #=> [:method2]
1354
1360
  # Mod.private_instance_methods #=> [:method1]
1355
1361
  #
1356
- def private_instance_methods: (?boolish include_super) -> ::Array[Symbol]
1362
+ def private_instance_methods: (?boolish include_super) -> Array[Symbol]
1357
1363
 
1358
1364
  # <!--
1359
1365
  # rdoc-file=vm_method.c
@@ -1443,10 +1449,14 @@ class Module < Object
1443
1449
  #
1444
1450
  private def protected: () -> nil
1445
1451
  | (Symbol method_name) -> Symbol
1446
- | (Symbol, Symbol, *Symbol method_name) -> Array[Symbol]
1447
- | (string method_name) -> string
1448
- | (interned, interned, *interned method_name) -> Array[interned]
1449
- | (Array[interned]) -> Array[interned]
1452
+ | [T < _ToStr] (T method_name) -> T
1453
+ | (interned method_name) -> interned
1454
+ | (Symbol, Symbol, *Symbol method_names) -> Array[Symbol]
1455
+ | [T < _ToStr] (T, T, *T method_names) -> Array[T]
1456
+ | (interned, interned, *interned method_names) -> Array[interned]
1457
+ | (Array[Symbol] method_names) -> Array[Symbol]
1458
+ | [T < _ToStr] (Array[T] method_names) -> Array[T]
1459
+ | (Array[interned] method_names) -> Array[interned]
1450
1460
 
1451
1461
  # <!--
1452
1462
  # rdoc-file=object.c
@@ -1455,7 +1465,7 @@ class Module < Object
1455
1465
  # Returns a list of the protected instance methods defined in *mod*. If the
1456
1466
  # optional parameter is `false`, the methods of any ancestors are not included.
1457
1467
  #
1458
- def protected_instance_methods: (?boolish include_super) -> ::Array[Symbol]
1468
+ def protected_instance_methods: (?boolish include_super) -> Array[Symbol]
1459
1469
 
1460
1470
  # <!--
1461
1471
  # rdoc-file=vm_method.c
@@ -1503,10 +1513,14 @@ class Module < Object
1503
1513
  #
1504
1514
  private def public: () -> nil
1505
1515
  | (Symbol method_name) -> Symbol
1506
- | (Symbol, Symbol, *Symbol method_name) -> Array[Symbol]
1507
- | (string method_name) -> string
1508
- | (interned, interned, *interned method_name) -> Array[interned]
1509
- | (Array[interned]) -> Array[interned]
1516
+ | [T < _ToStr] (T method_name) -> T
1517
+ | (interned method_name) -> interned
1518
+ | (Symbol, Symbol, *Symbol method_names) -> Array[Symbol]
1519
+ | [T < _ToStr] (T, T, *T method_names) -> Array[T]
1520
+ | (interned, interned, *interned method_names) -> Array[interned]
1521
+ | (Array[Symbol] method_names) -> Array[Symbol]
1522
+ | [T < _ToStr] (Array[T] method_names) -> Array[T]
1523
+ | (Array[interned] method_names) -> Array[interned]
1510
1524
 
1511
1525
  # <!--
1512
1526
  # rdoc-file=vm_method.c
@@ -1519,8 +1533,8 @@ class Module < Object
1519
1533
  # String arguments are converted to symbols. An Array of Symbols and/or Strings
1520
1534
  # is also accepted.
1521
1535
  #
1522
- def public_class_method: (*interned arg0) -> self
1523
- | (Array[interned] arg0) -> self
1536
+ def public_class_method: (*interned method_names) -> self
1537
+ | (Array[interned] method_names) -> self
1524
1538
 
1525
1539
  # <!--
1526
1540
  # rdoc-file=object.c
@@ -1528,7 +1542,7 @@ class Module < Object
1528
1542
  # -->
1529
1543
  # Makes a list of existing constants public.
1530
1544
  #
1531
- def public_constant: (*interned arg0) -> self
1545
+ def public_constant: (*interned names) -> self
1532
1546
 
1533
1547
  # <!--
1534
1548
  # rdoc-file=proc.c
@@ -1545,7 +1559,7 @@ class Module < Object
1545
1559
  # Returns a list of the public instance methods defined in *mod*. If the
1546
1560
  # optional parameter is `false`, the methods of any ancestors are not included.
1547
1561
  #
1548
- def public_instance_methods: (?boolish include_super) -> ::Array[Symbol]
1562
+ def public_instance_methods: (?boolish include_super) -> Array[Symbol]
1549
1563
 
1550
1564
  # <!--
1551
1565
  # rdoc-file=vm_method.c
@@ -1627,7 +1641,7 @@ class Module < Object
1627
1641
  # 99
1628
1642
  # nil
1629
1643
  #
1630
- def remove_class_variable: (interned arg0) -> untyped
1644
+ def remove_class_variable: (interned name) -> untyped
1631
1645
 
1632
1646
  # <!--
1633
1647
  # rdoc-file=object.c
@@ -1637,7 +1651,7 @@ class Module < Object
1637
1651
  # previous value. If that constant referred to a module, this will not change
1638
1652
  # that module's name and can lead to confusion.
1639
1653
  #
1640
- private def remove_const: (interned arg0) -> untyped
1654
+ private def remove_const: (interned name) -> untyped
1641
1655
 
1642
1656
  # <!--
1643
1657
  # rdoc-file=vm_method.c
@@ -1647,7 +1661,7 @@ class Module < Object
1647
1661
  # Removes the method identified by *symbol* from the current class. For an
1648
1662
  # example, see Module#undef_method. String arguments are converted to symbols.
1649
1663
  #
1650
- def remove_method: (*interned arg0) -> self
1664
+ def remove_method: (*interned method_names) -> self
1651
1665
 
1652
1666
  # <!--
1653
1667
  # rdoc-file=vm_method.c
@@ -1684,7 +1698,7 @@ class Module < Object
1684
1698
  # of the `foo` method using the above approach will change so that the method
1685
1699
  # does not pass through keywords.
1686
1700
  #
1687
- private def ruby2_keywords: (*interned method_name) -> nil
1701
+ private def ruby2_keywords: (interned method_name, *interned more_method_names) -> nil
1688
1702
 
1689
1703
  # <!--
1690
1704
  # rdoc-file=object.c
@@ -1733,7 +1747,7 @@ class Module < Object
1733
1747
  # C::M.name #=> "C::M"
1734
1748
  # c.new # => #<C:0x0....>
1735
1749
  #
1736
- def set_temporary_name: (string?) -> self
1750
+ def set_temporary_name: (string? name) -> self
1737
1751
 
1738
1752
  # <!--
1739
1753
  # rdoc-file=object.c
@@ -1817,14 +1831,14 @@ class Module < Object
1817
1831
  # Import class refinements from *module* into the current class or module
1818
1832
  # definition.
1819
1833
  #
1820
- private def using: (Module arg0) -> self
1834
+ private def using: (Module mod) -> self
1821
1835
 
1822
1836
  # <!-- rdoc-file=object.c -->
1823
1837
  # Returns a string representing this module or class. For basic classes and
1824
1838
  # modules, this is the name. For singletons, we show information on the thing
1825
1839
  # we're attached to as well.
1826
1840
  #
1827
- def inspect: () -> String
1841
+ alias inspect to_s
1828
1842
 
1829
1843
  # <!--
1830
1844
  # rdoc-file=object.c
@@ -1837,6 +1851,6 @@ class Module < Object
1837
1851
  # to <code>attr_reader(name)</code> but deprecated. Returns an array of defined
1838
1852
  # method names as symbols.
1839
1853
  #
1840
- def attr: %a{deprecated} (interned, bool) -> Array[Symbol]
1841
- | (*interned arg0) -> Array[Symbol]
1854
+ def attr: %a{deprecated} (interned name, bool create_writer) -> Array[Symbol]
1855
+ | (*interned names) -> Array[Symbol]
1842
1856
  end
data/core/numeric.rbs CHANGED
@@ -158,6 +158,9 @@
158
158
  class Numeric
159
159
  include Comparable
160
160
 
161
+ # The direction you can round
162
+ type round_mode = :up | :down | :even | 'up' | 'down' | 'even' | string | nil
163
+
161
164
  # <!--
162
165
  # rdoc-file=numeric.c
163
166
  # - self % other -> real_numeric
@@ -57,7 +57,7 @@ module ObjectSpace
57
57
  # attributes always, but the values that aren't needed anymore wouldn't be
58
58
  # sitting in the cache forever.
59
59
  #
60
- class WeakKeyMap[Key, Value]
60
+ class WeakKeyMap[K, V]
61
61
  # <!--
62
62
  # rdoc-file=weakmap.c
63
63
  # - map[key] -> value
@@ -66,7 +66,7 @@ module ObjectSpace
66
66
  #
67
67
  # If `key` is not found, returns `nil`.
68
68
  #
69
- def []: (Key) -> Value?
69
+ def []: (K) -> V?
70
70
 
71
71
  # <!--
72
72
  # rdoc-file=weakmap.c
@@ -80,7 +80,7 @@ module ObjectSpace
80
80
  # If the given `key` exists, replaces its value with the given `value`; the
81
81
  # ordering is not affected
82
82
  #
83
- def []=: (Key, Value?) -> Value?
83
+ def []=: (K, V?) -> V?
84
84
 
85
85
  # <!--
86
86
  # rdoc-file=weakmap.c
@@ -119,8 +119,8 @@ module ObjectSpace
119
119
  # m = ObjectSpace::WeakKeyMap.new
120
120
  # m.delete("nosuch") { |key| "Key #{key} not found" } # => "Key nosuch not found"
121
121
  #
122
- def delete: (Key) -> Value?
123
- | [T] (Key) { (Key) -> T } -> (Value | T)
122
+ def delete: (K) -> V?
123
+ | [T] (K) { (K) -> T } -> (V | T)
124
124
 
125
125
  # <!--
126
126
  # rdoc-file=weakmap.c
@@ -141,7 +141,7 @@ module ObjectSpace
141
141
  # copy = cache.getkey({amount: 1, currency: 'USD'})
142
142
  # copy.object_id == value.object_id #=> true
143
143
  #
144
- def getkey: (untyped) -> Key?
144
+ def getkey: (untyped) -> K?
145
145
 
146
146
  # <!--
147
147
  # rdoc-file=weakmap.c
@@ -161,6 +161,6 @@ module ObjectSpace
161
161
  # -->
162
162
  # Returns `true` if `key` is a key in `self`, otherwise `false`.
163
163
  #
164
- def key?: (Key) -> bool
164
+ def key?: (K) -> bool
165
165
  end
166
166
  end