rbs 3.2.0.pre.1 → 3.2.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.
data/core/fiber.rbs CHANGED
@@ -86,7 +86,7 @@ class Fiber < Object
86
86
  #
87
87
  # See also Fiber::[]=.
88
88
  #
89
- def self.[]: (Symbol | String) -> untyped
89
+ def self.[]: (Symbol) -> untyped
90
90
 
91
91
  # <!--
92
92
  # rdoc-file=cont.c
@@ -99,7 +99,7 @@ class Fiber < Object
99
99
  #
100
100
  # See also Fiber::[].
101
101
  #
102
- def self.[]=: [A] (Symbol | String, A) -> A
102
+ def self.[]=: [A] (Symbol, A) -> A
103
103
 
104
104
  # <!--
105
105
  # rdoc-file=cont.c
data/core/kernel.rbs CHANGED
@@ -300,7 +300,7 @@ module Kernel : BasicObject
300
300
  # eval "str + ' Fred'" #=> "hello Fred"
301
301
  # eval "str + ' Fred'", get_binding("bye") #=> "bye Fred"
302
302
  #
303
- def self?.eval: (String arg0, ?Binding arg1, ?String filename, ?Integer lineno) -> untyped
303
+ def self?.eval: (string src, ?Binding? scope, ?string filename, ?int lineno) -> untyped
304
304
 
305
305
  # <!--
306
306
  # rdoc-file=vm_eval.c
@@ -358,7 +358,7 @@ module Kernel : BasicObject
358
358
  # srand 1234 # => 1234
359
359
  # [ rand, rand ] # => [0.1915194503788923, 0.6221087710398319]
360
360
  #
361
- def self?.srand: (?Numeric number) -> Numeric
361
+ def self?.srand: (?int number) -> Integer
362
362
 
363
363
  # <!--
364
364
  # rdoc-file=process.c
@@ -383,7 +383,7 @@ module Kernel : BasicObject
383
383
  # 4. Therefore you should use spawn() instead of fork().
384
384
  #
385
385
  def self?.fork: () -> Integer?
386
- | () { () -> untyped } -> Integer?
386
+ | () { () -> void } -> Integer
387
387
 
388
388
  def initialize_copy: (self object) -> self
389
389
 
@@ -403,12 +403,10 @@ module Kernel : BasicObject
403
403
  #
404
404
  # Array(:foo) # => [:foo]
405
405
  #
406
- def self?.Array: (NilClass x) -> [ ]
407
- | [T] (::Array[T] x) -> ::Array[T]
408
- | [T] (::Range[T] x) -> ::Array[T]
409
- | [T] (_Each[T] x) -> ::Array[T]
410
- | [K, V] (::Hash[K, V] x) -> ::Array[[ K, V ]]
411
- | [T] (T x) -> ::Array[T]
406
+ def self?.Array: (nil) -> []
407
+ | [T] (Array[T] ary) -> Array[T]
408
+ | [T] (_ToAry[T] | _ToA[T] array_like) -> Array[T]
409
+ | [T] (T ele) -> [T]
412
410
 
413
411
  # <!--
414
412
  # rdoc-file=complex.c
@@ -446,7 +444,11 @@ module Kernel : BasicObject
446
444
  #
447
445
  # See String#to_c.
448
446
  #
449
- def self?.Complex: (Numeric | String x, ?Numeric | String y, ?exception: bool exception) -> Complex
447
+ def self?.Complex: (_ToC complex_like, ?exception: true) -> Complex
448
+ | (_ToC complex_like, exception: bool) -> Complex?
449
+ | (Numeric | String real, ?Numeric | String imag, ?exception: true) -> Complex
450
+ | (Numeric | String real, ?Numeric | String imag, exception: bool) -> Complex?
451
+ | (untyped, ?untyped, exception: false) -> nil
450
452
 
451
453
  # <!--
452
454
  # rdoc-file=kernel.rb
@@ -464,7 +466,9 @@ module Kernel : BasicObject
464
466
  # Float(nil) #=> TypeError: can't convert nil into Float
465
467
  # Float("123.0_badstring", exception: false) #=> nil
466
468
  #
467
- def self?.Float: (Numeric | String x, ?exception: bool exception) -> Float
469
+ def self?.Float: (_ToF float_like, ?exception: true) -> Float
470
+ | (_ToF float_like, exception: bool) -> Float?
471
+ | (untyped, exception: false) -> nil
468
472
 
469
473
  # <!--
