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/marshal.rbs CHANGED
@@ -108,6 +108,16 @@
108
108
  # which is Marshal.loaded in _load for complex objects.
109
109
  #
110
110
  module Marshal
111
+ # <!-- rdoc-file=marshal.c -->
112
+ # major version
113
+ #
114
+ MAJOR_VERSION: Integer
115
+
116
+ # <!-- rdoc-file=marshal.c -->
117
+ # minor version
118
+ #
119
+ MINOR_VERSION: Integer
120
+
111
121
  # <!--
112
122
  # rdoc-file=marshal.c
113
123
  # - dump( obj [, anIO] , limit=-1 ) -> anIO
@@ -141,8 +151,8 @@ module Marshal
141
151
  # ThreadGroup, Continuation
142
152
  # * objects which define singleton methods
143
153
  #
144
- def self.dump: (untyped obj, untyped port, ?Integer limit) -> untyped
145
- | (untyped obj, ?Integer limit) -> String
154
+ def self?.dump: [W < _Writer] (untyped obj, W port, ?int? limit) -> W
155
+ | (untyped obj, ?Integer limit) -> String
146
156
 
147
157
  # <!--
148
158
  # rdoc-file=marshal.rb
@@ -175,8 +185,18 @@ module Marshal
175
185
  # deserialized.map(&:object_id)
176
186
  # # => [1039360, 1039380, 1039360, 1039380] -- only 2 different objects, object_ids repeating
177
187
  #
178
- def self.load: (String | untyped port, ?freeze: boolish) -> untyped
179
- | [A] (String | untyped port, ^(untyped) -> A, ?freeze: boolish) -> A
188
+ def self.load: (string | _Source source, ?freeze: boolish) -> untyped
189
+ | [A] (string | _Source source, _Proc[A] proc, ?freeze: boolish) -> A
190
+
191
+ interface _Proc[T]
192
+ def call: (untyped loaded) -> T
193
+ end
194
+
195
+ interface _Source
196
+ def getbyte: () -> (String | int)
197
+
198
+ def read: (Integer) -> string
199
+ end
180
200
 
181
201
  # <!--
182
202
  # rdoc-file=marshal.rb
@@ -185,13 +205,3 @@ module Marshal
185
205
  #
186
206
  alias self.restore self.load
187
207
  end
188
-
189
- # <!-- rdoc-file=marshal.c -->
190
- # major version
191
- #
192
- Marshal::MAJOR_VERSION: Integer
193
-
194
- # <!-- rdoc-file=marshal.c -->
195
- # minor version
196
- #
197
- Marshal::MINOR_VERSION: Integer
data/core/match_data.rbs CHANGED
@@ -83,7 +83,7 @@ class MatchData
83
83
  def []: (Integer idx) -> String?
84
84
  | (Integer start, Integer length) -> ::Array[String?]
85
85
  | (::Range[Integer] range) -> ::Array[String?]
86
- | (String | Symbol name) -> String?
86
+ | (interned name) -> String?
87
87
 
88
88
  # <!--
89
89
  # rdoc-file=re.c
@@ -121,7 +121,7 @@ class MatchData
121
121
  #
122
122
  # Related: MatchData#end, MatchData#offset, MatchData#byteoffset.
123
123
  #
124
- def begin: (Integer | String | Symbol n_or_name) -> Integer?
124
+ def begin: (Integer | interned n_or_name) -> Integer?
125
125
 
126
126
  # <!--
127
127
  # rdoc-file=re.c
@@ -139,7 +139,7 @@ class MatchData
139
139
  # p m.byteoffset(:foo) #=> [0, 1]
140
140
  # p m.byteoffset(:bar) #=> [2, 3]
141
141
  #
142
- def byteoffset: (Integer | Symbol | String n_or_name) -> ([ Integer, Integer ] | [ nil, nil ])
142
+ def byteoffset: (Integer | interned n_or_name) -> ([ Integer, Integer ] | [ nil, nil ])
143
143
 
