rbs 4.0.0.dev.5 → 4.0.1.dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (194) hide show
  1. checksums.yaml +4 -4
  2. data/.clang-format +1 -0
  3. data/.github/workflows/c-check.yml +8 -4
  4. data/.github/workflows/comments.yml +3 -1
  5. data/.github/workflows/dependabot.yml +1 -1
  6. data/.github/workflows/ruby.yml +10 -0
  7. data/.github/workflows/rust.yml +95 -0
  8. data/CHANGELOG.md +323 -0
  9. data/Rakefile +12 -29
  10. data/Steepfile +1 -0
  11. data/config.yml +393 -37
  12. data/core/array.rbs +218 -188
  13. data/core/basic_object.rbs +9 -8
  14. data/core/class.rbs +6 -5
  15. data/core/comparable.rbs +45 -31
  16. data/core/complex.rbs +52 -40
  17. data/core/dir.rbs +57 -45
  18. data/core/encoding.rbs +5 -5
  19. data/core/enumerable.rbs +96 -91
  20. data/core/enumerator.rbs +4 -3
  21. data/core/errno.rbs +3 -2
  22. data/core/errors.rbs +31 -29
  23. data/core/exception.rbs +12 -12
  24. data/core/fiber.rbs +36 -36
  25. data/core/file.rbs +186 -113
  26. data/core/file_test.rbs +2 -2
  27. data/core/float.rbs +41 -32
  28. data/core/gc.rbs +78 -70
  29. data/core/hash.rbs +70 -60
  30. data/core/integer.rbs +32 -28
  31. data/core/io/buffer.rbs +36 -36
  32. data/core/io/wait.rbs +7 -7
  33. data/core/io.rbs +120 -135
  34. data/core/kernel.rbs +189 -139
  35. data/core/marshal.rbs +3 -3
  36. data/core/match_data.rbs +14 -12
  37. data/core/math.rbs +69 -67
  38. data/core/method.rbs +6 -6
  39. data/core/module.rbs +146 -85
  40. data/core/nil_class.rbs +4 -3
  41. data/core/numeric.rbs +35 -32
  42. data/core/object.rbs +6 -8
  43. data/core/object_space.rbs +11 -10
  44. data/core/pathname.rbs +131 -81
  45. data/core/proc.rbs +65 -33
  46. data/core/process.rbs +219 -201
  47. data/core/ractor.rbs +15 -11
  48. data/core/random.rbs +4 -3
  49. data/core/range.rbs +52 -47
  50. data/core/rational.rbs +5 -5
  51. data/core/rbs/unnamed/argf.rbs +58 -51
  52. data/core/rbs/unnamed/env_class.rbs +18 -13
  53. data/core/rbs/unnamed/main_class.rbs +123 -0
  54. data/core/rbs/unnamed/random.rbs +7 -5
  55. data/core/regexp.rbs +236 -197
  56. data/core/ruby.rbs +1 -1
  57. data/core/ruby_vm.rbs +32 -30
  58. data/core/rubygems/config_file.rbs +5 -5
  59. data/core/rubygems/errors.rbs +1 -1
  60. data/core/rubygems/requirement.rbs +5 -5
  61. data/core/rubygems/rubygems.rbs +5 -3
  62. data/core/set.rbs +17 -16
  63. data/core/signal.rbs +2 -2
  64. data/core/string.rbs +311 -292
  65. data/core/struct.rbs +26 -25
  66. data/core/symbol.rbs +25 -24
  67. data/core/thread.rbs +40 -34
  68. data/core/time.rbs +47 -42
  69. data/core/trace_point.rbs +34 -31
  70. data/core/true_class.rbs +2 -2
  71. data/core/unbound_method.rbs +10 -10
  72. data/core/warning.rbs +7 -7
  73. data/docs/collection.md +1 -1
  74. data/docs/config.md +171 -0
  75. data/docs/inline.md +110 -4
  76. data/docs/syntax.md +13 -12
  77. data/ext/rbs_extension/ast_translation.c +489 -135
  78. data/ext/rbs_extension/class_constants.c +8 -0
  79. data/ext/rbs_extension/class_constants.h +4 -0
  80. data/ext/rbs_extension/legacy_location.c +28 -51
  81. data/ext/rbs_extension/legacy_location.h +37 -0
  82. data/ext/rbs_extension/main.c +12 -20
  83. data/include/rbs/ast.h +423 -195
  84. data/include/rbs/lexer.h +2 -2
  85. data/include/rbs/location.h +25 -44
  86. data/include/rbs/parser.h +2 -2
  87. data/include/rbs/util/rbs_constant_pool.h +0 -3
  88. data/include/rbs.h +8 -0
  89. data/lib/rbs/ast/ruby/annotations.rb +157 -4
  90. data/lib/rbs/ast/ruby/members.rb +374 -22
  91. data/lib/rbs/cli/validate.rb +5 -60
  92. data/lib/rbs/collection/config/lockfile_generator.rb +6 -2
  93. data/lib/rbs/definition_builder.rb +60 -27
  94. data/lib/rbs/errors.rb +0 -11
  95. data/lib/rbs/inline_parser.rb +1 -1
  96. data/lib/rbs/parser_aux.rb +20 -7
  97. data/lib/rbs/prototype/helpers.rb +57 -0
  98. data/lib/rbs/prototype/rb.rb +1 -26
  99. data/lib/rbs/prototype/rbi.rb +1 -20
  100. data/lib/rbs/test/type_check.rb +3 -0
  101. data/lib/rbs/types.rb +62 -52
  102. data/lib/rbs/unit_test/type_assertions.rb +35 -8
  103. data/lib/rbs/version.rb +1 -1
  104. data/lib/rbs.rb +0 -1
  105. data/rbs.gemspec +1 -1
  106. data/rust/.gitignore +1 -0
  107. data/rust/Cargo.lock +378 -0
  108. data/rust/Cargo.toml +7 -0
  109. data/rust/ruby-rbs/Cargo.toml +22 -0
  110. data/rust/ruby-rbs/build.rs +764 -0
  111. data/rust/ruby-rbs/examples/locations.rs +60 -0
  112. data/rust/ruby-rbs/src/lib.rs +1 -0
  113. data/rust/ruby-rbs/src/node/mod.rs +742 -0
  114. data/rust/ruby-rbs/tests/sanity.rs +47 -0
  115. data/rust/ruby-rbs/vendor/rbs/config.yml +1 -0
  116. data/rust/ruby-rbs-sys/Cargo.toml +23 -0
  117. data/rust/ruby-rbs-sys/build.rs +204 -0
  118. data/rust/ruby-rbs-sys/src/lib.rs +50 -0
  119. data/rust/ruby-rbs-sys/vendor/rbs/include +1 -0
  120. data/rust/ruby-rbs-sys/vendor/rbs/src +1 -0
  121. data/rust/ruby-rbs-sys/wrapper.h +1 -0
  122. data/sig/ast/ruby/annotations.rbs +191 -4
  123. data/sig/ast/ruby/members.rbs +21 -1
  124. data/sig/cli/validate.rbs +1 -6
  125. data/sig/definition_builder.rbs +2 -0
  126. data/sig/errors.rbs +0 -8
  127. data/sig/method_types.rbs +1 -1
  128. data/sig/parser.rbs +17 -13
  129. data/sig/prototype/helpers.rbs +2 -0
  130. data/sig/types.rbs +10 -11
  131. data/sig/unit_test/spy.rbs +0 -8
  132. data/sig/unit_test/type_assertions.rbs +11 -0
  133. data/src/ast.c +339 -161
  134. data/src/lexstate.c +1 -1
  135. data/src/location.c +7 -47
  136. data/src/parser.c +674 -480
  137. data/src/util/rbs_constant_pool.c +0 -4
  138. data/stdlib/bigdecimal/0/big_decimal.rbs +16 -16
  139. data/stdlib/cgi-escape/0/escape.rbs +4 -4
  140. data/stdlib/coverage/0/coverage.rbs +4 -3
  141. data/stdlib/date/0/date.rbs +33 -28
  142. data/stdlib/date/0/date_time.rbs +24 -23
  143. data/stdlib/did_you_mean/0/did_you_mean.rbs +17 -16
  144. data/stdlib/erb/0/erb.rbs +64 -53
  145. data/stdlib/etc/0/etc.rbs +55 -50
  146. data/stdlib/fileutils/0/fileutils.rbs +138 -125
  147. data/stdlib/forwardable/0/forwardable.rbs +10 -10
  148. data/stdlib/io-console/0/io-console.rbs +2 -2
  149. data/stdlib/json/0/json.rbs +135 -108
  150. data/stdlib/monitor/0/monitor.rbs +3 -3
  151. data/stdlib/net-http/0/net-http.rbs +159 -134
  152. data/stdlib/objspace/0/objspace.rbs +8 -7
  153. data/stdlib/open-uri/0/open-uri.rbs +8 -8
  154. data/stdlib/open3/0/open3.rbs +36 -35
  155. data/stdlib/openssl/0/openssl.rbs +144 -129
  156. data/stdlib/optparse/0/optparse.rbs +18 -14
  157. data/stdlib/pathname/0/pathname.rbs +2 -2
  158. data/stdlib/pp/0/pp.rbs +9 -8
  159. data/stdlib/prettyprint/0/prettyprint.rbs +7 -7
  160. data/stdlib/pstore/0/pstore.rbs +35 -30
  161. data/stdlib/psych/0/psych.rbs +61 -8
  162. data/stdlib/psych/0/store.rbs +2 -4
  163. data/stdlib/pty/0/pty.rbs +9 -6
  164. data/stdlib/random-formatter/0/random-formatter.rbs +2 -2
  165. data/stdlib/ripper/0/ripper.rbs +20 -17
  166. data/stdlib/securerandom/0/securerandom.rbs +1 -1
  167. data/stdlib/shellwords/0/shellwords.rbs +2 -2
  168. data/stdlib/socket/0/addrinfo.rbs +7 -7
  169. data/stdlib/socket/0/basic_socket.rbs +3 -3
  170. data/stdlib/socket/0/ip_socket.rbs +10 -8
  171. data/stdlib/socket/0/socket.rbs +10 -9
  172. data/stdlib/socket/0/tcp_server.rbs +1 -1
  173. data/stdlib/socket/0/tcp_socket.rbs +1 -1
  174. data/stdlib/socket/0/udp_socket.rbs +1 -1
  175. data/stdlib/socket/0/unix_server.rbs +1 -1
  176. data/stdlib/stringio/0/stringio.rbs +55 -54
  177. data/stdlib/strscan/0/string_scanner.rbs +46 -44
  178. data/stdlib/tempfile/0/tempfile.rbs +24 -20
  179. data/stdlib/time/0/time.rbs +7 -5
  180. data/stdlib/tsort/0/tsort.rbs +7 -6
  181. data/stdlib/uri/0/common.rbs +26 -18
  182. data/stdlib/uri/0/file.rbs +2 -2
  183. data/stdlib/uri/0/generic.rbs +2 -2
  184. data/stdlib/uri/0/http.rbs +2 -2
  185. data/stdlib/uri/0/ldap.rbs +2 -2
  186. data/stdlib/uri/0/mailto.rbs +3 -3
  187. data/stdlib/uri/0/rfc2396_parser.rbs +6 -5
  188. data/stdlib/zlib/0/deflate.rbs +4 -3
  189. data/stdlib/zlib/0/gzip_reader.rbs +4 -4
  190. data/stdlib/zlib/0/gzip_writer.rbs +14 -12
  191. data/stdlib/zlib/0/inflate.rbs +1 -1
  192. data/stdlib/zlib/0/need_dict.rbs +1 -1
  193. metadata +23 -5
  194. data/.github/workflows/valgrind.yml +0 -42