470
474
  # rdoc-file=object.c
@@ -488,7 +492,8 @@ module Kernel : BasicObject
488
492
  # Hash(nil) # => {}
489
493
  # Hash([]) # => {}
490
494
  #
491
- def self?.Hash: [K, V] (Object x) -> ::Hash[K, V]
495
+ def self?.Hash: [K, V] (nil | [] _empty) -> Hash[K, V]
496
+ | [K, V] (_ToHash[K, V] hash_like) -> Hash[K, V]
492
497
 
493
498
  # <!--
494
499
  # rdoc-file=object.c
@@ -574,8 +579,11 @@ module Kernel : BasicObject
574
579
  # With `exception` given as `false`, an exception of any kind is suppressed and
575
580
  # `nil` is returned.
576
581
  #
577
- def self?.Integer: (Numeric | String arg, ?exception: bool exception) -> Integer
578
- | (String arg, ?Integer base, ?exception: bool exception) -> Integer
582
+ def self?.Integer: (_ToInt | _ToI int_like, ?exception: true) -> Integer
583
+ | (_ToInt | _ToI int_like, exception: bool) -> Integer?
584
+ | (string str, ?int base, ?exception: true) -> Integer
585
+ | (string str, ?int base, exception: bool) -> Integer?
586
+ | (untyped, ?untyped, exception: false) -> nil
579
587
 
580
588
  # <!--
581
589
  # rdoc-file=rational.c
@@ -614,7 +622,17 @@ module Kernel : BasicObject
614
622
  #
615
623
  # See also String#to_r.
616
624
  #
617
- def self?.Rational: (Numeric | String | Object x, ?Numeric | String y, ?exception: bool exception) -> Rational
625
+ def self?.Rational: (_ToInt | _ToR rational_like, ?exception: true) -> Rational
626
+ | (_ToInt | _ToR rational_like, exception: bool) -> Rational?
627
+ | (_ToInt | _ToR numer, ?_ToInt | _ToR denom, ?exception: true) -> Rational
628
+ | (_ToInt | _ToR numer, ?_ToInt | _ToR denom, exception: bool) -> Rational?
629
+ | [T] (Numeric&_RationalDiv[T] numer, Numeric denom, ?exception: bool) -> T
630
+ | [T < Numeric] (T value, 1, ?exception: bool) -> T
631
+ | (untyped, ?untyped, exception: false) -> nil
632
+
633
+ interface _RationalDiv[T]
634
+ def /: (Numeric) -> T
635
+ end
618
636
 
619
637
  # <!--
620
638
  # rdoc-file=object.c
@@ -630,7 +648,7 @@ module Kernel : BasicObject
630
648
  #
631
649
  # Raises `TypeError` if `object` cannot be converted to a string.
632
650
  #
633
- def self?.String: (_ToStr | _ToS x) -> String
651
+ def self?.String: (string | _ToS string_like) -> String
634
652
 
635
653
  # <!--
636
654
  # rdoc-file=eval.c
@@ -691,7 +709,7 @@ module Kernel : BasicObject
691
709
  # Terminate execution immediately, effectively by calling `Kernel.exit(false)`.
692
710
  # If *msg* is given, it is written to STDERR prior to terminating.
693
711
  #
694
- def self?.abort: (?String msg) -> bot
712
+ def self?.abort: (?string msg) -> bot
695
713
 
696
714
  # <!--
697
715
  # rdoc-file=eval_jump.c
@@ -712,7 +730,7 @@ module Kernel : BasicObject
712
730
  #
713
731
  # goodbye cruel world
714
732
  #
715
- def self?.at_exit: () { () -> untyped } -> Proc
733
+ def self?.at_exit: () { () -> void } -> Proc
716
734
 
717
735
  # <!--
718
736
  # rdoc-file=load.c
@@ -795,8 +813,7 @@ module Kernel : BasicObject
795
813
  # at_exit function
796
814
  # in finalizer
797
815
  #
798
- def self?.exit: () -> bot
799
- | (?Integer | TrueClass | FalseClass status) -> bot
816
+ def self?.exit: (?int | bool status) -> bot
800
817
 
801
818
  # <!--
802
819
  # rdoc-file=process.c
@@ -807,7 +824,7 @@ module Kernel : BasicObject
807
824
  #
808
825
  # Process.exit!(true)
809
826
  #
810
- def self?.exit!: (?Integer | TrueClass | FalseClass status) -> bot
827
+ def self?.exit!: (?int | bool status) -> bot
811
828
 
