rbs 1.0.0.pre → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +10 -4
  3. data/CHANGELOG.md +41 -6
  4. data/Gemfile +7 -2
  5. data/README.md +1 -1
  6. data/Rakefile +11 -4
  7. data/Steepfile +2 -1
  8. data/bin/annotate-with-rdoc +0 -4
  9. data/bin/test_runner.rb +4 -5
  10. data/core/encoding.rbs +1 -1
  11. data/core/file.rbs +4 -0
  12. data/core/io.rbs +81 -5
  13. data/core/kernel.rbs +56 -56
  14. data/core/module.rbs +43 -2
  15. data/core/unbound_method.rbs +16 -0
  16. data/docs/CONTRIBUTING.md +2 -2
  17. data/docs/stdlib.md +50 -12
  18. data/docs/syntax.md +0 -17
  19. data/goodcheck.yml +3 -3
  20. data/lib/rbs/ast/declarations.rb +0 -47
  21. data/lib/rbs/definition_builder.rb +102 -64
  22. data/lib/rbs/definition_builder/ancestor_builder.rb +52 -3
  23. data/lib/rbs/environment.rb +1 -7
  24. data/lib/rbs/environment_loader.rb +7 -3
  25. data/lib/rbs/errors.rb +22 -57
  26. data/lib/rbs/parser.rb +1003 -1027
  27. data/lib/rbs/parser.y +12 -21
  28. data/lib/rbs/prototype/rb.rb +18 -4
  29. data/lib/rbs/prototype/runtime.rb +30 -14
  30. data/lib/rbs/test/hook.rb +7 -6
  31. data/lib/rbs/test/setup_helper.rb +0 -1
  32. data/lib/rbs/types.rb +6 -2
  33. data/lib/rbs/version.rb +1 -1
  34. data/lib/rbs/writer.rb +4 -3
  35. data/rbs.gemspec +1 -0
  36. data/sig/ancestor_builder.rbs +98 -0
  37. data/sig/declarations.rbs +4 -16
  38. data/sig/definition_builder.rbs +17 -71
  39. data/sig/errors.rbs +141 -2
  40. data/sig/method_builder.rbs +71 -0
  41. data/sig/substitution.rbs +3 -0
  42. data/sig/types.rbs +1 -15
  43. data/stdlib/csv/0/csv.rbs +3 -0
  44. data/stdlib/fileutils/0/fileutils.rbs +585 -0
  45. data/stdlib/pathname/0/pathname.rbs +2 -2
  46. data/stdlib/prettyprint/0/prettyprint.rbs +366 -0
  47. data/stdlib/prime/0/prime.rbs +6 -0
  48. data/stdlib/securerandom/0/securerandom.rbs +2 -0
  49. data/stdlib/uri/0/common.rbs +1 -1
  50. metadata +10 -7
  51. data/core/data.rbs +0 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fd21602800550be064e741db770aa752eaab018ca894238f88d75d1d1e950edd
4
- data.tar.gz: 346c39ff339931cf9866e29cd096a0877c620feff86044a2bbb007826276904b
3
+ metadata.gz: 036100021b0cbb49dd861874f559cf64e038d283bf6dbcb6068db71fc9900a69
4
+ data.tar.gz: 9bdf796be6710ae9f9a7c1ab50e7ce1871d86e34b9712fb03fa7418652499e25
5
5
  SHA512:
6
- metadata.gz: 94651715eeed037f3d899fdae1cc49dc5134f5d3df7da03d06b7ebc7a053d43139adf29680de4a0036446afb16ef824862fae4ad5a6870861ae48bd589799ac6
7
- data.tar.gz: ec967eef1ab035d4da2fe66f8a4661523c672eb1bc13f7033ac73ac8593810fd73e52d2d52173f8284abc47273b4442f9a95f4a5325c0e265cdb6a6d6b0321e1
6
+ metadata.gz: c70a2e6caa836c06d8136806b45d307f46b40e5cb21a6d4b4eaf49850fa884be0b240e1c8617e3f5d2cca75be25d91cfb0573613fff5ad8c945d0f9f45f8bdb0
7
+ data.tar.gz: fdc96f11d612bdc16672620fd135360a0ff31cb6d32d181aa70785a0b15bf63d13588be95ade7a702d1c64091f22378c1a864a80dbcdf81c129dcdbb091f5afe
@@ -12,8 +12,8 @@ jobs:
12
12
  strategy:
13
13
  matrix:
14
14
  container_tag:
15
- - master-nightly-bionic
16
- - 2.6-bionic
15
+ - master-nightly-focal
16
+ - 3.0-focal
17
17
  - 2.7-bionic
18
18
  job:
19
19
  - test
@@ -27,12 +27,18 @@ jobs:
27
27
  run: |
