steep 0.11.1 → 0.12.0

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 (299) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +27 -0
  3. data/.gitmodules +3 -0
  4. data/CHANGELOG.md +5 -0
  5. data/README.md +48 -90
  6. data/Rakefile +10 -6
  7. data/Steepfile +1 -0
  8. data/bin/setup +1 -0
  9. data/bin/smoke_runner.rb +9 -14
  10. data/exe/rbs +3 -0
  11. data/exe/ruby-signature +3 -0
  12. data/exe/steep +1 -0
  13. data/lib/steep.rb +32 -26
  14. data/lib/steep/annotation_parser.rb +167 -0
  15. data/lib/steep/ast/annotation/collection.rb +7 -7
  16. data/lib/steep/ast/types.rb +60 -0
  17. data/lib/steep/ast/types/any.rb +1 -1
  18. data/lib/steep/ast/types/factory.rb +535 -0
  19. data/lib/steep/ast/types/name.rb +3 -3
  20. data/lib/steep/ast/types/var.rb +1 -1
  21. data/lib/steep/cli.rb +56 -240
  22. data/lib/steep/drivers/annotations.rb +36 -19
  23. data/lib/steep/drivers/check.rb +55 -91
  24. data/lib/steep/drivers/init.rb +54 -0
  25. data/lib/steep/drivers/langserver.rb +241 -150
  26. data/lib/steep/drivers/print_project.rb +56 -0
  27. data/lib/steep/drivers/signature_error_printer.rb +25 -0
  28. data/lib/steep/drivers/trace_printer.rb +25 -0
  29. data/lib/steep/drivers/utils/driver_helper.rb +26 -0
  30. data/lib/steep/drivers/validate.rb +18 -38
  31. data/lib/steep/drivers/vendor.rb +46 -0
  32. data/lib/steep/drivers/watch.rb +78 -140
  33. data/lib/steep/errors.rb +22 -13
  34. data/lib/steep/interface/interface.rb +91 -0
  35. data/lib/steep/interface/method.rb +0 -4
  36. data/lib/steep/interface/method_type.rb +362 -2
  37. data/lib/steep/interface/substitution.rb +22 -0
  38. data/lib/steep/project.rb +25 -233
  39. data/lib/steep/project/dsl.rb +132 -0
  40. data/lib/steep/project/file.rb +93 -76
  41. data/lib/steep/project/file_loader.rb +63 -0
  42. data/lib/steep/project/options.rb +7 -0
  43. data/lib/steep/project/target.rb +190 -0
  44. data/lib/steep/signature/errors.rb +25 -77
  45. data/lib/steep/signature/validator.rb +122 -0
  46. data/lib/steep/source.rb +12 -7
  47. data/lib/steep/subtyping/check.rb +357 -633
  48. data/lib/steep/subtyping/constraints.rb +2 -2
  49. data/lib/steep/subtyping/trace.rb +23 -0
  50. data/lib/steep/type_construction.rb +509 -455
  51. data/lib/steep/type_inference/constant_env.rb +16 -24
  52. data/lib/steep/type_inference/type_env.rb +26 -18
  53. data/lib/steep/version.rb +1 -1
  54. data/sample/Steepfile +6 -0
  55. data/sample/lib/conference.rb +12 -0
  56. data/sample/sig/conference.rbs +6 -0
  57. data/smoke/alias/Steepfile +4 -0
  58. data/smoke/alias/a.rb +2 -2
  59. data/smoke/alias/{a.rbi → a.rbs} +1 -1
  60. data/smoke/and/Steepfile +4 -0
  61. data/smoke/array/Steepfile +4 -0
  62. data/smoke/array/a.rb +2 -2
  63. data/smoke/array/b.rb +4 -4
  64. data/smoke/array/c.rb +2 -2
  65. data/smoke/block/Steepfile +5 -0
  66. data/smoke/block/{a.rbi → a.rbs} +1 -1
  67. data/smoke/block/{c.rbi → c.rbs} +0 -0
  68. data/smoke/block/d.rb +6 -6
  69. data/smoke/case/Steepfile +4 -0
  70. data/smoke/case/a.rb +4 -3
  71. data/smoke/class/Steepfile +4 -0
  72. data/smoke/class/a.rb +1 -4
  73. data/smoke/class/a.rbs +24 -0
  74. data/smoke/class/h.rb +6 -2
  75. data/smoke/class/{h.rbi → h.rbs} +1 -2
  76. data/smoke/class/i.rb +1 -2
  77. data/smoke/class/i.rbs +9 -0
  78. data/smoke/const/Steepfile +4 -0
  79. data/smoke/dstr/Steepfile +4 -0
  80. data/smoke/ensure/Steepfile +4 -0
  81. data/smoke/ensure/a.rb +1 -1
  82. data/smoke/enumerator/Steepfile +4 -0
  83. data/smoke/enumerator/a.rb +7 -7
  84. data/smoke/enumerator/b.rb +6 -6
  85. data/smoke/extension/Steepfile +4 -0
  86. data/smoke/extension/{a.rbi → a.rbs} +2 -2
  87. data/smoke/extension/{e.rbi → e.rbs} +2 -2
  88. data/smoke/hash/Steepfile +4 -0
  89. data/smoke/hash/{a.rbi → a.rbs} +0 -0
  90. data/smoke/hash/b.rb +2 -2
  91. data/smoke/hash/c.rb +1 -1
  92. data/smoke/hash/e.rbs +3 -0
  93. data/smoke/hash/f.rb +1 -1
  94. data/smoke/hello/Steepfile +4 -0
  95. data/smoke/hello/hello.rbs +7 -0
  96. data/smoke/if/Steepfile +4 -0
  97. data/smoke/implements/Steepfile +4 -0
  98. data/smoke/implements/a.rbs +6 -0
  99. data/smoke/initialize/Steepfile +4 -0
  100. data/smoke/initialize/a.rbs +3 -0
  101. data/smoke/integer/Steepfile +4 -0
  102. data/smoke/integer/a.rb +5 -3
  103. data/smoke/interface/Steepfile +4 -0
  104. data/smoke/interface/{a.rbi → a.rbs} +0 -0
  105. data/smoke/kwbegin/Steepfile +4 -0
  106. data/smoke/lambda/Steepfile +4 -0
  107. data/smoke/lambda/a.rb +9 -2
  108. data/smoke/literal/Steepfile +4 -0
  109. data/smoke/literal/{literal_methods.rbi → literal_methods.rbs} +0 -0
  110. data/smoke/map/Steepfile +4 -0
  111. data/smoke/map/a.rb +1 -1
  112. data/smoke/method/Steepfile +4 -0
  113. data/smoke/method/{a.rbi → a.rbs} +0 -0
  114. data/smoke/method/b.rb +1 -4
  115. data/smoke/method/d.rb +1 -0
  116. data/smoke/method/d.rbs +3 -0
  117. data/smoke/module/Steepfile +4 -0
  118. data/smoke/module/a.rb +1 -1
  119. data/smoke/module/a.rbs +16 -0
  120. data/smoke/module/c.rb +1 -1
  121. data/smoke/regexp/Steepfile +4 -0
  122. data/smoke/regexp/a.rb +2 -2
  123. data/smoke/regexp/b.rb +16 -16
  124. data/smoke/regression/Steepfile +5 -0
  125. data/smoke/regression/array.rb +2 -2
  126. data/smoke/regression/hash.rb +2 -2
  127. data/smoke/regression/poly_new.rb +2 -0
  128. data/smoke/regression/poly_new.rbs +4 -0
  129. data/smoke/regression/set_divide.rb +2 -2
  130. data/smoke/rescue/Steepfile +4 -0
  131. data/smoke/rescue/a.rb +1 -1
  132. data/smoke/self/Steepfile +4 -0
  133. data/smoke/self/a.rbs +4 -0
  134. data/smoke/skip/Steepfile +4 -0
  135. data/smoke/stdout/Steepfile +4 -0
  136. data/smoke/stdout/{a.rbi → a.rbs} +1 -1
  137. data/smoke/super/Steepfile +4 -0
  138. data/smoke/super/a.rbs +10 -0
  139. data/smoke/type_case/Steepfile +4 -0
  140. data/smoke/type_case/a.rb +1 -1
  141. data/smoke/yield/Steepfile +4 -0
  142. data/smoke/yield/a.rb +2 -2
  143. data/steep.gemspec +14 -7
  144. data/vendor/ruby-signature/.github/workflows/ruby.yml +27 -0
  145. data/vendor/ruby-signature/.gitignore +12 -0
  146. data/vendor/ruby-signature/.rubocop.yml +15 -0
  147. data/vendor/ruby-signature/BSDL +22 -0
  148. data/vendor/ruby-signature/COPYING +56 -0
  149. data/vendor/ruby-signature/Gemfile +6 -0
  150. data/vendor/ruby-signature/README.md +93 -0
  151. data/vendor/ruby-signature/Rakefile +66 -0
  152. data/vendor/ruby-signature/bin/annotate-with-rdoc +156 -0
  153. data/vendor/ruby-signature/bin/console +14 -0
  154. data/vendor/ruby-signature/bin/query-rdoc +103 -0
  155. data/vendor/ruby-signature/bin/setup +10 -0
  156. data/vendor/ruby-signature/bin/sort +88 -0
  157. data/vendor/ruby-signature/bin/test_runner.rb +17 -0
  158. data/vendor/ruby-signature/docs/CONTRIBUTING.md +97 -0
  159. data/vendor/ruby-signature/docs/sigs.md +148 -0
  160. data/vendor/ruby-signature/docs/stdlib.md +152 -0
  161. data/vendor/ruby-signature/docs/syntax.md +528 -0
  162. data/vendor/ruby-signature/exe/rbs +3 -0
  163. data/vendor/ruby-signature/exe/ruby-signature +7 -0
  164. data/vendor/ruby-signature/lib/ruby/signature.rb +64 -0
  165. data/vendor/ruby-signature/lib/ruby/signature/ast/annotation.rb +29 -0
  166. data/vendor/ruby-signature/lib/ruby/signature/ast/comment.rb +29 -0
  167. data/vendor/ruby-signature/lib/ruby/signature/ast/declarations.rb +391 -0
  168. data/vendor/ruby-signature/lib/ruby/signature/ast/members.rb +364 -0
  169. data/vendor/ruby-signature/lib/ruby/signature/buffer.rb +52 -0
  170. data/vendor/ruby-signature/lib/ruby/signature/builtin_names.rb +54 -0
  171. data/vendor/ruby-signature/lib/ruby/signature/cli.rb +534 -0
  172. data/vendor/ruby-signature/lib/ruby/signature/constant.rb +28 -0
  173. data/vendor/ruby-signature/lib/ruby/signature/constant_table.rb +152 -0
  174. data/vendor/ruby-signature/lib/ruby/signature/definition.rb +172 -0
  175. data/vendor/ruby-signature/lib/ruby/signature/definition_builder.rb +921 -0
  176. data/vendor/ruby-signature/lib/ruby/signature/environment.rb +283 -0
  177. data/vendor/ruby-signature/lib/ruby/signature/environment_loader.rb +138 -0
  178. data/vendor/ruby-signature/lib/ruby/signature/environment_walker.rb +126 -0
  179. data/vendor/ruby-signature/lib/ruby/signature/errors.rb +189 -0
  180. data/vendor/ruby-signature/lib/ruby/signature/location.rb +104 -0
  181. data/vendor/ruby-signature/lib/ruby/signature/method_type.rb +125 -0
  182. data/vendor/ruby-signature/lib/ruby/signature/namespace.rb +93 -0
  183. data/vendor/ruby-signature/lib/ruby/signature/parser.y +1343 -0
  184. data/vendor/ruby-signature/lib/ruby/signature/prototype/rb.rb +441 -0
  185. data/vendor/ruby-signature/lib/ruby/signature/prototype/rbi.rb +579 -0
  186. data/vendor/ruby-signature/lib/ruby/signature/prototype/runtime.rb +383 -0
  187. data/vendor/ruby-signature/lib/ruby/signature/substitution.rb +48 -0
  188. data/vendor/ruby-signature/lib/ruby/signature/test.rb +28 -0
  189. data/vendor/ruby-signature/lib/ruby/signature/test/errors.rb +63 -0
  190. data/vendor/ruby-signature/lib/ruby/signature/test/hook.rb +290 -0
  191. data/vendor/ruby-signature/lib/ruby/signature/test/setup.rb +58 -0
  192. data/vendor/ruby-signature/lib/ruby/signature/test/spy.rb +324 -0
  193. data/vendor/ruby-signature/lib/ruby/signature/test/test_helper.rb +185 -0
  194. data/vendor/ruby-signature/lib/ruby/signature/test/type_check.rb +256 -0
  195. data/vendor/ruby-signature/lib/ruby/signature/type_name.rb +72 -0
  196. data/vendor/ruby-signature/lib/ruby/signature/types.rb +932 -0
  197. data/vendor/ruby-signature/lib/ruby/signature/variance_calculator.rb +140 -0
  198. data/vendor/ruby-signature/lib/ruby/signature/vendorer.rb +49 -0
  199. data/vendor/ruby-signature/lib/ruby/signature/version.rb +5 -0
  200. data/vendor/ruby-signature/lib/ruby/signature/writer.rb +271 -0
  201. data/vendor/ruby-signature/ruby-signature.gemspec +45 -0
  202. data/vendor/ruby-signature/stdlib/abbrev/abbrev.rbs +3 -0
  203. data/vendor/ruby-signature/stdlib/base64/base64.rbs +15 -0
  204. data/vendor/ruby-signature/stdlib/builtin/array.rbs +1997 -0
  205. data/vendor/ruby-signature/stdlib/builtin/basic_object.rbs +280 -0
  206. data/vendor/ruby-signature/stdlib/builtin/binding.rbs +177 -0
  207. data/vendor/ruby-signature/stdlib/builtin/builtin.rbs +35 -0
  208. data/vendor/ruby-signature/stdlib/builtin/class.rbs +145 -0
  209. data/vendor/ruby-signature/stdlib/builtin/comparable.rbs +116 -0
  210. data/vendor/ruby-signature/stdlib/builtin/complex.rbs +400 -0
  211. data/vendor/ruby-signature/stdlib/builtin/constants.rbs +37 -0
  212. data/vendor/ruby-signature/stdlib/builtin/data.rbs +5 -0
  213. data/vendor/ruby-signature/stdlib/builtin/deprecated.rbs +2 -0
  214. data/vendor/ruby-signature/stdlib/builtin/dir.rbs +419 -0
  215. data/vendor/ruby-signature/stdlib/builtin/encoding.rbs +606 -0
  216. data/vendor/ruby-signature/stdlib/builtin/enumerable.rbs +404 -0
  217. data/vendor/ruby-signature/stdlib/builtin/enumerator.rbs +260 -0
  218. data/vendor/ruby-signature/stdlib/builtin/errno.rbs +781 -0
  219. data/vendor/ruby-signature/stdlib/builtin/errors.rbs +582 -0
  220. data/vendor/ruby-signature/stdlib/builtin/exception.rbs +193 -0
  221. data/vendor/ruby-signature/stdlib/builtin/false_class.rbs +40 -0
  222. data/vendor/ruby-signature/stdlib/builtin/fiber.rbs +68 -0
  223. data/vendor/ruby-signature/stdlib/builtin/fiber_error.rbs +12 -0
  224. data/vendor/ruby-signature/stdlib/builtin/file.rbs +476 -0
  225. data/vendor/ruby-signature/stdlib/builtin/file_test.rbs +59 -0
  226. data/vendor/ruby-signature/stdlib/builtin/float.rbs +696 -0
  227. data/vendor/ruby-signature/stdlib/builtin/gc.rbs +121 -0
  228. data/vendor/ruby-signature/stdlib/builtin/hash.rbs +1029 -0
  229. data/vendor/ruby-signature/stdlib/builtin/integer.rbs +710 -0
  230. data/vendor/ruby-signature/stdlib/builtin/io.rbs +683 -0
  231. data/vendor/ruby-signature/stdlib/builtin/kernel.rbs +574 -0
  232. data/vendor/ruby-signature/stdlib/builtin/marshal.rbs +135 -0
  233. data/vendor/ruby-signature/stdlib/builtin/match_data.rbs +141 -0
  234. data/vendor/ruby-signature/stdlib/builtin/math.rbs +66 -0
  235. data/vendor/ruby-signature/stdlib/builtin/method.rbs +182 -0
  236. data/vendor/ruby-signature/stdlib/builtin/module.rbs +248 -0
  237. data/vendor/ruby-signature/stdlib/builtin/nil_class.rbs +82 -0
  238. data/vendor/ruby-signature/stdlib/builtin/numeric.rbs +409 -0
  239. data/vendor/ruby-signature/stdlib/builtin/object.rbs +824 -0
  240. data/vendor/ruby-signature/stdlib/builtin/proc.rbs +426 -0
  241. data/vendor/ruby-signature/stdlib/builtin/process.rbs +354 -0
  242. data/vendor/ruby-signature/stdlib/builtin/random.rbs +93 -0
  243. data/vendor/ruby-signature/stdlib/builtin/range.rbs +226 -0
  244. data/vendor/ruby-signature/stdlib/builtin/rational.rbs +424 -0
  245. data/vendor/ruby-signature/stdlib/builtin/rb_config.rbs +10 -0
  246. data/vendor/ruby-signature/stdlib/builtin/regexp.rbs +131 -0
  247. data/vendor/ruby-signature/stdlib/builtin/ruby_vm.rbs +14 -0
  248. data/vendor/ruby-signature/stdlib/builtin/signal.rbs +55 -0
  249. data/vendor/ruby-signature/stdlib/builtin/string.rbs +770 -0
  250. data/vendor/ruby-signature/stdlib/builtin/string_io.rbs +13 -0
  251. data/vendor/ruby-signature/stdlib/builtin/struct.rbs +40 -0
  252. data/vendor/ruby-signature/stdlib/builtin/symbol.rbs +230 -0
  253. data/vendor/ruby-signature/stdlib/builtin/thread.rbs +1112 -0
  254. data/vendor/ruby-signature/stdlib/builtin/thread_group.rbs +23 -0
  255. data/vendor/ruby-signature/stdlib/builtin/time.rbs +739 -0
  256. data/vendor/ruby-signature/stdlib/builtin/trace_point.rbs +91 -0
  257. data/vendor/ruby-signature/stdlib/builtin/true_class.rbs +46 -0
  258. data/vendor/ruby-signature/stdlib/builtin/unbound_method.rbs +159 -0
  259. data/vendor/ruby-signature/stdlib/builtin/warning.rbs +17 -0
  260. data/vendor/ruby-signature/stdlib/erb/erb.rbs +18 -0
  261. data/vendor/ruby-signature/stdlib/find/find.rbs +44 -0
  262. data/vendor/ruby-signature/stdlib/pathname/pathname.rbs +21 -0
  263. data/vendor/ruby-signature/stdlib/prime/integer-extension.rbs +23 -0
  264. data/vendor/ruby-signature/stdlib/prime/prime.rbs +188 -0
  265. data/vendor/ruby-signature/stdlib/securerandom/securerandom.rbs +9 -0
  266. data/vendor/ruby-signature/stdlib/set/set.rbs +77 -0
  267. data/vendor/ruby-signature/stdlib/tmpdir/tmpdir.rbs +53 -0
  268. metadata +244 -54
  269. data/.travis.yml +0 -7
  270. data/lib/steep/ast/signature/alias.rb +0 -19
  271. data/lib/steep/ast/signature/class.rb +0 -33
  272. data/lib/steep/ast/signature/const.rb +0 -17
  273. data/lib/steep/ast/signature/env.rb +0 -138
  274. data/lib/steep/ast/signature/extension.rb +0 -21
  275. data/lib/steep/ast/signature/gvar.rb +0 -17
  276. data/lib/steep/ast/signature/interface.rb +0 -31
  277. data/lib/steep/ast/signature/members.rb +0 -115
  278. data/lib/steep/ast/signature/module.rb +0 -21
  279. data/lib/steep/drivers/print_interface.rb +0 -94
  280. data/lib/steep/drivers/scaffold.rb +0 -321
  281. data/lib/steep/drivers/utils/each_signature.rb +0 -31
  282. data/lib/steep/interface/abstract.rb +0 -68
  283. data/lib/steep/interface/builder.rb +0 -637
  284. data/lib/steep/interface/instantiated.rb +0 -163
  285. data/lib/steep/interface/ivar_chain.rb +0 -26
  286. data/lib/steep/parser.y +0 -1278
  287. data/lib/steep/project/listener.rb +0 -53
  288. data/smoke/class/a.rbi +0 -24
  289. data/smoke/class/d.rb +0 -9
  290. data/smoke/class/e.rb +0 -12
  291. data/smoke/class/i.rbi +0 -9
  292. data/smoke/hash/e.rbi +0 -3
  293. data/smoke/hello/hello.rbi +0 -7
  294. data/smoke/implements/a.rbi +0 -6
  295. data/smoke/initialize/a.rbi +0 -3
  296. data/smoke/module/a.rbi +0 -16
  297. data/smoke/self/a.rbi +0 -4
  298. data/smoke/super/a.rbi +0 -10
  299. data/stdlib/builtin.rbi +0 -787