812
829
  # <!-- rdoc-file=eval.c -->
813
830
  # With no arguments, raises the exception in `$!` or raises a RuntimeError if
@@ -828,8 +845,8 @@ module Kernel : BasicObject
828
845
  # raise ArgumentError, "No parameters", caller
829
846
  #
830
847
  def self?.fail: () -> bot
831
- | (String message, ?cause: Exception?) -> bot
832
- | (_Exception exception, ?untyped message, ?::Array[String] backtrace, ?cause: Exception?) -> bot
848
+ | (string message, ?cause: Exception?) -> bot
849
+ | (_Exception exception, ?_ToS? message, ?nil | String | Array[String] backtrace, ?cause: Exception?) -> bot
833
850
 
834
851
  # <!--
835
852
  # rdoc-file=eval.c
@@ -988,7 +1005,7 @@ module Kernel : BasicObject
988
1005
  # puts enum.next
989
1006
  # } #=> :ok
990
1007
  #
991
- def self?.loop: () { (nil) -> untyped } -> bot
1008
+ def self?.loop: () { () -> void } -> bot
992
1009
  | () -> ::Enumerator[nil, bot]
993
1010
 
994
1011
  # <!--
@@ -1137,7 +1154,7 @@ module Kernel : BasicObject
1137
1154
  # gets # Sets $_ to the most recent user input.
1138
1155
  # print # Prints $_.
1139
1156
  #
1140
- def self?.print: (*Kernel args) -> nil
1157
+ def self?.print: (*_ToS args) -> nil
1141
1158
 
1142
1159
  # <!--
1143
1160
  # rdoc-file=io.c
@@ -1171,9 +1188,9 @@ module Kernel : BasicObject
1171
1188
  #
1172
1189
  # With no arguments, does nothing.
1173
1190
  #
1174
- def self?.printf: (IO arg0, String arg1, *untyped args) -> nil
1175
- | (String arg1, *untyped args) -> nil
1176
- | () -> nil
1191
+ def self?.printf: () -> nil
1192
+ | (String fmt, *untyped args) -> nil
1193
+ | (_Writer io, string fmt, *untyped args) -> nil
1177
1194
 
1178
1195
  # <!--
1179
1196
  # rdoc-file=proc.c
@@ -1202,8 +1219,8 @@ module Kernel : BasicObject
1202
1219
  #
1203
1220
  # See IO#putc for important information regarding multi-byte characters.
1204
1221
  #
1205
- def self?.putc: (Integer arg0) -> Integer
1206
- | (String arg0) -> String
1222
+ def self?.putc: [T < _ToInt] (T chr) -> T
1223
+ | (String chr) -> String
1207
1224
 
1208
1225
  # <!--
1209
1226
  # rdoc-file=io.c
@@ -1213,7 +1230,7 @@ module Kernel : BasicObject
1213
1230
  #
1214
1231
  # $stdout.puts(objects)
1215
1232
  #
1216
- def self?.puts: (*untyped arg0) -> NilClass
1233
+ def self?.puts: (*_ToS objects) -> nil
1217
1234
 
1218
1235
  # <!--
1219
1236
  # rdoc-file=io.c
@@ -1240,8 +1257,8 @@ module Kernel : BasicObject
1240
1257
  # 0..4
1241
1258
  # [0..4, 0..4, 0..4]
1242
1259
  #
1243
- def self?.p: [T] (T arg0) -> T
1244
- | (untyped, untyped, *untyped) -> Array[untyped]
1260
+ def self?.p: [T < _Inspect] (T arg0) -> T
1261
+ | (_Inspect arg0, _Inspect arg1, *_Inspect rest) -> Array[_Inspect]
1245
1262
  | () -> nil
1246
1263
 
1247
1264
  # <!--
@@ -1550,7 +1567,7 @@ module Kernel : BasicObject
1550
1567
  # sleep 1.9 #=> 2
1551
1568
  # Time.new #=> 2008-03-08 19:56:22 +0900
1552
1569
  #
1553
- def self?.sleep: () -> bot
1570
+ def self?.sleep: (?nil) -> bot
1554
1571
  | ((Integer | Float | _Divmod) duration) -> Integer
1555
1572
 
1556
1573
  interface _Divmod
@@ -1650,7 +1667,7 @@ module Kernel : BasicObject
1650
1667
  # optional second parameter supplies a return value for the `catch` block, which