28
28
  apt-get update
29
29
  apt-get install -y libdb-dev
30
- - name: Install
30
+ - name: Install bundler
31
31
  run: |
32
32
  ruby -v
33
33
  gem install bundler
34
+ - name: bundle config set with
35
+ run: |
36
+ echo "NO_MINITEST=true" >> $GITHUB_ENV
37
+ bundle config set --local without 'minitest'
38
+ if: "contains(matrix.container_tag, 'master-nightly')"
39
+ - name: bin/setup
40
+ run: |
34
41
  bin/setup
35
42
  - name: Run test
36
43
  run: |
37
44
  bundle exec rake ${{ matrix.job }}
38
- if: "!(matrix.job == 'stdlib_test' && contains(matrix.container_tag, '2.6'))"
@@ -2,16 +2,51 @@
2
2
 
3
3
  ## master
4
4
 
5
- ## 1.0.0 (Pre released)
6
-
7
- * Signature updates for `URI`, `IO`, and `Time` ([#529](https://github.com/ruby/rbs/pull/529), [#521](https://github.com/ruby/rbs/pull/521), [#520](https://github.com/ruby/rbs/pull/520), [#511](https://github.com/ruby/rbs/pull/511), [#517](https://github.com/ruby/rbs/pull/517))
5
+ ## 1.0.3 (2021-01-28)
6
+
7
+ * Set up `#ancestors` and `#location` of `RecursiveAncestorError` ([#583](https://github.com/ruby/rbs/pull/583))
8
+
9
+ ## 1.0.2 (2021-01-28)
10
+
11
+ * Signature Updates
12
+ * Kernel([#582](https://github.com/ruby/rbs/pull/582))
13
+
14
+ ## 1.0.1 (2021-01-27)
15
+
16
+ * Signature Updates
17
+ * PrettyPrint ([\#573](https://github.com/ruby/rbs/pull/573))
18
+ * FileUtils ([\#576](https://github.com/ruby/rbs/pull/576))
19
+ * UnboundMethod ([\#555](https://github.com/ruby/rbs/pull/555))
20
+ * IO ([\#571](https://github.com/ruby/rbs/pull/571))
21
+ * Kernel ([\#549](https://github.com/ruby/rbs/pull/549), [\#569](https://github.com/ruby/rbs/pull/569))
22
+ * File ([\#552](https://github.com/ruby/rbs/pull/552))
23
+ * Data is removed ([\#570](https://github.com/ruby/rbs/pull/570))
24
+ * Module ([\#568](https://github.com/ruby/rbs/pull/568))
25
+ * Object ([\#557](https://github.com/ruby/rbs/pull/557))
26
+ * Renew test sample code ([#581](https://github.com/ruby/rbs/pull/581))
27
+ * Add description to `generate:stdlib_test` Rake task ([\#578](https://github.com/ruby/rbs/pull/578))
28
+ * Declare supported ruby version >= 2.6 ([\#548](https://github.com/ruby/rbs/pull/548))
29
+ * Fix module self-type override ([\#577](https://github.com/ruby/rbs/pull/577))
30
+ * Fix parser to support all operator symbols ([\#550](https://github.com/ruby/rbs/pull/550))
31
+ * Migrate from Minitest to Test::Unit ([\#556](https://github.com/ruby/rbs/pull/556))
32
+ * Fix type alias parsing ([\#565](https://github.com/ruby/rbs/pull/565))
33
+ * Support end-less method definition in `prototype rb` ([\#561](https://github.com/ruby/rbs/pull/561))
34
+ * Support method argument forwarding in `prototype rb` ([\#560](https://github.com/ruby/rbs/pull/560))
35
+
36
+ ## 1.0.0 (2020-12-24)
37
+
38
+ * Signature updates for `URI`, `IO`, `File`, `Pathname`, `Module`, and `Time` ([#529](https://github.com/ruby/rbs/pull/529), [#521](https://github.com/ruby/rbs/pull/521), [#520](https://github.com/ruby/rbs/pull/520), [#511](https://github.com/ruby/rbs/pull/511), [#517](https://github.com/ruby/rbs/pull/517), [#542](https://github.com/ruby/rbs/pull/542), [#546](https://github.com/ruby/rbs/pull/546), [#540](https://github.com/ruby/rbs/pull/540), [#538](https://github.com/ruby/rbs/pull/538))
8
39
  * `rbs prototype runtime` generates `extend`s ([#535](https://github.com/ruby/rbs/pull/535))
9
40
  * `rbs prototype runtime` stability improvements ([#533](https://github.com/ruby/rbs/pull/533), [#526](https://github.com/ruby/rbs/pull/526))
10
- * Improve runtime type checker compatibility ([#532](https://github.com/ruby/rbs/pull/532), [#528](https://github.com/ruby/rbs/pull/528), )
41
+ * `rbs prototype rb` compatibility improvements ([#545](https://github.com/ruby/rbs/pull/545))
42
+ * Implement method names escape in `RBS::Writer` ([#537](https://github.com/ruby/rbs/pull/537))
43
+ * Improve runtime type checker compatibility ([#532](https://github.com/ruby/rbs/pull/532), [#528](https://github.com/ruby/rbs/pull/528), [#547](https://github.com/ruby/rbs/pull/547))
44
+ * Fix `ruby2_keywords` for `Proc` in Ruby <2.7 ([#513](https://github.com/ruby/rbs/pull/513))
11
45
  * Better compatibility for record type attribute names ([#525](https://github.com/ruby/rbs/pull/525), [#524](https://github.com/ruby/rbs/pull/524))
12
- * Let module-self-types be classes ([#523](https://github.com/ruby/rbs/pull/523))
46
+ * Let module self-types be classes ([#523](https://github.com/ruby/rbs/pull/523))
47
+ * Delete `extension` syntax ([#543](https://github.com/ruby/rbs/pull/543))
13
48
  * Method resolution improvements about `alias` and `.new` ([#522](https://github.com/ruby/rbs/pull/522), [#519](https://github.com/ruby/rbs/pull/519), [#516](https://github.com/ruby/rbs/pull/516))
14
- * Fix `ruby2_keywords` for `Proc` in Ruby <2.7 ([#513](https://github.com/ruby/rbs/pull/513))
49
+ * Better message for `DuplicatedMethodDefinitionError` ([#539](https://github.com/ruby/rbs/pull/539))
15
50
 
16
51
  ## 0.20.1 (2020-12-06)
17
52
 
data/Gemfile CHANGED
@@ -5,12 +5,12 @@ gemspec
5
5
 
6
6
  # Development dependencies
7
7
  gem "rake"
8
- gem "minitest"
8
+ gem "test-unit"
9
+ gem "test-unit-rr"
9
10
  gem "rspec"
10
11
  gem "racc"
11
12
  gem "rubocop"
12
13
  gem "rubocop-rubycw"
13
- gem "minitest-reporters"
14
14
  gem "json"
15
15
  gem "json-schema"
16
16
  gem 'stackprof'
@@ -22,4 +22,9 @@ gem "rbs-amber", path: "test/assets/test-gem"
22
22
 
23
23
  group :ide, optional: true do
24
24
  gem "ruby-debug-ide"
25
+ gem "debase", ">= 0.2.5.beta2"
26
+ end
27
+
28
+ group :minitest do
29
+ gem "minitest"
25
30
  end
data/README.md CHANGED
@@ -107,7 +107,7 @@ instance = builder.build_instance(string)
107
107
 
108
108
  # Print the types of `gsub` method:
109
109
  puts instance.methods[:gsub].method_types.join("\n")
110
- # Ouputs =>
110
+ # Outputs =>
111
111
  # (::Regexp | ::string pattern, ::string replacement) -> ::String
112
112
  # (::Regexp | ::string pattern, ::Hash[::String, ::String] hash) -> ::String
113
113
  # (::Regexp | ::string pattern) { (::String match) -> ::_ToS } -> ::String
data/Rakefile CHANGED
@@ -28,8 +28,6 @@ task :validate => :parser do
28
28
  sh "#{ruby} #{rbs} validate --silent"
29
29
 
30
30
  FileList["stdlib/*"].each do |path|
31
- next if path =~ %r{stdlib/builtin}
32
-
33
31
  lib = [File.basename(path).to_s]
34
32
 
35
33
  if lib == ["bigdecimal-math"]
@@ -45,6 +43,14 @@ task :validate => :parser do
45
43
  lib << "monitor"
46
44
  end
47
45
 
46
+ if lib == ["csv"]
47
+ lib << "forwardable"
48
+ end
49
+
50
+ if lib == ["prime"]
51
+ lib << "singleton"
52
+ end
53
+
48
54
  sh "#{ruby} #{rbs} #{lib.map {|l| "-r #{l}"}.join(" ")} validate --silent"
49
55
  end
50
56
  end
@@ -76,6 +82,7 @@ task :confirm_parser do
76
82
  end
77
83
 
78
84
  namespace :generate do
85
+ desc "Generate a test file for a stdlib class signatures"
79
86
  task :stdlib_test, [:class] do |_task, args|
80
87
  klass = args.fetch(:class) do
81
88
  raise "Class name is necessary. e.g. rake 'generate:stdlib_test[String]'"
@@ -107,7 +114,7 @@ namespace :generate do
107
114
  require_relative "test_helper"
108
115
 
109
116
  <%- unless class_methods.empty? -%>
110
- class <%= klass %>SingletonTest < Minitest::Test
117
+ class <%= klass %>SingletonTest < Test::Unit::TestCase
111
118
  include TypeAssertions
112
119
 
113
120
  # library "pathname", "set", "securerandom" # Declare library signatures to load
@@ -125,7 +132,7 @@ namespace :generate do
125
132
  <%- end -%>
126
133
 
127
134
  <%- unless instance_methods.empty? -%>
128
- class <%= klass %>Test < Minitest::Test
135
+ class <%= klass %>Test < Test::Unit::TestCase
129
136
  include TypeAssertions
130
137
 
131
138
  # library "pathname", "set", "securerandom" # Declare library signatures to load
data/Steepfile CHANGED
@@ -2,8 +2,9 @@ target :lib do
2
2
  signature "sig"
3
3
  check "lib"
4
4
  ignore "lib/rbs/parser.rb"
5
+ ignore "lib/rbs/prototype", "lib/rbs/test", "lib/rbs/test.rb"
5
6
 
6
- library "set", "pathname", "json", "logger"
7
+ library "set", "pathname", "json", "logger", "monitor", "tsort"
7
8
  end
8
9
 
9
10
  # target :lib do
@@ -140,10 +140,6 @@ ARGV.map {|f| Pathname(f) }.each do |path|
140
140
  comment = comment_for_class(decl, stores: stores)
141
141
  decl.instance_variable_set(:@comment, comment)
142
142
 
143
- print_members stores, decl.name.to_s, decl.members
144
- when RBS::AST::Declarations::Extension
145
- puts " Importing documentation for #{decl.name} (#{decl.extension_name})"
146
-
147
143
  print_members stores, decl.name.to_s, decl.members
148
144
  end
149
145
  end
@@ -4,13 +4,12 @@ $LOAD_PATH << File.join(__dir__, "../lib")
4
4
 
5
5
  require "set"
6
6
 
7
- IS_RUBY_27 = Gem::Version.new(RUBY_VERSION).yield_self do |ruby_version|
8
- Gem::Version.new('2.7.0') <= ruby_version &&
9
- ruby_version <= Gem::Version.new('2.8.0')
7
+ IS_LATEST_RUBY = Gem::Version.new(RUBY_VERSION).yield_self do |ruby_version|
8
+ Gem::Version.new('3.0.0') <= ruby_version && ruby_version < Gem::Version.new('3.1.0')
10
9
  end
11
10
 
12
- unless IS_RUBY_27
13
- STDERR.puts "⚠️⚠️⚠️⚠️ stdlib test assumes Ruby 2.7 but RUBY_VERSION==#{RUBY_VERSION} ⚠️⚠️⚠️⚠️"
11
+ unless IS_LATEST_RUBY
12
+ STDERR.puts "⚠️⚠️⚠️⚠️ stdlib test assumes Ruby 3.0 but RUBY_VERSION==#{RUBY_VERSION} ⚠️⚠️⚠️⚠️"
14
13
  end
15
14
 
16
15
  KNOWN_FAILS = %w(dbm).map do |lib|
@@ -567,7 +567,7 @@ Encoding::Windows_31J: Encoding
567
567
 
568
568
  Encoding::Windows_874: Encoding
569
569
 
570
- class Encoding::Converter < Data
570
+ class Encoding::Converter < Object
571
571
  end
572
572
 
573
573
  Encoding::Converter::AFTER_OUTPUT: Integer
@@ -531,6 +531,10 @@ class File < IO
531
531
  #
532
532
  def self.mtime: (string | _ToPath | IO file_name) -> Time
533
533
 
534
+ # Alias of `File.new`.
535
+ def self.open: (string | _ToPath | int file_name, ?(string | int) mode, ?int perm) -> instance
536
+ | [T] (string | _ToPath | int file_name, ?(string | int) mode, ?int perm) { (File) -> T } -> T
537
+
534
538
  # Returns `true` if the named file exists and the effective used id of the
535
539
  # calling process is the owner of the file.
536
540
  #
@@ -107,14 +107,85 @@ class IO < Object
107
107
 
108
108
  include Enumerable[String]
109
109
 
110
- def <<: (untyped arg0) -> self
110
+ # String Output---Writes *obj* to *ios*. *obj* will be converted to a string
111
+ # using `to_s`.
112
+ #
113
+ # $stdout << "Hello " << "world!\n"
114
+ #
115
+ # *produces:*
116
+ #
117
+ # Hello world!
118
+ #
119
+ def <<: (_ToS obj) -> self
111
120
 
112
- def advise: (Symbol arg0, ?Integer offset, ?Integer len) -> NilClass
121
+ # Announce an intention to access data from the current file in a specific
122
+ # pattern. On platforms that do not support the *posix_fadvise(2)* system call,
123
+ # this method is a no-op.
124
+ #
125
+ # *advice* is one of the following symbols:
126
+ #
127
+ # :normal
128
+ # : No advice to give; the default assumption for an open file.
129
+ # :sequential
130
+ # : The data will be accessed sequentially with lower offsets read before
131
+ # higher ones.
132
+ # :random
133
+ # : The data will be accessed in random order.
134
+ # :willneed
135
+ # : The data will be accessed in the near future.
136
+ # :dontneed
137
+ # : The data will not be accessed in the near future.
138
+ # :noreuse
139
+ # : The data will only be accessed once.
140
+ #
141
+ #
142
+ # The semantics of a piece of advice are platform-dependent. See *man 2
143
+ # posix_fadvise* for details.
144
+ #
145
+ # "data" means the region of the current file that begins at *offset* and
146
+ # extends for *len* bytes. If *len* is 0, the region ends at the last byte of
147
+ # the file. By default, both *offset* and *len* are 0, meaning that the advice
148
+ # applies to the entire file.
149
+ #
150
+ # If an error occurs, one of the following exceptions will be raised:
151
+ #
152
+ # IOError
153
+ # : The IO stream is closed.
154
+ # Errno::EBADF
155
+ # : The file descriptor of the current file is invalid.
156
+ # Errno::EINVAL
157
+ # : An invalid value for *advice* was given.
158
+ # Errno::ESPIPE
159
+ # : The file descriptor of the current file refers to a FIFO or pipe. (Linux
160
+ # raises Errno::EINVAL in this case).
161
+ # TypeError
162
+ # : Either *advice* was not a Symbol, or one of the other arguments was not an
163
+ # Integer.
164
+ # RangeError
165
+ # : One of the arguments given was too big/small.
166
+ #
167
+ # This list is not exhaustive; other Errno
168
+ # : exceptions are also possible.
169
+ #
170
+ def advise: ((:normal | :sequential | :random | :willneed | :dontneed | :noreuse) advise, ?Integer offset, ?Integer len) -> nil
113
171
 
114
- def autoclose=: (boolish) -> bool
172
+ # Sets auto-close flag.
173
+ #
174
+ # f = open("/dev/null")
175
+ # IO.for_fd(f.fileno)
176
+ # # ...
177
+ # f.gets # may cause Errno::EBADF
178
+ #
179
+ # f = open("/dev/null")
180
+ # IO.for_fd(f.fileno).autoclose = false
181
+ # # ...
182
+ # f.gets # won't cause Errno::EBADF
183
+ #
184
+ def autoclose=: (bool) -> bool
115
185
 
116
186
  # Returns `true` if the underlying file descriptor of *ios* will be closed
117
- # automatically at its finalization, otherwise `false` .
187
+ # automatically at its finalization, otherwise `false`.
188
+ #
118
189
  def autoclose?: () -> bool
119
190
 
120
191
  # Puts *ios* into binary mode. Once a stream is in binary mode, it cannot
@@ -683,7 +754,12 @@ class IO < Object
683
754
 
684
755
  def self.write: (String name, _ToS arg0, ?Integer offset, ?external_encoding: String external_encoding, ?internal_encoding: String internal_encoding, ?encoding: String encoding, ?textmode: untyped textmode, ?binmode: untyped binmode, ?autoclose: untyped autoclose, ?mode: String mode) -> Integer
685
756
 
686
- def self.for_fd: (Integer fd, ?Integer mode, ?Integer opt) -> self
757
+ def self.for_fd: (int fd, ?(string | int) mode, **untyped opt) -> instance
758
+
759
+ alias self.open self.for_fd
760
+
761
+ def self.open: [A] (int fd, ?(string | int) mode, **untyped opt) { (instance) -> A } -> A
762
+ | ...
687
763
 
688
764
  def bytes: () { (Integer arg0) -> untyped } -> self
689
765
  | () -> ::Enumerator[Integer, self]
@@ -13,14 +13,14 @@
13
13
  module Kernel : BasicObject
14
14
  private
15
15
 
16
- def caller: (?Integer start_or_range, ?Integer length) -> ::Array[String]?
16
+ def self?.caller: (?Integer start_or_range, ?Integer length) -> ::Array[String]?
17
17
  | (?::Range[Integer] start_or_range) -> ::Array[String]?
18
18
  | () -> ::Array[String]
19
19
 
20
- def caller_locations: (?Integer start_or_range, ?Integer length) -> ::Array[Thread::Backtrace::Location]?
20
+ def self?.caller_locations: (?Integer start_or_range, ?Integer length) -> ::Array[Thread::Backtrace::Location]?
21
21
  | (?::Range[Integer] start_or_range) -> ::Array[Thread::Backtrace::Location]?
22
22
 
23
- def catch: [T] (T tag) { (T tag) -> untyped } -> untyped
23
+ def self?.catch: [T] (T tag) { (T tag) -> untyped } -> untyped
24
24
  | () { (Object tag) -> untyped } -> untyped
25
25
 
26
26
  # In a perfect world this should be:
@@ -38,10 +38,9 @@ module Kernel : BasicObject
38
38
  def define_singleton_method: (Symbol | String symbol, ?Proc | Method | UnboundMethod method) -> Symbol
39
39
  | (Symbol | String symbol) { () -> untyped } -> Symbol
40
40
 
41
- def eval: (String arg0, ?Binding arg1, ?String filename, ?Integer lineno) -> untyped
41
+ def self?.eval: (String arg0, ?Binding arg1, ?String filename, ?Integer lineno) -> untyped
42
42
 
43
43
  # Returns `true` if `yield` would execute a block in the current context.
44
- # The `iterator?` form is mildly deprecated.
45
44
  #
46
45
  # ```ruby
47
46
  # def try
@@ -55,8 +54,7 @@ module Kernel : BasicObject
55
54
  # try { "hello" } #=> "hello"
56
55
  # try do "hello" end #=> "hello"
57
56
  # ```
58
- def iterator?: () -> bool
59
- alias block_given? iterator?
57
+ def self?.block_given?: () -> bool
60
58
 
61
59
  # Returns the names of the current local variables.
62
60
  #
@@ -67,9 +65,9 @@ module Kernel : BasicObject
67
65
  # end
68
66
  # local_variables #=> [:fred, :i]
69
67
  # ```
70
- def local_variables: () -> ::Array[Symbol]
68
+ def self?.local_variables: () -> ::Array[Symbol]
71
69
 
72
- def srand: (?Numeric number) -> Numeric
70
+ def self?.srand: (?Numeric number) -> Numeric
73
71
 
74
72
  # Creates a subprocess. If a block is specified, that block is run in the
75
73
  # subprocess, and the subprocess terminates with a status of zero.
@@ -88,7 +86,7 @@ module Kernel : BasicObject
88
86
  #
89
87
  # Note that fork(2) is not available on some platforms like Windows and
90
88
  # NetBSD 4. Therefore you should use spawn() instead of fork().
91
- def fork: () -> Integer?
89
+ def self?.fork: () -> Integer?
92
90
  | () { () -> untyped } -> Integer?
93
91
 
94
92
  def initialize_copy: (self object) -> self
@@ -112,50 +110,50 @@ module Kernel : BasicObject
112
110
  # Array(nil) #=> []
113
111
  # Array(1) #=> [1]
114
112
  # ```
115
- def Array: (NilClass x) -> [ ]
113
+ def self?.Array: (NilClass x) -> [ ]
116
114
  | [T] (::Array[T] x) -> ::Array[T]
117
115
  | [T] (::Range[T] x) -> ::Array[T]
118
116
  | [K, V] (::Hash[K, V] x) -> ::Array[[K, V]]
119
117
  | [T] (T x) -> ::Array[T]
120
118
 
121
- def Complex: (Numeric | String x, ?Numeric | String y, ?exception: bool exception) -> Complex
119
+ def self?.Complex: (Numeric | String x, ?Numeric | String y, ?exception: bool exception) -> Complex
122
120
 
123
- def Float: (Numeric | String x, ?exception: bool exception) -> Float
121
+ def self?.Float: (Numeric | String x, ?exception: bool exception) -> Float
124
122
 
125
- def Hash: [K, V] (Object x) -> ::Hash[K, V]
123
+ def self?.Hash: [K, V] (Object x) -> ::Hash[K, V]
126
124
 
127
- def Integer: (Numeric | String arg, ?exception: bool exception) -> Integer
125
+ def self?.Integer: (Numeric | String arg, ?exception: bool exception) -> Integer
128
126
  | (String arg, ?Integer base, ?exception: bool exception) -> Integer
129
127
 
130
- def Rational: (Numeric | String | Object x, ?Numeric | String y, ?exception: bool exception) -> Rational
128
+ def self?.Rational: (Numeric | String | Object x, ?Numeric | String y, ?exception: bool exception) -> Rational
131
129
 
132
- def String: (Object x) -> String
130
+ def self?.String: (Object x) -> String
133
131
 
134
132
  # Returns the called name of the current method as a
135
133
  # [Symbol](https://ruby-doc.org/core-2.6.3/Symbol.html). If called
136
134
  # outside of a method, it returns `nil` .
137
- def __callee__: () -> Symbol?
135
+ def self?.__callee__: () -> Symbol?
138
136
 
139
137
  # Returns the canonicalized absolute path of the directory of the file
140
138
  # from which this method is called. It means symlinks in the path is
141
139
  # resolved. If `__FILE__` is `nil`, it returns `nil` . The return value
142
140
  # equals to `File.dirname(File.realpath(__FILE__))` .
143
- def __dir__: () -> String?
141
+ def self?.__dir__: () -> String?
144
142
 
145
143
  # Returns the name at the definition of the current method as a
146
144
  # [Symbol](https://ruby-doc.org/core-2.6.3/Symbol.html). If called
147
145
  # outside of a method, it returns `nil` .
148
- def __method__: () -> Symbol?
146
+ def self?.__method__: () -> Symbol?
149
147
 
150
- def `: (String arg0) -> String
148
+ def self?.`: (String arg0) -> String
151
149
 
152
- def abort: (?String msg) -> bot
150
+ def self?.abort: (?String msg) -> bot
153
151
 
154
- def at_exit: () { () -> untyped } -> Proc
152
+ def self?.at_exit: () { () -> untyped } -> Proc
155
153
 
156
- def autoload: (String | Symbol _module, String filename) -> NilClass
154
+ def self?.autoload: (String | Symbol _module, String filename) -> NilClass
157
155
 
158
- def autoload?: (Symbol | String name) -> String?
156
+ def self?.autoload?: (Symbol | String name) -> String?
159
157
 
160
158
  # Returns a `Binding` object, describing the variable and method bindings
161
159
  # at the point of call. This object can be used when calling `eval` to
@@ -169,7 +167,7 @@ module Kernel : BasicObject
169
167
  # b = get_binding("hello")
170
168
  # eval("param", b) #=> "hello"
171
169
  # ```
172
- def binding: () -> Binding
170
+ def self?.binding: () -> Binding
173
171
 
174
172
  # Initiates the termination of the Ruby script by raising the `SystemExit`
175
173
  # exception. This exception may be caught. The optional parameter is used
@@ -207,10 +205,10 @@ module Kernel : BasicObject
207
205
  #
208
206
  # at_exit function
209
207
  # in finalizer
210
- def exit: () -> bot
208
+ def self?.exit: () -> bot
211
209
  | (?Integer | TrueClass | FalseClass status) -> bot
212
210
 
213
- def exit!: (Integer | TrueClass | FalseClass status) -> bot
211
+ def self?.exit!: (Integer | TrueClass | FalseClass status) -> bot
214
212
 
215
213
  # With no arguments, raises the exception in `$!` or raises a
216
214
  # `RuntimeError` if `$!` is `nil` . With a single `String` argument,
@@ -230,24 +228,26 @@ module Kernel : BasicObject
230
228
  # “current” exception ( `$!` ) if any. An alternative value, either an
231
229
  # `Exception` object or `nil`, can be specified via the `:cause`
232
230
  # argument.
233
- def fail: () -> bot
231
+ def self?.fail: () -> bot
234
232
  | (String arg0) -> bot
235
233
  | (_Exception arg0, ?untyped arg1, ?::Array[String] arg2) -> bot
236
234
  alias raise fail
235
+ alias self.raise self.fail
237
236
 
238
- def format: (String format, *untyped args) -> String
237
+ def self?.format: (String format, *untyped args) -> String
239
238
  alias sprintf format
239
+ alias self.sprintf self.format
240
240
 
241
- def gets: (?String arg0, ?Integer arg1) -> String?
241
+ def self?.gets: (?String arg0, ?Integer arg1) -> String?
242
242
 
243
243
  # Returns an array of the names of global variables.
244
244
  #
245
245
  # ```ruby
246
246
  # global_variables.grep /std/ #=> [:$stdin, :$stdout, :$stderr]
247
247
  # ```
248
- def global_variables: () -> ::Array[Symbol]
248
+ def self?.global_variables: () -> ::Array[Symbol]
249
249
 
250
- def load: (String filename, ?boolish) -> bool
250
+ def self?.load: (String filename, ?boolish) -> bool
251
251
 
252
252
  # Repeatedly executes the block.
253
253
  #
@@ -277,10 +277,10 @@ module Kernel : BasicObject
277
277
  # puts enum.next
278
278
  # } #=> :ok
279
279
  # ```
280
- def loop: () { (nil) -> untyped } -> bot
280
+ def self?.loop: () { (nil) -> untyped } -> bot
281
281
  | () -> ::Enumerator[nil, bot]
282
282
 
283
- def open: (String name, ?String mode, ?Integer perm) -> IO?
283
+ def self?.open: (String name, ?String mode, ?Integer perm) -> IO?
284
284
  | [T] (String name, ?String mode, ?Integer perm) { (IO) -> T } -> T
285
285
 
286
286
  # Prints each object in turn to `$stdout` . If the output field separator
@@ -300,25 +300,25 @@ module Kernel : BasicObject
300
300
  #
301
301
  # cat12399
302
302
  # cat, 1, 2, 3, 99
303
- def print: (*Kernel args) -> nil
303
+ def self?.print: (*Kernel args) -> nil
304
304
 
305
- def printf: (IO arg0, String arg1, *untyped args) -> nil
305
+ def self?.printf: (IO arg0, String arg1, *untyped args) -> nil
306
306
  | (String arg1, *untyped args) -> nil
307
307
  | -> nil
308
308
 
309
- def proc: () { () -> untyped } -> Proc
309
+ def self?.proc: () { () -> untyped } -> Proc
310
310
 
311
- def lambda: () { () -> untyped } -> Proc
311
+ def self?.lambda: () { () -> untyped } -> Proc
312
312
 
313
- def putc: (Integer arg0) -> Integer
313
+ def self?.putc: (Integer arg0) -> Integer
314
314
  | (String arg0) -> String
315
315
 
316
- def puts: (*untyped arg0) -> NilClass
316
+ def self?.puts: (*untyped arg0) -> NilClass
317
317
 
318
- def p: [T] (T arg0) -> T
318
+ def self?.p: [T] (T arg0) -> T
319
319
  | (*untyped arg0) -> Array[untyped]
320
320
 
321
- def pp: [T] (T arg0) -> T
321
+ def self?.pp: [T] (T arg0) -> T
322
322
  | (*untyped arg0) -> Array[untyped]
323
323
 
324
324
  # If called without an argument, or if `max.to_i.abs == 0`, rand returns
@@ -356,31 +356,31 @@ module Kernel : BasicObject
356
356
  # See also
357
357
  # [Random\#rand](https://ruby-doc.org/core-2.6.3/Random.html#method-i-rand)
358
358
  # .
359
- def rand: () -> Float
359
+ def self?.rand: () -> Float
360
360
  | (Integer arg0) -> Integer
361
361
  | (::Range[Integer] arg0) -> Integer
362
362
  | (::Range[Float] arg0) -> Float
363
363
 
364
- def readline: (?String arg0, ?Integer arg1) -> String
364
+ def self?.readline: (?String arg0, ?Integer arg1) -> String
365
365
 
366
- def readlines: (?String arg0, ?Integer arg1) -> ::Array[String]
366
+ def self?.readlines: (?String arg0, ?Integer arg1) -> ::Array[String]
367
367
 
368
- def require: (String path) -> bool
368
+ def self?.require: (String path) -> bool
369
369
 
370
- def require_relative: (String feature) -> bool
370
+ def self?.require_relative: (String feature) -> bool
371
371
 
372
- def select: (::Array[IO] read, ?::Array[IO] write, ?::Array[IO] error, ?Integer timeout) -> ::Array[String]
372
+ def self?.select: (::Array[IO] read, ?::Array[IO] write, ?::Array[IO] error, ?Integer timeout) -> ::Array[String]
373
373
 
374
- def sleep: () -> bot
374
+ def self?.sleep: () -> bot
375
375
  | (Numeric duration) -> Integer
376
376
 
377
- def syscall: (Integer num, *untyped args) -> untyped
377
+ def self?.syscall: (Integer num, *untyped args) -> untyped
378
378
 
379
- def test: (String | Integer cmd, String | IO file1, ?String | IO file2) -> (TrueClass | FalseClass | Time | nil | Integer)
379
+ def self?.test: (String | Integer cmd, String | IO file1, ?String | IO file2) -> (TrueClass | FalseClass | Time | nil | Integer)
380
380
 
381
- def throw: (Object tag, ?untyped obj) -> bot
381
+ def self?.throw: (Object tag, ?untyped obj) -> bot
382
382
 
383
- def warn: (*untyped msg, ?uplevel: Integer | nil) -> NilClass
383
+ def self?.warn: (*untyped msg, ?uplevel: Integer | nil) -> NilClass
384
384
 
385
385
  # Replaces the current process by running the given external *command* ,
386
386
  # which can take one of the following forms:
@@ -461,7 +461,7 @@ module Kernel : BasicObject
461
461
  # exec "echo", "*" # echoes an asterisk
462
462
  # # never get here
463
463
  # ```
464
- def exec: (*String args) -> bot
464
+ def self?.exec: (*String args) -> bot
465
465
 
466
466
  # Executes *command…* in a subshell. *command…* is one of following forms.
467
467
  #
@@ -488,7 +488,7 @@ module Kernel : BasicObject
488
488
  # *
489
489
  #
490
490
  # See `Kernel.exec` for the standard shell.
491
- def system: (*String args) -> (NilClass | FalseClass | TrueClass)
491
+ def self?.system: (*String args) -> (NilClass | FalseClass | TrueClass)
492
492
  end
493
493
 
494
494
  Kernel::RUBYGEMS_ACTIVATION_MONITOR: untyped