@@ -35,8 +35,8 @@ module Zlib
35
35
  # Be careful of the footer of the gzip file. A gzip file has the checksum of
36
36
  # pre-compressed data in its footer. GzipReader checks all uncompressed data
37
37
  # against that checksum at the following cases, and if it fails, raises
38
- # `Zlib::GzipFile::NoFooter`, `Zlib::GzipFile::CRCError`, or
39
- # `Zlib::GzipFile::LengthError` exception.
38
+ # <code>Zlib::GzipFile::NoFooter</code>, <code>Zlib::GzipFile::CRCError</code>,
39
+ # or <code>Zlib::GzipFile::LengthError</code> exception.
40
40
  #
41
41
  # * When an reading request is received beyond the end of file (the end of
42
42
  # compressed data). That is, when Zlib::GzipReader#read,
@@ -282,8 +282,8 @@ module Zlib
282
282
  # `read` method that behaves same as the IO#read.
283
283
  #
284
284
  # The `options` hash may be used to set the encoding of the data.
285
- # `:external_encoding`, `:internal_encoding` and `:encoding` may be set as in
286
- # IO::new.
285
+ # <code>:external_encoding</code>, <code>:internal_encoding</code> and
286
+ # <code>:encoding</code> may be set as in IO::new.
287
287
  #
