rbi 0.3.6 → 0.3.8

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 80df141e229452edf3fb51dc8933c130ce2a2f972ee6906be79680d79f33a720
4
- data.tar.gz: '099a5b5fb43ccd50cf262bcdbc0d8fde6cd0aa14983851c9de14f488def2a56b'
3
+ metadata.gz: e8a26f05eff609245be847ff291cfd456b86e0a11aa85c496bcdcbaf8c202b5b
4
+ data.tar.gz: f1eb34ff26a99f6b1b20edfaec281db99559cce730e3c0cdbf0d8c75a8e6ee91
5
5
  SHA512:
6
- metadata.gz: 791d993759d3e237a52d34be622c23eec92d1adb26b267aa47b3aa9e7ce1767b96fff75e02d895493fb63b84fe3f15cb1c37f880db1698e5a8b9e17cba77503e
7
- data.tar.gz: cdf11ef801d7ac8a1329b39e095c4895d006ae46ad800d50d1d2cb52aa9c41fdb704557a8a660376b53e4bdb86a076bacde0a5a2c33d0031478dda36850297b1
6
+ metadata.gz: 9cbe3f72073f2813cef4744b57849d8725eab8ed19df9b14d7d7571f795dd90ca925645eed50f62ff86d8a387a5e845a516a7dfc097593788e9b27c6d6489edd
7
+ data.tar.gz: 72e11ed844915a8965f3a0db4f76b7cb3b6e22e6eb7848bcf2f5484a415bdf79fd7c552c811b279cb006121179c8ebc1cfa58bcbe3d95e2089fec02f1f8ab8a0
data/Gemfile CHANGED
@@ -10,10 +10,10 @@ group(:development, :test) do
10
10
  gem("minitest")
11
11
  gem("minitest-reporters")
12
12
  gem("rake", "~> 13.3")
13
- gem("rubocop", "~> 1.76", require: false)
13
+ gem("rubocop", "~> 1.81", require: false)
14
14
  gem("rubocop-shopify", require: false)
15
15
  gem("rubocop-sorbet", require: false)
16
16
  gem("sorbet", ">= 0.5.9204", require: false)
17
- gem("spoom", ">= 1.6.0", require: false)
18
- gem("tapioca", require: false)
17
+ gem("spoom", ">= 1.7.10", require: false)
18
+ gem("tapioca", ">= 0.17.9", require: false)
19
19
  end
data/lib/rbi/formatter.rb CHANGED
@@ -6,7 +6,15 @@ module RBI
6
6
  #: Integer?
7
7
  attr_accessor :max_line_length
8
8
 
