rbi 0.3.10 → 0.3.11
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 +4 -4
- data/Gemfile +3 -3
- data/lib/rbi/model.rb +18 -18
- data/lib/rbi/rbs_printer.rb +1 -1
- data/lib/rbi/rewriters/merge_trees.rb +4 -2
- data/lib/rbi/rewriters/sort_nodes.rb +1 -1
- data/lib/rbi/type.rb +4 -4
- data/lib/rbi/version.rb +1 -1
- data/rbi/rbi.rbi +0 -10
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 25403bea8eda0b45537db138c0bd858f416f6ba3f53e004bd862dbc80df71a35
|
|
4
|
+
data.tar.gz: f22394b06c7f3d5a9bfacf46c59f632f3c4cbe7f097eaec53ff55ad5cf749271
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4265d4d65186de19fd085b99200c71a2b4f727067c33b1b413316228a1fb404f452caa65185130cb08d71c446ba6e11973326e010abe0c85455fe7ba7c54c6e6
|
|
7
|
+
data.tar.gz: c12e329306017b52c72ab3c5055036162f2488cc3ab5f9cb5d7f19971a63916978273e7a3229c8247b55bf7189cab54783e651930444de246b3c9081fc0f30b7
|
data/Gemfile
CHANGED
|
@@ -6,11 +6,11 @@ source "https://rubygems.org"
|
|
|
6
6
|
gemspec
|
|
7
7
|
|
|
8
8
|
group(:development, :test) do
|
|
9
|
-
gem("
|
|
9
|
+
gem("debug")
|
|
10
10
|
gem("minitest")
|
|
11
11
|
gem("minitest-reporters")
|
|
12
|
-
gem("rake", "~> 13.
|
|
13
|
-
gem("rubocop", "~> 1.
|
|
12
|
+
gem("rake", "~> 13.4")
|
|
13
|
+
gem("rubocop", "~> 1.86", 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)
|
data/lib/rbi/model.rb
CHANGED
|
@@ -196,12 +196,12 @@ module RBI
|
|
|
196
196
|
|
|
197
197
|
class Module < Scope
|
|
198
198
|
#: String
|
|
199
|
-
|
|
199
|
+
attr_reader :name
|
|
200
200
|
|
|
201
201
|
#: (String name, ?loc: Loc?, ?comments: Array[Comment]?) ?{ (Module node) -> void } -> void
|
|
202
202
|
def initialize(name, loc: nil, comments: nil, &block)
|
|
203
203
|
super(loc: loc, comments: comments) {}
|
|
204
|
-
@name = name
|
|
204
|
+
@name = name.to_s #: String
|
|
205
205
|
block&.call(self)
|
|
206
206
|
end
|
|
207
207
|
|
|
@@ -216,7 +216,7 @@ module RBI
|
|
|
216
216
|
|
|
217
217
|
class Class < Scope
|
|
218
218
|
#: String
|
|
219
|
-
|
|
219
|
+
attr_reader :name
|
|
220
220
|
|
|
221
221
|
#: String?
|
|
222
222
|
attr_accessor :superclass_name
|
|
@@ -229,7 +229,7 @@ module RBI
|
|
|
229
229
|
#| ) ?{ (Class node) -> void } -> void
|
|
230
230
|
def initialize(name, superclass_name: nil, loc: nil, comments: nil, &block)
|
|
231
231
|
super(loc: loc, comments: comments) {}
|
|
232
|
-
@name = name
|
|
232
|
+
@name = name.to_s #: String
|
|
233
233
|
@superclass_name = superclass_name
|
|
234
234
|
block&.call(self)
|
|
235
235
|
end
|
|
@@ -259,7 +259,7 @@ module RBI
|
|
|
259
259
|
|
|
260
260
|
class Struct < Scope
|
|
261
261
|
#: String
|
|
262
|
-
|
|
262
|
+
attr_reader :name
|
|
263
263
|
|
|
264
264
|
#: Array[Symbol]
|
|
265
265
|
attr_accessor :members
|
|
@@ -276,7 +276,7 @@ module RBI
|
|
|
276
276
|
#| ) ?{ (Struct struct) -> void } -> void
|
|
277
277
|
def initialize(name, members: [], keyword_init: false, loc: nil, comments: nil, &block)
|
|
278
278
|
super(loc: loc, comments: comments) {}
|
|
279
|
-
@name = name
|
|
279
|
+
@name = name.to_s #: String
|
|
280
280
|
@members = members
|
|
281
281
|
@keyword_init = keyword_init
|
|
282
282
|
block&.call(self)
|
|
@@ -300,7 +300,7 @@ module RBI
|
|
|
300
300
|
#: (String name, String value, ?loc: Loc?, ?comments: Array[Comment]?) ?{ (Const node) -> void } -> void
|
|
301
301
|
def initialize(name, value, loc: nil, comments: nil, &block)
|
|
302
302
|
super(loc: loc, comments: comments)
|
|
303
|
-
@name = name
|
|
303
|
+
@name = name.to_s #: String
|
|
304
304
|
@value = value
|
|
305
305
|
block&.call(self)
|
|
306
306
|
end
|
|
@@ -453,7 +453,7 @@ module RBI
|
|
|
453
453
|
|
|
454
454
|
class Method < NodeWithComments
|
|
455
455
|
#: String
|
|
456
|
-
|
|
456
|
+
attr_reader :name
|
|
457
457
|
|
|
458
458
|
#: -> Array[Param]
|
|
459
459
|
def params
|
|
@@ -499,7 +499,7 @@ module RBI
|
|
|
499
499
|
&block
|
|
500
500
|
)
|
|
501
501
|
super(loc: loc, comments: comments)
|
|
502
|
-
@name = name
|
|
502
|
+
@name = name.to_s #: String
|
|
503
503
|
@params = params #: Array[Param]?
|
|
504
504
|
@is_singleton = is_singleton
|
|
505
505
|
@visibility = visibility
|
|
@@ -605,7 +605,7 @@ module RBI
|
|
|
605
605
|
#: (String name, ?loc: Loc?, ?comments: Array[Comment]?) -> void
|
|
606
606
|
def initialize(name, loc: nil, comments: nil)
|
|
607
607
|
super(loc: loc, comments: comments)
|
|
608
|
-
@name = name
|
|
608
|
+
@name = name.to_s #: String
|
|
609
609
|
@anonymous = name.start_with?("_") #: bool
|
|
610
610
|
end
|
|
611
611
|
|
|
@@ -731,7 +731,7 @@ module RBI
|
|
|
731
731
|
#: (String name, Array[String] names, ?loc: Loc?, ?comments: Array[Comment]?) -> void
|
|
732
732
|
def initialize(name, names, loc: nil, comments: nil)
|
|
733
733
|
super(loc: loc, comments: comments)
|
|
734
|
-
@names = [name, *names] #: Array[String]
|
|
734
|
+
@names = [name, *names].map(&:to_s) #: Array[String]
|
|
735
735
|
end
|
|
736
736
|
end
|
|
737
737
|
|
|
@@ -1022,7 +1022,7 @@ module RBI
|
|
|
1022
1022
|
#: (String name, (Type | String) type, ?loc: Loc?, ?comments: Array[Comment]?) ?{ (SigParam node) -> void } -> void
|
|
1023
1023
|
def initialize(name, type, loc: nil, comments: nil, &block)
|
|
1024
1024
|
super(loc: loc, comments: comments)
|
|
1025
|
-
@name = name
|
|
1025
|
+
@name = name.to_s #: String
|
|
1026
1026
|
@anonymous = name.start_with?("_") #: bool
|
|
1027
1027
|
@type = type
|
|
1028
1028
|
block&.call(self)
|
|
@@ -1054,7 +1054,7 @@ module RBI
|
|
|
1054
1054
|
# @abstract
|
|
1055
1055
|
class TStructField < NodeWithComments
|
|
1056
1056
|
#: String
|
|
1057
|
-
|
|
1057
|
+
attr_reader :name
|
|
1058
1058
|
|
|
1059
1059
|
#: (Type | String)
|
|
1060
1060
|
attr_accessor :type
|
|
@@ -1065,7 +1065,7 @@ module RBI
|
|
|
1065
1065
|
#: (String name, (Type | String) type, ?default: String?, ?loc: Loc?, ?comments: Array[Comment]?) -> void
|
|
1066
1066
|
def initialize(name, type, default: nil, loc: nil, comments: nil)
|
|
1067
1067
|
super(loc: loc, comments: comments)
|
|
1068
|
-
@name = name
|
|
1068
|
+
@name = name.to_s #: String
|
|
1069
1069
|
@type = type
|
|
1070
1070
|
@default = default
|
|
1071
1071
|
end
|
|
@@ -1166,7 +1166,7 @@ module RBI
|
|
|
1166
1166
|
#: (String name, ?loc: Loc?, ?comments: Array[Comment]?) ?{ (TEnumValue node) -> void } -> void
|
|
1167
1167
|
def initialize(name, loc: nil, comments: nil, &block)
|
|
1168
1168
|
super(loc: loc, comments: comments)
|
|
1169
|
-
@name = name
|
|
1169
|
+
@name = name.to_s #: String
|
|
1170
1170
|
block&.call(self)
|
|
1171
1171
|
end
|
|
1172
1172
|
|
|
@@ -1191,7 +1191,7 @@ module RBI
|
|
|
1191
1191
|
#: (String name, ?loc: Loc?, ?comments: Array[Comment]?) ?{ (Helper node) -> void } -> void
|
|
1192
1192
|
def initialize(name, loc: nil, comments: nil, &block)
|
|
1193
1193
|
super(loc: loc, comments: comments)
|
|
1194
|
-
@name = name
|
|
1194
|
+
@name = name.to_s #: String
|
|
1195
1195
|
block&.call(self)
|
|
1196
1196
|
end
|
|
1197
1197
|
|
|
@@ -1209,7 +1209,7 @@ module RBI
|
|
|
1209
1209
|
#: (String name, String value, ?loc: Loc?, ?comments: Array[Comment]?) ?{ (TypeMember node) -> void } -> void
|
|
1210
1210
|
def initialize(name, value, loc: nil, comments: nil, &block)
|
|
1211
1211
|
super(loc: loc, comments: comments)
|
|
1212
|
-
@name = name
|
|
1212
|
+
@name = name.to_s #: String
|
|
1213
1213
|
@value = value
|
|
1214
1214
|
block&.call(self)
|
|
1215
1215
|
end
|
|
@@ -1254,7 +1254,7 @@ module RBI
|
|
|
1254
1254
|
#: (String name, ?loc: Loc?, ?comments: Array[Comment]?) -> void
|
|
1255
1255
|
def initialize(name, loc: nil, comments: nil)
|
|
1256
1256
|
super(loc: loc, comments: comments)
|
|
1257
|
-
@name = name
|
|
1257
|
+
@name = name.to_s #: String
|
|
1258
1258
|
end
|
|
1259
1259
|
|
|
1260
1260
|
# @override
|
data/lib/rbi/rbs_printer.rb
CHANGED
|
@@ -479,10 +479,12 @@ module RBI
|
|
|
479
479
|
super
|
|
480
480
|
|
|
481
481
|
# If self is the all-anonymous side (since compatible_with? ensures
|
|
482
|
-
# at most one side is),
|
|
483
|
-
|
|
482
|
+
# at most one side is), or if self has no sigs but other does, adopt
|
|
483
|
+
# other's non-anonymous param names and sigs.
|
|
484
|
+
if params.all?(&:anonymous?) || (sigs.empty? && !other.sigs.empty?)
|
|
484
485
|
@params = other.params.dup
|
|
485
486
|
@sigs = other.sigs.dup unless other.sigs.empty?
|
|
487
|
+
return
|
|
486
488
|
end
|
|
487
489
|
|
|
488
490
|
other.sigs.each do |sig|
|
|
@@ -18,7 +18,7 @@ module RBI
|
|
|
18
18
|
|
|
19
19
|
# Fast path: if no Visibility nodes are present (common after group_nodes!/nest_non_public_members!),
|
|
20
20
|
# skip the chunk and sort directly.
|
|
21
|
-
has_visibility = nodes.any?
|
|
21
|
+
has_visibility = nodes.any?(Visibility)
|
|
22
22
|
|
|
23
23
|
if has_visibility
|
|
24
24
|
# The child nodes contain private/protected markers. Divide into chunks
|
data/lib/rbi/type.rb
CHANGED
|
@@ -112,7 +112,7 @@ module RBI
|
|
|
112
112
|
# @override
|
|
113
113
|
#: -> String
|
|
114
114
|
def to_rbi
|
|
115
|
-
"T::Boolean"
|
|
115
|
+
"::T::Boolean"
|
|
116
116
|
end
|
|
117
117
|
|
|
118
118
|
# @override
|
|
@@ -258,7 +258,7 @@ module RBI
|
|
|
258
258
|
# @override
|
|
259
259
|
#: -> String
|
|
260
260
|
def to_rbi
|
|
261
|
-
"T::Class[#{@type}]"
|
|
261
|
+
"::T::Class[#{@type}]"
|
|
262
262
|
end
|
|
263
263
|
|
|
264
264
|
# @override
|
|
@@ -294,7 +294,7 @@ module RBI
|
|
|
294
294
|
# @override
|
|
295
295
|
#: -> String
|
|
296
296
|
def to_rbi
|
|
297
|
-
"T::Module[#{@type}]"
|
|
297
|
+
"::T::Module[#{@type}]"
|
|
298
298
|
end
|
|
299
299
|
|
|
300
300
|
# @override
|
|
@@ -498,7 +498,7 @@ module RBI
|
|
|
498
498
|
return type.simplify unless type.is_a?(Any)
|
|
499
499
|
|
|
500
500
|
types = type.types.map(&:simplify)
|
|
501
|
-
return Untyped.new if types.any?
|
|
501
|
+
return Untyped.new if types.any?(Untyped)
|
|
502
502
|
|
|
503
503
|
has_true_class = types.any? { |type| type.is_a?(Simple) && type.name == "TrueClass" }
|
|
504
504
|
has_false_class = types.any? { |type| type.is_a?(Simple) && type.name == "FalseClass" }
|
data/lib/rbi/version.rb
CHANGED
data/rbi/rbi.rbi
CHANGED
|
@@ -220,8 +220,6 @@ class RBI::Class < ::RBI::Scope
|
|
|
220
220
|
sig { returns(::String) }
|
|
221
221
|
def name; end
|
|
222
222
|
|
|
223
|
-
def name=(_arg0); end
|
|
224
|
-
|
|
225
223
|
sig { returns(T.nilable(::String)) }
|
|
226
224
|
def superclass_name; end
|
|
227
225
|
|
|
@@ -705,8 +703,6 @@ class RBI::Method < ::RBI::NodeWithComments
|
|
|
705
703
|
sig { returns(::String) }
|
|
706
704
|
def name; end
|
|
707
705
|
|
|
708
|
-
def name=(_arg0); end
|
|
709
|
-
|
|
710
706
|
sig { returns(T::Array[::RBI::Param]) }
|
|
711
707
|
def params; end
|
|
712
708
|
|
|
@@ -796,8 +792,6 @@ class RBI::Module < ::RBI::Scope
|
|
|
796
792
|
|
|
797
793
|
sig { returns(::String) }
|
|
798
794
|
def name; end
|
|
799
|
-
|
|
800
|
-
def name=(_arg0); end
|
|
801
795
|
end
|
|
802
796
|
|
|
803
797
|
class RBI::Node
|
|
@@ -2268,8 +2262,6 @@ class RBI::Struct < ::RBI::Scope
|
|
|
2268
2262
|
|
|
2269
2263
|
sig { returns(::String) }
|
|
2270
2264
|
def name; end
|
|
2271
|
-
|
|
2272
|
-
def name=(_arg0); end
|
|
2273
2265
|
end
|
|
2274
2266
|
|
|
2275
2267
|
class RBI::TEnum < ::RBI::Class
|
|
@@ -2398,8 +2390,6 @@ class RBI::TStructField < ::RBI::NodeWithComments
|
|
|
2398
2390
|
sig { returns(::String) }
|
|
2399
2391
|
def name; end
|
|
2400
2392
|
|
|
2401
|
-
def name=(_arg0); end
|
|
2402
|
-
|
|
2403
2393
|
sig { returns(T.any(::RBI::Type, ::String)) }
|
|
2404
2394
|
def type; end
|
|
2405
2395
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rbi
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.11
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Alexandre Terrasa
|
|
@@ -89,14 +89,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
89
89
|
requirements:
|
|
90
90
|
- - ">="
|
|
91
91
|
- !ruby/object:Gem::Version
|
|
92
|
-
version: '3.
|
|
92
|
+
version: '3.3'
|
|
93
93
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
94
94
|
requirements:
|
|
95
95
|
- - ">="
|
|
96
96
|
- !ruby/object:Gem::Version
|
|
97
97
|
version: '0'
|
|
98
98
|
requirements: []
|
|
99
|
-
rubygems_version:
|
|
99
|
+
rubygems_version: 4.0.3
|
|
100
100
|
specification_version: 4
|
|
101
101
|
summary: RBI generation framework
|
|
102
102
|
test_files: []
|