288
288
  # If the gzip file header is incorrect, raises an Zlib::GzipFile::Error
289
289
  # exception.
@@ -38,7 +38,8 @@ module Zlib
38
38
  # returns a GzipWriter object associated with that file. Further details of
39
39
  # this method are found in Zlib::GzipWriter.new and Zlib::GzipFile.wrap.
40
40
  #
41
- def self.open: (String filename) { (instance gz) -> void } -> instance
41
+ def self.open: (String filename, ?Integer level, ?Integer strategy, **untyped opts) -> instance
42
+ | (String filename, ?Integer level, ?Integer strategy, **untyped opts) { (instance gz) -> void } -> nil
42
43
 
43
44
  # <!--
44
45
  # rdoc-file=ext/zlib/zlib.c
@@ -61,10 +62,11 @@ module Zlib
61
62
  # - flush(flush=nil)
62
63
  # -->
63
64
  # Flushes all the internal buffers of the GzipWriter object. The meaning of
64
- # `flush` is same as in Zlib::Deflate#deflate. `Zlib::SYNC_FLUSH` is used if
65
- # `flush` is omitted. It is no use giving flush `Zlib::NO_FLUSH`.
65
+ # `flush` is same as in Zlib::Deflate#deflate. <code>Zlib::SYNC_FLUSH</code> is
66
+ # used if `flush` is omitted. It is no use giving flush
67
+ # <code>Zlib::NO_FLUSH</code>.
66
68
  #