1651
1668
  # otherwise defaults to `nil`. For examples, see Kernel::catch.
1652
1669
  #
1653
- def self?.throw: (Object tag, ?untyped obj) -> bot
1670
+ def self?.throw: (untyped tag, ?untyped obj) -> bot
1654
1671
 
1655
1672
  # <!--
1656
1673
  # rdoc-file=warning.rb
@@ -1697,7 +1714,7 @@ module Kernel : BasicObject
1697
1714
  # :experimental
1698
1715
  # : Used for experimental features that may change in future releases.
1699
1716
  #
1700
- def self?.warn: (*untyped msg, ?uplevel: Integer | nil, ?category: :deprecated | :experimental | nil) -> NilClass
1717
+ def self?.warn: (*_ToS msg, ?uplevel: int?, ?category: Warning::category?) -> nil
1701
1718
 
1702
1719
  # <!--
1703
1720
  # rdoc-file=process.c
data/core/object.rbs CHANGED
@@ -223,7 +223,7 @@ class Object < BasicObject
223
223
  #
224
224
  # 1cat[4, 5, 6]
225
225
  #
226
- def display: (?_Writeable port) -> void
226
+ def display: (?_Writer port) -> void
227
227
 
228
228
  # <!--
229
229
  # rdoc-file=object.c
@@ -1074,8 +1074,4 @@ class Object < BasicObject
1074
1074
  alias then yield_self
1075
1075
  end
1076
1076
 
1077
- interface _Writeable
1078
- def write: (untyped) -> void
1079
- end
1080
-
1081
1077
  type Object::name = Symbol | string
data/core/warning.rbs CHANGED
@@ -29,6 +29,8 @@
29
29
  # The `warning` gem provides convenient ways to customize Warning.warn.
30
30
  #
31
31
  module Warning
32
+ type category = :deprecated | :experimental
33
+
32
34
  # <!--
33
35
  # rdoc-file=error.c
34
36
  # - warn(msg, category: nil) -> nil
@@ -38,5 +40,5 @@ module Warning
38
40
  #
39
41
  # See the documentation of the Warning module for how to customize this.
40
42
  #
41
- def self?.warn: (String message, ?category: :deprecated | :experimental | nil) -> nil
43
+ def self?.warn: (String message, ?category: category?) -> nil
42
44
  end
@@ -134,8 +134,12 @@ module RBS
134
134
  if locked
135
135
  lockfile.gems[name] = locked
136
136
 
137
- locked[:source].dependencies_of(locked[:name], locked[:version])&.each do |dep|
138
- assign_stdlib(name: dep["name"], from_gem: name)
137
+ begin
138
+ locked[:source].dependencies_of(locked[:name], locked[:version])&.each do |dep|
139
+ assign_stdlib(name: dep["name"], from_gem: name)
140
+ end
141
+ rescue
142
+ RBS.logger.warn "Cannot find `#{locked[:name]}-#{locked[:version]}` gem. Using incorrect Bundler context? (#{definition.lockfile})"
139
143
  end
140
144
  end
141
145
  end
@@ -276,9 +276,9 @@ module RBS
276
276
  end
277
277
 
278
278
  def normalize_type_name?(name)
279
- if name.class?
280
- normalize_module_name?(name)
281
- else
279
+ return normalize_module_name?(name) if name.class?
280
+
281
+ type_name =
282
282
  unless name.namespace.empty?
283
283
  parent = name.namespace.to_type_name
284
284
  parent = normalize_module_name?(parent)
@@ -288,6 +288,9 @@ module RBS
288
288
  else
289
289
  name
290
290
  end
291
+
292
+ if type_name?(type_name)
293
+ type_name
291
294
  end
292
295
  end
293
296
 
data/lib/rbs/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RBS
4
- VERSION = "3.2.0.pre.1"
4
+ VERSION = "3.2.1"
5
5
  end
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: 3.2.0.pre.1
4
+ version: 3.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Soutaro Matsumoto
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-08-18 00:00:00.000000000 Z
11
+ date: 2023-08-29 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.
@@ -463,9 +463,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
463
463
  version: '3.0'
464
464
  required_rubygems_version: !ruby/object:Gem::Requirement
465
465
  requirements:
466
- - - ">"
466
+ - - ">="
467
467
  - !ruby/object:Gem::Version
468
- version: 1.3.1
468
+ version: '0'
469
469
  requirements: []
470
470
  rubygems_version: 3.4.10
471
471
  signing_key: