rbs 1.8.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +82 -4
  3. data/docs/collection.md +23 -1
  4. data/docs/syntax.md +94 -41
  5. data/ext/rbs_extension/constants.c +2 -6
  6. data/ext/rbs_extension/constants.h +1 -2
  7. data/ext/rbs_extension/parser.c +212 -178
  8. data/ext/rbs_extension/parserstate.c +6 -2
  9. data/ext/rbs_extension/parserstate.h +10 -0
  10. data/ext/rbs_extension/ruby_objs.c +9 -11
  11. data/ext/rbs_extension/ruby_objs.h +1 -2
  12. data/lib/rbs/ast/declarations.rb +0 -97
  13. data/lib/rbs/ast/type_param.rb +134 -0
  14. data/lib/rbs/cli.rb +32 -4
  15. data/lib/rbs/collection/config/lockfile_generator.rb +26 -18
  16. data/lib/rbs/collection/sources/git.rb +18 -7
  17. data/lib/rbs/collection/sources/rubygems.rb +7 -0
  18. data/lib/rbs/collection/sources/stdlib.rb +6 -0
  19. data/lib/rbs/definition.rb +9 -0
  20. data/lib/rbs/definition_builder.rb +49 -14
  21. data/lib/rbs/environment.rb +32 -9
  22. data/lib/rbs/environment_loader.rb +0 -2
  23. data/lib/rbs/errors.rb +20 -7
  24. data/lib/rbs/location_aux.rb +2 -0
  25. data/lib/rbs/method_type.rb +29 -6
  26. data/lib/rbs/prototype/rb.rb +3 -3
  27. data/lib/rbs/prototype/rbi.rb +8 -6
  28. data/lib/rbs/prototype/runtime.rb +4 -4
  29. data/lib/rbs/types.rb +89 -0
  30. data/lib/rbs/validator.rb +62 -11
  31. data/lib/rbs/variance_calculator.rb +9 -8
  32. data/lib/rbs/version.rb +1 -1
  33. data/lib/rbs/writer.rb +1 -13
  34. data/lib/rbs.rb +1 -0
  35. data/schema/decls.json +16 -55
  36. data/schema/methodType.json +1 -1
  37. data/schema/typeParam.json +36 -0
  38. data/sig/collection/collections.rbs +11 -2
  39. data/sig/collection/config.rbs +2 -2
  40. data/sig/declarations.rbs +8 -58
  41. data/sig/definition.rbs +11 -1
  42. data/sig/definition_builder.rbs +8 -1
  43. data/sig/environment.rbs +7 -1
  44. data/sig/errors.rbs +19 -4
  45. data/sig/location.rbs +3 -1
  46. data/sig/locator.rbs +1 -1
  47. data/sig/method_types.rbs +25 -4
  48. data/sig/type_param.rbs +74 -0
  49. data/sig/types.rbs +27 -1
  50. data/sig/validator.rbs +31 -2
  51. data/sig/variance_calculator.rbs +1 -1
  52. data/sig/writer.rbs +1 -1
  53. data/stdlib/bigdecimal-math/0/manifest.yaml +2 -0
  54. data/stdlib/csv/0/manifest.yaml +2 -0
  55. data/stdlib/logger/0/manifest.yaml +2 -0
  56. data/stdlib/net-http/0/manifest.yaml +2 -0
  57. data/stdlib/openssl/0/manifest.yaml +2 -0
  58. data/stdlib/prime/0/manifest.yaml +2 -0
  59. data/stdlib/resolv/0/manifest.yaml +3 -0
  60. data/stdlib/uri/0/common.rbs +10 -5
  61. data/stdlib/uri/0/ftp.rbs +10 -0
  62. data/stdlib/uri/0/generic.rbs +34 -34
  63. data/stdlib/uri/0/mailto.rbs +5 -0
  64. data/stdlib/uri/0/ws.rbs +10 -0
  65. data/stdlib/uri/0/wss.rbs +7 -0
  66. data/stdlib/yaml/0/manifest.yaml +3 -0
  67. metadata +17 -2
@@ -193,14 +193,14 @@ module URI
193
193
  #
194
194
  # Creates a new URI::Generic instance from ``generic'' components without check.
195
195
  #