144
144
  # <!--
145
145
  # rdoc-file=re.c
@@ -221,7 +221,7 @@ class MatchData
221
221
  #
222
222
  # Related: MatchData#begin, MatchData#offset, MatchData#byteoffset.
223
223
  #
224
- def end: (Integer | String | Symbol n_or_name) -> Integer?
224
+ def end: (Integer | interned n_or_name) -> Integer?
225
225
 
226
226
  # <!--
227
227
  # rdoc-file=re.c
@@ -348,7 +348,7 @@ class MatchData
348
348
  # m.match('foo') # => "h"
349
349
  # m.match(:bar) # => "ge"
350
350
  #
351
- def match: (int | String | Symbol) -> String?
351
+ def match: (int | interned) -> String?
352
352
 
353
353
  # <!--
354
354
  # rdoc-file=re.c
@@ -375,7 +375,7 @@ class MatchData
375
375
  # m.match_length('foo') # => 1
376
376
  # m.match_length(:bar) # => 2
377
377
  #
378
- def match_length: (int | String | Symbol) -> Integer?
378
+ def match_length: (int | interned) -> Integer?
379
379
 
380
380
  # <!--
381
381
  # rdoc-file=re.c
@@ -414,7 +414,7 @@ class MatchData
414
414
  #
415
415
  # Related: MatchData#byteoffset, MatchData#begin, MatchData#end.
416
416
  #
417
- def offset: (Integer | Symbol | String n_or_name) -> ([ Integer, Integer ] | [ nil, nil ])
417
+ def offset: (Integer | interned n_or_name) -> ([ Integer, Integer ] | [ nil, nil ])
418
418
 
419
419
  # <!--
420
420
  # rdoc-file=re.c
@@ -544,7 +544,7 @@ class MatchData
544
544
  # m.values_at(0, 1..2, :a, :b, :op)
545
545
  # # => ["1 + 2", "1", "+", "1", "2", "+"]
546
546
  #
547
- def values_at: (*Integer | Symbol | String n_or_name) -> ::Array[String?]
547
+ def values_at: (*Integer | interned n_or_name) -> ::Array[String?]
548
548
 
549
549
  private
550
550
 
data/core/math.rbs CHANGED
@@ -127,6 +127,37 @@
127
127
  # * ::hypot: Returns `sqrt(a**2 + b**2)` for the given `a` and `b`.
128
128
  #
129
129
  module Math
130
+ # <!-- rdoc-file=math.c -->
131
+ # Definition of the mathematical constant E for Euler's number (e) as a Float
132
+ # number.
133
+ #
134
+ E: Float
135
+
136
+ # <!-- rdoc-file=math.c -->
137
+ # Definition of the mathematical constant PI as a Float number.
138
+ #
139
+ PI: Float
140
+
141
+ # <!-- rdoc-file=math.c -->
142
+ # Raised when a mathematical function is evaluated outside of its domain of
143
+ # definition.
144
+ #
145
+ # For example, since `cos` returns values in the range -1..1, its inverse
146
+ # function `acos` is only defined on that interval:
147
+ #
148
+ # Math.acos(42)
149
+ #
150
+ # *produces:*
151
+ #
152
+ # Math::DomainError: Numerical argument is out of domain - "acos"
153
+ #
154
+ class DomainError < StandardError
155
+ end
156
+
157
+ # A type that's passable to `Math` functions: A `Numeric` type that defines `.to_f`.
158
+ #
159
+ type double = Numeric & _ToF
160
+
130
161
  # <!--
131
162
  # rdoc-file=math.c
132
163
  # - Math.acos(x) -> float
@@ -144,7 +175,7 @@ module Math
144
175
  # acos(0.0) # => 1.5707963267948966 # PI/2
145
176
  # acos(1.0) # => 0.0
146
177
  #
147
- def self.acos: (Numeric x) -> Float
178
+ def self.acos: (double x) -> Float
148
179
 
149
180
  # <!--
150
181
  # rdoc-file=math.c
@@ -162,7 +193,7 @@ module Math
162
193
  # acosh(1.0) # => 0.0
163
194
  # acosh(INFINITY) # => Infinity
164
195
  #
165
- def self.acosh: (Numeric x) -> Float
196
+ def self.acosh: (double x) -> Float
166
197
 
167
198
  # <!--
168
199
  # rdoc-file=math.c
@@ -181,7 +212,7 @@ module Math
181
212
  # asin(0.0) # => 0.0
182
213
  # asin(1.0) # => 1.5707963267948966 # PI/2
183
214
  #
184
- def self.asin: (Numeric x) -> Float
215
+ def self.asin: (double x) -> Float
185
216
 
186
217
  # <!--
187
218
  # rdoc-file=math.c
@@ -200,7 +231,7 @@ module Math
200
231
  # asinh(0.0) # => 0.0
201
232
  # asinh(INFINITY) # => Infinity
202
233
  #
203
- def self.asinh: (Numeric x) -> Float
234
+ def self.asinh: (double x) -> Float
204
235
 
205
236
  # <!--
206
237
  # rdoc-file=math.c
@@ -224,7 +255,7 @@ module Math
224
255
  # atan(PI) # => 1.2626272556789115
225
256
  # atan(INFINITY) # => 1.5707963267948966 # PI/2
226
257
  #
227
- def self.atan: (Numeric x) -> Float
258
+ def self.atan: (double x) -> Float
228
259
 
229
260
  # <!--
230
261
  # rdoc-file=math.c
@@ -247,7 +278,7 @@ module Math
247
278
  # atan2(-1.0, 1.0) # => -0.7853981633974483 # -PI/4
248
279
  # atan2(0.0, -1.0) # => 3.141592653589793 # PI
249
280
  #
250
- def self.atan2: (Numeric y, Numeric x) -> Float
281
+ def self.atan2: (double y, double x) -> Float
251
282
 
252
283
  # <!--
253
284
  # rdoc-file=math.c
@@ -266,7 +297,7 @@ module Math
266
297
  # atanh(0.0) # => 0.0
267
298
  # atanh(1.0) # => Infinity
268
299
  #
269
- def self.atanh: (Numeric x) -> Float
300
+ def self.atanh: (double x) -> Float
270
301
 
271
302
  # <!--
272
303
  # rdoc-file=math.c
@@ -292,7 +323,7 @@ module Math
292
323
  # cbrt(27.0) # => 3.0
293
324
  # cbrt(INFINITY) # => Infinity
294
325
  #
295
- def self.cbrt: (Numeric x) -> Float
326
+ def self.cbrt: (double x) -> Float
296
327
 
297
328
  # <!--
298
329
  # rdoc-file=math.c
@@ -314,7 +345,7 @@ module Math
314
345
  # cos(PI/2) # => 6.123031769111886e-17 # 0.0000000000000001
315
346
  # cos(PI) # => -1.0
316
347
  #
317
- def self.cos: (Numeric x) -> Float
348
+ def self.cos: (double x) -> Float
318
349
 
319
350
  # <!--
320
351
  # rdoc-file=math.c
@@ -335,7 +366,7 @@ module Math
335
366
  # cosh(0.0) # => 1.0
336
367
  # cosh(INFINITY) # => Infinity
337
368
  #
338
- def self.cosh: (Numeric x) -> Float
369
+ def self.cosh: (double x) -> Float
339
370
 
340
371
  # <!--
341
372
  # rdoc-file=math.c
@@ -356,7 +387,7 @@ module Math
356
387
  #
357
388
  # Related: Math.erfc.
358
389
  #
359
- def self.erf: (Numeric x) -> Float
390
+ def self.erf: (double x) -> Float
360
391
 