9
- #: (?add_sig_templates: bool, ?group_nodes: bool, ?max_line_length: Integer?, ?nest_singleton_methods: bool, ?nest_non_public_members: bool, ?sort_nodes: bool, ?replace_attributes_with_methods: bool) -> void
9
+ #: (
10
+ #| ?add_sig_templates: bool,
11
+ #| ?group_nodes: bool,
12
+ #| ?max_line_length: Integer?,
13
+ #| ?nest_singleton_methods: bool,
14
+ #| ?nest_non_public_members: bool,
15
+ #| ?sort_nodes: bool,
16
+ #| ?replace_attributes_with_methods: bool
17
+ #| ) -> void
10
18
  def initialize(
11
19
  add_sig_templates: false,
12
20
  group_nodes: false,
data/lib/rbi/index.rb CHANGED
@@ -73,7 +73,7 @@ module RBI
73
73
  # getter and the setter.
74
74
  # @abstract
75
75
  #: -> Array[String]
76
- def index_ids; end
76
+ def index_ids = raise NotImplementedError, "Abstract method called"
77
77
  end
78
78
 
79
79
  class Scope
data/lib/rbi/loc.rb CHANGED
@@ -22,7 +22,13 @@ module RBI
22
22
  #: Integer?
23
23
  attr_reader :begin_line, :end_line, :begin_column, :end_column
24
24
 
25
- #: (?file: String?, ?begin_line: Integer?, ?end_line: Integer?, ?begin_column: Integer?, ?end_column: Integer?) -> void
25
+ #: (
26
+ #| ?file: String?,
27
+ #| ?begin_line: Integer?,
28
+ #| ?end_line: Integer?,
29
+ #| ?begin_column: Integer?,
30
+ #| ?end_column: Integer?
31
+ #| ) -> void
26
32
  def initialize(file: nil, begin_line: nil, end_line: nil, begin_column: nil, end_column: nil)
27
33
  @file = file
28
34
  @begin_line = begin_line
data/lib/rbi/model.rb CHANGED
@@ -163,7 +163,7 @@ module RBI
163
163
  class Scope < Tree
164
164
  # @abstract
165
165
  #: -> String
166
- def fully_qualified_name; end
166
+ def fully_qualified_name = raise NotImplementedError, "Abstract method called"
167
167
 
168
168
  # @override
169
169
  #: -> String
@@ -240,7 +240,13 @@ module RBI
240
240
  #: bool
241
241
  attr_accessor :keyword_init
242
242
 
243
- #: (String name, ?members: Array[Symbol], ?keyword_init: bool, ?loc: Loc?, ?comments: Array[Comment]) ?{ (Struct struct) -> void } -> void
243
+ #: (
244
+ #| String name,
245
+ #| ?members: Array[Symbol],
246
+ #| ?keyword_init: bool,
247
+ #| ?loc: Loc?,
248
+ #| ?comments: Array[Comment]
249
+ #| ) ?{ (Struct struct) -> void } -> void
244
250
  def initialize(name, members: [], keyword_init: false, loc: nil, comments: [], &block)
245
251
  super(loc: loc, comments: comments) {}
246
252
  @name = name
@@ -299,7 +305,14 @@ module RBI
299
305
  #: Array[Sig]
300
306
  attr_reader :sigs
301
307
 
302
- #: (Symbol name, Array[Symbol] names, ?visibility: Visibility, ?sigs: Array[Sig], ?loc: Loc?, ?comments: Array[Comment]) -> void
308
+ #: (
309
+ #| Symbol name,
310
+ #| Array[Symbol] names,
311
+ #| ?visibility: Visibility,
312
+ #| ?sigs: Array[Sig],
313
+ #| ?loc: Loc?,
314
+ #| ?comments: Array[Comment]
315
+ #| ) -> void
303
316
  def initialize(name, names, visibility: Public.new, sigs: [], loc: nil, comments: [])
304
317
  super(loc: loc, comments: comments)
305
318
  @names = [name, *names] #: Array[Symbol]
@@ -309,11 +322,18 @@ module RBI
309
322
 
310
323
  # @abstract
311
324
  #: -> Array[String]
312
- def fully_qualified_names; end
325
+ def fully_qualified_names = raise NotImplementedError, "Abstract method called"
313
326
  end
314
327
 
315
328
  class AttrAccessor < Attr
316
- #: (Symbol name, *Symbol names, ?visibility: Visibility, ?sigs: Array[Sig], ?loc: Loc?, ?comments: Array[Comment]) ?{ (AttrAccessor node) -> void } -> void
329
+ #: (
330
+ #| Symbol name,
331
+ #| *Symbol names,
332
+ #| ?visibility: Visibility,
333
+ #| ?sigs: Array[Sig],
334
+ #| ?loc: Loc?,
335
+ #| ?comments: Array[Comment]
336
+ #| ) ?{ (AttrAccessor node) -> void } -> void
317
337
  def initialize(name, *names, visibility: Public.new, sigs: [], loc: nil, comments: [], &block)
318
338
  super(name, names, loc: loc, visibility: visibility, sigs: sigs, comments: comments)
319
339
  block&.call(self)
@@ -335,7 +355,14 @@ module RBI
335
355
  end
336
356
 
337
357
  class AttrReader < Attr
338
- #: (Symbol name, *Symbol names, ?visibility: Visibility, ?sigs: Array[Sig], ?loc: Loc?, ?comments: Array[Comment]) ?{ (AttrReader node) -> void } -> void
358
+ #: (
359
+ #| Symbol name,
360
+ #| *Symbol names,
361
+ #| ?visibility: Visibility,
362
+ #| ?sigs: Array[Sig],
363
+ #| ?loc: Loc?,
364
+ #| ?comments: Array[Comment]
365
+ #| ) ?{ (AttrReader node) -> void } -> void
339
366
  def initialize(name, *names, visibility: Public.new, sigs: [], loc: nil, comments: [], &block)
340
367
  super(name, names, loc: loc, visibility: visibility, sigs: sigs, comments: comments)
341
368
  block&.call(self)
@@ -357,7 +384,14 @@ module RBI
357
384
  end
358
385
 
359
386
  class AttrWriter < Attr
360
- #: (Symbol name, *Symbol names, ?visibility: Visibility, ?sigs: Array[Sig], ?loc: Loc?, ?comments: Array[Comment]) ?{ (AttrWriter node) -> void } -> void
387
+ #: (
388
+ #| Symbol name,
389
+ #| *Symbol names,
390
+ #| ?visibility: Visibility,
391
+ #| ?sigs: Array[Sig],
392
+ #| ?loc: Loc?,
393
+ #| ?comments: Array[Comment]
394
+ #| ) ?{ (AttrWriter node) -> void } -> void
361
395
  def initialize(name, *names, visibility: Public.new, sigs: [], loc: nil, comments: [], &block)
362
396
  super(name, names, loc: loc, visibility: visibility, sigs: sigs, comments: comments)
363
397
  block&.call(self)
@@ -396,7 +430,15 @@ module RBI
396
430
  #: Array[Sig]
397
431
  attr_accessor :sigs
398
432
 
399
- #: (String name, ?params: Array[Param], ?is_singleton: bool, ?visibility: Visibility, ?sigs: Array[Sig], ?loc: Loc?, ?comments: Array[Comment]) ?{ (Method node) -> void } -> void
433
+ #: (
434
+ #| String name,
435
+ #| ?params: Array[Param],
436
+ #| ?is_singleton: bool,
437
+ #| ?visibility: Visibility,
438
+ #| ?sigs: Array[Sig],
439
+ #| ?loc: Loc?,
440
+ #| ?comments: Array[Comment]
441
+ #| ) ?{ (Method node) -> void } -> void
400
442
  def initialize(
401
443
  name,
402
444
  params: [],
@@ -456,7 +498,15 @@ module RBI
456
498
  @params << BlockParam.new(name)
457
499
  end
458
500
 
459
- #: (?params: Array[SigParam], ?return_type: (String | Type), ?is_abstract: bool, ?is_override: bool, ?is_overridable: bool, ?is_final: bool, ?type_params: Array[String], ?checked: Symbol?) ?{ (Sig node) -> void } -> void
501
+ #: (
502
+ #| ?params: Array[SigParam],
503
+ #| ?return_type: (String | Type),
504
+ #| ?is_abstract: bool,
505
+ #| ?is_override: bool,
506
+ #| ?is_overridable: bool,
507
+ #| ?is_final: bool,
508
+ #| ?type_params: Array[String],
509
+ #| ?checked: Symbol?) ?{ (Sig node) -> void } -> void
460
510
  def add_sig(
461
511
  params: [],
462
512
  return_type: "void",
@@ -832,7 +882,25 @@ module RBI
832
882
  attr_accessor :return_type
833
883
 
834
884
  #: bool
835
- attr_accessor :is_abstract, :is_override, :is_overridable, :is_final, :allow_incompatible_override, :without_runtime
885
+ attr_accessor :is_abstract
886
+
887
+ #: bool
888
+ attr_accessor :is_override
889
+
890
+ #: bool
891
+ attr_accessor :is_overridable
892
+
893
+ #: bool
894
+ attr_accessor :is_final
895
+
896
+ #: bool
897
+ attr_accessor :allow_incompatible_override
898
+
899
+ #: bool
900
+ attr_accessor :allow_incompatible_override_visibility
901
+
902
+ #: bool
903
+ attr_accessor :without_runtime
836
904
 
837
905
  #: Array[String]
838
906
  attr_reader :type_params
@@ -840,7 +908,21 @@ module RBI
840
908
  #: Symbol?
841
909
  attr_accessor :checked
842
910
 
843
- #: (?params: Array[SigParam], ?return_type: (Type | String), ?is_abstract: bool, ?is_override: bool, ?is_overridable: bool, ?is_final: bool, ?allow_incompatible_override: bool, ?without_runtime: bool, ?type_params: Array[String], ?checked: Symbol?, ?loc: Loc?, ?comments: Array[Comment]) ?{ (Sig node) -> void } -> void
911
+ #: (
912
+ #| ?params: Array[SigParam],
913
+ #| ?return_type: (Type | String),
914
+ #| ?is_abstract: bool,
915
+ #| ?is_override: bool,
916
+ #| ?is_overridable: bool,
917
+ #| ?is_final: bool,
918
+ #| ?allow_incompatible_override: bool,
919
+ #| ?allow_incompatible_override_visibility: bool,
920
+ #| ?without_runtime: bool,
921
+ #| ?type_params: Array[String],
922
+ #| ?checked: Symbol?,
923
+ #| ?loc: Loc?,
924
+ #| ?comments: Array[Comment]
925
+ #| ) ?{ (Sig node) -> void } -> void
844
926
  def initialize(
845
927
  params: [],
846
928
  return_type: "void",
@@ -849,6 +931,7 @@ module RBI
849
931
  is_overridable: false,
850
932
  is_final: false,
851
933
  allow_incompatible_override: false,
934
+ allow_incompatible_override_visibility: false,
852
935
  without_runtime: false,
853
936
  type_params: [],
854
937
  checked: nil,
@@ -864,6 +947,7 @@ module RBI
864
947
  @is_overridable = is_overridable
865
948
  @is_final = is_final
866
949
  @allow_incompatible_override = allow_incompatible_override
950
+ @allow_incompatible_override_visibility = allow_incompatible_override_visibility
867
951
  @without_runtime = without_runtime
868
952
  @type_params = type_params
869
953
  @checked = checked
@@ -942,11 +1026,17 @@ module RBI
942
1026
 
943
1027
  # @abstract
944
1028
  #: -> Array[String]
945
- def fully_qualified_names; end
1029
+ def fully_qualified_names = raise NotImplementedError, "Abstract method called"
946
1030
  end
947
1031
 
948
1032
  class TStructConst < TStructField
949
- #: (String name, (Type | String) type, ?default: String?, ?loc: Loc?, ?comments: Array[Comment]) ?{ (TStructConst node) -> void } -> void
1033
+ #: (
1034
+ #| String name,
1035
+ #| (Type | String) type,
1036
+ #| ?default: String?,
1037
+ #| ?loc: Loc?,
1038
+ #| ?comments: Array[Comment]
1039
+ #| ) ?{ (TStructConst node) -> void } -> void
950
1040
  def initialize(name, type, default: nil, loc: nil, comments: [], &block)
951
1041
  super(name, type, default: default, loc: loc, comments: comments)
952
1042
  block&.call(self)
@@ -967,7 +1057,13 @@ module RBI
967
1057
  end
968
1058
 
969
1059
  class TStructProp < TStructField
970
- #: (String name, (Type | String) type, ?default: String?, ?loc: Loc?, ?comments: Array[Comment]) ?{ (TStructProp node) -> void } -> void
1060
+ #: (
1061
+ #| String name,
1062
+ #| (Type | String) type,
1063
+ #| ?default: String?,
1064
+ #| ?loc: Loc?,
1065
+ #| ?comments: Array[Comment]
1066
+ #| ) ?{ (TStructProp node) -> void } -> void
971
1067
  def initialize(name, type, default: nil, loc: nil, comments: [], &block)
972
1068
  super(name, type, default: default, loc: loc, comments: comments)
973
1069
  block&.call(self)
@@ -1087,7 +1183,12 @@ module RBI
1087
1183
  end
1088
1184
 
1089
1185
  class MixesInClassMethods < Mixin
1090
- #: (String name, *String names, ?loc: Loc?, ?comments: Array[Comment]) ?{ (MixesInClassMethods node) -> void } -> void
1186
+ #: (
1187
+ #| String name,
1188
+ #| *String names,
1189
+ #| ?loc: Loc?,
1190
+ #| ?comments: Array[Comment]
1191
+ #| ) ?{ (MixesInClassMethods node) -> void } -> void
1091
1192
  def initialize(name, *names, loc: nil, comments: [], &block)
1092
1193
  super(name, names, loc: loc, comments: comments)
1093
1194
  block&.call(self)
data/lib/rbi/parser.rb CHANGED
@@ -946,22 +946,8 @@ module RBI
946
946
  end
947
947
  when "override"
948
948
  @current.is_override = true
949
-
950
- args = node.arguments&.arguments
951
-
952
- keywords_hash = args
953
- &.grep(Prism::KeywordHashNode)
954
- &.first
955
-
956
- allow_incompatible_override = keywords_hash
957
- &.elements
958
- &.any? do |assoc|
959
- assoc.is_a?(Prism::AssocNode) &&
960
- node_string(assoc.key) == "allow_incompatible:" &&
961
- node_string(assoc.value) == "true"
962
- end
963
-
964
- @current.allow_incompatible_override = !!allow_incompatible_override
949
+ @current.allow_incompatible_override = allow_incompatible_override?(node, "true")
950
+ @current.allow_incompatible_override_visibility = allow_incompatible_override?(node, ":visibility")
965
951
  when "overridable"
966
952
  @current.is_overridable = true
967
953
  when "params"
@@ -995,6 +981,23 @@ module RBI
995
981
  node_string!(node.value),
996
982
  )
997
983
  end
984
+
985
+ #: (Prism::CallNode node, String value) -> bool
986
+ def allow_incompatible_override?(node, value)
987
+ args = node.arguments&.arguments
988
+
989
+ keywords_hash = args
990
+ &.grep(Prism::KeywordHashNode)
991
+ &.first
992
+
993
+ !!keywords_hash
994
+ &.elements
995
+ &.any? do |assoc|
996
+ assoc.is_a?(Prism::AssocNode) &&
997
+ node_string(assoc.key) == "allow_incompatible:" &&
998
+ node_string(assoc.value) == value
999
+ end
1000
+ end
998
1001
  end
999
1002
 
1000
1003
  class HeredocLocationVisitor < Prism::Visitor
data/lib/rbi/printer.rb CHANGED
@@ -800,6 +800,8 @@ module RBI
800
800
  if node.is_override
801
801
  modifiers << if node.allow_incompatible_override
802
802
  "override(allow_incompatible: true)"
803
+ elsif node.allow_incompatible_override_visibility
804
+ "override(allow_incompatible: :visibility)"
803
805
  else
804
806
  "override"
805
807
  end
@@ -33,8 +33,7 @@ module RBI
33
33
  def translate(type)
34
34
  case type
35
35
  when ::RBS::Types::Alias
36
- # TODO: unsupported yet
37
- Type.untyped
36
+ translate_type_alias(type)
38
37
  when ::RBS::Types::Bases::Any
39
38
  Type.untyped
40
39
  when ::RBS::Types::Bases::Bool
@@ -85,12 +84,24 @@ module RBI
85
84
  when ::RBS::Types::Variable
86
85
  Type.type_parameter(type.name)
87
86
  else
88
- T.absurd(type)
87
+ type #: absurd
89
88
  end
90
89
  end
91
90
 
92
91
  private
93
92
 
93
+ #: (::RBS::Types::Alias) -> Type
94
+ def translate_type_alias(type)
95
+ name = ::RBS::TypeName.new(
96
+ namespace: type.name.namespace,
97
+ name: type.name.name.to_s.gsub(/(?:^|_)([a-z\d]*)/i) do |match|
98
+ match = match.delete_prefix("_")
99
+ !match.empty? ? match[0].upcase.concat(match[1..-1]) : +""
100
+ end,
101
+ )
102
+ Type.simple(name.to_s)
103
+ end
104
+
94
105
  #: (::RBS::Types::ClassInstance) -> Type
95
106
  def translate_class_instance(type)
96
107
  return Type.simple(type.name.to_s) if type.args.empty?
@@ -150,23 +161,25 @@ module RBI
150
161
  def translate_t_generic_type(type_name)
151
162
  case type_name.delete_prefix("::")
152
163
  when "Array"
153
- "T::Array"
164
+ "::T::Array"
154
165
  when "Class"
155
- "T::Class"
166
+ "::T::Class"
156
167
  when "Enumerable"
157
- "T::Enumerable"
168
+ "::T::Enumerable"
158
169
  when "Enumerator"
159
- "T::Enumerator"
170
+ "::T::Enumerator"
160
171
  when "Enumerator::Chain"
161
- "T::Enumerator::Chain"
172
+ "::T::Enumerator::Chain"
162
173
  when "Enumerator::Lazy"
163
- "T::Enumerator::Lazy"
174
+ "::T::Enumerator::Lazy"
164
175
  when "Hash"
165
- "T::Hash"
176
+ "::T::Hash"
177
+ when "Module"
178
+ "::T::Module"
166
179
  when "Set"
167
- "T::Set"
180
+ "::T::Set"
168
181
  when "Range"
169
- "T::Range"
182
+ "::T::Range"
170
183
  else
171
184
  type_name
172
185
  end
@@ -337,6 +337,8 @@ module RBI
337
337
  if node.sigs.any?(&:is_override)
338
338
  if node.sigs.any?(&:allow_incompatible_override)
339
339
  printl("# @override(allow_incompatible: true)")
340
+ elsif node.sigs.any?(&:allow_incompatible_override_visibility)
341
+ printl("# @override(allow_incompatible: :visibility)")
340
342
  else
341
343
  printl("# @override")
342
344
  end
@@ -1028,6 +1030,8 @@ module RBI
1028
1030
  visit_type_parameter(node)
1029
1031
  when Type::Class
1030
1032
  visit_class(node)
1033
+ when Type::Module
1034
+ visit_module(node)
1031
1035
  else
1032
1036
  raise Error, "Unhandled node: #{node.class}"
1033
1037
  end
@@ -1188,6 +1192,13 @@ module RBI
1188
1192
  @string << "]"
1189
1193
  end
1190
1194
 
1195
+ #: (Type::Module type) -> void
1196
+ def visit_module(type)
1197
+ @string << "Module["
1198
+ visit(type.type)
1199
+ @string << "]"
1200
+ end
1201
+
1191
1202
  private
1192
1203
 
1193
1204
  #: (String type_name) -> String
@@ -1195,10 +1206,20 @@ module RBI
1195
1206
  case type_name
1196
1207
  when "T::Array"
1197
1208
  "Array"
1209
+ when "T::Enumerable"
1210
+ "Enumerable"
1211
+ when "T::Enumerator"
1212
+ "Enumerator"
1213
+ when "T::Enumerator::Chain"
1214
+ "Enumerator::Chain"
1215
+ when "T::Enumerator::Lazy"
1216
+ "Enumerator::Lazy"
1198
1217
  when "T::Hash"
1199
1218
  "Hash"
1200
1219
  when "T::Set"
1201
1220
  "Set"
1221
+ when "T::Range"
1222
+ "Range"
1202
1223
  else
1203
1224
  type_name
1204
1225
  end
@@ -56,7 +56,7 @@ module RBI
56
56
  class Attr
57
57
  # @abstract
58
58
  #: -> Array[Method]
59
- def convert_to_methods; end
59
+ def convert_to_methods = raise NotImplementedError, "Abstract method called"
60
60
 
61
61
  private
62
62
 
@@ -88,7 +88,14 @@ module RBI
88
88
  )
89
89
  end
90
90
 
91
- #: (String name, Sig? sig, (Type | String)? attribute_type, Visibility visibility, Loc? loc, Array[Comment] comments) -> Method
91
+ #: (
92
+ #| String name,
93
+ #| Sig? sig,
94
+ #| (Type | String)? attribute_type,
95
+ #| Visibility visibility,
96
+ #| Loc? loc,
97
+ #| Array[Comment] comments
98
+ #| ) -> Method
92
99
  def create_setter_method(name, sig, attribute_type, visibility, loc, comments) # rubocop:disable Metrics/ParameterLists
93
100
  sig = if sig # Modify the original sig to correct the name, and remove the return type
94
101
  params = attribute_type ? [SigParam.new(name, attribute_type)] : []
@@ -330,7 +330,11 @@ module RBI
330
330
  #: Array[Rewriters::Merge::Conflict]
331
331
  attr_reader :conflicts
332
332
 
333
- #: (?loc: Loc?, ?comments: Array[Comment], ?conflicts: Array[Rewriters::Merge::Conflict]) ?{ (Tree node) -> void } -> void
333
+ #: (
334
+ #| ?loc: Loc?,
335
+ #| ?comments: Array[Comment],
336
+ #| ?conflicts: Array[Rewriters::Merge::Conflict]
337
+ #| ) ?{ (Tree node) -> void } -> void
334
338
  def initialize(loc: nil, comments: [], conflicts: [], &block)
335
339
  super(loc: loc, comments: comments)
336
340
  @conflicts = conflicts
data/lib/rbi/type.rb CHANGED
@@ -58,7 +58,7 @@ module RBI
58
58
  # @override
59
59
  #: -> String
60
60
  def to_rbi
61
- "T.anything"
61
+ "::T.anything"
62
62
  end
63
63
 
64
64
  # @override
@@ -85,7 +85,7 @@ module RBI
85
85
  # @override
86
86
  #: -> String
87
87
  def to_rbi
88
- "T.attached_class"
88
+ "::T.attached_class"
89
89
  end
90
90
 
91
91
  # @override
@@ -139,7 +139,7 @@ module RBI
139
139
  # @override
140
140
  #: -> String
141
141
  def to_rbi
142
- "T.noreturn"
142
+ "::T.noreturn"
143
143
  end
144
144
 
145
145
  # @override
@@ -166,7 +166,7 @@ module RBI
166
166
  # @override
167
167
  #: -> String
168
168
  def to_rbi
169
- "T.self_type"
169
+ "::T.self_type"
170
170
  end
171
171
 
172
172
  # @override
@@ -193,7 +193,7 @@ module RBI
193
193
  # @override
194
194
  #: -> String
195
195
  def to_rbi
196
- "T.untyped"
196
+ "::T.untyped"
197
197
  end
198
198
 
199
199
  # @override
@@ -274,6 +274,42 @@ module RBI
274
274
  end
275
275
  end
276
276
 
277
+ # The module of another type like `T::Module[Foo]`.
278
+ class Module < Type
279
+ #: Type
280
+ attr_reader :type
281
+
282
+ #: (Type type) -> void
283
+ def initialize(type)
284
+ super()
285
+ @type = type
286
+ end
287
+
288
+ # @override
289
+ #: (BasicObject other) -> bool
290
+ def ==(other)
291
+ Module === other && @type == other.type
292
+ end
293
+
294
+ # @override
295
+ #: -> String
296
+ def to_rbi
297
+ "T::Module[#{@type}]"
298
+ end
299
+
300
+ # @override
301
+ #: -> Type
302
+ def normalize
303
+ self
304
+ end
305
+
306
+ # @override
307
+ #: -> Type
308
+ def simplify
309
+ self
310
+ end
311
+ end
312
+
277
313
  # The singleton class of another type like `T.class_of(Foo)`.
278
314
  class ClassOf < Type
279
315
  #: Simple
@@ -299,9 +335,9 @@ module RBI
299
335
  #: -> String
300
336
  def to_rbi
301
337
  if @type_parameter
302
- "T.class_of(#{@type.to_rbi})[#{@type_parameter.to_rbi}]"
338
+ "::T.class_of(#{@type.to_rbi})[#{@type_parameter.to_rbi}]"
303
339
  else
304
- "T.class_of(#{@type.to_rbi})"
340
+ "::T.class_of(#{@type.to_rbi})"
305
341
  end
306
342
  end
307
343
 
@@ -338,7 +374,7 @@ module RBI
338
374
  # @override
339
375
  #: -> String
340
376
  def to_rbi
341
- "T.nilable(#{@type.to_rbi})"
377
+ "::T.nilable(#{@type.to_rbi})"
342
378
  end
343
379
 
344
380
  # @override
@@ -385,7 +421,7 @@ module RBI
385
421
  # @override
386
422
  #: -> String
387
423
  def to_rbi
388
- "T.all(#{@types.map(&:to_rbi).join(", ")})"
424
+ "::T.all(#{@types.map(&:to_rbi).join(", ")})"
389
425
  end
390
426
 
391
427
  # @override
@@ -427,7 +463,7 @@ module RBI
427
463
  # @override
428
464
  #: -> String
429
465
  def to_rbi
430
- "T.any(#{@types.map(&:to_rbi).join(", ")})"
466
+ "::T.any(#{@types.map(&:to_rbi).join(", ")})"
431
467
  end
432
468
 
433
469
  #: -> bool
@@ -567,7 +603,7 @@ module RBI
567
603
  # @override
568
604
  #: -> String
569
605
  def to_rbi
570
- "T.type_parameter(#{@name.inspect})"
606
+ "::T.type_parameter(#{@name.inspect})"
571
607
  end
572
608
 
573
609
  # @override
@@ -583,6 +619,46 @@ module RBI
583
619
  end
584
620
  end
585
621
 
622
+ # A type alias that references another type by name like `MyTypeAlias`.
623
+ class TypeAlias < Type
624
+ #: String
625
+ attr_reader :name
626
+
627
+ #: Type
628
+ attr_reader :aliased_type
629
+
630
+ #: (String name, Type aliased_type) -> void
631
+ def initialize(name, aliased_type)
632
+ super()
633
+ @name = name
634
+ @aliased_type = aliased_type
635
+ end
636
+
637
+ # @override
638
+ #: (BasicObject other) -> bool
639
+ def ==(other)
640
+ TypeAlias === other && @name == other.name && @aliased_type == other.aliased_type
641
+ end
642
+
643
+ # @override
644
+ #: -> String
645
+ def to_rbi
646
+ "#{name} = ::T.type_alias { #{aliased_type.to_rbi} }"
647
+ end
648
+
649
+ # @override
650
+ #: -> Type
651
+ def normalize
652
+ TypeAlias.new(name, aliased_type.normalize)
653
+ end
654
+
655
+ # @override
656
+ #: -> Type
657
+ def simplify
658
+ TypeAlias.new(name, aliased_type.simplify)
659
+ end
660
+ end
661
+
586
662
  # Tuples and shapes
587
663
 
588
664
  # A tuple type like `[String, Integer]`.
@@ -720,7 +796,7 @@ module RBI
720
796
  # @override
721
797
  #: -> String
722
798
  def to_rbi
723
- rbi = +"T.proc"
799
+ rbi = +"::T.proc"
724
800
 
725
801
  if @proc_bind
726
802
  rbi << ".bind(#{@proc_bind})"
@@ -823,6 +899,12 @@ module RBI
823
899
  Class.new(type)
824
900
  end
825
901
 
902
+ # Builds a type that represents the module of another type like `T::Module[Foo]`.
903
+ #: (Type type) -> Module
904
+ def t_module(type)
905
+ Module.new(type)
906
+ end
907
+
826
908
  # Builds a type that represents the singleton class of another type like `T.class_of(Foo)`.
827
909
  #: (Simple type, ?Type? type_parameter) -> ClassOf
828
910
  def class_of(type, type_parameter = nil)
@@ -871,6 +953,12 @@ module RBI
871
953
  TypeParameter.new(name)
872
954
  end
873
955
 
956
+ # Builds a type that represents a type alias like `MyTypeAlias`.
957
+ #: (String name, Type aliased_type) -> TypeAlias
958
+ def type_alias(name, aliased_type)
959
+ TypeAlias.new(name, aliased_type)
960
+ end
961
+
874
962
  # Tuples and shapes
875
963
 
876
964
  # Builds a type that represents a tuple type like `[String, Integer]`.
@@ -912,8 +1000,8 @@ module RBI
912
1000
  # ```ruby
913
1001
  # type = RBI::Type.simple("String")
914
1002
  # type.to_rbi # => "String"
915
- # type.nilable.to_rbi # => "T.nilable(String)"
916
- # type.nilable.nilable.to_rbi # => "T.nilable(String)"
1003
+ # type.nilable.to_rbi # => "::T.nilable(String)"
1004
+ # type.nilable.nilable.to_rbi # => "::T.nilable(String)"
917
1005
  # ```
918
1006
  #: -> Type
919
1007
  def nilable
@@ -926,7 +1014,7 @@ module RBI
926
1014
  #
927
1015
  # ```ruby
928
1016
  # type = RBI::Type.nilable(RBI::Type.simple("String"))
929
- # type.to_rbi # => "T.nilable(String)"
1017
+ # type.to_rbi # => "::T.nilable(String)"
930
1018
  # type.non_nilable.to_rbi # => "String"
931
1019
  # type.non_nilable.non_nilable.to_rbi # => "String"
932
1020
  # ```
@@ -957,7 +1045,7 @@ module RBI
957
1045
  #
958
1046
  # @abstract
959
1047
  #: -> Type
960
- def normalize; end
1048
+ def normalize = raise NotImplementedError, "Abstract method called"
961
1049
 
962
1050
  # Returns a simplified version of the type.
963
1051
  #
@@ -969,11 +1057,11 @@ module RBI
969
1057
  #
970
1058
  # @abstract
971
1059
  #: -> Type
972
- def simplify; end
1060
+ def simplify = raise NotImplementedError, "Abstract method called"
973
1061
 
974
1062
  # @abstract
975
1063
  #: (BasicObject) -> bool
976
- def ==(other); end
1064
+ def ==(other) = raise NotImplementedError, "Abstract method called"
977
1065
 
978
1066
  #: (BasicObject other) -> bool
979
1067
  def eql?(other)
@@ -988,7 +1076,7 @@ module RBI
988
1076
 
989
1077
  # @abstract
990
1078
  #: -> String
991
- def to_rbi; end
1079
+ def to_rbi = raise NotImplementedError, "Abstract method called"
992
1080
 
993
1081
  # @override
994
1082
  #: -> String
@@ -27,6 +27,8 @@ module RBI
27
27
  case node
28
28
  when Prism::ConstantReadNode, Prism::ConstantPathNode
29
29
  parse_constant(node)
30
+ when Prism::ConstantWriteNode, Prism::ConstantPathWriteNode
31
+ parse_constant_assignment(node)
30
32
  when Prism::CallNode
31
33
  parse_call(node)
32
34
  when Prism::ArrayNode
@@ -67,6 +69,29 @@ module RBI
67
69
  end
68
70
  end
69
71
 
72
+ #: (Prism::ConstantWriteNode | Prism::ConstantPathWriteNode node) -> Type
73
+ def parse_constant_assignment(node)
74
+ if t_type_alias?(node.value)
75
+ value = node.value #: as Prism::CallNode
76
+ name = if node.is_a?(Prism::ConstantPathWriteNode)
77
+ node.target.full_name
78
+ else
79
+ node.full_name
80
+ end
81
+
82
+ body = value.block
83
+
84
+ if body.is_a?(Prism::BlockNode) && (stmts = body.body).is_a?(Prism::StatementsNode)
85
+ body_node = stmts.body.first #: as !nil
86
+ Type::TypeAlias.new(name, parse_node(body_node))
87
+ else
88
+ Type::Simple.new(node.slice)
89
+ end
90
+ else
91
+ Type::Simple.new(node.slice)
92
+ end
93
+ end
94
+
70
95
  #: (Prism::CallNode node) -> Type
71
96
  def parse_call(node)
72
97
  recv = node.receiver
@@ -91,6 +116,14 @@ module RBI
91
116
  args.first, #: as !nil
92
117
  ),
93
118
  )
119
+ elsif t_module?(recv)
120
+ # `T::Module[Foo]` or `::T::Module[Foo]`
121
+ args = check_arguments_exactly!(node, 1)
122
+ return Type::Module.new(
123
+ parse_node(
124
+ args.first, #: as !nil
125
+ ),
126
+ )
94
127
  else
95
128
  # `::Foo[Bar]` or `::Foo[Bar, Baz]`
96
129
  args = check_arguments_at_least!(node, 1)
@@ -310,6 +343,13 @@ module RBI
310
343
  false
311
344
  end
312
345
 
346
+ #: (Prism::Node? node) -> bool
347
+ def t_type_alias?(node)
348
+ return false unless node.is_a?(Prism::CallNode)
349
+
350
+ t?(node.receiver) && node.name == :type_alias
351
+ end
352
+
313
353
  #: (Prism::Node? node) -> bool
314
354
  def t_boolean?(node)
315
355
  return false unless node.is_a?(Prism::ConstantPathNode)
@@ -322,6 +362,11 @@ module RBI
322
362
  t?(node.parent) && node.name == :Class
323
363
  end
324
364
 
365
+ #: (Prism::ConstantPathNode node) -> bool
366
+ def t_module?(node)
367
+ t?(node.parent) && node.name == :Module
368
+ end
369
+
325
370
  #: (Prism::Node? node) -> bool
326
371
  def t_class_of?(node)
327
372
  return false unless node.is_a?(Prism::CallNode)
@@ -45,6 +45,8 @@ module RBI
45
45
  visit_type_parameter(node)
46
46
  when Type::Class
47
47
  visit_class(node)
48
+ when Type::TypeAlias
49
+ visit_type_alias(node)
48
50
  else
49
51
  raise Error, "Unhandled node: #{node.class}"
50
52
  end
@@ -105,6 +107,9 @@ module RBI
105
107
 
106
108
  #: (Type::Untyped type) -> void
107
109
  def visit_untyped(type); end
110
+
111
+ #: (Type::TypeAlias type) -> void
112
+ def visit_type_alias(type); end
108
113
  end
109
114
  end
110
115
  end
data/lib/rbi/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module RBI
5
- VERSION = "0.3.6"
5
+ VERSION = "0.3.8"
6
6
  end
data/rbi/rbi.rbi CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  # DO NOT EDIT MANUALLY
4
4
  # This is an autogenerated file for types exported from the `rbi` gem.
5
- # Please instead update this file by running `spoom srb sigs export`.
5
+ # Please instead update this file by running `bundle exec spoom srb sigs export`.
6
6
 
7
7
  module RBI; end
8
8
 
@@ -968,6 +968,9 @@ class RBI::Parser::SigBuilder < ::RBI::Parser::Visitor
968
968
  sig { params(content: ::String, file: ::String).void }
969
969
  def initialize(content, file:); end
970
970
 
971
+ sig { params(node: ::Prism::CallNode, value: ::String).returns(T::Boolean) }
972
+ def allow_incompatible_override?(node, value); end
973
+
971
974
  sig { returns(::RBI::Sig) }
972
975
  def current; end
973
976
 
@@ -1418,6 +1421,9 @@ class RBI::RBS::TypeTranslator
1418
1421
 
1419
1422
  sig { params(type_name: ::String).returns(::String) }
1420
1423
  def translate_t_generic_type(type_name); end
1424
+
1425
+ sig { params(type: ::RBS::Types::Alias).returns(::RBI::Type) }
1426
+ def translate_type_alias(type); end
1421
1427
  end
1422
1428
  end
1423
1429
 
@@ -2102,6 +2108,7 @@ class RBI::Sig < ::RBI::NodeWithComments
2102
2108
  is_overridable: T::Boolean,
2103
2109
  is_final: T::Boolean,
2104
2110
  allow_incompatible_override: T::Boolean,
2111
+ allow_incompatible_override_visibility: T::Boolean,
2105
2112
  without_runtime: T::Boolean,
2106
2113
  type_params: T::Array[::String],
2107
2114
  checked: T.nilable(::Symbol),
@@ -2110,7 +2117,7 @@ class RBI::Sig < ::RBI::NodeWithComments
2110
2117
  block: T.nilable(T.proc.params(node: ::RBI::Sig).void)
2111
2118
  ).void
2112
2119
  end
2113
- def initialize(params: T.unsafe(nil), return_type: T.unsafe(nil), is_abstract: T.unsafe(nil), is_override: T.unsafe(nil), is_overridable: T.unsafe(nil), is_final: T.unsafe(nil), allow_incompatible_override: T.unsafe(nil), without_runtime: T.unsafe(nil), type_params: T.unsafe(nil), checked: T.unsafe(nil), loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
2120
+ def initialize(params: T.unsafe(nil), return_type: T.unsafe(nil), is_abstract: T.unsafe(nil), is_override: T.unsafe(nil), is_overridable: T.unsafe(nil), is_final: T.unsafe(nil), allow_incompatible_override: T.unsafe(nil), allow_incompatible_override_visibility: T.unsafe(nil), without_runtime: T.unsafe(nil), type_params: T.unsafe(nil), checked: T.unsafe(nil), loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
2114
2121
 
2115
2122
  sig { params(param: ::RBI::SigParam).void }
2116
2123
  def <<(param); end
@@ -2121,9 +2128,16 @@ class RBI::Sig < ::RBI::NodeWithComments
2121
2128
  sig { params(name: ::String, type: T.any(::RBI::Type, ::String)).void }
2122
2129
  def add_param(name, type); end
2123
2130
 
2131
+ sig { returns(T::Boolean) }
2124
2132
  def allow_incompatible_override; end
2133
+
2125
2134
  def allow_incompatible_override=(_arg0); end
2126
2135
 
2136
+ sig { returns(T::Boolean) }
2137
+ def allow_incompatible_override_visibility; end
2138
+
2139
+ def allow_incompatible_override_visibility=(_arg0); end
2140
+
2127
2141
  sig { returns(T.nilable(::Symbol)) }
2128
2142
  def checked; end
2129
2143
 
@@ -2133,11 +2147,20 @@ class RBI::Sig < ::RBI::NodeWithComments
2133
2147
  def is_abstract; end
2134
2148
 
2135
2149
  def is_abstract=(_arg0); end
2150
+
2151
+ sig { returns(T::Boolean) }
2136
2152
  def is_final; end
2153
+
2137
2154
  def is_final=(_arg0); end
2155
+
2156
+ sig { returns(T::Boolean) }
2138
2157
  def is_overridable; end
2158
+
2139
2159
  def is_overridable=(_arg0); end
2160
+
2161
+ sig { returns(T::Boolean) }
2140
2162
  def is_override; end
2163
+
2141
2164
  def is_override=(_arg0); end
2142
2165
 
2143
2166
  sig { returns(T::Array[::RBI::SigParam]) }
@@ -2151,7 +2174,9 @@ class RBI::Sig < ::RBI::NodeWithComments
2151
2174
  sig { returns(T::Array[::String]) }
2152
2175
  def type_params; end
2153
2176
 
2177
+ sig { returns(T::Boolean) }
2154
2178
  def without_runtime; end
2179
+
2155
2180
  def without_runtime=(_arg0); end
2156
2181
  end
2157
2182
 
@@ -2407,58 +2432,6 @@ class RBI::Tree < ::RBI::NodeWithComments
2407
2432
  sig { params(annotation: ::String, annotate_scopes: T::Boolean, annotate_properties: T::Boolean).void }
2408
2433
  def annotate!(annotation, annotate_scopes: T.unsafe(nil), annotate_properties: T.unsafe(nil)); end
2409
2434
 
2410
- sig do
2411
- params(
2412
- name: ::String,
2413
- superclass_name: T.nilable(::String),
2414
- block: T.nilable(T.proc.params(scope: ::RBI::Scope).void)
2415
- ).returns(::RBI::Scope)
2416
- end
2417
- def create_class(name, superclass_name: T.unsafe(nil), &block); end
2418
-
2419
- sig { params(name: ::String, value: ::String).void }
2420
- def create_constant(name, value:); end
2421
-
2422
- sig { params(name: ::String).void }
2423
- def create_extend(name); end
2424
-
2425
- sig { params(name: ::String).void }
2426
- def create_include(name); end
2427
-
2428
- sig do
2429
- params(
2430
- name: ::String,
2431
- parameters: T::Array[::RBI::TypedParam],
2432
- return_type: T.nilable(::String),
2433
- class_method: T::Boolean,
2434
- visibility: ::RBI::Visibility,
2435
- comments: T::Array[::RBI::Comment],
2436
- block: T.nilable(T.proc.params(node: ::RBI::Method).void)
2437
- ).void
2438
- end
2439
- def create_method(name, parameters: T.unsafe(nil), return_type: T.unsafe(nil), class_method: T.unsafe(nil), visibility: T.unsafe(nil), comments: T.unsafe(nil), &block); end
2440
-
2441
- sig { params(name: ::String).void }
2442
- def create_mixes_in_class_methods(name); end
2443
-
2444
- sig { params(name: ::String, block: T.nilable(T.proc.params(scope: ::RBI::Scope).void)).returns(::RBI::Scope) }
2445
- def create_module(name, &block); end
2446
-
2447
- sig { params(constant: ::Module, block: T.nilable(T.proc.params(scope: ::RBI::Scope).void)).returns(::RBI::Scope) }
2448
- def create_path(constant, &block); end
2449
-
2450
- sig do
2451
- params(
2452
- name: ::String,
2453
- type: ::String,
2454
- variance: ::Symbol,
2455
- fixed: T.nilable(::String),
2456
- upper: T.nilable(::String),
2457
- lower: T.nilable(::String)
2458
- ).void
2459
- end
2460
- def create_type_variable(name, type:, variance: T.unsafe(nil), fixed: T.unsafe(nil), upper: T.unsafe(nil), lower: T.unsafe(nil)); end
2461
-
2462
2435
  sig { params(annotation: ::String).void }
2463
2436
  def deannotate!(annotation); end
2464
2437
 
@@ -2510,14 +2483,6 @@ class RBI::Tree < ::RBI::NodeWithComments
2510
2483
 
2511
2484
  sig { void }
2512
2485
  def translate_rbs_sigs!; end
2513
-
2514
- private
2515
-
2516
- sig { params(node: ::RBI::Node).returns(::RBI::Node) }
2517
- def create_node(node); end
2518
-
2519
- sig { returns(T::Hash[::String, ::RBI::Node]) }
2520
- def nodes_cache; end
2521
2486
  end
2522
2487
 
2523
2488
  class RBI::Type
@@ -2608,9 +2573,15 @@ class RBI::Type
2608
2573
  sig { params(type: ::RBI::Type).returns(::RBI::Type::Class) }
2609
2574
  def t_class(type); end
2610
2575
 
2576
+ sig { params(type: ::RBI::Type).returns(::RBI::Type::Module) }
2577
+ def t_module(type); end
2578
+
2611
2579
  sig { params(types: T.any(::RBI::Type, T::Array[::RBI::Type])).returns(::RBI::Type::Tuple) }
2612
2580
  def tuple(*types); end
2613
2581
 
2582
+ sig { params(name: ::String, aliased_type: ::RBI::Type).returns(::RBI::Type::TypeAlias) }
2583
+ def type_alias(name, aliased_type); end
2584
+
2614
2585
  sig { params(name: ::Symbol).returns(::RBI::Type::TypeParameter) }
2615
2586
  def type_parameter(name); end
2616
2587
 
@@ -2637,6 +2608,9 @@ class RBI::Type
2637
2608
  sig { params(node: T.any(::Prism::ConstantPathNode, ::Prism::ConstantReadNode)).returns(::RBI::Type) }
2638
2609
  def parse_constant(node); end
2639
2610
 
2611
+ sig { params(node: T.any(::Prism::ConstantPathWriteNode, ::Prism::ConstantWriteNode)).returns(::RBI::Type) }
2612
+ def parse_constant_assignment(node); end
2613
+
2640
2614
  sig { params(node: ::Prism::CallNode).returns(::RBI::Type) }
2641
2615
  def parse_proc(node); end
2642
2616
 
@@ -2658,9 +2632,15 @@ class RBI::Type
2658
2632
  sig { params(node: T.nilable(::Prism::Node)).returns(T::Boolean) }
2659
2633
  def t_class_of?(node); end
2660
2634
 
2635
+ sig { params(node: ::Prism::ConstantPathNode).returns(T::Boolean) }
2636
+ def t_module?(node); end
2637
+
2661
2638
  sig { params(node: ::Prism::CallNode).returns(T::Boolean) }
2662
2639
  def t_proc?(node); end
2663
2640
 
2641
+ sig { params(node: T.nilable(::Prism::Node)).returns(T::Boolean) }
2642
+ def t_type_alias?(node); end
2643
+
2664
2644
  sig { params(name: ::String).returns(T::Boolean) }
2665
2645
  def valid_identifier?(name); end
2666
2646
  end
@@ -2814,6 +2794,26 @@ class RBI::Type::Generic < ::RBI::Type
2814
2794
  def to_rbi; end
2815
2795
  end
2816
2796
 
2797
+ class RBI::Type::Module < ::RBI::Type
2798
+ sig { params(type: ::RBI::Type).void }
2799
+ def initialize(type); end
2800
+
2801
+ sig { override.params(other: ::BasicObject).returns(T::Boolean) }
2802
+ def ==(other); end
2803
+
2804
+ sig { override.returns(::RBI::Type) }
2805
+ def normalize; end
2806
+
2807
+ sig { override.returns(::RBI::Type) }
2808
+ def simplify; end
2809
+
2810
+ sig { override.returns(::String) }
2811
+ def to_rbi; end
2812
+
2813
+ sig { returns(::RBI::Type) }
2814
+ def type; end
2815
+ end
2816
+
2817
2817
  class RBI::Type::Nilable < ::RBI::Type
2818
2818
  sig { params(type: ::RBI::Type).void }
2819
2819
  def initialize(type); end
@@ -2960,6 +2960,29 @@ class RBI::Type::Tuple < ::RBI::Type
2960
2960
  def types; end
2961
2961
  end
2962
2962
 
2963
+ class RBI::Type::TypeAlias < ::RBI::Type
2964
+ sig { params(name: ::String, aliased_type: ::RBI::Type).void }
2965
+ def initialize(name, aliased_type); end
2966
+
2967
+ sig { override.params(other: ::BasicObject).returns(T::Boolean) }
2968
+ def ==(other); end
2969
+
2970
+ sig { returns(::RBI::Type) }
2971
+ def aliased_type; end
2972
+
2973
+ sig { returns(::String) }
2974
+ def name; end
2975
+
2976
+ sig { override.returns(::RBI::Type) }
2977
+ def normalize; end
2978
+
2979
+ sig { override.returns(::RBI::Type) }
2980
+ def simplify; end
2981
+
2982
+ sig { override.returns(::String) }
2983
+ def to_rbi; end
2984
+ end
2985
+
2963
2986
  class RBI::Type::TypeParameter < ::RBI::Type
2964
2987
  sig { params(name: ::Symbol).void }
2965
2988
  def initialize(name); end
@@ -3045,6 +3068,9 @@ class RBI::Type::Visitor
3045
3068
  sig { params(type: ::RBI::Type::Tuple).void }
3046
3069
  def visit_tuple(type); end
3047
3070
 
3071
+ sig { params(type: ::RBI::Type::TypeAlias).void }
3072
+ def visit_type_alias(type); end
3073
+
3048
3074
  sig { params(type: ::RBI::Type::TypeParameter).void }
3049
3075
  def visit_type_parameter(type); end
3050
3076
 
@@ -3134,6 +3160,9 @@ class RBI::TypePrinter
3134
3160
  sig { params(type: ::RBI::Type::Generic).void }
3135
3161
  def visit_generic(type); end
3136
3162
 
3163
+ sig { params(type: ::RBI::Type::Module).void }
3164
+ def visit_module(type); end
3165
+
3137
3166
  sig { params(type: ::RBI::Type::Nilable).void }
3138
3167
  def visit_nilable(type); end
3139
3168
 
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.6
4
+ version: 0.3.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexandre Terrasa
8
+ autorequire:
8
9
  bindir: bin
9
10
  cert_chain: []
10
- date: 1980-01-02 00:00:00.000000000 Z
11
+ date: 2025-12-02 00:00:00.000000000 Z
11
12
  dependencies:
12
13
  - !ruby/object:Gem::Dependency
13
14
  name: prism
@@ -37,6 +38,7 @@ dependencies:
37
38
  - - ">="
38
39
  - !ruby/object:Gem::Version
39
40
  version: 3.4.4
41
+ description:
40
42
  email:
41
43
  - ruby@shopify.com
42
44
  executables: []
@@ -82,6 +84,7 @@ licenses:
82
84
  - MIT
83
85
  metadata:
84
86
  allowed_push_host: https://rubygems.org
87
+ post_install_message:
85
88
  rdoc_options: []
86
89
  require_paths:
87
90
  - lib
@@ -96,7 +99,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
99
  - !ruby/object:Gem::Version
97
100
  version: '0'
98
101
  requirements: []
99
- rubygems_version: 3.6.9
102
+ rubygems_version: 3.5.3
103
+ signing_key:
100
104
  specification_version: 4
101
105
  summary: RBI generation framework
102
106
  test_files: []