196
- def initialize: (String scheme, String userinfo, String host, Integer port, String? registry, String path, String? opaque, String query, String fragment, ?untyped parser, ?boolish arg_check) -> URI::Generic
196
+ def initialize: (String? scheme, String? userinfo, String? host, (String | Integer)? port, nil registry, String? path, String? opaque, String? query, String? fragment, ?untyped parser, ?boolish arg_check) -> void
197
197
 
198
198
  #
199
199
  # Returns the scheme component of the URI.
200
200
  #
201
201
  # URI("http://foo/bar/baz").scheme #=> "http"
202
202
  #
203
- attr_reader scheme: String
203
+ attr_reader scheme: String?
204
204
 
205
205
  # Returns the host component of the URI.
206
206
  #
@@ -222,14 +222,14 @@ module URI
222
222
  # URI("http://[::1]/bar/baz").host #=> "[::1]"
223
223
  # URI("http://[::1]/bar/baz").hostname #=> "::1"
224
224
  #
225
- attr_reader host: String
225
+ attr_reader host: String?
226
226
 
227
227
  # Returns the port component of the URI.
228
228
  #
229
229
  # URI("http://foo/bar/baz").port #=> 80
230
230
  # URI("http://foo:8080/bar/baz").port #=> 8080
231
231
  #
232
- attr_reader port: Integer
232
+ attr_reader port: Integer?
233
233
 
234
234
  def registry: () -> nil
235
235
 
@@ -237,13 +237,13 @@ module URI
237
237
  #
238
238
  # URI("http://foo/bar/baz").path #=> "/bar/baz"
239
239
  #
240
- attr_reader path: String
240
+ attr_reader path: String?
241
241
 
242
242
  # Returns the query component of the URI.
243
243
  #
244
244
  # URI("http://foo/bar/baz?search=FooBar").query #=> "search=FooBar"
245
245
  #
246
- attr_reader query: String
246
+ attr_reader query: String?
247
247
 
248
248
  # Returns the opaque part of the URI.
249
249
  #
@@ -280,13 +280,13 @@ module URI
280
280
  #
281
281
  # Checks the scheme +v+ component against the URI::Parser Regexp for :SCHEME.
282
282
  #
283
- def check_scheme: (String v) -> true
283
+ def check_scheme: (String? v) -> true
284
284
 
285
285
  # Protected setter for the scheme component +v+.
286
286
  #
287
287
  # See also URI::Generic.scheme=.
288
288
  #
289
- def set_scheme: (String v) -> String
289
+ def set_scheme: (String? v) -> String?
290
290
 
291
291
  #
292
292
  # == Args
@@ -309,7 +309,7 @@ module URI
309
309
  # uri.scheme = "https"
310
310
  # uri.to_s #=> "https://my.example.com"
311
311
  #
312
- def scheme=: (String v) -> String
312
+ def scheme=: (String? v) -> String?
313
313
 
314
314
  #
315
315
  # Checks the +user+ and +password+.
@@ -338,12 +338,12 @@ module URI
338
338
  # Can not have a registry or opaque component defined,
339
339
  # with a user component defined.
340
340
  #
341
- def check_password: (String v, ?String user) -> (String | true)
341
+ def check_password: (String? v, ?String user) -> (String? | true)
342
342
 
343
343
  #
344
344
  # Sets userinfo, argument is string like 'name:pass'.
345
345
  #
346
- def userinfo=: (String? userinfo) -> Array[String | nil]?
346
+ def userinfo=: (String? userinfo) -> String?
347
347
 
348
348
  #
349
349
  # == Args
@@ -366,7 +366,7 @@ module URI
366
366
  # uri.user = "sam"
367
367
  # uri.to_s #=> "http://sam:V3ry_S3nsit1ve@my.example.com"
368
368
  #
369
- def user=: (String user) -> String
369
+ def user=: (String? user) -> String?
370
370
 
371
371
  #
372
372
  # == Args
@@ -389,26 +389,26 @@ module URI
389
389
  # uri.password = "V3ry_S3nsit1ve"
390
390
  # uri.to_s #=> "http://john:V3ry_S3nsit1ve@my.example.com"
391
391
  #
392
- def password=: (String password) -> String
392
+ def password=: (String? password) -> String?
393
393
 
394
394
  # Protected setter for the +user+ component, and +password+ if available
395
395
  # (with validation).
396
396
  #
397
397
  # See also URI::Generic.userinfo=.
398
398
  #
399
- def set_userinfo: (String user, ?String? password) -> Array[String | nil]
399
+ def set_userinfo: (String? user, ?String? password) -> [String?, String?]
400
400
 
401
401
  # Protected setter for the user component +v+.
402
402
  #
403
403
  # See also URI::Generic.user=.
404
404
  #
405
- def set_user: (String v) -> String
405
+ def set_user: (String? v) -> String?
406
406
 
407
407
  # Protected setter for the password component +v+.
408
408
  #
409
409
  # See also URI::Generic.password=.
410
410
  #
411
- def set_password: (String v) -> String
411
+ def set_password: (String? v) -> String?
412
412
 
413
413
  # Returns the userinfo +ui+ as <code>[user, password]</code>
414
414
  # if properly formatted as 'user:password'.
@@ -421,10 +421,10 @@ module URI
421
421
  def userinfo: () -> String?
422
422
 
423
423
  # Returns the user component.
424
- def user: () -> String
424
+ def user: () -> String?
425
425
 
426
426
  # Returns the password component.
427
- def password: () -> String
427
+ def password: () -> String?
428
428
 
429
429
  #
430
430
  # Checks the host +v+ component for RFC2396 compliance
@@ -433,13 +433,13 @@ module URI
433
433
  # Can not have a registry or opaque component defined,
434
434
  # with a host component defined.
435
435
  #
436
- def check_host: (String v) -> (String | true)
436
+ def check_host: (String? v) -> true?
437
437
 
438
438
  # Protected setter for the host component +v+.
439
439
  #
440
440
  # See also URI::Generic.host=.
441
441
  #
442
- def set_host: (String v) -> String
442
+ def set_host: (String? v) -> String?
443
443
 
444
444
  #
445
445
  # == Args
@@ -462,7 +462,7 @@ module URI
462
462
  # uri.host = "foo.com"
463
463
  # uri.to_s #=> "http://foo.com"
464
464
  #
465
- def host=: (String v) -> String
465
+ def host=: (String? v) -> String?
466
466
 
467
467
  # Extract the host part of the URI and unwrap brackets for IPv6 addresses.
468
468
  #
@@ -473,7 +473,7 @@ module URI
473
473
  # uri.hostname #=> "::1"
474
474
  # uri.host #=> "[::1]"
475
475
  #
476
- def hostname: () -> String
476
+ def hostname: () -> String?
477
477
 
478
478
  # Sets the host part of the URI as the argument with brackets for IPv6 addresses.
479
479
  #
@@ -487,7 +487,7 @@ module URI
487
487
  # If the argument seems to be an IPv6 address,
488
488
  # it is wrapped with brackets.
489
489
  #
490
- def hostname=: (String v) -> String
490
+ def hostname=: (String? v) -> String?
491
491
 
492
492
  #
493
493
  # Checks the port +v+ component for RFC2396 compliance
@@ -496,13 +496,13 @@ module URI
496
496
  # Can not have a registry or opaque component defined,
497
497
  # with a port component defined.
498
498
  #
499
- def check_port: (Integer v) -> (Integer | true)
499
+ def check_port: ((String | Integer)? v) -> true?
500
500
 
501
501
  # Protected setter for the port component +v+.
502
502
  #
503
503
  # See also URI::Generic.port=.
504
504
  #
505
- def set_port: (Integer v) -> Integer
505
+ def set_port: ((String | Integer)? v) -> (String | Integer)?
506
506
 
507
507
  #
508
508
  # == Args
@@ -525,7 +525,7 @@ module URI
525
525
  # uri.port = 8080
526
526
  # uri.to_s #=> "http://my.example.com:8080"
527
527
  #
528
- def port=: (Integer v) -> Integer
528
+ def port=: ((String | Integer)? v) -> (String | Integer)?
529
529
 
530
530
  def check_registry: (String v) -> nil
531
531
 
@@ -541,13 +541,13 @@ module URI
541
541
  # Can not have a opaque component defined,
542
542
  # with a path component defined.
543
543
  #
544
- def check_path: (String v) -> true
544
+ def check_path: (String? v) -> true
545
545
 
546
546
  # Protected setter for the path component +v+.
547
547
  #
548
548
  # See also URI::Generic.path=.
549
549
  #
550
- def set_path: (String v) -> String
550
+ def set_path: (String? v) -> String?
551
551
 
552
552
  #
553
553
  # == Args
@@ -570,7 +570,7 @@ module URI
570
570
  # uri.path = "/faq/"
571
571
  # uri.to_s #=> "http://my.example.com/faq/"
572
572
  #
573
- def path=: (String v) -> String
573
+ def path=: (String? v) -> String?
574
574
 
575
575
  #
576
576
  # == Args
@@ -590,7 +590,7 @@ module URI
590
590
  # uri.query = "id=1"
591
591
  # uri.to_s #=> "http://my.example.com/?id=1"
592
592
  #
593
- def query=: (String v) -> String
593
+ def query=: (String? v) -> String?
594
594
 
595
595
  #
596
596
  # Checks the opaque +v+ component for RFC2396 compliance and
@@ -599,13 +599,13 @@ module URI
599
599
  # Can not have a host, port, user, or path component defined,
600
600
  # with an opaque component defined.
601
601
  #
602
- def check_opaque: (String v) -> (String | true)
602
+ def check_opaque: (String? v) -> true?
603
603
 
604
604
  # Protected setter for the opaque component +v+.
605
605
  #
606
606
  # See also URI::Generic.opaque=.
607
607
  #
608
- def set_opaque: (String v) -> String
608
+ def set_opaque: (String? v) -> String?
609
609
 
610
610
  #
611
611
  # == Args
@@ -620,7 +620,7 @@ module URI
620
620
  #
621
621
  # See also URI::Generic.check_opaque.
622
622
  #
623
- def opaque=: (String v) -> String
623
+ def opaque=: (String? v) -> String?
624
624
 
625
625
  #
626
626
  # Checks the fragment +v+ component against the URI::Parser Regexp for :FRAGMENT.
@@ -644,7 +644,7 @@ module URI
644
644
  # uri.fragment = "time=1305212086"
645
645
  # uri.to_s #=> "http://my.example.com/?id=25#time=1305212086"
646
646
  #
647
- def fragment=: (String v) -> String
647
+ def fragment=: (String? v) -> String?
648
648
 
649
649
  #
650
650
  # Returns true if URI is hierarchical.
@@ -0,0 +1,5 @@
1
+ module URI
2
+ # RFC6068, the mailto URL scheme.
3
+ class MailTo < Generic
4
+ end
5
+ end
@@ -0,0 +1,10 @@
1
+ module URI
2
+ # The syntax of WS URIs is defined in RFC6455 section 3.
3
+ #
4
+ # Note that the Ruby URI library allows WS URLs containing usernames and
5
+ # passwords. This is not legal as per the RFC, but used to be
6
+ # supported in Internet Explorer 5 and 6, before the MS04-004 security
7
+ # update. See <URL:http://support.microsoft.com/kb/834489>.
8
+ class WS < Generic
9
+ end
10
+ end
@@ -0,0 +1,7 @@
1
+ module URI
2
+ # The default port for WSS URIs is 443, and the scheme is 'wss:' rather
3
+ # than 'ws:'. Other than that, WSS URIs are identical to WS URIs;
4
+ # see URI::WS.
5
+ class WSS < WS
6
+ end
7
+ end
@@ -0,0 +1,3 @@
1
+ dependencies:
2
+ - name: dbm
3
+ - name: pstore
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbs
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Soutaro Matsumoto
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-12-02 00:00:00.000000000 Z
11
+ date: 2021-12-24 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: RBS is the language for type signatures for Ruby and standard library
14
14
  definitions.
@@ -124,6 +124,7 @@ files:
124
124
  - lib/rbs/ast/comment.rb
125
125
  - lib/rbs/ast/declarations.rb
126
126
  - lib/rbs/ast/members.rb
127
+ - lib/rbs/ast/type_param.rb
127
128
  - lib/rbs/buffer.rb
128
129
  - lib/rbs/builtin_names.rb
129
130
  - lib/rbs/char_scanner.rb
@@ -191,6 +192,7 @@ files:
191
192
  - schema/location.json
192
193
  - schema/members.json
193
194
  - schema/methodType.json
195
+ - schema/typeParam.json
194
196
  - schema/types.json
195
197
  - sig/ancestor_builder.rbs
196
198
  - sig/ancestor_graph.rbs
@@ -228,6 +230,7 @@ files:
228
230
  - sig/type_alias_dependency.rbs
229
231
  - sig/type_alias_regularity.rbs
230
232
  - sig/type_name_resolver.rbs
233
+ - sig/type_param.rbs
231
234
  - sig/typename.rbs
232
235
  - sig/types.rbs
233
236
  - sig/util.rbs
@@ -240,10 +243,12 @@ files:
240
243
  - stdlib/base64/0/base64.rbs
241
244
  - stdlib/benchmark/0/benchmark.rbs
242
245
  - stdlib/bigdecimal-math/0/big_math.rbs
246
+ - stdlib/bigdecimal-math/0/manifest.yaml
243
247
  - stdlib/bigdecimal/0/big_decimal.rbs
244
248
  - stdlib/cgi/0/core.rbs
245
249
  - stdlib/coverage/0/coverage.rbs
246
250
  - stdlib/csv/0/csv.rbs
251
+ - stdlib/csv/0/manifest.yaml
247
252
  - stdlib/date/0/date.rbs
248
253
  - stdlib/date/0/date_time.rbs
249
254
  - stdlib/dbm/0/dbm.rbs
@@ -259,20 +264,25 @@ files:
259
264
  - stdlib/logger/0/formatter.rbs
260
265
  - stdlib/logger/0/log_device.rbs
261
266
  - stdlib/logger/0/logger.rbs
267
+ - stdlib/logger/0/manifest.yaml
262
268
  - stdlib/logger/0/period.rbs
263
269
  - stdlib/logger/0/severity.rbs
264
270
  - stdlib/monitor/0/monitor.rbs
265
271
  - stdlib/mutex_m/0/mutex_m.rbs
272
+ - stdlib/net-http/0/manifest.yaml
266
273
  - stdlib/net-http/0/net-http.rbs
267
274
  - stdlib/objspace/0/objspace.rbs
275
+ - stdlib/openssl/0/manifest.yaml
268
276
  - stdlib/openssl/0/openssl.rbs
269
277
  - stdlib/optparse/0/optparse.rbs
270
278
  - stdlib/pathname/0/pathname.rbs
271
279
  - stdlib/prettyprint/0/prettyprint.rbs
272
280
  - stdlib/prime/0/integer-extension.rbs
281
+ - stdlib/prime/0/manifest.yaml
273
282
  - stdlib/prime/0/prime.rbs
274
283
  - stdlib/pstore/0/pstore.rbs
275
284
  - stdlib/pty/0/pty.rbs
285
+ - stdlib/resolv/0/manifest.yaml
276
286
  - stdlib/resolv/0/resolv.rbs
277
287
  - stdlib/rubygems/0/basic_specification.rbs
278
288
  - stdlib/rubygems/0/config_file.rbs
@@ -311,14 +321,19 @@ files:
311
321
  - stdlib/tsort/0/tsort.rbs
312
322
  - stdlib/uri/0/common.rbs
313
323
  - stdlib/uri/0/file.rbs
324
+ - stdlib/uri/0/ftp.rbs
314
325
  - stdlib/uri/0/generic.rbs
315
326
  - stdlib/uri/0/http.rbs
316
327
  - stdlib/uri/0/https.rbs
317
328
  - stdlib/uri/0/ldap.rbs
318
329
  - stdlib/uri/0/ldaps.rbs
330
+ - stdlib/uri/0/mailto.rbs
319
331
  - stdlib/uri/0/rfc2396_parser.rbs
320
332
  - stdlib/uri/0/rfc3986_parser.rbs
333
+ - stdlib/uri/0/ws.rbs
334
+ - stdlib/uri/0/wss.rbs
321
335
  - stdlib/yaml/0/dbm.rbs
336
+ - stdlib/yaml/0/manifest.yaml
322
337
  - stdlib/yaml/0/store.rbs
323
338
  - stdlib/zlib/0/zlib.rbs
324
339
  - steep/Gemfile