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.
- checksums.yaml +4 -4
- data/.github/workflows/comments.yml +1 -1
- data/.github/workflows/ruby.yml +7 -2
- data/CHANGELOG.md +85 -0
- data/Gemfile.lock +14 -14
- data/README.md +11 -2
- data/Rakefile +10 -7
- data/Steepfile +7 -7
- data/core/basic_object.rbs +7 -7
- data/core/binding.rbs +3 -3
- data/core/builtin.rbs +171 -5
- data/core/constants.rbs +17 -17
- data/core/dir.rbs +3 -3
- data/core/encoding.rbs +434 -628
- data/core/enumerator.rbs +37 -0
- data/core/exception.rbs +11 -11
- data/core/false_class.rbs +5 -11
- data/core/fiber.rbs +3 -3
- data/core/file_test.rbs +28 -26
- data/core/kernel.rbs +900 -21
- data/core/marshal.rbs +24 -14
- data/core/match_data.rbs +8 -8
- data/core/math.rbs +57 -53
- data/core/method.rbs +3 -1
- data/core/module.rbs +38 -36
- data/core/nil_class.rbs +7 -13
- data/core/object.rbs +3 -966
- data/core/process.rbs +3 -3
- data/core/ractor.rbs +2 -2
- data/core/rb_config.rbs +64 -43
- data/core/regexp.rbs +3 -3
- data/core/signal.rbs +10 -4
- data/core/struct.rbs +1 -1
- data/core/thread.rbs +7 -7
- data/core/thread_group.rbs +9 -9
- data/core/true_class.rbs +5 -11
- data/core/unbound_method.rbs +56 -7
- data/core/warning.rbs +33 -0
- data/docs/collection.md +56 -6
- data/docs/data_and_struct.md +57 -0
- data/docs/stdlib.md +61 -2
- data/docs/syntax.md +123 -2
- data/ext/rbs_extension/lexer.c +624 -569
- data/ext/rbs_extension/lexer.h +1 -0
- data/ext/rbs_extension/lexer.re +1 -0
- data/ext/rbs_extension/lexstate.c +1 -0
- data/ext/rbs_extension/parser.c +6 -0
- data/goodcheck.yml +2 -2
- data/lib/rbs/annotate/formatter.rb +13 -3
- data/lib/rbs/annotate/rdoc_source.rb +10 -1
- data/lib/rbs/cli/colored_io.rb +48 -0
- data/lib/rbs/cli/diff.rb +80 -0
- data/lib/rbs/cli.rb +151 -16
- data/lib/rbs/collection/config/lockfile.rb +0 -25
- data/lib/rbs/collection/config/lockfile_generator.rb +0 -6
- data/lib/rbs/collection/installer.rb +1 -1
- data/lib/rbs/collection/sources/git.rb +6 -4
- data/lib/rbs/collection/sources/local.rb +7 -5
- data/lib/rbs/diff.rb +104 -0
- data/lib/rbs/environment.rb +1 -1
- data/lib/rbs/method_type.rb +23 -0
- data/lib/rbs/prototype/rb.rb +2 -9
- data/lib/rbs/prototype/runtime/helpers.rb +59 -0
- data/lib/rbs/prototype/runtime/value_object_generator.rb +236 -0
- data/lib/rbs/prototype/runtime.rb +234 -150
- data/lib/rbs/sorter.rb +144 -117
- data/lib/rbs/test/guaranteed.rb +31 -0
- data/lib/rbs/test/type_check.rb +4 -4
- data/lib/rbs/test.rb +3 -0
- data/lib/rbs/types.rb +184 -3
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs/writer.rb +4 -4
- data/lib/rbs.rb +1 -0
- data/rbs.gemspec +1 -0
- data/sig/annotate/formatter.rbs +2 -2
- data/sig/annotate/rdoc_annotater.rbs +1 -1
- data/sig/cli/colored_io.rbs +15 -0
- data/sig/cli/diff.rbs +21 -0
- data/sig/cli.rbs +2 -0
- data/sig/collection/config/lockfile.rbs +0 -6
- data/sig/diff.rbs +23 -0
- data/sig/errors.rbs +1 -5
- data/sig/method_types.rbs +6 -0
- data/sig/prototype/runtime.rbs +108 -0
- data/sig/rdoc/rbs.rbs +4 -0
- data/sig/shims/bundler.rbs +5 -0
- data/sig/sorter.rbs +23 -5
- data/sig/types.rbs +29 -0
- data/stdlib/benchmark/0/benchmark.rbs +1 -1
- data/stdlib/cgi/0/core.rbs +2 -2
- data/stdlib/did_you_mean/0/did_you_mean.rbs +2 -2
- data/stdlib/digest/0/digest.rbs +1 -1
- data/stdlib/fileutils/0/fileutils.rbs +1 -1
- data/stdlib/forwardable/0/forwardable.rbs +4 -4
- data/stdlib/io-console/0/io-console.rbs +1 -1
- data/stdlib/json/0/json.rbs +37 -0
- data/stdlib/logger/0/logger.rbs +2 -2
- data/stdlib/net-http/0/manifest.yaml +1 -1
- data/stdlib/net-http/0/net-http.rbs +16 -63
- data/stdlib/net-protocol/0/manifest.yaml +2 -0
- data/stdlib/net-protocol/0/net-protocol.rbs +56 -0
- data/stdlib/openssl/0/openssl.rbs +1 -1
- data/stdlib/pp/0/manifest.yaml +2 -0
- data/stdlib/pp/0/pp.rbs +301 -0
- data/stdlib/{yaml → psych}/0/dbm.rbs +3 -3
- data/stdlib/psych/0/manifest.yaml +3 -0
- data/stdlib/psych/0/psych.rbs +391 -0
- data/stdlib/{yaml → psych}/0/store.rbs +2 -2
- data/stdlib/rdoc/0/code_object.rbs +55 -0
- data/stdlib/rdoc/0/comment.rbs +60 -0
- data/stdlib/rdoc/0/context.rbs +153 -0
- data/stdlib/rdoc/0/markup.rbs +119 -0
- data/stdlib/rdoc/0/parser.rbs +56 -0
- data/stdlib/rdoc/0/rdoc.rbs +0 -372
- data/stdlib/rdoc/0/ri.rbs +17 -0
- data/stdlib/rdoc/0/store.rbs +48 -0
- data/stdlib/rdoc/0/top_level.rbs +97 -0
- data/stdlib/socket/0/basic_socket.rbs +1 -1
- data/stdlib/socket/0/socket.rbs +1 -1
- data/stdlib/uri/0/common.rbs +1 -1
- data/stdlib/yaml/0/manifest.yaml +1 -2
- data/stdlib/yaml/0/yaml.rbs +1 -199
- metadata +46 -9
- data/sig/shims/pp.rbs +0 -3
- 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
|
|
145
|
-
|
|
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: (
|
|
179
|
-
| [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
|
-
| (
|
|
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 |
|
|
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 |
|
|
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 |
|
|
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 |
|
|
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 |
|
|
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 |
|
|
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 |
|
|
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: (
|
|
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: (
|
|
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: (
|
|
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: (
|
|
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: (
|
|
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: (
|
|
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: (
|
|
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: (
|
|
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: (
|
|
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: (
|
|
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: (
|
|
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: (
|
|
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: (
|
|
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: (
|
|
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: (
|
|
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: (
|
|
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: (
|
|
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: (
|
|
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: (
|
|
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: (
|
|
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: (
|
|
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: (
|
|
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: (
|
|
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: (
|
|
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: (
|
|
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: (
|
|
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: () ->
|
|
257
|
+
def parameters: () -> param_types
|
|
256
258
|
|
|
257
259
|
# <!--
|
|
258
260
|
# rdoc-file=proc.c
|