steep 0.16.0 → 0.16.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (147) hide show
  1. checksums.yaml +4 -4
  2. data/.gitmodules +0 -3
  3. data/CHANGELOG.md +6 -0
  4. data/Rakefile +0 -13
  5. data/bin/setup +0 -2
  6. data/bin/smoke_runner.rb +0 -1
  7. data/exe/steep +0 -1
  8. data/lib/steep/project/file.rb +1 -1
  9. data/lib/steep/project/hover_content.rb +1 -1
  10. data/lib/steep/server/code_worker.rb +1 -1
  11. data/lib/steep/server/signature_worker.rb +4 -4
  12. data/lib/steep/type_construction.rb +10 -16
  13. data/lib/steep/type_inference/constant_env.rb +2 -10
  14. data/lib/steep/type_inference/context.rb +1 -0
  15. data/lib/steep/version.rb +1 -1
  16. data/steep.gemspec +1 -5
  17. metadata +17 -135
  18. data/exe/rbs +0 -3
  19. data/vendor/ruby-signature/.github/workflows/ruby.yml +0 -27
  20. data/vendor/ruby-signature/.gitignore +0 -12
  21. data/vendor/ruby-signature/.rubocop.yml +0 -15
  22. data/vendor/ruby-signature/BSDL +0 -22
  23. data/vendor/ruby-signature/COPYING +0 -56
  24. data/vendor/ruby-signature/Gemfile +0 -6
  25. data/vendor/ruby-signature/README.md +0 -93
  26. data/vendor/ruby-signature/Rakefile +0 -142
  27. data/vendor/ruby-signature/bin/annotate-with-rdoc +0 -157
  28. data/vendor/ruby-signature/bin/console +0 -14
  29. data/vendor/ruby-signature/bin/query-rdoc +0 -103
  30. data/vendor/ruby-signature/bin/setup +0 -10
  31. data/vendor/ruby-signature/bin/sort +0 -89
  32. data/vendor/ruby-signature/bin/test_runner.rb +0 -16
  33. data/vendor/ruby-signature/docs/CONTRIBUTING.md +0 -97
  34. data/vendor/ruby-signature/docs/sigs.md +0 -148
  35. data/vendor/ruby-signature/docs/stdlib.md +0 -152
  36. data/vendor/ruby-signature/docs/syntax.md +0 -528
  37. data/vendor/ruby-signature/exe/rbs +0 -7
  38. data/vendor/ruby-signature/lib/rbs.rb +0 -64
  39. data/vendor/ruby-signature/lib/rbs/ast/annotation.rb +0 -27
  40. data/vendor/ruby-signature/lib/rbs/ast/comment.rb +0 -27
  41. data/vendor/ruby-signature/lib/rbs/ast/declarations.rb +0 -395
  42. data/vendor/ruby-signature/lib/rbs/ast/members.rb +0 -362
  43. data/vendor/ruby-signature/lib/rbs/buffer.rb +0 -50
  44. data/vendor/ruby-signature/lib/rbs/builtin_names.rb +0 -55
  45. data/vendor/ruby-signature/lib/rbs/cli.rb +0 -558
  46. data/vendor/ruby-signature/lib/rbs/constant.rb +0 -26
  47. data/vendor/ruby-signature/lib/rbs/constant_table.rb +0 -150
  48. data/vendor/ruby-signature/lib/rbs/definition.rb +0 -170
  49. data/vendor/ruby-signature/lib/rbs/definition_builder.rb +0 -919
  50. data/vendor/ruby-signature/lib/rbs/environment.rb +0 -281
  51. data/vendor/ruby-signature/lib/rbs/environment_loader.rb +0 -136
  52. data/vendor/ruby-signature/lib/rbs/environment_walker.rb +0 -124
  53. data/vendor/ruby-signature/lib/rbs/errors.rb +0 -187
  54. data/vendor/ruby-signature/lib/rbs/location.rb +0 -102
  55. data/vendor/ruby-signature/lib/rbs/method_type.rb +0 -123
  56. data/vendor/ruby-signature/lib/rbs/namespace.rb +0 -91
  57. data/vendor/ruby-signature/lib/rbs/parser.y +0 -1344
  58. data/vendor/ruby-signature/lib/rbs/prototype/rb.rb +0 -553
  59. data/vendor/ruby-signature/lib/rbs/prototype/rbi.rb +0 -587
  60. data/vendor/ruby-signature/lib/rbs/prototype/runtime.rb +0 -381
  61. data/vendor/ruby-signature/lib/rbs/substitution.rb +0 -46
  62. data/vendor/ruby-signature/lib/rbs/test.rb +0 -26
  63. data/vendor/ruby-signature/lib/rbs/test/errors.rb +0 -61
  64. data/vendor/ruby-signature/lib/rbs/test/hook.rb +0 -294
  65. data/vendor/ruby-signature/lib/rbs/test/setup.rb +0 -58
  66. data/vendor/ruby-signature/lib/rbs/test/spy.rb +0 -325
  67. data/vendor/ruby-signature/lib/rbs/test/test_helper.rb +0 -183
  68. data/vendor/ruby-signature/lib/rbs/test/type_check.rb +0 -254
  69. data/vendor/ruby-signature/lib/rbs/type_name.rb +0 -70
  70. data/vendor/ruby-signature/lib/rbs/types.rb +0 -936
  71. data/vendor/ruby-signature/lib/rbs/variance_calculator.rb +0 -138
  72. data/vendor/ruby-signature/lib/rbs/vendorer.rb +0 -47
  73. data/vendor/ruby-signature/lib/rbs/version.rb +0 -3
  74. data/vendor/ruby-signature/lib/rbs/writer.rb +0 -269
  75. data/vendor/ruby-signature/lib/ruby/signature.rb +0 -7
  76. data/vendor/ruby-signature/rbs.gemspec +0 -46
  77. data/vendor/ruby-signature/stdlib/abbrev/abbrev.rbs +0 -60
  78. data/vendor/ruby-signature/stdlib/base64/base64.rbs +0 -71
  79. data/vendor/ruby-signature/stdlib/benchmark/benchmark.rbs +0 -372
  80. data/vendor/ruby-signature/stdlib/builtin/array.rbs +0 -1997
  81. data/vendor/ruby-signature/stdlib/builtin/basic_object.rbs +0 -280
  82. data/vendor/ruby-signature/stdlib/builtin/binding.rbs +0 -177
  83. data/vendor/ruby-signature/stdlib/builtin/builtin.rbs +0 -45
  84. data/vendor/ruby-signature/stdlib/builtin/class.rbs +0 -145
  85. data/vendor/ruby-signature/stdlib/builtin/comparable.rbs +0 -116
  86. data/vendor/ruby-signature/stdlib/builtin/complex.rbs +0 -400
  87. data/vendor/ruby-signature/stdlib/builtin/constants.rbs +0 -37
  88. data/vendor/ruby-signature/stdlib/builtin/data.rbs +0 -5
  89. data/vendor/ruby-signature/stdlib/builtin/deprecated.rbs +0 -2
  90. data/vendor/ruby-signature/stdlib/builtin/dir.rbs +0 -413
  91. data/vendor/ruby-signature/stdlib/builtin/encoding.rbs +0 -607
  92. data/vendor/ruby-signature/stdlib/builtin/enumerable.rbs +0 -404
  93. data/vendor/ruby-signature/stdlib/builtin/enumerator.rbs +0 -260
  94. data/vendor/ruby-signature/stdlib/builtin/errno.rbs +0 -781
  95. data/vendor/ruby-signature/stdlib/builtin/errors.rbs +0 -582
  96. data/vendor/ruby-signature/stdlib/builtin/exception.rbs +0 -194
  97. data/vendor/ruby-signature/stdlib/builtin/false_class.rbs +0 -40
  98. data/vendor/ruby-signature/stdlib/builtin/fiber.rbs +0 -68
  99. data/vendor/ruby-signature/stdlib/builtin/fiber_error.rbs +0 -12
  100. data/vendor/ruby-signature/stdlib/builtin/file.rbs +0 -1076
  101. data/vendor/ruby-signature/stdlib/builtin/file_test.rbs +0 -59
  102. data/vendor/ruby-signature/stdlib/builtin/float.rbs +0 -696
  103. data/vendor/ruby-signature/stdlib/builtin/gc.rbs +0 -243
  104. data/vendor/ruby-signature/stdlib/builtin/hash.rbs +0 -1029
  105. data/vendor/ruby-signature/stdlib/builtin/integer.rbs +0 -707
  106. data/vendor/ruby-signature/stdlib/builtin/io.rbs +0 -683
  107. data/vendor/ruby-signature/stdlib/builtin/kernel.rbs +0 -576
  108. data/vendor/ruby-signature/stdlib/builtin/marshal.rbs +0 -161
  109. data/vendor/ruby-signature/stdlib/builtin/match_data.rbs +0 -271
  110. data/vendor/ruby-signature/stdlib/builtin/math.rbs +0 -369
  111. data/vendor/ruby-signature/stdlib/builtin/method.rbs +0 -185
  112. data/vendor/ruby-signature/stdlib/builtin/module.rbs +0 -1104
  113. data/vendor/ruby-signature/stdlib/builtin/nil_class.rbs +0 -82
  114. data/vendor/ruby-signature/stdlib/builtin/numeric.rbs +0 -409
  115. data/vendor/ruby-signature/stdlib/builtin/object.rbs +0 -824
  116. data/vendor/ruby-signature/stdlib/builtin/proc.rbs +0 -429
  117. data/vendor/ruby-signature/stdlib/builtin/process.rbs +0 -1227
  118. data/vendor/ruby-signature/stdlib/builtin/random.rbs +0 -267
  119. data/vendor/ruby-signature/stdlib/builtin/range.rbs +0 -226
  120. data/vendor/ruby-signature/stdlib/builtin/rational.rbs +0 -424
  121. data/vendor/ruby-signature/stdlib/builtin/rb_config.rbs +0 -57
  122. data/vendor/ruby-signature/stdlib/builtin/regexp.rbs +0 -1083
  123. data/vendor/ruby-signature/stdlib/builtin/ruby_vm.rbs +0 -14
  124. data/vendor/ruby-signature/stdlib/builtin/signal.rbs +0 -55
  125. data/vendor/ruby-signature/stdlib/builtin/string.rbs +0 -1901
  126. data/vendor/ruby-signature/stdlib/builtin/string_io.rbs +0 -284
  127. data/vendor/ruby-signature/stdlib/builtin/struct.rbs +0 -40
  128. data/vendor/ruby-signature/stdlib/builtin/symbol.rbs +0 -228
  129. data/vendor/ruby-signature/stdlib/builtin/thread.rbs +0 -1108
  130. data/vendor/ruby-signature/stdlib/builtin/thread_group.rbs +0 -23
  131. data/vendor/ruby-signature/stdlib/builtin/time.rbs +0 -1047
  132. data/vendor/ruby-signature/stdlib/builtin/trace_point.rbs +0 -290
  133. data/vendor/ruby-signature/stdlib/builtin/true_class.rbs +0 -46
  134. data/vendor/ruby-signature/stdlib/builtin/unbound_method.rbs +0 -153
  135. data/vendor/ruby-signature/stdlib/builtin/warning.rbs +0 -17
  136. data/vendor/ruby-signature/stdlib/coverage/coverage.rbs +0 -62
  137. data/vendor/ruby-signature/stdlib/csv/csv.rbs +0 -773
  138. data/vendor/ruby-signature/stdlib/erb/erb.rbs +0 -392
  139. data/vendor/ruby-signature/stdlib/find/find.rbs +0 -40
  140. data/vendor/ruby-signature/stdlib/ipaddr/ipaddr.rbs +0 -247
  141. data/vendor/ruby-signature/stdlib/json/json.rbs +0 -335
  142. data/vendor/ruby-signature/stdlib/pathname/pathname.rbs +0 -1093
  143. data/vendor/ruby-signature/stdlib/prime/integer-extension.rbs +0 -23
  144. data/vendor/ruby-signature/stdlib/prime/prime.rbs +0 -188
  145. data/vendor/ruby-signature/stdlib/securerandom/securerandom.rbs +0 -9
  146. data/vendor/ruby-signature/stdlib/set/set.rbs +0 -301
  147. data/vendor/ruby-signature/stdlib/tmpdir/tmpdir.rbs +0 -53
