steep 0.13.0 → 0.16.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (214) hide show
  1. checksums.yaml +4 -4
  2. data/.gitmodules +0 -3
  3. data/CHANGELOG.md +28 -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.rb +33 -1
  9. data/lib/steep/annotation_parser.rb +4 -4
  10. data/lib/steep/ast/buffer.rb +11 -7
  11. data/lib/steep/ast/builtin.rb +8 -0
  12. data/lib/steep/ast/types/factory.rb +124 -89
  13. data/lib/steep/cli.rb +16 -1
  14. data/lib/steep/drivers/annotations.rb +1 -1
  15. data/lib/steep/drivers/check.rb +20 -4
  16. data/lib/steep/drivers/init.rb +5 -5
  17. data/lib/steep/drivers/langserver.rb +13 -287
  18. data/lib/steep/drivers/utils/driver_helper.rb +1 -1
  19. data/lib/steep/drivers/vendor.rb +2 -2
  20. data/lib/steep/drivers/watch.rb +97 -85
  21. data/lib/steep/drivers/worker.rb +51 -0
  22. data/lib/steep/project.rb +9 -5
  23. data/lib/steep/project/completion_provider.rb +298 -0
  24. data/lib/steep/project/dsl.rb +14 -0
  25. data/lib/steep/project/file.rb +54 -47
  26. data/lib/steep/project/hover_content.rb +17 -8
  27. data/lib/steep/project/options.rb +25 -3
  28. data/lib/steep/project/target.rb +40 -24
  29. data/lib/steep/server/base_worker.rb +56 -0
  30. data/lib/steep/server/code_worker.rb +151 -0
  31. data/lib/steep/server/interaction_worker.rb +281 -0
  32. data/lib/steep/server/master.rb +196 -0
  33. data/lib/steep/server/signature_worker.rb +148 -0
  34. data/lib/steep/server/utils.rb +36 -0
  35. data/lib/steep/server/worker_process.rb +62 -0
  36. data/lib/steep/signature/errors.rb +1 -1
  37. data/lib/steep/signature/validator.rb +13 -13
  38. data/lib/steep/source.rb +1 -1
  39. data/lib/steep/type_construction.rb +1004 -727
  40. data/lib/steep/type_inference/constant_env.rb +3 -11
  41. data/lib/steep/type_inference/context.rb +8 -3
  42. data/lib/steep/type_inference/context_array.rb +111 -0
  43. data/lib/steep/type_inference/local_variable_type_env.rb +226 -0
  44. data/lib/steep/type_inference/logic.rb +130 -0
  45. data/lib/steep/type_inference/type_env.rb +5 -69
  46. data/lib/steep/typing.rb +91 -23
  47. data/lib/steep/version.rb +1 -1
  48. data/smoke/alias/Steepfile +1 -0
  49. data/smoke/alias/a.rb +1 -1
  50. data/smoke/and/Steepfile +1 -0
  51. data/smoke/array/Steepfile +1 -0
  52. data/smoke/array/b.rb +0 -2
  53. data/smoke/block/Steepfile +1 -0
  54. data/smoke/case/Steepfile +1 -0
  55. data/smoke/class/Steepfile +1 -0
  56. data/smoke/const/Steepfile +1 -0
  57. data/smoke/dstr/Steepfile +1 -0
  58. data/smoke/ensure/Steepfile +1 -0
  59. data/smoke/enumerator/Steepfile +1 -0
  60. data/smoke/extension/Steepfile +1 -0
  61. data/smoke/extension/c.rb +1 -0
  62. data/smoke/hash/Steepfile +1 -0
  63. data/smoke/hello/Steepfile +1 -0
  64. data/smoke/if/Steepfile +1 -0
  65. data/smoke/if/a.rb +1 -1
  66. data/smoke/implements/Steepfile +1 -0
  67. data/smoke/initialize/Steepfile +1 -0
  68. data/smoke/integer/Steepfile +1 -0
  69. data/smoke/interface/Steepfile +1 -0
  70. data/smoke/kwbegin/Steepfile +1 -0
  71. data/smoke/lambda/Steepfile +1 -0
  72. data/smoke/literal/Steepfile +1 -0
  73. data/smoke/map/Steepfile +1 -0
  74. data/smoke/method/Steepfile +1 -0
  75. data/smoke/module/Steepfile +1 -0
  76. data/smoke/regexp/Steepfile +1 -0
  77. data/smoke/regexp/b.rb +4 -4
  78. data/smoke/regression/Steepfile +1 -0
  79. data/smoke/rescue/Steepfile +1 -0
  80. data/smoke/rescue/a.rb +1 -1
  81. data/smoke/self/Steepfile +1 -0
  82. data/smoke/skip/Steepfile +1 -0
  83. data/smoke/stdout/Steepfile +1 -0
  84. data/smoke/super/Steepfile +1 -0
  85. data/smoke/type_case/Steepfile +1 -0
  86. data/smoke/yield/Steepfile +1 -0
  87. data/steep.gemspec +8 -8
  88. metadata +38 -138
  89. data/exe/rbs +0 -3
  90. data/exe/ruby-signature +0 -3
  91. data/vendor/ruby-signature/.github/workflows/ruby.yml +0 -27
  92. data/vendor/ruby-signature/.gitignore +0 -12
  93. data/vendor/ruby-signature/.rubocop.yml +0 -15
  94. data/vendor/ruby-signature/BSDL +0 -22
  95. data/vendor/ruby-signature/COPYING +0 -56
  96. data/vendor/ruby-signature/Gemfile +0 -6
  97. data/vendor/ruby-signature/README.md +0 -93
  98. data/vendor/ruby-signature/Rakefile +0 -66
  99. data/vendor/ruby-signature/bin/annotate-with-rdoc +0 -156
  100. data/vendor/ruby-signature/bin/console +0 -14
  101. data/vendor/ruby-signature/bin/query-rdoc +0 -103
  102. data/vendor/ruby-signature/bin/setup +0 -10
  103. data/vendor/ruby-signature/bin/sort +0 -88
  104. data/vendor/ruby-signature/bin/test_runner.rb +0 -17
  105. data/vendor/ruby-signature/docs/CONTRIBUTING.md +0 -97
  106. data/vendor/ruby-signature/docs/sigs.md +0 -148
  107. data/vendor/ruby-signature/docs/stdlib.md +0 -152
  108. data/vendor/ruby-signature/docs/syntax.md +0 -528
  109. data/vendor/ruby-signature/exe/rbs +0 -3
  110. data/vendor/ruby-signature/exe/ruby-signature +0 -7
  111. data/vendor/ruby-signature/lib/ruby/signature.rb +0 -64
  112. data/vendor/ruby-signature/lib/ruby/signature/ast/annotation.rb +0 -29
  113. data/vendor/ruby-signature/lib/ruby/signature/ast/comment.rb +0 -29
  114. data/vendor/ruby-signature/lib/ruby/signature/ast/declarations.rb +0 -391
  115. data/vendor/ruby-signature/lib/ruby/signature/ast/members.rb +0 -364
  116. data/vendor/ruby-signature/lib/ruby/signature/buffer.rb +0 -52
  117. data/vendor/ruby-signature/lib/ruby/signature/builtin_names.rb +0 -54
  118. data/vendor/ruby-signature/lib/ruby/signature/cli.rb +0 -534
  119. data/vendor/ruby-signature/lib/ruby/signature/constant.rb +0 -28
  120. data/vendor/ruby-signature/lib/ruby/signature/constant_table.rb +0 -152
  121. data/vendor/ruby-signature/lib/ruby/signature/definition.rb +0 -172
  122. data/vendor/ruby-signature/lib/ruby/signature/definition_builder.rb +0 -921
  123. data/vendor/ruby-signature/lib/ruby/signature/environment.rb +0 -283
  124. data/vendor/ruby-signature/lib/ruby/signature/environment_loader.rb +0 -138
  125. data/vendor/ruby-signature/lib/ruby/signature/environment_walker.rb +0 -126
  126. data/vendor/ruby-signature/lib/ruby/signature/errors.rb +0 -189
  127. data/vendor/ruby-signature/lib/ruby/signature/location.rb +0 -104
  128. data/vendor/ruby-signature/lib/ruby/signature/method_type.rb +0 -125
  129. data/vendor/ruby-signature/lib/ruby/signature/namespace.rb +0 -93
  130. data/vendor/ruby-signature/lib/ruby/signature/parser.y +0 -1343
  131. data/vendor/ruby-signature/lib/ruby/signature/prototype/rb.rb +0 -441
  132. data/vendor/ruby-signature/lib/ruby/signature/prototype/rbi.rb +0 -579
  133. data/vendor/ruby-signature/lib/ruby/signature/prototype/runtime.rb +0 -383
  134. data/vendor/ruby-signature/lib/ruby/signature/substitution.rb +0 -48
  135. data/vendor/ruby-signature/lib/ruby/signature/test.rb +0 -28
  136. data/vendor/ruby-signature/lib/ruby/signature/test/errors.rb +0 -63
  137. data/vendor/ruby-signature/lib/ruby/signature/test/hook.rb +0 -290
  138. data/vendor/ruby-signature/lib/ruby/signature/test/setup.rb +0 -58
  139. data/vendor/ruby-signature/lib/ruby/signature/test/spy.rb +0 -324
  140. data/vendor/ruby-signature/lib/ruby/signature/test/test_helper.rb +0 -185
  141. data/vendor/ruby-signature/lib/ruby/signature/test/type_check.rb +0 -256
  142. data/vendor/ruby-signature/lib/ruby/signature/type_name.rb +0 -72
  143. data/vendor/ruby-signature/lib/ruby/signature/types.rb +0 -932
  144. data/vendor/ruby-signature/lib/ruby/signature/variance_calculator.rb +0 -140
  145. data/vendor/ruby-signature/lib/ruby/signature/vendorer.rb +0 -49
  146. data/vendor/ruby-signature/lib/ruby/signature/version.rb +0 -5
  147. data/vendor/ruby-signature/lib/ruby/signature/writer.rb +0 -271
  148. data/vendor/ruby-signature/ruby-signature.gemspec +0 -45
  149. data/vendor/ruby-signature/stdlib/abbrev/abbrev.rbs +0 -3
  150. data/vendor/ruby-signature/stdlib/base64/base64.rbs +0 -15
  151. data/vendor/ruby-signature/stdlib/builtin/array.rbs +0 -1997
  152. data/vendor/ruby-signature/stdlib/builtin/basic_object.rbs +0 -280
  153. data/vendor/ruby-signature/stdlib/builtin/binding.rbs +0 -177
  154. data/vendor/ruby-signature/stdlib/builtin/builtin.rbs +0 -35
  155. data/vendor/ruby-signature/stdlib/builtin/class.rbs +0 -145
  156. data/vendor/ruby-signature/stdlib/builtin/comparable.rbs +0 -116
  157. data/vendor/ruby-signature/stdlib/builtin/complex.rbs +0 -400
  158. data/vendor/ruby-signature/stdlib/builtin/constants.rbs +0 -37
  159. data/vendor/ruby-signature/stdlib/builtin/data.rbs +0 -5
  160. data/vendor/ruby-signature/stdlib/builtin/deprecated.rbs +0 -2
  161. data/vendor/ruby-signature/stdlib/builtin/dir.rbs +0 -419
  162. data/vendor/ruby-signature/stdlib/builtin/encoding.rbs +0 -606
  163. data/vendor/ruby-signature/stdlib/builtin/enumerable.rbs +0 -404
  164. data/vendor/ruby-signature/stdlib/builtin/enumerator.rbs +0 -260
  165. data/vendor/ruby-signature/stdlib/builtin/errno.rbs +0 -781
  166. data/vendor/ruby-signature/stdlib/builtin/errors.rbs +0 -582
  167. data/vendor/ruby-signature/stdlib/builtin/exception.rbs +0 -193
  168. data/vendor/ruby-signature/stdlib/builtin/false_class.rbs +0 -40
  169. data/vendor/ruby-signature/stdlib/builtin/fiber.rbs +0 -68
  170. data/vendor/ruby-signature/stdlib/builtin/fiber_error.rbs +0 -12
  171. data/vendor/ruby-signature/stdlib/builtin/file.rbs +0 -476
  172. data/vendor/ruby-signature/stdlib/builtin/file_test.rbs +0 -59
  173. data/vendor/ruby-signature/stdlib/builtin/float.rbs +0 -696
  174. data/vendor/ruby-signature/stdlib/builtin/gc.rbs +0 -121
  175. data/vendor/ruby-signature/stdlib/builtin/hash.rbs +0 -1029
  176. data/vendor/ruby-signature/stdlib/builtin/integer.rbs +0 -710
  177. data/vendor/ruby-signature/stdlib/builtin/io.rbs +0 -683
  178. data/vendor/ruby-signature/stdlib/builtin/kernel.rbs +0 -574
  179. data/vendor/ruby-signature/stdlib/builtin/marshal.rbs +0 -135
  180. data/vendor/ruby-signature/stdlib/builtin/match_data.rbs +0 -141
  181. data/vendor/ruby-signature/stdlib/builtin/math.rbs +0 -66
  182. data/vendor/ruby-signature/stdlib/builtin/method.rbs +0 -182
  183. data/vendor/ruby-signature/stdlib/builtin/module.rbs +0 -248
  184. data/vendor/ruby-signature/stdlib/builtin/nil_class.rbs +0 -82
  185. data/vendor/ruby-signature/stdlib/builtin/numeric.rbs +0 -409
  186. data/vendor/ruby-signature/stdlib/builtin/object.rbs +0 -824
  187. data/vendor/ruby-signature/stdlib/builtin/proc.rbs +0 -426
  188. data/vendor/ruby-signature/stdlib/builtin/process.rbs +0 -354
  189. data/vendor/ruby-signature/stdlib/builtin/random.rbs +0 -93
  190. data/vendor/ruby-signature/stdlib/builtin/range.rbs +0 -226
  191. data/vendor/ruby-signature/stdlib/builtin/rational.rbs +0 -424
  192. data/vendor/ruby-signature/stdlib/builtin/rb_config.rbs +0 -10
  193. data/vendor/ruby-signature/stdlib/builtin/regexp.rbs +0 -131
  194. data/vendor/ruby-signature/stdlib/builtin/ruby_vm.rbs +0 -14
  195. data/vendor/ruby-signature/stdlib/builtin/signal.rbs +0 -55
  196. data/vendor/ruby-signature/stdlib/builtin/string.rbs +0 -770
  197. data/vendor/ruby-signature/stdlib/builtin/string_io.rbs +0 -13
  198. data/vendor/ruby-signature/stdlib/builtin/struct.rbs +0 -40
  199. data/vendor/ruby-signature/stdlib/builtin/symbol.rbs +0 -230
  200. data/vendor/ruby-signature/stdlib/builtin/thread.rbs +0 -1112
  201. data/vendor/ruby-signature/stdlib/builtin/thread_group.rbs +0 -23
  202. data/vendor/ruby-signature/stdlib/builtin/time.rbs +0 -739
  203. data/vendor/ruby-signature/stdlib/builtin/trace_point.rbs +0 -91
  204. data/vendor/ruby-signature/stdlib/builtin/true_class.rbs +0 -46
  205. data/vendor/ruby-signature/stdlib/builtin/unbound_method.rbs +0 -159
  206. data/vendor/ruby-signature/stdlib/builtin/warning.rbs +0 -17
  207. data/vendor/ruby-signature/stdlib/erb/erb.rbs +0 -18
  208. data/vendor/ruby-signature/stdlib/find/find.rbs +0 -44
  209. data/vendor/ruby-signature/stdlib/pathname/pathname.rbs +0 -21
  210. data/vendor/ruby-signature/stdlib/prime/integer-extension.rbs +0 -23
  211. data/vendor/ruby-signature/stdlib/prime/prime.rbs +0 -188
  212. data/vendor/ruby-signature/stdlib/securerandom/securerandom.rbs +0 -9
  213. data/vendor/ruby-signature/stdlib/set/set.rbs +0 -77
  214. data/vendor/ruby-signature/stdlib/tmpdir/tmpdir.rbs +0 -53