67
- def flush: (?Integer flush) -> String
69
+ def flush: (?Integer flush) -> self
68
70
 
69
71
  # <!--
70
72
  # rdoc-file=ext/zlib/zlib.c
@@ -74,16 +76,16 @@ module Zlib
74
76
  #
75
77
  # Setting the mtime in the gzip header does not effect the mtime of the file
76
78
  # generated. Different utilities that expand the gzipped files may use the mtime
77
- # header. For example the gunzip utility can use the `-N` flag which will set
78
- # the resultant file's mtime to the value in the header. By default many tools
79
- # will set the mtime of the expanded file to the mtime of the gzipped file, not
80
- # the mtime in the header.
79
+ # header. For example the gunzip utility can use the <code>-N</code> flag which
80
+ # will set the resultant file's mtime to the value in the header. By default
81
+ # many tools will set the mtime of the expanded file to the mtime of the gzipped
82
+ # file, not the mtime in the header.
81
83
  #
82
84
  # If you do not set an mtime, the default value will be the time when
83
85
  # compression started. Setting a value of 0 indicates no time stamp is
84
86
  # available.
85
87
  #
86
- def mtime=: (path | IO file_name) -> Time
88
+ def mtime=: (Time | Integer) -> void
87
89
 
88
90
  # <!--
89
91
  # rdoc-file=ext/zlib/zlib.c
@@ -158,9 +160,9 @@ module Zlib
158
160
  # that behaves the same as IO#write.
159
161
  #
160
162
  # The `options` hash may be used to set the encoding of the data.
161
- # `:external_encoding`, `:internal_encoding` and `:encoding` may be set as in
162
- # IO::new.
163
+ # <code>:external_encoding</code>, <code>:internal_encoding</code> and
164
+ # <code>:encoding</code> may be set as in IO::new.
163
165
  #
164
- def initialize: (_Writer io, Integer level, Integer strategy, **untyped opts) -> void
166
+ def initialize: (_Writer io, ?Integer? level, ?Integer? strategy, **untyped opts) -> void
165
167
  end
166
168
  end
@@ -123,7 +123,7 @@ module Zlib
123
123
  #
124
124
  # What is this?
125
125
  #
126
- # `:)`
126
+ # <code>:)</code>
127
127
  #
128
128
  def sync_point?: () -> bool
129
129
 
@@ -6,7 +6,7 @@ module Zlib
6
6
  # When zlib returns a Z_NEED_DICT if a preset dictionary is needed at this
7
7
  # point.
8
8
  #
9
- # Used by Zlib::Inflate.inflate and `Zlib.inflate`
9
+ # Used by Zlib::Inflate.inflate and <code>Zlib.inflate</code>
10
10
  #
11
11
  class NeedDict < Zlib::Error
12
12
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbs
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0.dev.5
4
+ version: 4.0.1.dev.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Soutaro Matsumoto
@@ -29,14 +29,14 @@ dependencies:
29
29
  requirements:
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 1.3.0
32
+ version: 1.6.0
33
33
  type: :runtime