@@ -1,582 +0,0 @@
1
- # Raised when the arguments are wrong and there isn't a more specific Exception
2
- # class.
3
- #
4
- # Ex: passing the wrong number of arguments
5
- #
6
- # [1, 2, 3].first(4, 5)
7
- #
8
- # *raises the exception:*
9
- #
10
- # ArgumentError: wrong number of arguments (given 2, expected 1)
11
- #
12
- # Ex: passing an argument that is not acceptable:
13
- #
14
- # [1, 2, 3].first(-4)
15
- #
16
- # *raises the exception:*
17
- #
18
- # ArgumentError: negative array size
19
- #
20
- class ArgumentError < StandardError
21
- end
22
-
23
- # The exception class which will be raised when pushing into a closed Queue.
24
- # See Queue#close and SizedQueue#close.
25
- #
26
- class ClosedQueueError < StopIteration
27
- end
28
-
29
- # EncodingError is the base class for encoding errors.
30
- #
31
- class EncodingError < StandardError
32
- end
33
-
34
- # Raised by some IO operations when reaching the end of file. Many IO methods
35
- # exist in two forms,
36
- #
37
- # one that returns `nil` when the end of file is reached, the other raises
38
- # `EOFError`.
39
- #
40
- # `EOFError` is a subclass of `IOError`.
41
- #
42
- # file = File.open("/etc/hosts")
43
- # file.read
44
- # file.gets #=> nil
45
- # file.readline #=> EOFError: end of file reached
46
- #
47
- class EOFError < IOError
48
- end
49
-
50
- # Raised when attempting to convert special float values (in particular
51
- # `Infinity` or `NaN`) to numerical classes which don't support them.
52
- #
53
- # Float::INFINITY.to_r #=> FloatDomainError: Infinity
54
- #
55
- class FloatDomainError < RangeError
56
- end
57
-
58
- # Raised when there is an attempt to modify a frozen object.
59
- #
60
- # [1, 2, 3].freeze << 4
61
- #
62
- # *raises the exception:*
63
- #
64
- # FrozenError: can't modify frozen Array
65
- #
66
- class FrozenError[T] < RuntimeError
67
- # Construct a new FrozenError exception. If given the *receiver* parameter may
68
- # subsequently be examined using the FrozenError#receiver method.
69
- #
70
- # a = [].freeze
71
- # raise FrozenError.new("can't modify frozen array", receiver: a)
72
- #
73
- def initialize: (?string? msg, ?receiver: T?) -> void
74
-
75
- # Return the receiver associated with this FrozenError exception.
76
- #
77
- def receiver: () -> T?
78
- end
79
-
80
- # Raised when the given index is invalid.
81
- #
82
- # a = [:foo, :bar]
83
- # a.fetch(0) #=> :foo
84
- # a[4] #=> nil
85
- # a.fetch(4) #=> IndexError: index 4 outside of array bounds: -2...2
86
- #
87
- class IndexError < StandardError
88
- end
89
-
90
- # Raised when the interrupt signal is received, typically because the user has
91
- # pressed Control-C (on most posix platforms). As such, it is a subclass of
92
- # `SignalException`.
93
- #
94
- # begin
95
- # puts "Press ctrl-C when you get bored"
96
- # loop {}
97
- # rescue Interrupt => e
98
- # puts "Note: You will typically use Signal.trap instead."
99
- # end
100
- #
101
- # *produces:*
102
- #
103
- # Press ctrl-C when you get bored
104
- #
105
- # *then waits until it is interrupted with Control-C and then prints:*
106
- #
107
- # Note: You will typically use Signal.trap instead.
108
- #
109
- class Interrupt < SignalException
110
- def initialize: (?string) -> void
111
- end
112
-
113
- # Raised when an IO operation fails.
114
- #
115
- # File.open("/etc/hosts") {|f| f << "example"}
116
- # #=> IOError: not opened for writing
117
- #
118
- # File.open("/etc/hosts") {|f| f.close; f.read }
119
- # #=> IOError: closed stream
120
- #
121
- # Note that some IO failures raise `SystemCallError`s and these are not
122
- # subclasses of IOError:
123
- #
124
- # File.open("does/not/exist")
125
- # #=> Errno::ENOENT: No such file or directory - does/not/exist
126
- #
127
- class IOError < StandardError
128
- end
129
-
130
- # Raised when the specified key is not found. It is a subclass of IndexError.
131
- #
132
- # h = {"foo" => :bar}
133
- # h.fetch("foo") #=> :bar
134
- # h.fetch("baz") #=> KeyError: key not found: "baz"
135
- #
136
- class KeyError[K, R] < IndexError
137
- # Construct a new `KeyError` exception with the given message, receiver and key.
138
- #
139
- def initialize: (?string msg, ?receiver: R?, ?key: K?) -> void
140
-
141
- # Return the key caused this KeyError exception.
142
- #
143
- def key: () -> K?
144
-
145
- # Return the receiver associated with this KeyError exception.
146
- #
147
- def receiver: () -> R?
148
- end
149
-
150
- # Raised when a file required (a Ruby script, extension library, ...) fails to
151
- # load.
152
- #
153
- # require 'this/file/does/not/exist'
154
- #
155
- # *raises the exception:*
156
- #
157
- # LoadError: no such file to load -- this/file/does/not/exist
158
- #
159
- class LoadError < ScriptError
160
- # the path failed to load
161
- #
162
- #
163
- def path: () -> String?
164
- end
165
-
166
- # Raised when Ruby can't yield as requested.
167
- #
168
- # A typical scenario is attempting to yield when no block is given:
169
- #
170
- # def call_block
171
- # yield 42
172
- # end
173
- # call_block
174
- #
175
- # *raises the exception:*
176
- #
177
- # LocalJumpError: no block given (yield)
178
- #
179
- # A more subtle example:
180
- #
181
- # def get_me_a_return
182
- # Proc.new { return 42 }
183
- # end
184
- # get_me_a_return.call
185
- #
186
- # *raises the exception:*
187
- #
188
- # LocalJumpError: unexpected return
189
- #
190
- class LocalJumpError < StandardError
191
- # Returns the exit value associated with this `LocalJumpError`.
192
- #
193
- def exit_value: () -> untyped
194
-
195
- # The reason this block was terminated: :break, :redo, :retry, :next, :return,
196
- # or :noreason.
197
- #
198
- def reason: () -> Symbol
199
- end
200
-
201
- # Raised when a given name is invalid or undefined.
202
- #
203
- # puts foo
204
- #
205
- # *raises the exception:*
206
- #
207
- # NameError: undefined local variable or method `foo' for main:Object
208
- #
209
- # Since constant names must start with a capital:
210
- #
211
- # Integer.const_set :answer, 42
212
- #
213
- # *raises the exception:*
214
- #
215
- # NameError: wrong constant name answer
216
- #
217
- class NameError[T] < StandardError
218
- # Construct a new NameError exception. If given the *name* parameter may
219
- # subsequently be examined using the NameError#name method. *receiver* parameter
220
- # allows to pass object in context of which the error happened. Example:
221
- #
222
- # [1, 2, 3].method(:rject) # NameError with name "rject" and receiver: Array
223
- # [1, 2, 3].singleton_method(:rject) # NameError with name "rject" and receiver: [1, 2, 3]
224
- #
225
- def initialize: (?string msg, ?String? name, ?receiver: T?) -> void
226
-
227
- public
228
-
229
- # Return a list of the local variable names defined where this NameError
230
- # exception was raised.
231
- #
232
- # Internal use only.
233
- #
234
- def local_variables: () -> ::Array[Symbol]
235
-
236
- # Return the name associated with this NameError exception.
237
- #
238
- def name: () -> String?
239
-
240
- # Return the receiver associated with this NameError exception.
241
- #
242
- def receiver: () -> T?
243
- end
244
-
245
- # Raised when memory allocation fails.
246
- #
247
- class NoMemoryError < Exception
248
- end
249
-
250
- # Raised when a method is called on a receiver which doesn't have it defined and
251
- # also fails to respond with `method_missing`.
252
- #
253
- # "hello".to_ary
254
- #
255
- # *raises the exception:*
256
- #
257
- # NoMethodError: undefined method `to_ary' for "hello":String
258
- #
259
- class NoMethodError[T] < NameError[T]
260
- # Construct a NoMethodError exception for a method of the given name called with
261
- # the given arguments. The name may be accessed using the `#name` method on the
262
- # resulting object, and the arguments using the `#args` method.
263
- #
264
- # If *private* argument were passed, it designates method was attempted to call
265
- # in private context, and can be accessed with `#private_call?` method.
266
- #
267
- # *receiver* argument stores an object whose method was called.
268
- #
269
- def initialize: (?string? msg, ?String? name, ?Array[untyped] args, ?bool `private`, ?receiver: T?) -> void
270
-
271
- public
272
-
273
- # Return the arguments passed in as the third parameter to the constructor.
274
- #
275
- def args: () -> Array[untyped]
276
-
277
- # Return true if the caused method was called as private.
278
- #
279
- def private_call?: () -> bool
280
- end
281
-
282
- # Raised when a feature is not implemented on the current platform. For example,
283
- # methods depending on the `fsync` or `fork` system calls may raise this
284
- # exception if the underlying operating system or Ruby runtime does not support
285
- # them.
286
- #
287
- # Note that if `fork` raises a `NotImplementedError`, then `respond_to?(:fork)`
288
- # returns `false`.
289
- #
290
- class NotImplementedError < ScriptError
291
- end
292
-
293
- # Raised when a given numerical value is out of range.
294
- #
295
- # [1, 2, 3].drop(1 << 100)
296
- #
297
- # *raises the exception:*
298
- #
299
- # RangeError: bignum too big to convert into `long'
300
- #
301
- class RangeError < StandardError
302
- end
303
-
304
- # Raised when given an invalid regexp expression.
305
- #
306
- # Regexp.new("?")
307
- #
308
- # *raises the exception:*
309
- #
310
- # RegexpError: target of repeat operator is not specified: /?/
311
- #
312
- class RegexpError < StandardError
313
- end
314
-
315
- # A generic error class raised when an invalid operation is attempted.
316
- # Kernel#raise will raise a RuntimeError if no Exception class is specified.
317
- #
318
- # raise "ouch"
319
- #
320
- # *raises the exception:*
321
- #
322
- # RuntimeError: ouch
323
- #
324
- class RuntimeError < StandardError
325
- end
326
-
327
- # ScriptError is the superclass for errors raised when a script can not be
328
- # executed because of a `LoadError`, `NotImplementedError` or a `SyntaxError`.
329
- # Note these type of `ScriptErrors` are not `StandardError` and will not be
330
- # rescued unless it is specified explicitly (or its ancestor `Exception`).
331
- #
332
- class ScriptError < Exception
333
- end
334
-
335
- # No longer used by internal code.
336
- #
337
- class SecurityError < Exception
338
- end
339
-
340
- # Raised when a signal is received.
341
- #
342
- # begin
343
- # Process.kill('HUP',Process.pid)
344
- # sleep # wait for receiver to handle signal sent by Process.kill
345
- # rescue SignalException => e
346
- # puts "received Exception #{e}"
347
- # end
348
- #
349
- # *produces:*
350
- #
351
- # received Exception SIGHUP
352
- #
353
- class SignalException < Exception
354
- # Construct a new SignalException object. `sig_name` should be a known signal
355
- # name.
356
- #
357
- def initialize: (?string sig_name) -> void
358
- | (int sig_number, ?string sig_name) -> void
359
-
360
- public
361
-
362
- def signm: () -> String
363
-
364
- # Returns a signal number.
365
- #
366
- def signo: () -> Integer
367
- end
368
-
369
- # The most standard error types are subclasses of StandardError. A rescue clause
370
- # without an explicit Exception class will rescue all StandardErrors (and only
371
- # those).
372
- #
373
- # def foo
374
- # raise "Oups"
375
- # end
376
- # foo rescue "Hello" #=> "Hello"
377
- #
378
- # On the other hand:
379
- #
380
- # require 'does/not/exist' rescue "Hi"
381
- #
382
- # *raises the exception:*
383
- #
384
- # LoadError: no such file to load -- does/not/exist
385
- #
386
- class StandardError < Exception
387
- end
388
-
389
- # Raised to stop the iteration, in particular by Enumerator#next. It is rescued
390
- # by Kernel#loop.
391
- #
392
- # loop do
393
- # puts "Hello"
394
- # raise StopIteration
395
- # puts "World"
396
- # end
397
- # puts "Done!"
398
- #
399
- # *produces:*
400
- #
401
- # Hello
402
- # Done!
403
- #
404
- class StopIteration < IndexError
405
- # Returns the return value of the iterator.
406
- #
407
- # o = Object.new
408
- # def o.each
409
- # yield 1
410
- # yield 2
411
- # yield 3
412
- # 100
413
- # end
414
- #
415
- # e = o.to_enum
416
- #
417
- # puts e.next #=> 1
418
- # puts e.next #=> 2
419
- # puts e.next #=> 3
420
- #
421
- # begin
422
- # e.next
423
- # rescue StopIteration => ex
424
- # puts ex.result #=> 100
425
- # end
426
- #
427
- def result: () -> untyped
428
- end
429
-
430
- # Raised when encountering Ruby code with an invalid syntax.
431
- #
432
- # eval("1+1=2")
433
- #
434
- # *raises the exception:*
435
- #
436
- # SyntaxError: (eval):1: syntax error, unexpected '=', expecting $end
437
- #
438
- class SyntaxError < ScriptError
439
- # Construct a SyntaxError exception.
440
- #
441
- def initialize: (?string msg) -> void
442
- end
443
-
444
- # SystemCallError is the base class for all low-level platform-dependent errors.
445
- #
446
- # The errors available on the current platform are subclasses of SystemCallError
447
- # and are defined in the Errno module.
448
- #
449
- # File.open("does/not/exist")
450
- #
451
- # *raises the exception:*
452
- #
453
- # Errno::ENOENT: No such file or directory - does/not/exist
454
- #
455
- class SystemCallError < StandardError
456
- # If *errno* corresponds to a known system error code, constructs the
457
- # appropriate Errno class for that error, otherwise constructs a generic
458
- # SystemCallError object. The error number is subsequently available via the
459
- # #errno method.
460
- #
461
- def initialize: (string msg, Integer errno) -> SystemCallError
462
-
463
- # Return `true` if the receiver is a generic `SystemCallError`, or if the error
464
- # numbers `self` and *other* are the same.
465
- #
466
- def self.===: (untyped other) -> bool
467
-
468
- public
469
-
470
- # Return this SystemCallError's error number.
471
- #
472
- def errno: () -> Integer
473
- end
474
-
475
- # Raised by `exit` to initiate the termination of the script.
476
- #
477
- class SystemExit < Exception
478
- # Create a new `SystemExit` exception with the given status and message. Status
479
- # is true, false, or an integer. If status is not given, true is used.
480
- #
481
- def initialize: () -> void
482
- | (string msg) -> void
483
- | (true | false | int status, ?string msg) -> void
484
-
485
- public
486
-
487
- # Return the status value associated with this system exit.
488
- #
489
- def status: () -> Integer
490
-
491
- # Returns `true` if exiting successful, `false` if not.
492
- #
493
- def success?: () -> bool
494
- end
495
-
496
- # Raised in case of a stack overflow.
497
- #
498
- # def me_myself_and_i
499
- # me_myself_and_i
500
- # end
501
- # me_myself_and_i
502
- #
503
- # *raises the exception:*
504
- #
505
- # SystemStackError: stack level too deep
506
- #
507
- class SystemStackError < Exception
508
- end
509
-
510
- # Raised when an invalid operation is attempted on a thread.
511
- #
512
- # For example, when no other thread has been started:
513
- #
514
- # Thread.stop
515
- #
516
- # This will raises the following exception:
517
- #
518
- # ThreadError: stopping only thread
519
- # note: use sleep to stop forever
520
- #
521
- class ThreadError < StandardError
522
- end
523
-
524
- # Raised when encountering an object that is not of the expected type.
525
- #
526
- # [1, 2, 3].first("two")
527
- #
528
- # *raises the exception:*
529
- #
530
- # TypeError: no implicit conversion of String into Integer
531
- #
532
- class TypeError < StandardError
533
- end
534
-
535
- # Raised when `throw` is called with a *tag* which does not have corresponding
536
- # `catch` block.
537
- #
538
- # throw "foo", "bar"
539
- #
540
- # *raises the exception:*
541
- #
542
- # UncaughtThrowError: uncaught throw "foo"
543
- #
544
- class UncaughtThrowError < ArgumentError
545
- # Raised when `throw` is called with a *tag* which does not have corresponding
546
- # `catch` block.
547
- #
548
- # throw "foo", "bar"
549
- #
550
- # *raises the exception:*
551
- #
552
- # UncaughtThrowError: uncaught throw "foo"
553
- #
554
- def initialize: (untyped tag, untyped value) -> void
555
-
556
- public
557
-
558
- # Return the tag object which was called for.
559
- #
560
- def tag: () -> untyped
561
-
562
- # Returns formatted message with the inspected tag.
563
- #
564
- def to_s: () -> String
565
-
566
- # Return the return value which was called for.
567
- #
568
- def value: () -> untyped
569
- end
570
-
571
- # Raised when attempting to divide an integer by 0.
572
- #
573
- # 42 / 0 #=> ZeroDivisionError: divided by 0
574
- #
575
- # Note that only division by an exact 0 will raise the exception:
576
- #
577
- # 42 / 0.0 #=> Float::INFINITY
578
- # 42 / -0.0 #=> -Float::INFINITY
579
- # 0 / 0.0 #=> NaN
580
- #
581
- class ZeroDivisionError < StandardError
582
- end