rbs 0.9.1 → 0.12.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +9 -9
  3. data/CHANGELOG.md +31 -0
  4. data/Gemfile +1 -0
  5. data/README.md +1 -1
  6. data/Rakefile +16 -6
  7. data/Steepfile +28 -0
  8. data/bin/steep +4 -0
  9. data/bin/test_runner.rb +7 -5
  10. data/docs/syntax.md +14 -1
  11. data/lib/rbs/ast/comment.rb +7 -1
  12. data/lib/rbs/ast/declarations.rb +15 -9
  13. data/lib/rbs/ast/members.rb +3 -8
  14. data/lib/rbs/buffer.rb +1 -1
  15. data/lib/rbs/cli.rb +62 -1
  16. data/lib/rbs/definition.rb +35 -16
  17. data/lib/rbs/definition_builder.rb +99 -68
  18. data/lib/rbs/environment.rb +24 -11
  19. data/lib/rbs/environment_loader.rb +55 -35
  20. data/lib/rbs/location.rb +1 -5
  21. data/lib/rbs/method_type.rb +5 -5
  22. data/lib/rbs/namespace.rb +14 -3
  23. data/lib/rbs/parser.y +2 -12
  24. data/lib/rbs/prototype/rb.rb +3 -5
  25. data/lib/rbs/prototype/rbi.rb +1 -4
  26. data/lib/rbs/prototype/runtime.rb +0 -4
  27. data/lib/rbs/substitution.rb +4 -3
  28. data/lib/rbs/test/hook.rb +1 -0
  29. data/lib/rbs/test/setup.rb +8 -6
  30. data/lib/rbs/test/setup_helper.rb +15 -0
  31. data/lib/rbs/test/tester.rb +55 -11
  32. data/lib/rbs/test/type_check.rb +43 -14
  33. data/lib/rbs/type_name.rb +18 -1
  34. data/lib/rbs/type_name_resolver.rb +10 -3
  35. data/lib/rbs/types.rb +27 -21
  36. data/lib/rbs/variance_calculator.rb +8 -5
  37. data/lib/rbs/version.rb +1 -1
  38. data/lib/rbs/writer.rb +7 -3
  39. data/sig/annotation.rbs +26 -0
  40. data/sig/buffer.rbs +28 -0
  41. data/sig/builtin_names.rbs +41 -0
  42. data/sig/comment.rbs +26 -0
  43. data/sig/declarations.rbs +202 -0
  44. data/sig/definition.rbs +129 -0
  45. data/sig/definition_builder.rbs +95 -0
  46. data/sig/environment.rbs +94 -0
  47. data/sig/environment_loader.rbs +4 -0
  48. data/sig/location.rbs +52 -0
  49. data/sig/members.rbs +160 -0
  50. data/sig/method_types.rbs +40 -0
  51. data/sig/namespace.rbs +124 -0
  52. data/sig/polyfill.rbs +3 -0
  53. data/sig/rbs.rbs +3 -0
  54. data/sig/substitution.rbs +39 -0
  55. data/sig/type_name_resolver.rbs +24 -0
  56. data/sig/typename.rbs +70 -0
  57. data/sig/types.rbs +361 -0
  58. data/sig/util.rbs +13 -0
  59. data/sig/variance_calculator.rbs +35 -0
  60. data/stdlib/bigdecimal/big_decimal.rbs +887 -0
  61. data/stdlib/bigdecimal/math/big_math.rbs +142 -0
  62. data/stdlib/builtin/array.rbs +2 -1
  63. data/stdlib/builtin/builtin.rbs +0 -3
  64. data/stdlib/builtin/hash.rbs +1 -1
  65. data/stdlib/builtin/math.rbs +26 -26
  66. data/stdlib/builtin/struct.rbs +9 -10
  67. data/stdlib/date/date.rbs +1056 -0
  68. data/stdlib/date/date_time.rbs +582 -0
  69. data/stdlib/forwardable/forwardable.rbs +204 -0
  70. data/stdlib/pty/pty.rbs +5 -29
  71. data/stdlib/set/set.rbs +1 -1
  72. data/stdlib/uri/file.rbs +167 -0
  73. data/stdlib/uri/generic.rbs +875 -0
  74. data/stdlib/zlib/zlib.rbs +392 -0
  75. data/steep/Gemfile +3 -0
  76. data/steep/Gemfile.lock +55 -0
  77. metadata +38 -5
@@ -0,0 +1,392 @@
1
+ # This module provides access to the [zlib library](http://zlib.net). Zlib is
2
+ # designed to be a portable, free, general-purpose, legally unencumbered -- that
3
+ # is, not covered by any patents -- lossless data-compression library for use on
4
+ # virtually any computer hardware and operating system.
5
+ #
6
+ # The zlib compression library provides in-memory compression and decompression
7
+ # functions, including integrity checks of the uncompressed data.
8
+ #
9
+ # The zlib compressed data format is described in RFC 1950, which is a wrapper
10
+ # around a deflate stream which is described in RFC 1951.
11
+ #
12
+ # The library also supports reading and writing files in gzip (.gz) format with
13
+ # an interface similar to that of IO. The gzip format is described in RFC 1952
14
+ # which is also a wrapper around a deflate stream.
15
+ #
16
+ # The zlib format was designed to be compact and fast for use in memory and on
17
+ # communications channels. The gzip format was designed for single-file
18
+ # compression on file systems, has a larger header than zlib to maintain
19
+ # directory information, and uses a different, slower check method than zlib.
20
+ #
21
+ # See your system's zlib.h for further information about zlib
22
+ #
23
+ # ## Sample usage
24
+ #
25
+ # Using the wrapper to compress strings with default parameters is quite simple:
26
+ #
27
+ # require "zlib"
28
+ #
29
+ # data_to_compress = File.read("don_quixote.txt")
30
+ #
31
+ # puts "Input size: #{data_to_compress.size}"
32
+ # #=> Input size: 2347740
33
+ #
34
+ # data_compressed = Zlib::Deflate.deflate(data_to_compress)
35
+ #
36
+ # puts "Compressed size: #{data_compressed.size}"
37
+ # #=> Compressed size: 887238
38
+ #
39
+ # uncompressed_data = Zlib::Inflate.inflate(data_compressed)
40
+ #
41
+ # puts "Uncompressed data is: #{uncompressed_data}"
42
+ # #=> Uncompressed data is: The Project Gutenberg EBook of Don Quixote...
43
+ #
44
+ # ## Class tree
45
+ #
46
+ # * Zlib::Deflate
47
+ # * Zlib::Inflate
48
+ # * Zlib::ZStream
49
+ # * Zlib::Error
50
+ # * Zlib::StreamEnd
51
+ # * Zlib::NeedDict
52
+ # * Zlib::DataError
53
+ # * Zlib::StreamError
54
+ # * Zlib::MemError
55
+ # * Zlib::BufError
56
+ # * Zlib::VersionError
57
+ #
58
+ #
59
+ #
60
+ # (if you have GZIP_SUPPORT)
61
+ # * Zlib::GzipReader
62
+ # * Zlib::GzipWriter
63
+ # * Zlib::GzipFile
64
+ # * Zlib::GzipFile::Error
65
+ # * Zlib::GzipFile::LengthError
66
+ # * Zlib::GzipFile::CRCError
67
+ # * Zlib::GzipFile::NoFooter
68
+ #
69
+ #
70
+ #
71
+ module Zlib
72
+ # Calculates Adler-32 checksum for `string`, and returns updated value of
73
+ # `adler`. If `string` is omitted, it returns the Adler-32 initial value. If
74
+ # `adler` is omitted, it assumes that the initial value is given to `adler`.
75
+ #
76
+ # Example usage:
77
+ #
78
+ # require "zlib"
79
+ #
80
+ # data = "foo"
81
+ # puts "Adler32 checksum: #{Zlib.adler32(data).to_s(16)}"
82
+ # #=> Adler32 checksum: 2820145
83
+ #
84
+ def self.adler32: () -> Integer
85
+ | (String) -> Integer
86
+ | (String, Integer) -> Integer
87
+
88
+ # Combine two Adler-32 check values in to one. `alder1` is the first Adler-32
89
+ # value, `adler2` is the second Adler-32 value. `len2` is the length of the
90
+ # string used to generate `adler2`.
91
+ #
92
+ def self.adler32_combine: (Integer, Integer, Integer) -> Integer
93
+
94
+ # Calculates CRC checksum for `string`, and returns updated value of `crc`. If
95
+ # `string` is omitted, it returns the CRC initial value. If `crc` is omitted, it
96
+ # assumes that the initial value is given to `crc`.
97
+ #
98
+ # FIXME: expression.
99
+ #
100
+ def self.crc32: () -> Integer
101
+ | (String) -> Integer
102
+ | (String, Integer) -> Integer
103
+
104
+ # Combine two CRC-32 check values in to one. `crc1` is the first CRC-32 value,
105
+ # `crc2` is the second CRC-32 value. `len2` is the length of the string used to
106
+ # generate `crc2`.
107
+ #
108
+ def self.crc32_combine: (Integer, Integer, Integer) -> Integer
109
+
110
+ # Returns the table for calculating CRC checksum as an array.
111
+ #
112
+ def self.crc_table: () -> Array[Integer]
113
+
114
+ # Compresses the given `string`. Valid values of level are Zlib::NO_COMPRESSION,
115
+ # Zlib::BEST_SPEED, Zlib::BEST_COMPRESSION, Zlib::DEFAULT_COMPRESSION, or an
116
+ # integer from 0 to 9.
117
+ #
118
+ # This method is almost equivalent to the following code:
119
+ #
120
+ # def deflate(string, level)
121
+ # z = Zlib::Deflate.new(level)
122
+ # dst = z.deflate(string, Zlib::FINISH)
123
+ # z.close
124
+ # dst
125
+ # end
126
+ #
127
+ # See also Zlib.inflate
128
+ #
129
+ def self.deflate: (String) -> String
130
+ | (String, Integer) -> String
131
+ # Decode the given gzipped `string`.
132
+ #
133
+ # This method is almost equivalent to the following code:
134
+ #
135
+ # def gunzip(string)
136
+ # sio = StringIO.new(string)
137
+ # gz = Zlib::GzipReader.new(sio, encoding: Encoding::ASCII_8BIT)
138
+ # gz.read
139
+ # ensure
140
+ # gz&.close
141
+ # end
142
+ #
143
+ # See also Zlib.gzip
144
+ #
145
+ def self.gunzip: (String) -> String
146
+
147
+ # Gzip the given `string`. Valid values of level are Zlib::NO_COMPRESSION,
148
+ # Zlib::BEST_SPEED, Zlib::BEST_COMPRESSION, Zlib::DEFAULT_COMPRESSION (default),
149
+ # or an integer from 0 to 9.
150
+ #
151
+ # This method is almost equivalent to the following code:
152
+ #
153
+ # def gzip(string, level: nil, strategy: nil)
154
+ # sio = StringIO.new
155
+ # sio.binmode
156
+ # gz = Zlib::GzipWriter.new(sio, level, strategy)
157
+ # gz.write(string)
158
+ # gz.close
159
+ # sio.string
160
+ # end
161
+ #
162
+ # See also Zlib.gunzip
163
+ #
164
+ def self.gzip: (String) -> String
165
+ | (String, level: Integer) -> String
166
+ | (String, strategy: Integer) -> String
167
+ | (String, level: Integer, strategy: Integer) -> String
168
+ # Decompresses `string`. Raises a Zlib::NeedDict exception if a preset
169
+ # dictionary is needed for decompression.
170
+ #
171
+ # This method is almost equivalent to the following code:
172
+ #
173
+ # def inflate(string)
174
+ # zstream = Zlib::Inflate.new
175
+ # buf = zstream.inflate(string)
176
+ # zstream.finish
177
+ # zstream.close
178
+ # buf
179
+ # end
180
+ #
181
+ # See also Zlib.deflate
182
+ #
183
+ def self.inflate: (String) -> String
184
+
185
+ # Returns the string which represents the version of zlib library.
186
+ #
187
+ def self.zlib_version: () -> String
188
+ end
189
+
190
+ # Represents text data as guessed by deflate.
191
+ #
192
+ # NOTE: The underlying constant Z_ASCII was deprecated in favor of Z_TEXT in
193
+ # zlib 1.2.2. New applications should not use this constant.
194
+ #
195
+ # See Zlib::Deflate#data_type.
196
+ #
197
+ #
198
+ Zlib::ASCII: Integer
199
+
200
+ # Slowest compression level, but with the best space savings.
201
+ #
202
+ #
203
+ Zlib::BEST_COMPRESSION: Integer
204
+
205
+ # Fastest compression level, but with the lowest space savings.
206
+ #
207
+ #
208
+ Zlib::BEST_SPEED: Integer
209
+
210
+ # Represents binary data as guessed by deflate.
211
+ #
212
+ # See Zlib::Deflate#data_type.
213
+ #
214
+ #
215
+ Zlib::BINARY: Integer
216
+
217
+ # Default compression level which is a good trade-off between space and time
218
+ #
219
+ Zlib::DEFAULT_COMPRESSION: Integer
220
+
221
+ # Default deflate strategy which is used for normal data.
222
+ #
223
+ #
224
+ Zlib::DEFAULT_STRATEGY: Integer
225
+
226
+ # The default memory level for allocating zlib deflate compression state.
227
+ #
228
+ Zlib::DEF_MEM_LEVEL: Integer
229
+
230
+ # Deflate strategy for data produced by a filter (or predictor). The effect of
231
+ # FILTERED is to force more Huffman codes and less string matching; it is
232
+ # somewhat intermediate between DEFAULT_STRATEGY and HUFFMAN_ONLY. Filtered data
233
+ # consists mostly of small values with a somewhat random distribution.
234
+ #
235
+ Zlib::FILTERED: Integer
236
+
237
+ # Processes all pending input and flushes pending output.
238
+ #
239
+ #
240
+ Zlib::FINISH: Integer
241
+
242
+ # Deflate strategy which prevents the use of dynamic Huffman codes, allowing for
243
+ # a simpler decoder for specialized applications.
244
+ #
245
+ Zlib::FIXED: Integer
246
+
247
+ # Flushes all output as with SYNC_FLUSH, and the compression state is reset so
248
+ # that decompression can restart from this point if previous compressed data has
249
+ # been damaged or if random access is desired. Like SYNC_FLUSH, using FULL_FLUSH
250
+ # too often can seriously degrade compression.
251
+ #
252
+ Zlib::FULL_FLUSH: Integer
253
+
254
+ # Deflate strategy which uses Huffman codes only (no string matching).
255
+ #
256
+ #
257
+ Zlib::HUFFMAN_ONLY: Integer
258
+
259
+ # The maximum memory level for allocating zlib deflate compression state.
260
+ #
261
+ Zlib::MAX_MEM_LEVEL: Integer
262
+
263
+ # The maximum size of the zlib history buffer. Note that zlib allows larger
264
+ # values to enable different inflate modes. See Zlib::Inflate.new for details.
265
+ #
266
+ Zlib::MAX_WBITS: Integer
267
+
268
+ # No compression, passes through data untouched. Use this for appending
269
+ # pre-compressed data to a deflate stream.
270
+ #
271
+ Zlib::NO_COMPRESSION: Integer
272
+
273
+ # NO_FLUSH is the default flush method and allows deflate to decide how much
274
+ # data to accumulate before producing output in order to maximize compression.
275
+ #
276
+ Zlib::NO_FLUSH: Integer
277
+
278
+ # OS code for Amiga hosts
279
+ #
280
+ #
281
+ Zlib::OS_AMIGA: Integer
282
+
283
+ # OS code for Atari hosts
284
+ #
285
+ #
286
+ Zlib::OS_ATARI: Integer
287
+
288
+ # The OS code of current host
289
+ #
290
+ #
291
+ Zlib::OS_CODE: Integer
292
+
293
+ # OS code for CP/M hosts
294
+ #
295
+ #
296
+ Zlib::OS_CPM: Integer
297
+
298
+ # OS code for Mac OS hosts
299
+ #
300
+ #
301
+ Zlib::OS_MACOS: Integer
302
+
303
+ # OS code for MSDOS hosts
304
+ #
305
+ #
306
+ Zlib::OS_MSDOS: Integer
307
+
308
+ # OS code for OS2 hosts
309
+ #
310
+ #
311
+ Zlib::OS_OS2: Integer
312
+
313
+ # OS code for QDOS hosts
314
+ #
315
+ #
316
+ Zlib::OS_QDOS: Integer
317
+
318
+ # OS code for RISC OS hosts
319
+ #
320
+ #
321
+ Zlib::OS_RISCOS: Integer
322
+
323
+ # OS code for TOPS-20 hosts
324
+ #
325
+ #
326
+ Zlib::OS_TOPS20: Integer
327
+
328
+ # OS code for UNIX hosts
329
+ #
330
+ #
331
+ Zlib::OS_UNIX: Integer
332
+
333
+ # OS code for unknown hosts
334
+ #
335
+ #
336
+ Zlib::OS_UNKNOWN: Integer
337
+
338
+ # OS code for VM OS hosts
339
+ #
340
+ #
341
+ Zlib::OS_VMCMS: Integer
342
+
343
+ # OS code for VMS hosts
344
+ #
345
+ #
346
+ Zlib::OS_VMS: Integer
347
+
348
+ # OS code for Win32 hosts
349
+ #
350
+ #
351
+ Zlib::OS_WIN32: Integer
352
+
353
+ # OS code for Z-System hosts
354
+ #
355
+ #
356
+ Zlib::OS_ZSYSTEM: Integer
357
+
358
+ # Deflate compression strategy designed to be almost as fast as HUFFMAN_ONLY,
359
+ # but give better compression for PNG image data.
360
+ #
361
+ Zlib::RLE: Integer
362
+
363
+ # The SYNC_FLUSH method flushes all pending output to the output buffer and the
364
+ # output is aligned on a byte boundary. Flushing may degrade compression so it
365
+ # should be used only when necessary, such as at a request or response boundary
366
+ # for a network stream.
367
+ #
368
+ Zlib::SYNC_FLUSH: Integer
369
+
370
+ # Represents text data as guessed by deflate.
371
+ #
372
+ # See Zlib::Deflate#data_type.
373
+ #
374
+ #
375
+ Zlib::TEXT: Integer
376
+
377
+ # Represents an unknown data type as guessed by deflate.
378
+ #
379
+ # See Zlib::Deflate#data_type.
380
+ #
381
+ #
382
+ Zlib::UNKNOWN: Integer
383
+
384
+ # The Ruby/zlib version string.
385
+ #
386
+ #
387
+ Zlib::VERSION: String
388
+
389
+ # The string which represents the version of zlib.h
390
+ #
391
+ #
392
+ Zlib::ZLIB_VERSION: String
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "steep"
@@ -0,0 +1,55 @@
1
+ PATH
2
+ remote: ../../steep
3
+ specs:
4
+ steep (0.27.0)
5
+ activesupport (>= 5.1)
6
+ ast_utils (~> 0.3.0)
7
+ language_server-protocol (~> 3.14.0.2)
8
+ listen (~> 3.1)
9
+ parser (~> 2.7.0)
10
+ rainbow (>= 2.2.2, < 4.0)
11
+ rbs (~> 0.11.0)
12
+
13
+ GEM
14
+ remote: https://rubygems.org/
15
+ specs:
16
+ activesupport (6.0.3.2)
17
+ concurrent-ruby (~> 1.0, >= 1.0.2)
18
+ i18n (>= 0.7, < 2)
19
+ minitest (~> 5.1)
20
+ tzinfo (~> 1.1)
21
+ zeitwerk (~> 2.2, >= 2.2.2)
22
+ ast (2.4.1)
23
+ ast_utils (0.3.0)
24
+ parser (~> 2.4)
25
+ thor (>= 0.19)
26
+ concurrent-ruby (1.1.7)
27
+ ffi (1.13.1)
28
+ i18n (1.8.5)
29
+ concurrent-ruby (~> 1.0)
30
+ language_server-protocol (3.14.0.2)
31
+ listen (3.2.1)
32
+ rb-fsevent (~> 0.10, >= 0.10.3)
33
+ rb-inotify (~> 0.9, >= 0.9.10)
34
+ minitest (5.14.2)
35
+ parser (2.7.1.4)
36
+ ast (~> 2.4.1)
37
+ rainbow (3.0.0)
38
+ rb-fsevent (0.10.4)
39
+ rb-inotify (0.10.1)
40
+ ffi (~> 1.0)
41
+ rbs (0.11.0)
42
+ thor (1.0.1)
43
+ thread_safe (0.3.6)
44
+ tzinfo (1.2.7)
45
+ thread_safe (~> 0.1)
46
+ zeitwerk (2.4.0)
47
+
48
+ PLATFORMS
49
+ ruby
50
+
51
+ DEPENDENCIES
52
+ steep!
53
+
54
+ BUNDLED WITH
55
+ 2.1.3