34
34
  prerelease: false
35
35
  version_requirements: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - ">="
38
38
  - !ruby/object:Gem::Version
39
- version: 1.3.0
39
+ version: 1.6.0
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: tsort
42
42
  requirement: !ruby/object:Gem::Requirement
@@ -69,8 +69,8 @@ files:
69
69
  - ".github/workflows/comments.yml"
70
70
  - ".github/workflows/dependabot.yml"
71
71
  - ".github/workflows/ruby.yml"
72
+ - ".github/workflows/rust.yml"
72
73
  - ".github/workflows/typecheck.yml"
73
- - ".github/workflows/valgrind.yml"
74
74
  - ".github/workflows/windows.yml"
75
75
  - ".gitignore"
76
76
  - ".rubocop.yml"
@@ -136,6 +136,7 @@ files:
136
136
  - core/rb_config.rbs
137
137
  - core/rbs/unnamed/argf.rbs
138
138
  - core/rbs/unnamed/env_class.rbs
139
+ - core/rbs/unnamed/main_class.rbs
139
140
  - core/rbs/unnamed/random.rbs
140
141
  - core/refinement.rbs
141
142
  - core/regexp.rbs
@@ -172,6 +173,7 @@ files:
172
173
  - docs/aliases.md
173
174
  - docs/architecture.md
174
175
  - docs/collection.md
176
+ - docs/config.md
175
177
  - docs/data_and_struct.md
176
178
  - docs/encoding.md
177
179
  - docs/gem.md
@@ -313,6 +315,22 @@ files:
313
315
  - lib/rdoc/discover.rb
314
316
  - lib/rdoc_plugin/parser.rb
315
317
  - rbs.gemspec
318
+ - rust/.gitignore
319
+ - rust/Cargo.lock
320
+ - rust/Cargo.toml
321
+ - rust/ruby-rbs-sys/Cargo.toml
322
+ - rust/ruby-rbs-sys/build.rs
323
+ - rust/ruby-rbs-sys/src/lib.rs
324
+ - rust/ruby-rbs-sys/vendor/rbs/include
325
+ - rust/ruby-rbs-sys/vendor/rbs/src
326
+ - rust/ruby-rbs-sys/wrapper.h
327
+ - rust/ruby-rbs/Cargo.toml
328
+ - rust/ruby-rbs/build.rs
329
+ - rust/ruby-rbs/examples/locations.rs
330
+ - rust/ruby-rbs/src/lib.rs
331
+ - rust/ruby-rbs/src/node/mod.rs
332
+ - rust/ruby-rbs/tests/sanity.rs
333
+ - rust/ruby-rbs/vendor/rbs/config.yml
316
334
  - schema/annotation.json
317
335
  - schema/comment.json
318
336
  - schema/decls.json
@@ -622,7 +640,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
622
640
  - !ruby/object:Gem::Version
623
641
  version: '0'
624
642
  requirements: []
625
- rubygems_version: 3.6.9
643
+ rubygems_version: 4.0.3
626
644
  specification_version: 4
627
645
  summary: Type signature for Ruby.
628
646
  test_files: []
@@ -1,42 +0,0 @@
1
- name: Valgrind
2
-
3
- on:
4
- push:
5
- branches:
6
- - master
7
- paths:
8
- - "ext/**"
9
- - "include/**"
10
- - "src/**"
11
- pull_request:
12
- paths:
13
- - "ext/**"
14
- - "include/**"
15
- - "src/**"
16
- merge_group: {}
17
-
18
- jobs:
19
- valgrind:
20
- runs-on: ubuntu-latest
21
- steps:
22
- - uses: actions/checkout@v6
23
- - uses: ruby/setup-ruby@v1
24
- with:
25
- ruby-version: "3.4"
26
- bundler-cache: none
27
- - name: Set working directory as safe
28
- run: git config --global --add safe.directory $(pwd)
29
- - name: Install dependencies
30
- run: |
31
- sudo apt-get update
32
- sudo apt-get install -y libdb-dev curl autoconf automake m4 libtool python3 valgrind
33
- - name: Update rubygems & bundler
34
- run: |
35
- ruby -v
36
- gem update --system
37
- - name: bin/setup
38
- run: |
39
- bin/setup
40
- - run: bundle exec rake test:valgrind
41
- env:
42
- RUBY_FREE_AT_EXIT: 1