361
392
  # <!--
362
393
  # rdoc-file=math.c
@@ -378,7 +409,7 @@ module Math
378
409
  #
379
410
  # Related: Math.erf.
380
411
  #
381
- def self.erfc: (Numeric x) -> Float
412
+ def self.erfc: (double x) -> Float
382
413
 
383
414
  # <!--
384
415
  # rdoc-file=math.c
@@ -400,7 +431,7 @@ module Math
400
431
  # exp(2.0) # => 7.38905609893065 # E**2
401
432
  # exp(INFINITY) # => Infinity
402
433
  #
403
- def self.exp: (Numeric x) -> Float
434
+ def self.exp: (double x) -> Float
404
435
 
405
436
  # <!--
406
437
  # rdoc-file=math.c
@@ -431,7 +462,7 @@ module Math
431
462
  #
432
463
  # Related: Math.ldexp (inverse of Math.frexp).
433
464
  #
434
- def self.frexp: (Numeric x) -> [ Float, Integer ]
465
+ def self.frexp: (double x) -> [Float, Integer]
435
466
 
436
467
  # <!--
437
468
  # rdoc-file=math.c
@@ -458,7 +489,7 @@ module Math
458
489
  #
459
490
  # Related: Math.lgamma.
460
491
  #
461
- def self.gamma: (Numeric x) -> Float
492
+ def self.gamma: (double x) -> Float
462
493
 
463
494
  # <!--
464
495
  # rdoc-file=math.c
@@ -483,7 +514,7 @@ module Math
483
514
  # Note that if either argument is `INFINITY` or `-INFINITY`, the result is
484
515
  # `Infinity`.
485
516
  #
486
- def self.hypot: (Numeric x, Numeric y) -> Float
517
+ def self.hypot: (double x, double y) -> Float
487
518
 
488
519
  # <!--
489
520
  # rdoc-file=math.c
@@ -511,7 +542,7 @@ module Math
511
542
  #
512
543
  # Related: Math.frexp (inverse of Math.ldexp).
513
544
  #
514
- def self.ldexp: (Numeric fraction, Numeric exponent) -> Float
545
+ def self.ldexp: (double fraction, int exponent) -> Float
515
546
 
516
547
  # <!--
517
548
  # rdoc-file=math.c
@@ -552,7 +583,7 @@ module Math
552
583
  #
553
584
  # Related: Math.gamma.
554
585
  #
555
- def self.lgamma: (Numeric x) -> [ Float, Integer ]
586
+ def self.lgamma: (double x) -> [Float, -1 | 1]
556
587
 
557
588
  # <!--
558
589
  # rdoc-file=math.c
@@ -580,7 +611,7 @@ module Math
580
611
  # log(1.0, 10.0) # => 0.0
581
612
  # log(10.0, 10.0) # => 1.0
582
613
  #
583
- def self.log: (Numeric x, ?Numeric base) -> Float
614
+ def self.log: (double x, ?double base) -> Float
584
615
 
585
616
  # <!--
586
617
  # rdoc-file=math.c
@@ -600,7 +631,7 @@ module Math
600
631
  # log10(10.0) # => 1.0
601
632
  # log10(INFINITY) # => Infinity
602
633
  #
603
- def self.log10: (Numeric x) -> Float
634
+ def self.log10: (double x) -> Float
604
635
 
605
636
  # <!--
606
637
  # rdoc-file=math.c
@@ -620,7 +651,7 @@ module Math
620
651
  # log2(2.0) # => 1.0
621
652
  # log2(INFINITY) # => Infinity
622
653
  #
623
- def self.log2: (Numeric x) -> Float
654
+ def self.log2: (double x) -> Float
624
655
 
625
656
  # <!--
626
657
  # rdoc-file=math.c
@@ -642,7 +673,7 @@ module Math
642
673
  # sin(PI/2) # => 1.0
643
674
  # sin(PI) # => 1.2246063538223773e-16 # 0.0000000000000001
644
675
  #
645
- def self.sin: (Numeric x) -> Float
676
+ def self.sin: (double x) -> Float
646
677
 
647
678
  # <!--
648
679
  # rdoc-file=math.c
@@ -663,7 +694,7 @@ module Math
663
694
  # sinh(0.0) # => 0.0
664
695
  # sinh(INFINITY) # => Infinity
665
696
  #
666
- def self.sinh: (Numeric x) -> Float
697
+ def self.sinh: (double x) -> Float
667
698
 
668
699
  # <!--
669
700
  # rdoc-file=math.c
@@ -686,7 +717,7 @@ module Math
686
717
  # sqrt(9.0) # => 3.0
687
718
  # sqrt(INFINITY) # => Infinity
688
719
  #
689
- def self.sqrt: (Numeric x) -> Float
720
+ def self.sqrt: (double x) -> Float
690
721
 
691
722
  # <!--
692
723
  # rdoc-file=math.c
@@ -709,7 +740,7 @@ module Math
709
740
  # tan(PI/2) # => 1.633123935319537e+16 # 16331239353195370.0
710
741
  # tan(PI) # => -1.2246467991473532e-16 # -0.0000000000000001
711
742
  #
712
- def self.tan: (Numeric x) -> Float
743
+ def self.tan: (double x) -> Float
713
744
 
714
745
  # <!--
715
746
  # rdoc-file=math.c
@@ -730,32 +761,5 @@ module Math
730
761
  # tanh(0.0) # => 0.0
731
762
  # tanh(INFINITY) # => 1.0
732
763
  #
733
- def self.tanh: (Numeric x) -> Float
734
- end
735
-
736
- # <!-- rdoc-file=math.c -->
737
- # Definition of the mathematical constant E for Euler's number (e) as a Float
738
- # number.
739
- #
740
- Math::E: Float
741
-
742
- # <!-- rdoc-file=math.c -->
743
- # Definition of the mathematical constant PI as a Float number.
744
- #
745
- Math::PI: Float
746
-
747
- # <!-- rdoc-file=math.c -->
748
- # Raised when a mathematical function is evaluated outside of its domain of
749
- # definition.
750
- #
751
- # For example, since `cos` returns values in the range -1..1, its inverse
752
- # function `acos` is only defined on that interval:
753
- #
754
- # Math.acos(42)
755
- #
756
- # *produces:*
757
- #
758
- # Math::DomainError: Numerical argument is out of domain - "acos"
759
- #
760
- class Math::DomainError < StandardError
764
+ def self.tanh: (double x) -> Float
761
765
  end
data/core/method.rbs CHANGED
@@ -23,6 +23,8 @@
23
23
  # #=> [#<Date: 2017-03-01 ((2457814j,0s,0n),+0s,2299161j)>, #<Date: 2017-03-02 ((2457815j,0s,0n),+0s,2299161j)>]
24
24
  #
25
25
  class Method < Object
26
+ type param_types = Array[[:req | :opt | :rest | :keyreq | :key | :keyrest | :block, Symbol] | [:rest | :keyrest | :nokey]]
27
+
26
28
  # <!--
27
29
  # rdoc-file=proc.c
28
30
  # - meth.to_proc -> proc
@@ -252,7 +254,7 @@ class Method < Object
252
254
  # def foo(bar, baz, *args, &blk); end
253
255
  # method(:foo).parameters #=> [[:req, :bar], [:req, :baz], [:rest, :args], [:block, :blk]]
254
256
  #
255
- def parameters: () -> ::Array[[ :req | :opt | :rest | :keyreq | :key | :keyrest | :block, Symbol ] | [ :rest | :keyrest ]]
257
+ def parameters: () -> param_types
256
258
 
257
259
  # <!--
258
260
  # rdoc-file=proc.c