@@ -1,193 +0,0 @@
1
- # Descendants of class [Exception](Exception) are used
2
- # to communicate between
3
- # [Kernel\#raise](https://ruby-doc.org/core-2.6.3/Kernel.html#method-i-raise)
4
- # and `rescue` statements in `begin ... end` blocks.
5
- # [Exception](Exception) objects carry information
6
- # about the exception – its type (the exception’s class name), an optional
7
- # descriptive string, and optional traceback information.
8
- # [Exception](Exception) subclasses may add additional
9
- # information like
10
- # [NameError\#name](https://ruby-doc.org/core-2.6.3/NameError.html#method-i-name)
11
- # .
12
- #
13
- # Programs may make subclasses of
14
- # [Exception](Exception), typically of
15
- # [StandardError](https://ruby-doc.org/core-2.6.3/StandardError.html) or
16
- # [RuntimeError](https://ruby-doc.org/core-2.6.3/RuntimeError.html), to
17
- # provide custom classes and add additional information. See the subclass
18
- # list below for defaults for `raise` and `rescue` .
19
- #
20
- # When an exception has been raised but not yet handled (in `rescue`,
21
- # `ensure`, `at_exit` and `END` blocks) the global variable `$!` will
22
- # contain the current exception and `$@` contains the current exception’s
23
- # backtrace.
24
- #
25
- # It is recommended that a library should have one subclass of
26
- # [StandardError](https://ruby-doc.org/core-2.6.3/StandardError.html) or
27
- # [RuntimeError](https://ruby-doc.org/core-2.6.3/RuntimeError.html) and
28
- # have specific exception types inherit from it. This allows the user to
29
- # rescue a generic exception type to catch all exceptions the library may
30
- # raise even if future versions of the library add new exception
31
- # subclasses.
32
- #
33
- # For example:
34
- #
35
- # ```ruby
36
- # class MyLibrary
37
- # class Error < RuntimeError
38
- # end
39
- #
40
- # class WidgetError < Error
41
- # end
42
- #
43
- # class FrobError < Error
44
- # end
45
- #
46
- # end
47
- # ```
48
- #
49
- # To handle both WidgetError and FrobError the library user can rescue
50
- # MyLibrary::Error.
51
- #
52
- # The built-in subclasses of [Exception](Exception)
53
- # are:
54
- #
55
- # - [NoMemoryError](https://ruby-doc.org/core-2.6.3/NoMemoryError.html)
56
- #
57
- # - [ScriptError](https://ruby-doc.org/core-2.6.3/ScriptError.html)
58
- #
59
- # - [LoadError](https://ruby-doc.org/core-2.6.3/LoadError.html)
60
- #
61
- # - [NotImplementedError](https://ruby-doc.org/core-2.6.3/NotImplementedError.html)
62
- #
63
- # - [SyntaxError](https://ruby-doc.org/core-2.6.3/SyntaxError.html)
64
- #
65
- # - [SecurityError](https://ruby-doc.org/core-2.6.3/SecurityError.html)
66
- #
67
- # - [SignalException](https://ruby-doc.org/core-2.6.3/SignalException.html)
68
- #
69
- # - [Interrupt](https://ruby-doc.org/core-2.6.3/Interrupt.html)
70
- #
71
- # - [StandardError](https://ruby-doc.org/core-2.6.3/StandardError.html)
72
- # -- default for `rescue`
73
- #
74
- # - [ArgumentError](https://ruby-doc.org/core-2.6.3/ArgumentError.html)
75
- #
76
- # - [UncaughtThrowError](https://ruby-doc.org/core-2.6.3/UncaughtThrowError.html)
77
- #
78
- # - [EncodingError](https://ruby-doc.org/core-2.6.3/EncodingError.html)
79
- #
80
- # - [FiberError](https://ruby-doc.org/core-2.6.3/FiberError.html)
81
- #
82
- # - [IOError](https://ruby-doc.org/core-2.6.3/IOError.html)
83
- #
84
- # - [EOFError](https://ruby-doc.org/core-2.6.3/EOFError.html)
85
- #
86
- # - [IndexError](https://ruby-doc.org/core-2.6.3/IndexError.html)
87
- #
88
- # - [KeyError](https://ruby-doc.org/core-2.6.3/KeyError.html)
89
- #
90
- # - [StopIteration](https://ruby-doc.org/core-2.6.3/StopIteration.html)
91
- #
92
- # - [LocalJumpError](https://ruby-doc.org/core-2.6.3/LocalJumpError.html)
93
- #
94
- # - [NameError](https://ruby-doc.org/core-2.6.3/NameError.html)
95
- #
96
- # - [NoMethodError](https://ruby-doc.org/core-2.6.3/NoMethodError.html)
97
- #
98
- # - [RangeError](https://ruby-doc.org/core-2.6.3/RangeError.html)
99
- #
100
- # - [FloatDomainError](https://ruby-doc.org/core-2.6.3/FloatDomainError.html)
101
- #
102
- # - [RegexpError](https://ruby-doc.org/core-2.6.3/RegexpError.html)
103
- #
104
- # - [RuntimeError](https://ruby-doc.org/core-2.6.3/RuntimeError.html)
105
- # -- default for `raise`
106
- #
107
- # - [FrozenError](https://ruby-doc.org/core-2.6.3/FrozenError.html)
108
- #
109
- # - [SystemCallError](https://ruby-doc.org/core-2.6.3/SystemCallError.html)
110
- #
111
- # - Errno::\*
112
- #
113
- # - [ThreadError](https://ruby-doc.org/core-2.6.3/ThreadError.html)
114
- #
115
- # - [TypeError](https://ruby-doc.org/core-2.6.3/TypeError.html)
116
- #
117
- # - [ZeroDivisionError](https://ruby-doc.org/core-2.6.3/ZeroDivisionError.html)
118
- #
119
- # - [SystemExit](https://ruby-doc.org/core-2.6.3/SystemExit.html)
120
- #
121
- # - [SystemStackError](https://ruby-doc.org/core-2.6.3/SystemStackError.html)
122
- #
123
- # - fatal – impossible to rescue
124
- class Exception < Object
125
- def self.to_tty?: () -> bool
126
-
127
- def self.exception: (?String msg) -> self
128
-
129
- def ==: (untyped arg0) -> bool
130
-
131
- # Returns any backtrace associated with the exception. The backtrace is an
132
- # array of strings, each containing either “filename:lineNo: in \`method”‘
133
- # or “filename:lineNo.”
134
- #
135
- # ```ruby
136
- # def a
137
- # raise "boom"
138
- # end
139
- #
140
- # def b
141
- # a()
142
- # end
143
- #
144
- # begin
145
- # b()
146
- # rescue => detail
147
- # print detail.backtrace.join("\n")
148
- # end
149
- # ```
150
- #
151
- # *produces:*
152
- #
153
- # prog.rb:2:in `a'
154
- # prog.rb:6:in `b'
155
- # prog.rb:10
156
- def backtrace: () -> ::Array[String]?
157
-
158
- # Returns any backtrace associated with the exception. This method is
159
- # similar to
160
- # [\#backtrace](Exception.downloaded.ruby_doc#method-i-backtrace), but
161
- # the backtrace is an array of
162
- # [Thread::Backtrace::Location](https://ruby-doc.org/core-2.6.3/Thread/Backtrace/Location.html)
163
- # .
164
- #
165
- # Now, this method is not affected by
166
- # [\#set\_backtrace](Exception.downloaded.ruby_doc#method-i-set_backtrace)
167
- # .
168
- def backtrace_locations: () -> ::Array[Thread::Backtrace::Location]?
169
-
170
- # Returns the previous exception ($\!) at the time this exception was
171
- # raised. This is useful for wrapping exceptions and retaining the
172
- # original exception information.
173
- def cause: () -> Exception?
174
-
175
- def exception: (?String arg0) -> Exception
176
-
177
- def initialize: (?String arg0) -> void
178
-
179
- # Return this exception’s class name and message.
180
- def inspect: () -> String
181
-
182
- # Returns the result of invoking `exception.to_s` . Normally this returns
183
- # the exception’s message or name.
184
- def message: () -> String
185
-
186
- def set_backtrace: (String | ::Array[String] arg0) -> ::Array[String]
187
-
188
- # Returns exception’s message (or the name of the exception if no message
189
- # is set).
190
- def to_s: () -> String
191
-
192
- def full_message: (?highlight: bool, ?order: :top | :bottom) -> String
193
- end
@@ -1,40 +0,0 @@
1
- # The global value `false` is the only instance of class FalseClass and
2
- # represents a logically false value in boolean expressions. The class provides
3
- # operators allowing `false` to participate correctly in logical expressions.
4
- #
5
- class FalseClass
6
- public
7
-
8
- def !: () -> bool
9
-
10
- # And---Returns `false`. *obj* is always evaluated as it is the argument to a
11
- # method call---there is no short-circuit evaluation in this case.
12
- #
13
- def &: (untyped obj) -> bool
14
-
15
- # Case Equality -- For class Object, effectively the same as calling `#==`, but
16
- # typically overridden by descendants to provide meaningful semantics in `case`
17
- # statements.
18
- #
19
- def ===: (false) -> true
20
- | (untyped obj) -> bool
21
-
22
- # Exclusive Or---If *obj* is `nil` or `false`, returns `false`; otherwise,
23
- # returns `true`.
24
- #
25
- def ^: (nil) -> false
26
- | (false) -> false
27
- | (untyped obj) -> bool
28
-
29
- alias inspect to_s
30
-
31
- # The string representation of `false` is "false".
32
- #
33
- def to_s: () -> "false"
34
-
35
- # Or---Returns `false` if *obj* is `nil` or `false`; `true` otherwise.
36
- #
37
- def |: (nil) -> false
38
- | (false) -> false
39
- | (untyped obj) -> bool
40
- end
@@ -1,68 +0,0 @@
1
- # Fibers are primitives for implementing light weight cooperative
2
- # concurrency in Ruby. Basically they are a means of creating code blocks
3
- # that can be paused and resumed, much like threads. The main difference
4
- # is that they are never preempted and that the scheduling must be done by
5
- # the programmer and not the VM.
6
- #
7
- # As opposed to other stackless light weight concurrency models, each
8
- # fiber comes with a stack. This enables the fiber to be paused from
9
- # deeply nested function calls within the fiber block. See the ruby(1)
10
- # manpage to configure the size of the fiber stack(s).
11
- #
12
- # When a fiber is created it will not run automatically. Rather it must be
13
- # explicitly asked to run using the `Fiber#resume` method. The code
14
- # running inside the fiber can give up control by calling `Fiber.yield` in
15
- # which case it yields control back to caller (the caller of the
16
- # `Fiber#resume` ).
17
- #
18
- # Upon yielding or termination the [Fiber](Fiber)
19
- # returns the value of the last executed expression
20
- #
21
- # For instance:
22
- #
23
- # ```ruby
24
- # fiber = Fiber.new do
25
- # Fiber.yield 1
26
- # 2
27
- # end
28
- #
29
- # puts fiber.resume
30
- # puts fiber.resume
31
- # puts fiber.resume
32
- # ```
33
- #
34
- # *produces*
35
- #
36
- # 1
37
- # 2
38
- # FiberError: dead fiber called
39
- #
40
- # The `Fiber#resume` method accepts an arbitrary number of parameters, if
41
- # it is the first call to `resume` then they will be passed as block
42
- # arguments. Otherwise they will be the return value of the call to
43
- # `Fiber.yield`
44
- #
45
- # Example:
46
- #
47
- # ```ruby
48
- # fiber = Fiber.new do |first|
49
- # second = Fiber.yield first + 2
50
- # end
51
- #
52
- # puts fiber.resume 10
53
- # puts fiber.resume 14
54
- # puts fiber.resume 18
55
- # ```
56
- #
57
- # *produces*
58
- #
59
- # 12
60
- # 14
61
- # FiberError: dead fiber called
62
- class Fiber < Object
63
- def self.yield: (*untyped args) -> untyped
64
-
65
- def initialize: () { () -> void } -> Fiber
66
-
67
- def resume: (*untyped args) -> untyped
68
- end
@@ -1,12 +0,0 @@
1
- # Raised when an invalid operation is attempted on a
2
- # [Fiber](https://ruby-doc.org/core-2.6.3/Fiber.html), in particular when
3
- # attempting to call/resume a dead fiber, attempting to yield from the
4
- # root fiber, or calling a fiber across threads.
5
- #
6
- # ```ruby
7
- # fiber = Fiber.new{}
8
- # fiber.resume #=> nil
9
- # fiber.resume #=> FiberError: dead fiber called
10
- # ```
11
- class FiberError < StandardError
12
- end
@@ -1,476 +0,0 @@
1
- # A `File` is an abstraction of any file object accessible by the program
2
- # and is closely associated with class `IO` . `File` includes the methods
3
- # of module `FileTest` as class methods, allowing you to write (for
4
- # example) `File.exist?("foo")` .
5
- #
6
- # In the description of [File](File) methods,
7
- # *permission bits* are a platform-specific set of bits that indicate
8
- # permissions of a file. On Unix-based systems, permissions are viewed as
9
- # a set of three octets, for the owner, the group, and the rest of the
10
- # world. For each of these entities, permissions may be set to read,
11
- # write, or execute the file:
12
- #
13
- # The permission bits `0644` (in octal) would thus be interpreted as
14
- # read/write for owner, and read-only for group and other. Higher-order
15
- # bits may also be used to indicate the type of file (plain, directory,
16
- # pipe, socket, and so on) and various other special features. If the
17
- # permissions are for a directory, the meaning of the execute bit changes;
18
- # when set the directory can be searched.
19
- #
20
- # On non-Posix operating systems, there may be only the ability to make a
21
- # file read-only or read-write. In this case, the remaining permission
22
- # bits will be synthesized to resemble typical values. For instance, on
23
- # Windows NT the default permission bits are `0644`, which means
24
- # read/write for owner, read-only for all others. The only change that can
25
- # be made is to make the file read-only, which is reported as `0444` .
26
- #
27
- # Various constants for the methods in [File](File)
28
- # can be found in
29
- # [File::Constants](https://ruby-doc.org/core-2.6.3/File/Constants.html).
30
- class File < IO
31
- def self.absolute_path: (String file, ?String dir) -> String
32
-
33
- def self.atime: (untyped file) -> Time
34
-
35
- def self.basename: (String file, ?String suffix) -> String
36
-
37
- def self.binread: (String arg0) -> String
38
- | (String arg0, ?Integer arg1) -> String
39
- | (String arg0, ?Integer arg1, ?Integer arg2) -> String
40
-
41
- def self.birthtime: (untyped file) -> Time
42
-
43
- def self.blockdev?: (String | IO file) -> bool
44
-
45
- def self.chardev?: (String | IO file) -> bool
46
-
47
- def self.chmod: (Integer mode, *String files) -> Integer
48
-
49
- def self.chown: (Integer owner, Integer group, *String files) -> Integer
50
-
51
- def self.ctime: (untyped file) -> Time
52
-
53
- def self.delete: (*String files) -> Integer
54
-
55
- def self.directory?: (String | IO file) -> bool
56
-
57
- def self.dirname: (String file) -> String
58
-
59
- def self.executable?: (String file) -> bool
60
-
61
- def self.executable_real?: (String file) -> bool
62
-
63
- def self.exist?: (untyped file) -> bool
64
-
65
- def self.expand_path: (untyped file, ?untyped dir) -> String
66
-
67
- def self.extname: (String path) -> String
68
-
69
- def self.file?: (String | IO file) -> bool
70
-
71
- def self.fnmatch: (String pattern, String path, ?Integer flags) -> bool
72
-
73
- def self.`ftype`: (String file) -> String
74
-
75
- def self.grpowned?: (String | IO file) -> bool
76
-
77
- def self.identical?: (String | IO file_1, String | IO file_2) -> bool
78
-
79
- def self.join: (*untyped arg0) -> String
80
-
81
- def self.lchmod: (Integer mode, *String files) -> Integer
82
-
83
- def self.lchown: (Integer owner, Integer group, *String files) -> Integer
84
-
85
- def self.link: (String old, String new) -> Integer
86
-
87
- def self.lstat: (String file) -> File::Stat
88
-
89
- def self.mtime: (untyped file) -> Time
90
-
91
- def self.owned?: (String file) -> bool
92
-
93
- def self.path: (String path) -> String
94
-
95
- def self.pipe?: (String file) -> bool
96
-
97
- def self.readable?: (String file) -> bool
98
-
99
- def self.readable_real?: (String file) -> bool
100
-
101
- def self.readlink: (String link) -> String
102
-
103
- def self.realdirpath: (String pathname, ?String dir) -> String
104
-
105
- def self.realpath: (String pathname, ?String dir) -> String
106
-
107
- def self.rename: (String old, String new) -> Integer
108
-
109
- def self.setgid?: (String file) -> bool
110
-
111
- def self.setuid?: (String file) -> bool
112
-
113
- def self.size: (String | IO file) -> Integer
114
-
115
- def self.size?: (String | IO file) -> Integer?
116
-
117
- def self.socket?: (String | IO file) -> bool
118
-
119
- def self.split: (String file) -> [ String, String ]
120
-
121
- def self.stat: (untyped file) -> File::Stat
122
-
123
- def self.sticky?: (String file) -> bool
124
-
125
- def self.symlink: (String old, String new) -> Integer
126
-
127
- def self.symlink?: (String file) -> bool
128
-
129
- def self.truncate: (String file, Integer arg0) -> Integer
130
-
131
- def self.umask: (?Integer arg0) -> Integer
132
-
133
- def self.utime: (Time atime, Time mtime, *String files) -> Integer
134
-
135
- def self.world_readable?: (String | IO file) -> Integer?
136
-
137
- def self.world_writable?: (String | IO file) -> Integer?
138
-
139
- def self.writable?: (String file) -> Integer?
140
-
141
- def self.writable_real?: (String file) -> Integer?
142
-
143
- def self.zero?: (String | IO file) -> Integer?
144
-
145
- # Returns the last access time (a `Time` object) for *file* , or epoch if
146
- # *file* has not been accessed.
147
- #
148
- # ```ruby
149
- # File.new("testfile").atime #=> Wed Dec 31 18:00:00 CST 1969
150
- # ```
151
- def atime: () -> Time
152
-
153
- # Returns the birth time for *file* .
154
- #
155
- # ```ruby
156
- # File.new("testfile").birthtime #=> Wed Apr 09 08:53:14 CDT 2003
157
- # ```
158
- #
159
- # If the platform doesn’t have birthtime, raises
160
- # [NotImplementedError](https://ruby-doc.org/core-2.6.3/NotImplementedError.html)
161
- # .
162
- def birthtime: () -> Time
163
-
164
- def chmod: (Integer mode) -> Integer
165
-
166
- def chown: (Integer owner, Integer group) -> Integer
167
-
168
- # Returns the change time for *file* (that is, the time directory
169
- # information about the file was changed, not the file itself).
170
- #
171
- # Note that on Windows (NTFS), returns creation time (birth time).
172
- #
173
- # ```ruby
174
- # File.new("testfile").ctime #=> Wed Apr 09 08:53:14 CDT 2003
175
- # ```
176
- def ctime: () -> Time
177
-
178
- def flock: (Integer arg0) -> (Integer | TrueClass | FalseClass)
179
-
180
- def initialize: (String file, ?String mode, ?String perm, ?Integer opt) -> void
181
-
182
- # Same as `IO#stat`, but does not follow the last symbolic link. Instead,
183
- # reports on the link itself.
184
- #
185
- # ```ruby
186
- # File.symlink("testfile", "link2test") #=> 0
187
- # File.stat("testfile").size #=> 66
188
- # f = File.new("link2test")
189
- # f.lstat.size #=> 8
190
- # f.stat.size #=> 66
191
- # ```
192
- def lstat: () -> File::Stat
193
-
194
- # Returns the modification time for *file* .
195
- #
196
- # ```ruby
197
- # File.new("testfile").mtime #=> Wed Apr 09 08:53:14 CDT 2003
198
- # ```
199
- def mtime: () -> Time
200
-
201
- # Returns the pathname used to create *file* as a string. Does not
202
- # normalize the name.
203
- #
204
- # The pathname may not point to the file corresponding to *file* . For
205
- # instance, the pathname becomes void when the file has been moved or
206
- # deleted.
207
- #
208
- # This method raises `IOError` for a *file* created using
209
- # `File::Constants::TMPFILE` because they don’t have a pathname.
210
- #
211
- # ```ruby
212
- # File.new("testfile").path #=> "testfile"
213
- # File.new("/tmp/../tmp/xxx", "w").path #=> "/tmp/../tmp/xxx"
214
- # ```
215
- def path: () -> String
216
-
217
- # Returns the size of *file* in bytes.
218
- #
219
- # ```ruby
220
- # File.new("testfile").size #=> 66
221
- # ```
222
- def size: () -> Integer
223
-
224
- def truncate: (Integer arg0) -> Integer
225
-
226
- def self.fnmatch?: (String pattern, String path, ?Integer flags) -> bool
227
-
228
- def self.unlink: (*String files) -> Integer
229
-
230
- # Returns the pathname used to create *file* as a string. Does not
231
- # normalize the name.
232
- #
233
- # The pathname may not point to the file corresponding to *file* . For
234
- # instance, the pathname becomes void when the file has been moved or
235
- # deleted.
236
- #
237
- # This method raises `IOError` for a *file* created using
238
- # `File::Constants::TMPFILE` because they don’t have a pathname.
239
- #
240
- # ```ruby
241
- # File.new("testfile").path #=> "testfile"
242
- # File.new("/tmp/../tmp/xxx", "w").path #=> "/tmp/../tmp/xxx"
243
- # ```
244
- def to_path: () -> String
245
- end
246
-
247
- File::ALT_SEPARATOR: NilClass
248
-
249
- File::APPEND: Integer
250
-
251
- File::BINARY: Integer
252
-
253
- File::CREAT: Integer
254
-
255
- File::DIRECT: Integer
256
-
257
- File::DSYNC: Integer
258
-
259
- File::EXCL: Integer
260
-
261
- File::FNM_CASEFOLD: Integer
262
-
263
- File::FNM_DOTMATCH: Integer
264
-
265
- File::FNM_EXTGLOB: Integer
266
-
267
- File::FNM_NOESCAPE: Integer
268
-
269
- File::FNM_PATHNAME: Integer
270
-
271
- File::FNM_SHORTNAME: Integer
272
-
273
- File::FNM_SYSCASE: Integer
274
-
275
- File::LOCK_EX: Integer
276
-
277
- File::LOCK_NB: Integer
278
-
279
- File::LOCK_SH: Integer
280
-
281
- File::LOCK_UN: Integer
282
-
283
- File::NOATIME: Integer
284
-
285
- File::NOCTTY: Integer
286
-
287
- File::NOFOLLOW: Integer
288
-
289
- File::NONBLOCK: Integer
290
-
291
- File::NULL: String
292
-
293
- File::PATH_SEPARATOR: String
294
-
295
- File::RDONLY: Integer
296
-
297
- File::RDWR: Integer
298
-
299
- File::RSYNC: Integer
300
-
301
- File::SEEK_CUR: Integer
302
-
303
- File::SEEK_DATA: Integer
304
-
305
- File::SEEK_END: Integer
306
-
307
- File::SEEK_HOLE: Integer
308
-
309
- File::SEEK_SET: Integer
310
-
311
- File::SEPARATOR: String
312
-
313
- File::SHARE_DELETE: Integer
314
-
315
- File::SYNC: Integer
316
-
317
- File::TMPFILE: Integer
318
-
319
- File::TRUNC: Integer
320
-
321
- File::WRONLY: Integer
322
-
323
- module File::Constants
324
- end
325
-
326
- File::Constants::APPEND: Integer
327
-
328
- File::Constants::BINARY: Integer
329
-
330
- File::Constants::CREAT: Integer
331
-
332
- File::Constants::DIRECT: Integer
333
-
334
- File::Constants::DSYNC: Integer
335
-
336
- File::Constants::EXCL: Integer
337
-
338
- File::Constants::FNM_CASEFOLD: Integer
339
-
340
- File::Constants::FNM_DOTMATCH: Integer
341
-
342
- File::Constants::FNM_EXTGLOB: Integer
343
-
344
- File::Constants::FNM_NOESCAPE: Integer
345
-
346
- File::Constants::FNM_PATHNAME: Integer
347
-
348
- File::Constants::FNM_SHORTNAME: Integer
349
-
350
- File::Constants::FNM_SYSCASE: Integer
351
-
352
- File::Constants::LOCK_EX: Integer
353
-
354
- File::Constants::LOCK_NB: Integer
355
-
356
- File::Constants::LOCK_SH: Integer
357
-
358
- File::Constants::LOCK_UN: Integer
359
-
360
- File::Constants::NOATIME: Integer
361
-
362
- File::Constants::NOCTTY: Integer
363
-
364
- File::Constants::NOFOLLOW: Integer
365
-
366
- File::Constants::NONBLOCK: Integer
367
-
368
- File::Constants::NULL: String
369
-
370
- File::Constants::RDONLY: Integer
371
-
372
- File::Constants::RDWR: Integer
373
-
374
- File::Constants::RSYNC: Integer
375
-
376
- File::Constants::SHARE_DELETE: Integer
377
-
378
- File::Constants::SYNC: Integer
379
-
380
- File::Constants::TMPFILE: Integer
381
-
382
- File::Constants::TRUNC: Integer
383
-
384
- File::Constants::WRONLY: Integer
385
-
386
- class File::Stat < Object
387
- include Comparable
388
-
389
- def <=>: (File::Stat other) -> Integer?
390
-
391
- def atime: () -> Time
392
-
393
- def birthtime: () -> Time
394
-
395
- def blksize: () -> Integer?
396
-
397
- def blockdev?: () -> bool
398
-
399
- def blocks: () -> Integer?
400
-
401
- def chardev?: () -> bool
402
-
403
- def ctime: () -> Time
404
-
405
- def dev: () -> Integer
406
-
407
- def dev_major: () -> Integer
408
-
409
- def dev_minor: () -> Integer
410
-
411
- def directory?: () -> bool
412
-
413
- def executable?: () -> bool
414
-
415
- def executable_real?: () -> bool
416
-
417
- def file?: () -> bool
418
-
419
- def `ftype`: () -> String
420
-
421
- def gid: () -> Integer
422
-
423
- def grpowned?: () -> bool
424
-
425
- def initialize: (String file) -> Object
426
-
427
- def ino: () -> Integer
428
-
429
- def inspect: () -> String
430
-
431
- def mode: () -> Integer
432
-
433
- def mtime: () -> Time
434
-
435
- def nlink: () -> Integer
436
-
437
- def owned?: () -> bool
438
-
439
- def pipe?: () -> bool
440
-
441
- def rdev: () -> Integer?
442
-
443
- def rdev_major: () -> Integer
444
-
445
- def rdev_minor: () -> Integer
446
-
447
- def read: (?Integer length, ?String outbuf) -> String
448
-
449
- def readable?: () -> bool
450
-
451
- def readable_real?: () -> bool
452
-
453
- def setgid?: () -> bool
454
-
455
- def setuid?: () -> bool
456
-
457
- def size: () -> Integer
458
-
459
- def socket?: () -> bool
460
-
461
- def sticky?: () -> bool
462
-
463
- def symlink?: () -> bool
464
-
465
- def uid: () -> Integer
466
-
467
- def world_readable?: () -> Integer?
468
-
469
- def world_writable?: () -> Integer?
470
-
471
- def writable?: () -> bool
472
-
473
- def writable_real?: () -> bool
474
-
475
- def zero?: () -> bool
476
- end