@@ -0,0 +1,574 @@
1
+ # The [Kernel](Kernel) module is included by class
2
+ # [Object](https://ruby-doc.org/core-2.6.3/Object.html), so its methods
3
+ # are available in every Ruby object.
4
+ #
5
+ # The [Kernel](Kernel) instance methods are documented
6
+ # in class [Object](https://ruby-doc.org/core-2.6.3/Object.html) while the
7
+ # module methods are documented here. These methods are called without a
8
+ # receiver and thus can be called in functional form:
9
+ #
10
+ # ```ruby
11
+ # sprintf "%.1f", 1.234 #=> "1.2"
12
+ # ```
13
+ module Kernel
14
+ def caller: (?Integer start_or_range, ?Integer length) -> ::Array[String]?
15
+ | (?::Range[Integer] start_or_range) -> ::Array[String]?
16
+ | () -> ::Array[String]
17
+
18
+ def caller_locations: (?Integer start_or_range, ?Integer length) -> ::Array[Thread::Backtrace::Location]?
19
+ | (?::Range[Integer] start_or_range) -> ::Array[Thread::Backtrace::Location]?
20
+
21
+ def catch: [T] (T tag) { (T tag) -> untyped } -> untyped
22
+ | () { (Object tag) -> untyped } -> untyped
23
+
24
+ # In a perfect world this should be:
25
+ #
26
+ # returns(T.class_of(T.self_type))
27
+ #
28
+ # but that doesn't work (yet). Even making it:
29
+ #
30
+ # returns(Class)
31
+ #
32
+ # is very surprising since users expect their methods to be present.
33
+ # So we settle for untyped.
34
+ def `class`: () -> untyped
35
+
36
+ def define_singleton_method: (Symbol | String symbol, ?Proc | Method | UnboundMethod method) -> Symbol
37
+ | (Symbol | String symbol) { () -> untyped } -> Symbol
38
+
39
+ def eval: (String arg0, ?Binding arg1, ?String filename, ?Integer lineno) -> untyped
40
+
41
+ # Returns `true` if `yield` would execute a block in the current context.
42
+ # The `iterator?` form is mildly deprecated.
43
+ #
44
+ # ```ruby
45
+ # def try
46
+ # if block_given?
47
+ # yield
48
+ # else
49
+ # "no block"
50
+ # end
51
+ # end
52
+ # try #=> "no block"
53
+ # try { "hello" } #=> "hello"
54
+ # try do "hello" end #=> "hello"
55
+ # ```
56
+ def iterator?: () -> bool
57
+ alias block_given? iterator?
58
+
59
+ # Returns the names of the current local variables.
60
+ #
61
+ # ```ruby
62
+ # fred = 1
63
+ # for i in 1..10
64
+ # # ...
65
+ # end
66
+ # local_variables #=> [:fred, :i]
67
+ # ```
68
+ def local_variables: () -> ::Array[Symbol]
69
+
70
+ def srand: (?Numeric number) -> Numeric
71
+
72
+ def !~: (untyped other) -> bool
73
+
74
+ def <=>: (untyped other) -> Integer?
75
+
76
+ def ===: (untyped other) -> bool
77
+
78
+ def =~: (untyped other) -> NilClass
79
+
80
+ def clone: (?freeze: (TrueClass | FalseClass)) -> self
81
+
82
+ def display: (?IO port) -> NilClass
83
+
84
+ def dup: () -> self
85
+
86
+ def enum_for: (Symbol method, *untyped args) -> ::Enumerator[untyped, untyped]
87
+ | (Symbol method, *untyped args) { (*untyped args) -> (Integer|Float|nil) } -> ::Enumerator[untyped, untyped]
88
+ alias to_enum enum_for
89
+
90
+ def eql?: (untyped other) -> bool
91
+
92
+ def `extend`: (*Module mod) -> self
93
+
94
+ # Creates a subprocess. If a block is specified, that block is run in the
95
+ # subprocess, and the subprocess terminates with a status of zero.
96
+ # Otherwise, the `fork` call returns twice, once in the parent, returning
97
+ # the process ID of the child, and once in the child, returning *nil* .
98
+ # The child process can exit using `Kernel.exit!` to avoid running any
99
+ # `at_exit` functions. The parent process should use `Process.wait` to
100
+ # collect the termination statuses of its children or use `Process.detach`
101
+ # to register disinterest in their status; otherwise, the operating system
102
+ # may accumulate zombie processes.
103
+ #
104
+ # The thread calling fork is the only thread in the created child process.
105
+ # fork doesn’t copy other threads.
106
+ #
107
+ # If fork is not usable, Process.respond\_to?(:fork) returns false.
108
+ #
109
+ # Note that fork(2) is not available on some platforms like Windows and
110
+ # NetBSD 4. Therefore you should use spawn() instead of fork().
111
+ def fork: () -> Integer?
112
+ | () { () -> untyped } -> Integer?
113
+
114
+ def freeze: () -> self
115
+
116
+ def frozen?: () -> bool
117
+
118
+ def hash: () -> Integer
119
+
120
+ def initialize_copy: (self object) -> self
121
+
122
+ def inspect: () -> String
123
+
124
+ def instance_of?: (Class arg0) -> bool
125
+
126
+ def instance_variable_defined?: (Symbol | String arg0) -> bool
127
+
128
+ def instance_variable_get: (Symbol | String arg0) -> untyped
129
+
130
+ def instance_variable_set: [T] (Symbol | String arg0, T arg1) -> T
131
+
132
+ def instance_variables: () -> ::Array[Symbol]
133
+
134
+ def is_a?: (Class | Module arg0) -> bool
135
+ alias kind_of? is_a?
136
+
137
+ def method: (Symbol | String arg0) -> Method
138
+
139
+ def methods: (?bool regular) -> ::Array[Symbol]
140
+
141
+ def `nil?`: () -> FalseClass
142
+
143
+ def private_methods: (?bool all) -> ::Array[Symbol]
144
+
145
+ def protected_methods: (?bool all) -> ::Array[Symbol]
146
+
147
+ def public_method: (Symbol | String arg0) -> Method
148
+
149
+ def public_methods: (?bool all) -> ::Array[Symbol]
150
+
151
+ def `public_send`: (Symbol | String arg0, *untyped args) -> untyped
152
+ | (Symbol | String arg0, *untyped args) { (*untyped) -> untyped } -> untyped
153
+
154
+ def remove_instance_variable: (Symbol | String arg0) -> untyped
155
+
156
+ def `send`: (String | Symbol arg0, *untyped arg1) -> untyped
157
+ | (String | Symbol arg0, *untyped arg1) { (*untyped) -> untyped } -> untyped
158
+
159
+ def `singleton_class`: () -> Class
160
+
161
+ def singleton_method: (Symbol | String arg0) -> Method
162
+
163
+ def singleton_methods: (?bool all) -> ::Array[Symbol]
164
+
165
+ def taint: () -> self
166
+ alias untrust taint
167
+
168
+ def tainted?: () -> bool
169
+ alias untrusted? tainted?
170
+
171
+ def tap: () { (untyped x) -> void } -> self
172
+
173
+ def to_s: () -> String
174
+
175
+ def untaint: () -> self
176
+ alias trust untaint
177
+
178
+ # Returns `arg` as an [Array](https://ruby-doc.org/core-2.6.3/Array.html)
179
+ # .
180
+ #
181
+ # First tries to call `to_ary` on `arg`, then `to_a` . If `arg` does not
182
+ # respond to `to_ary` or `to_a`, returns an
183
+ # [Array](https://ruby-doc.org/core-2.6.3/Array.html) of length 1
184
+ # containing `arg` .
185
+ #
186
+ # If `to_ary` or `to_a` returns something other than an
187
+ # [Array](https://ruby-doc.org/core-2.6.3/Array.html), raises a
188
+ # `TypeError` .
189
+ #
190
+ # ```ruby
191
+ # Array(["a", "b"]) #=> ["a", "b"]
192
+ # Array(1..5) #=> [1, 2, 3, 4, 5]
193
+ # Array(key: :value) #=> [[:key, :value]]
194
+ # Array(nil) #=> []
195
+ # Array(1) #=> [1]
196
+ # ```
197
+ def Array: (NilClass x) -> [ ]
198
+ | [T] (::Array[T] x) -> ::Array[T]
199
+ | [T] (::Range[T] x) -> ::Array[T]
200
+ | [K, V] (::Hash[K, V] x) -> ::Array[[K, V]]
201
+ | [T] (T x) -> ::Array[T]
202
+
203
+ def Complex: (Numeric | String x, ?Numeric | String y, ?exception: bool exception) -> Complex
204
+
205
+ def Float: (Numeric | String x, ?exception: bool exception) -> Float
206
+
207
+ def Hash: [K, V] (Object x) -> ::Hash[K, V]
208
+
209
+ def Integer: (Numeric | String arg, ?exception: bool exception) -> Integer
210
+ | (String arg, ?Integer base, ?exception: bool exception) -> Integer
211
+
212
+ def Rational: (Numeric | String | Object x, ?Numeric | String y, ?exception: bool exception) -> Rational
213
+
214
+ def String: (Object x) -> String
215
+
216
+ # Returns the called name of the current method as a
217
+ # [Symbol](https://ruby-doc.org/core-2.6.3/Symbol.html). If called
218
+ # outside of a method, it returns `nil` .
219
+ def __callee__: () -> Symbol?
220
+
221
+ # Returns the canonicalized absolute path of the directory of the file
222
+ # from which this method is called. It means symlinks in the path is
223
+ # resolved. If `__FILE__` is `nil`, it returns `nil` . The return value
224
+ # equals to `File.dirname(File.realpath(__FILE__))` .
225
+ def __dir__: () -> String?
226
+
227
+ # Returns the name at the definition of the current method as a
228
+ # [Symbol](https://ruby-doc.org/core-2.6.3/Symbol.html). If called
229
+ # outside of a method, it returns `nil` .
230
+ def __method__: () -> Symbol?
231
+
232
+ def `: (String arg0) -> String
233
+
234
+ def abort: (?String msg) -> bot
235
+
236
+ def at_exit: () { () -> untyped } -> Proc
237
+
238
+ def autoload: (String | Symbol _module, String filename) -> NilClass
239
+
240
+ def autoload?: (Symbol | String name) -> String?
241
+
242
+ # Returns a `Binding` object, describing the variable and method bindings
243
+ # at the point of call. This object can be used when calling `eval` to
244
+ # execute the evaluated command in this environment. See also the
245
+ # description of class `Binding` .
246
+ #
247
+ # ```ruby
248
+ # def get_binding(param)
249
+ # binding
250
+ # end
251
+ # b = get_binding("hello")
252
+ # eval("param", b) #=> "hello"
253
+ # ```
254
+ def binding: () -> Binding
255
+
256
+ # Initiates the termination of the Ruby script by raising the `SystemExit`
257
+ # exception. This exception may be caught. The optional parameter is used
258
+ # to return a status code to the invoking environment. `true` and `FALSE`
259
+ # of *status* means success and failure respectively. The interpretation
260
+ # of other integer values are system dependent.
261
+ #
262
+ # ```ruby
263
+ # begin
264
+ # exit
265
+ # puts "never get here"
266
+ # rescue SystemExit
267
+ # puts "rescued a SystemExit exception"
268
+ # end
269
+ # puts "after begin block"
270
+ # ```
271
+ #
272
+ # *produces:*
273
+ #
274
+ # rescued a SystemExit exception
275
+ # after begin block
276
+ #
277
+ # Just prior to termination, Ruby executes any `at_exit` functions (see
278
+ # Kernel::at\_exit) and runs any object finalizers (see
279
+ # [ObjectSpace.define\_finalizer](https://ruby-doc.org/core-2.6.3/ObjectSpace.html#method-c-define_finalizer)
280
+ # ).
281
+ #
282
+ # ```ruby
283
+ # at_exit { puts "at_exit function" }
284
+ # ObjectSpace.define_finalizer("string", proc { puts "in finalizer" })
285
+ # exit
286
+ # ```
287
+ #
288
+ # *produces:*
289
+ #
290
+ # at_exit function
291
+ # in finalizer
292
+ def exit: () -> bot
293
+ | (?Integer | TrueClass | FalseClass status) -> bot
294
+
295
+ def exit!: (Integer | TrueClass | FalseClass status) -> bot
296
+
297
+ # With no arguments, raises the exception in `$!` or raises a
298
+ # `RuntimeError` if `$!` is `nil` . With a single `String` argument,
299
+ # raises a `RuntimeError` with the string as a message. Otherwise, the
300
+ # first parameter should be the name of an `Exception` class (or an object
301
+ # that returns an `Exception` object when sent an `exception` message).
302
+ # The optional second parameter sets the message associated with the
303
+ # exception, and the third parameter is an array of callback information.
304
+ # Exceptions are caught by the `rescue` clause of `begin...end` blocks.
305
+ #
306
+ # ```ruby
307
+ # raise "Failed to create socket"
308
+ # raise ArgumentError, "No parameters", caller
309
+ # ```
310
+ #
311
+ # The `cause` of the generated exception is automatically set to the
312
+ # “current” exception ( `$!` ) if any. An alternative value, either an
313
+ # `Exception` object or `nil`, can be specified via the `:cause`
314
+ # argument.
315
+ def fail: () -> bot
316
+ | (String arg0) -> bot
317
+ | (?Exception arg0, ?String arg1, ?::Array[String] arg2) -> bot
318
+ alias raise fail
319
+
320
+ def format: (String format, *untyped args) -> String
321
+ alias sprintf format
322
+
323
+ def gets: (?String arg0, ?Integer arg1) -> String?
324
+
325
+ # Returns an array of the names of global variables.
326
+ #
327
+ # ```ruby
328
+ # global_variables.grep /std/ #=> [:$stdin, :$stdout, :$stderr]
329
+ # ```
330
+ def global_variables: () -> ::Array[Symbol]
331
+
332
+ def load: (String filename, ?bool arg0) -> bool
333
+
334
+ # Repeatedly executes the block.
335
+ #
336
+ # If no block is given, an enumerator is returned instead.
337
+ #
338
+ # ```ruby
339
+ # loop do
340
+ # print "Input: "
341
+ # line = gets
342
+ # break if !line or line =~ /^qQ/
343
+ # # ...
344
+ # end
345
+ # ```
346
+ #
347
+ # [StopIteration](https://ruby-doc.org/core-2.6.3/StopIteration.html)
348
+ # raised in the block breaks the loop. In this case, loop returns the
349
+ # "result" value stored in the exception.
350
+ #
351
+ # ```ruby
352
+ # enum = Enumerator.new { |y|
353
+ # y << "one"
354
+ # y << "two"
355
+ # :ok
356
+ # }
357
+ #
358
+ # result = loop {
359
+ # puts enum.next
360
+ # } #=> :ok
361
+ # ```
362
+ def loop: () { (nil) -> untyped } -> bot
363
+ | () -> ::Enumerator[nil, bot]
364
+
365
+ def open: (String name, ?String mode, ?Integer perm) -> IO?
366
+ | [T] (String name, ?String mode, ?Integer perm) { (IO) -> T } -> T
367
+
368
+ # Prints each object in turn to `$stdout` . If the output field separator
369
+ # ( `$,` ) is not `nil`, its contents will appear between each field. If
370
+ # the output record separator ( `$\` ) is not `nil`, it will be appended
371
+ # to the output. If no arguments are given, prints `$_` . Objects that
372
+ # aren’t strings will be converted by calling their `to_s` method.
373
+ #
374
+ # ```ruby
375
+ # print "cat", [1,2,3], 99, "\n"
376
+ # $, = ", "
377
+ # $\ = "\n"
378
+ # print "cat", [1,2,3], 99
379
+ # ```
380
+ #
381
+ # *produces:*
382
+ #
383
+ # cat12399
384
+ # cat, 1, 2, 3, 99
385
+ def print: (*Kernel args) -> nil
386
+
387
+ def printf: (?IO arg0, ?String arg1, *untyped arg2) -> nil
388
+
389
+ def proc: () { () -> untyped } -> Proc
390
+
391
+ def lambda: () { () -> untyped } -> Proc
392
+
393
+ def putc: (Integer arg0) -> Integer
394
+ | (String arg0) -> String
395
+
396
+ def puts: (*untyped arg0) -> NilClass
397
+
398
+ def p: [T] (T arg0) -> T
399
+ | (*untyped arg0) -> Array[untyped]
400
+
401
+ def pp: [T] (T arg0) -> T
402
+ | (*untyped arg0) -> Array[untyped]
403
+
404
+ # If called without an argument, or if `max.to_i.abs == 0`, rand returns
405
+ # a pseudo-random floating point number between 0.0 and 1.0, including 0.0
406
+ # and excluding 1.0.
407
+ #
408
+ # ```ruby
409
+ # rand #=> 0.2725926052826416
410
+ # ```
411
+ #
412
+ # When `max.abs` is greater than or equal to 1, `rand` returns a
413
+ # pseudo-random integer greater than or equal to 0 and less than
414
+ # `max.to_i.abs` .
415
+ #
416
+ # ```ruby
417
+ # rand(100) #=> 12
418
+ # ```
419
+ #
420
+ # When `max` is a [Range](https://ruby-doc.org/core-2.6.3/Range.html),
421
+ # `rand` returns a random number where range.member?(number) == true.
422
+ #
423
+ # Negative or floating point values for `max` are allowed, but may give
424
+ # surprising results.
425
+ #
426
+ # ```ruby
427
+ # rand(-100) # => 87
428
+ # rand(-0.5) # => 0.8130921818028143
429
+ # rand(1.9) # equivalent to rand(1), which is always 0
430
+ # ```
431
+ #
432
+ # [\#srand](Kernel.downloaded.ruby_doc#method-i-srand) may be used to
433
+ # ensure that sequences of random numbers are reproducible between
434
+ # different runs of a program.
435
+ #
436
+ # See also
437
+ # [Random\#rand](https://ruby-doc.org/core-2.6.3/Random.html#method-i-rand)
438
+ # .
439
+ def rand: () -> Float
440
+ | (Integer arg0) -> Integer
441
+ | (::Range[Integer] arg0) -> Integer
442
+ | (::Range[Float] arg0) -> Float
443
+
444
+ def readline: (?String arg0, ?Integer arg1) -> String
445
+
446
+ def readlines: (?String arg0, ?Integer arg1) -> ::Array[String]
447
+
448
+ def require: (String path) -> bool
449
+
450
+ def require_relative: (String feature) -> bool
451
+
452
+ def select: (::Array[IO] read, ?::Array[IO] write, ?::Array[IO] error, ?Integer timeout) -> ::Array[String]
453
+
454
+ def sleep: () -> bot
455
+ | (Numeric duration) -> Integer
456
+
457
+ def syscall: (Integer num, *untyped args) -> untyped
458
+
459
+ def test: (String | Integer cmd, String | IO file1, ?String | IO file2) -> (TrueClass | FalseClass | Time | nil | Integer)
460
+
461
+ def throw: (Object tag, ?untyped obj) -> bot
462
+
463
+ def warn: (*untyped msg, ?uplevel: Integer | nil) -> NilClass
464
+
465
+ # Replaces the current process by running the given external *command* ,
466
+ # which can take one of the following forms:
467
+ #
468
+ # - `exec(commandline)`
469
+ # command line string which is passed to the standard shell
470
+ #
471
+ # - `exec(cmdname, arg1, ...)`
472
+ # command name and one or more arguments (no shell)
473
+ #
474
+ # - `exec([cmdname, argv0], arg1, ...)`
475
+ # command name, [argv](https://ruby-doc.org/core-2.6.3/0) and zero or
476
+ # more arguments (no shell)
477
+ #
478
+ # In the first form, the string is taken as a command line that is subject
479
+ # to shell expansion before being executed.
480
+ #
481
+ # The standard shell always means `"/bin/sh"` on Unix-like systems, same
482
+ # as `ENV["RUBYSHELL"]` (or `ENV["COMSPEC"]` on Windows NT series), and
483
+ # similar.
484
+ #
485
+ # If the string from the first form ( `exec("command")` ) follows these
486
+ # simple rules:
487
+ #
488
+ # - no meta characters
489
+ #
490
+ # - no shell reserved word and no special built-in
491
+ #
492
+ # - Ruby invokes the command directly without shell
493
+ #
494
+ # You can force shell invocation by adding “;” to the string (because “;”
495
+ # is a meta character).
496
+ #
497
+ # Note that this behavior is observable by pid obtained (return value of
498
+ # spawn() and
499
+ # [IO\#pid](https://ruby-doc.org/core-2.6.3/IO.html#method-i-pid) for
500
+ # [IO.popen](https://ruby-doc.org/core-2.6.3/IO.html#method-c-popen) ) is
501
+ # the pid of the invoked command, not shell.
502
+ #
503
+ # In the second form ( `exec("command1", "arg1", ...)` ), the first is
504
+ # taken as a command name and the rest are passed as parameters to command
505
+ # with no shell expansion.
506
+ #
507
+ # In the third form ( `exec(["command", "argv0"], "arg1", ...)` ),
508
+ # starting a two-element array at the beginning of the command, the first
509
+ # element is the command to be executed, and the second argument is used
510
+ # as the `argv[0]` value, which may show up in process listings.
511
+ #
512
+ # In order to execute the command, one of the `exec(2)` system calls are
513
+ # used, so the running command may inherit some of the environment of the
514
+ # original program (including open file descriptors).
515
+ #
516
+ # This behavior is modified by the given `env` and `options` parameters.
517
+ # See ::spawn for details.
518
+ #
519
+ # If the command fails to execute (typically `Errno::ENOENT` when it was
520
+ # not found) a
521
+ # [SystemCallError](https://ruby-doc.org/core-2.6.3/SystemCallError.html)
522
+ # exception is raised.
523
+ #
524
+ # This method modifies process attributes according to given `options`
525
+ # before `exec(2)` system call. See ::spawn for more details about the
526
+ # given `options` .
527
+ #
528
+ # The modified attributes may be retained when `exec(2)` system call
529
+ # fails.
530
+ #
531
+ # For example, hard resource limits are not restorable.
532
+ #
533
+ # Consider to create a child process using ::spawn or
534
+ # [\#system](Kernel.downloaded.ruby_doc#method-i-system) if this is not
535
+ # acceptable.
536
+ #
537
+ # ```ruby
538
+ # exec "echo *" # echoes list of files in current directory
539
+ # # never get here
540
+ #
541
+ # exec "echo", "*" # echoes an asterisk
542
+ # # never get here
543
+ # ```
544
+ def exec: (*String args) -> bot
545
+
546
+ # Executes *command…* in a subshell. *command…* is one of following forms.
547
+ #
548
+ # commandline : command line string which is passed to the standard shell
549
+ # cmdname, arg1, ... : command name and one or more arguments (no shell)
550
+ # [cmdname, argv0], arg1, ... : command name, argv[0] and zero or more arguments (no shell)
551
+ #
552
+ # system returns `true` if the command gives zero exit status, `false` for
553
+ # non zero exit status. Returns `nil` if command execution fails. An error
554
+ # status is available in `$?` . The arguments are processed in the same
555
+ # way as for `Kernel.spawn` .
556
+ #
557
+ # The hash arguments, env and options, are same as `exec` and `spawn` .
558
+ # See `Kernel.spawn` for details.
559
+ #
560
+ # ```ruby
561
+ # system("echo *")
562
+ # system("echo", "*")
563
+ # ```
564
+ #
565
+ # *produces:*
566
+ #
567
+ # config.h main.rb
568
+ # *
569
+ #
570
+ # See `Kernel.exec` for the standard shell.
571
+ def system: (*String args) -> (NilClass | FalseClass | TrueClass)
572
+ end
573
+
574
+ Kernel::RUBYGEMS_ACTIVATION_MONITOR: untyped