rbs 1.8.0 → 2.0.0
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/CHANGELOG.md +82 -4
- data/docs/collection.md +23 -1
- data/docs/syntax.md +94 -41
- data/ext/rbs_extension/constants.c +2 -6
- data/ext/rbs_extension/constants.h +1 -2
- data/ext/rbs_extension/parser.c +212 -178
- data/ext/rbs_extension/parserstate.c +6 -2
- data/ext/rbs_extension/parserstate.h +10 -0
- data/ext/rbs_extension/ruby_objs.c +9 -11
- data/ext/rbs_extension/ruby_objs.h +1 -2
- data/lib/rbs/ast/declarations.rb +0 -97
- data/lib/rbs/ast/type_param.rb +134 -0
- data/lib/rbs/cli.rb +32 -4
- data/lib/rbs/collection/config/lockfile_generator.rb +26 -18
- data/lib/rbs/collection/sources/git.rb +18 -7
- data/lib/rbs/collection/sources/rubygems.rb +7 -0
- data/lib/rbs/collection/sources/stdlib.rb +6 -0
- data/lib/rbs/definition.rb +9 -0
- data/lib/rbs/definition_builder.rb +49 -14
- data/lib/rbs/environment.rb +32 -9
- data/lib/rbs/environment_loader.rb +0 -2
- data/lib/rbs/errors.rb +20 -7
- data/lib/rbs/location_aux.rb +2 -0
- data/lib/rbs/method_type.rb +29 -6
- data/lib/rbs/prototype/rb.rb +3 -3
- data/lib/rbs/prototype/rbi.rb +8 -6
- data/lib/rbs/prototype/runtime.rb +4 -4
- data/lib/rbs/types.rb +89 -0
- data/lib/rbs/validator.rb +62 -11
- data/lib/rbs/variance_calculator.rb +9 -8
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs/writer.rb +1 -13
- data/lib/rbs.rb +1 -0
- data/schema/decls.json +16 -55
- data/schema/methodType.json +1 -1
- data/schema/typeParam.json +36 -0
- data/sig/collection/collections.rbs +11 -2
- data/sig/collection/config.rbs +2 -2
- data/sig/declarations.rbs +8 -58
- data/sig/definition.rbs +11 -1
- data/sig/definition_builder.rbs +8 -1
- data/sig/environment.rbs +7 -1
- data/sig/errors.rbs +19 -4
- data/sig/location.rbs +3 -1
- data/sig/locator.rbs +1 -1
- data/sig/method_types.rbs +25 -4
- data/sig/type_param.rbs +74 -0
- data/sig/types.rbs +27 -1
- data/sig/validator.rbs +31 -2
- data/sig/variance_calculator.rbs +1 -1
- data/sig/writer.rbs +1 -1
- data/stdlib/bigdecimal-math/0/manifest.yaml +2 -0
- data/stdlib/csv/0/manifest.yaml +2 -0
- data/stdlib/logger/0/manifest.yaml +2 -0
- data/stdlib/net-http/0/manifest.yaml +2 -0
- data/stdlib/openssl/0/manifest.yaml +2 -0
- data/stdlib/prime/0/manifest.yaml +2 -0
- data/stdlib/resolv/0/manifest.yaml +3 -0
- data/stdlib/uri/0/common.rbs +10 -5
- data/stdlib/uri/0/ftp.rbs +10 -0
- data/stdlib/uri/0/generic.rbs +34 -34
- data/stdlib/uri/0/mailto.rbs +5 -0
- data/stdlib/uri/0/ws.rbs +10 -0
- data/stdlib/uri/0/wss.rbs +7 -0
- data/stdlib/yaml/0/manifest.yaml +3 -0
- metadata +17 -2
data/lib/rbs/method_type.rb
CHANGED
@@ -29,11 +29,18 @@ module RBS
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def sub(s)
|
32
|
-
s.without(*
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
32
|
+
sub = s.without(*type_param_names)
|
33
|
+
|
34
|
+
self.class.new(
|
35
|
+
type_params: type_params.map do |param|
|
36
|
+
param.map_type do |bound|
|
37
|
+
bound.map_type {|ty| ty.sub(sub) }
|
38
|
+
end
|
39
|
+
end,
|
40
|
+
type: type.sub(sub),
|
41
|
+
block: block&.sub(sub),
|
42
|
+
location: location
|
43
|
+
)
|
37
44
|
end
|
38
45
|
|
39
46
|
def update(type_params: self.type_params, type: self.type, block: self.block, location: self.location)
|
@@ -48,7 +55,7 @@ module RBS
|
|
48
55
|
def free_variables(set = Set.new)
|
49
56
|
type.free_variables(set)
|
50
57
|
block&.type&.free_variables(set)
|
51
|
-
set.subtract(
|
58
|
+
set.subtract(type_param_names)
|
52
59
|
end
|
53
60
|
|
54
61
|
def map_type(&block)
|
@@ -62,6 +69,18 @@ module RBS
|
|
62
69
|
)
|
63
70
|
end
|
64
71
|
|
72
|
+
def map_type_bound(&block)
|
73
|
+
if type_params.empty?
|
74
|
+
self
|
75
|
+
else
|
76
|
+
self.update(
|
77
|
+
type_params: type_params.map {|param|
|
78
|
+
param.map_type(&block)
|
79
|
+
}
|
80
|
+
)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
65
84
|
def each_type(&block)
|
66
85
|
if block
|
67
86
|
type.each_type(&block)
|
@@ -89,5 +108,9 @@ module RBS
|
|
89
108
|
"[#{type_params.join(", ")}] #{s}"
|
90
109
|
end
|
91
110
|
end
|
111
|
+
|
112
|
+
def type_param_names
|
113
|
+
type_params.map(&:name)
|
114
|
+
end
|
92
115
|
end
|
93
116
|
end
|
data/lib/rbs/prototype/rb.rb
CHANGED
@@ -49,7 +49,7 @@ module RBS
|
|
49
49
|
annotations: [],
|
50
50
|
comment: nil,
|
51
51
|
location: nil,
|
52
|
-
type_params:
|
52
|
+
type_params: []
|
53
53
|
)
|
54
54
|
decls << top
|
55
55
|
end
|
@@ -88,7 +88,7 @@ module RBS
|
|
88
88
|
kls = AST::Declarations::Class.new(
|
89
89
|
name: const_to_name(class_name),
|
90
90
|
super_class: super_class && AST::Declarations::Class::Super.new(name: const_to_name(super_class), args: [], location: nil),
|
91
|
-
type_params:
|
91
|
+
type_params: [],
|
92
92
|
members: [],
|
93
93
|
annotations: [],
|
94
94
|
location: nil,
|
@@ -108,7 +108,7 @@ module RBS
|
|
108
108
|
|
109
109
|
mod = AST::Declarations::Module.new(
|
110
110
|
name: const_to_name(module_name),
|
111
|
-
type_params:
|
111
|
+
type_params: [],
|
112
112
|
self_types: [],
|
113
113
|
members: [],
|
114
114
|
annotations: [],
|
data/lib/rbs/prototype/rbi.rb
CHANGED
@@ -48,7 +48,7 @@ module RBS
|
|
48
48
|
modules.push AST::Declarations::Class.new(
|
49
49
|
name: nested_name(name),
|
50
50
|
super_class: super_class && AST::Declarations::Class::Super.new(name: const_to_name(super_class), args: [], location: nil),
|
51
|
-
type_params:
|
51
|
+
type_params: [],
|
52
52
|
members: [],
|
53
53
|
annotations: [],
|
54
54
|
location: nil,
|
@@ -65,7 +65,7 @@ module RBS
|
|
65
65
|
def push_module(name, comment:)
|
66
66
|
modules.push AST::Declarations::Module.new(
|
67
67
|
name: nested_name(name),
|
68
|
-
type_params:
|
68
|
+
type_params: [],
|
69
69
|
members: [],
|
70
70
|
annotations: [],
|
71
71
|
location: nil,
|
@@ -212,10 +212,12 @@ module RBS
|
|
212
212
|
end
|
213
213
|
end
|
214
214
|
|
215
|
-
current_module.type_params.
|
216
|
-
|
217
|
-
|
218
|
-
|
215
|
+
current_module.type_params << AST::TypeParam.new(
|
216
|
+
name: node.children[0],
|
217
|
+
variance: variance || :invariant,
|
218
|
+
location: nil,
|
219
|
+
upper_bound: nil
|
220
|
+
)
|
219
221
|
end
|
220
222
|
else
|
221
223
|
name = node.children[0].yield_self do |n|
|
@@ -371,7 +371,7 @@ module RBS
|
|
371
371
|
unless decl
|
372
372
|
decl = AST::Declarations::Class.new(
|
373
373
|
name: to_type_name(only_name(mod)),
|
374
|
-
type_params:
|
374
|
+
type_params: [],
|
375
375
|
super_class: generate_super_class(mod),
|
376
376
|
members: [],
|
377
377
|
annotations: [],
|
@@ -425,7 +425,7 @@ module RBS
|
|
425
425
|
unless decl
|
426
426
|
decl = AST::Declarations::Module.new(
|
427
427
|
name: to_type_name(only_name(mod)),
|
428
|
-
type_params:
|
428
|
+
type_params: [],
|
429
429
|
self_types: [],
|
430
430
|
members: [],
|
431
431
|
annotations: [],
|
@@ -479,7 +479,7 @@ module RBS
|
|
479
479
|
if outer_module.is_a?(Class)
|
480
480
|
outer_decl = AST::Declarations::Class.new(
|
481
481
|
name: to_type_name(outer_module_name),
|
482
|
-
type_params:
|
482
|
+
type_params: [],
|
483
483
|
super_class: generate_super_class(outer_module),
|
484
484
|
members: [],
|
485
485
|
annotations: [],
|
@@ -489,7 +489,7 @@ module RBS
|
|
489
489
|
else
|
490
490
|
outer_decl = AST::Declarations::Module.new(
|
491
491
|
name: to_type_name(outer_module_name),
|
492
|
-
type_params:
|
492
|
+
type_params: [],
|
493
493
|
self_types: [],
|
494
494
|
members: [],
|
495
495
|
annotations: [],
|
data/lib/rbs/types.rb
CHANGED
@@ -26,6 +26,14 @@ module RBS
|
|
26
26
|
enum_for :each_type
|
27
27
|
end
|
28
28
|
end
|
29
|
+
|
30
|
+
def map_type(&block)
|
31
|
+
if block
|
32
|
+
_ = self
|
33
|
+
else
|
34
|
+
enum_for(:map_type)
|
35
|
+
end
|
36
|
+
end
|
29
37
|
end
|
30
38
|
|
31
39
|
module Bases
|
@@ -261,6 +269,18 @@ module RBS
|
|
261
269
|
location: location
|
262
270
|
)
|
263
271
|
end
|
272
|
+
|
273
|
+
def map_type(&block)
|
274
|
+
if block
|
275
|
+
Interface.new(
|
276
|
+
name: name,
|
277
|
+
args: args.map {|type| yield type },
|
278
|
+
location: location
|
279
|
+
)
|
280
|
+
else
|
281
|
+
enum_for(:map_type)
|
282
|
+
end
|
283
|
+
end
|
264
284
|
end
|
265
285
|
|
266
286
|
class ClassInstance
|
@@ -291,6 +311,18 @@ module RBS
|
|
291
311
|
location: location
|
292
312
|
)
|
293
313
|
end
|
314
|
+
|
315
|
+
def map_type(&block)
|
316
|
+
if block
|
317
|
+
ClassInstance.new(
|
318
|
+
name: name,
|
319
|
+
args: args.map {|type| yield type },
|
320
|
+
location: location
|
321
|
+
)
|
322
|
+
else
|
323
|
+
enum_for :map_type
|
324
|
+
end
|
325
|
+
end
|
294
326
|
end
|
295
327
|
|
296
328
|
class Alias
|
@@ -319,6 +351,18 @@ module RBS
|
|
319
351
|
location: location
|
320
352
|
)
|
321
353
|
end
|
354
|
+
|
355
|
+
def map_type(&block)
|
356
|
+
if block
|
357
|
+
Alias.new(
|
358
|
+
name: name,
|
359
|
+
args: args.map {|type| yield type },
|
360
|
+
location: location
|
361
|
+
)
|
362
|
+
else
|
363
|
+
enum_for :map_type
|
364
|
+
end
|
365
|
+
end
|
322
366
|
end
|
323
367
|
|
324
368
|
class Tuple
|
@@ -379,6 +423,17 @@ module RBS
|
|
379
423
|
location: location
|
380
424
|
)
|
381
425
|
end
|
426
|
+
|
427
|
+
def map_type(&block)
|
428
|
+
if block
|
429
|
+
Tuple.new(
|
430
|
+
types: types.map {|type| yield type },
|
431
|
+
location: location
|
432
|
+
)
|
433
|
+
else
|
434
|
+
enum_for :map_type
|
435
|
+
end
|
436
|
+
end
|
382
437
|
end
|
383
438
|
|
384
439
|
class Record
|
@@ -444,6 +499,17 @@ module RBS
|
|
444
499
|
location: location
|
445
500
|
)
|
446
501
|
end
|
502
|
+
|
503
|
+
def map_type(&block)
|
504
|
+
if block
|
505
|
+
Record.new(
|
506
|
+
fields: fields.transform_values {|type| yield type },
|
507
|
+
location: location
|
508
|
+
)
|
509
|
+
else
|
510
|
+
enum_for :map_type
|
511
|
+
end
|
512
|
+
end
|
447
513
|
end
|
448
514
|
|
449
515
|
class Optional
|
@@ -503,6 +569,17 @@ module RBS
|
|
503
569
|
location: location
|
504
570
|
)
|
505
571
|
end
|
572
|
+
|
573
|
+
def map_type(&block)
|
574
|
+
if block
|
575
|
+
Optional.new(
|
576
|
+
type: yield(type),
|
577
|
+
location: location
|
578
|
+
)
|
579
|
+
else
|
580
|
+
enum_for :map_type
|
581
|
+
end
|
582
|
+
end
|
506
583
|
end
|
507
584
|
|
508
585
|
class Union
|
@@ -1046,6 +1123,18 @@ module RBS
|
|
1046
1123
|
location: location
|
1047
1124
|
)
|
1048
1125
|
end
|
1126
|
+
|
1127
|
+
def map_type(&block)
|
1128
|
+
if block
|
1129
|
+
Proc.new(
|
1130
|
+
type: type.map_type(&block),
|
1131
|
+
block: self.block&.map_type(&block),
|
1132
|
+
location: location
|
1133
|
+
)
|
1134
|
+
else
|
1135
|
+
enum_for :map_type
|
1136
|
+
end
|
1137
|
+
end
|
1049
1138
|
end
|
1050
1139
|
|
1051
1140
|
class Literal
|
data/lib/rbs/validator.rb
CHANGED
@@ -27,19 +27,17 @@ module RBS
|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
+
definition_builder.validate_type_name(type.name, type.location)
|
31
|
+
|
30
32
|
type_params = case type
|
31
33
|
when Types::ClassInstance
|
32
|
-
env.class_decls[type.name]
|
34
|
+
env.class_decls[type.name].type_params
|
33
35
|
when Types::Interface
|
34
|
-
env.interface_decls[type.name]
|
36
|
+
env.interface_decls[type.name].decl.type_params
|
35
37
|
when Types::Alias
|
36
|
-
env.alias_decls[type.name]
|
38
|
+
env.alias_decls[type.name].decl.type_params
|
37
39
|
end
|
38
40
|
|
39
|
-
unless type_params
|
40
|
-
raise NoTypeFoundError.new(type_name: type.name, location: type.location)
|
41
|
-
end
|
42
|
-
|
43
41
|
InvalidTypeApplicationError.check!(
|
44
42
|
type_name: type.name,
|
45
43
|
args: type.args,
|
@@ -48,9 +46,7 @@ module RBS
|
|
48
46
|
)
|
49
47
|
|
50
48
|
when Types::ClassSingleton
|
51
|
-
|
52
|
-
type = _ = absolute_type(type, context: context) { type.name.absolute! }
|
53
|
-
NoTypeFoundError.check!(type.name, env: env, location: type.location)
|
49
|
+
definition_builder.validate_type_presence(type)
|
54
50
|
end
|
55
51
|
|
56
52
|
type.each_type do |type|
|
@@ -76,7 +72,7 @@ module RBS
|
|
76
72
|
result = calculator.in_type_alias(name: type_name)
|
77
73
|
if set = result.incompatible?(entry.decl.type_params)
|
78
74
|
set.each do |param_name|
|
79
|
-
param = entry.decl.type_params
|
75
|
+
param = entry.decl.type_params.find {|param| param.name == param_name } or raise
|
80
76
|
raise InvalidVarianceAnnotationError.new(
|
81
77
|
type_name: type_name,
|
82
78
|
param: param,
|
@@ -84,6 +80,61 @@ module RBS
|
|
84
80
|
)
|
85
81
|
end
|
86
82
|
end
|
83
|
+
|
84
|
+
validate_type_params(
|
85
|
+
entry.decl.type_params,
|
86
|
+
type_name: type_name,
|
87
|
+
location: entry.decl.location&.aref(:type_params)
|
88
|
+
)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
def validate_method_definition(method_def, type_name:)
|
93
|
+
method_def.types.each do |method_type|
|
94
|
+
unless method_type.type_params.empty?
|
95
|
+
loc = method_type.location&.aref(:type_params)
|
96
|
+
|
97
|
+
validate_type_params(
|
98
|
+
method_type.type_params,
|
99
|
+
type_name: type_name,
|
100
|
+
method_name: method_def.name,
|
101
|
+
location: loc
|
102
|
+
)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
def validate_type_params(params, type_name: , method_name: nil, location:)
|
108
|
+
# @type var each_node: TSort::_EachNode[Symbol]
|
109
|
+
each_node = __skip__ = -> (&block) do
|
110
|
+
params.each do |param|
|
111
|
+
block[param.name]
|
112
|
+
end
|
113
|
+
end
|
114
|
+
# @type var each_child: TSort::_EachChild[Symbol]
|
115
|
+
each_child = __skip__ = -> (name, &block) do
|
116
|
+
if param = params.find {|p| p.name == name }
|
117
|
+
if b = param.upper_bound
|
118
|
+
b.free_variables.each do |tv|
|
119
|
+
block[tv]
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
TSort.each_strongly_connected_component(each_node, each_child) do |names|
|
126
|
+
if names.size > 1
|
127
|
+
params = names.map do |name|
|
128
|
+
params.find {|param| param.name == name} or raise
|
129
|
+
end
|
130
|
+
|
131
|
+
raise CyclicTypeParameterBound.new(
|
132
|
+
type_name: type_name,
|
133
|
+
method_name: method_name,
|
134
|
+
params: params,
|
135
|
+
location: location
|
136
|
+
)
|
137
|
+
end
|
87
138
|
end
|
88
139
|
end
|
89
140
|
|
@@ -141,14 +141,15 @@ module RBS
|
|
141
141
|
end
|
142
142
|
|
143
143
|
type.args.each.with_index do |ty, i|
|
144
|
-
var = type_params
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
144
|
+
if var = type_params[i]
|
145
|
+
case var.variance
|
146
|
+
when :invariant
|
147
|
+
type(ty, result: result, context: :invariant)
|
148
|
+
when :covariant
|
149
|
+
type(ty, result: result, context: context)
|
150
|
+
when :contravariant
|
151
|
+
type(ty, result: result, context: negate(context))
|
152
|
+
end
|
152
153
|
end
|
153
154
|
end
|
154
155
|
when Types::Proc
|
data/lib/rbs/version.rb
CHANGED
data/lib/rbs/writer.rb
CHANGED
@@ -146,19 +146,7 @@ module RBS
|
|
146
146
|
"#{name}"
|
147
147
|
else
|
148
148
|
ps = params.each.map do |param|
|
149
|
-
|
150
|
-
if param.skip_validation
|
151
|
-
s << "unchecked "
|
152
|
-
end
|
153
|
-
case param.variance
|
154
|
-
when :invariant
|
155
|
-
# nop
|
156
|
-
when :covariant
|
157
|
-
s << "out "
|
158
|
-
when :contravariant
|
159
|
-
s << "in "
|
160
|
-
end
|
161
|
-
s + param.name.to_s
|
149
|
+
param.to_s
|
162
150
|
end
|
163
151
|
|
164
152
|
"#{name}[#{ps.join(", ")}]"
|
data/lib/rbs.rb
CHANGED
data/schema/decls.json
CHANGED
@@ -13,16 +13,10 @@
|
|
13
13
|
"type": "string"
|
14
14
|
},
|
15
15
|
"type_params": {
|
16
|
-
"type": "
|
17
|
-
"
|
18
|
-
"
|
19
|
-
|
20
|
-
"items": {
|
21
|
-
"$ref": "#/definitions/moduleTypeParam"
|
22
|
-
}
|
23
|
-
}
|
24
|
-
},
|
25
|
-
"required": ["params"]
|
16
|
+
"type": "array",
|
17
|
+
"items": {
|
18
|
+
"$ref": "typeParam.json"
|
19
|
+
}
|
26
20
|
},
|
27
21
|
"type": {
|
28
22
|
"$ref": "types.json"
|
@@ -88,21 +82,6 @@
|
|
88
82
|
},
|
89
83
|
"required": ["declaration", "name", "type", "comment", "location"]
|
90
84
|
},
|
91
|
-
"moduleTypeParam": {
|
92
|
-
"type": "object",
|
93
|
-
"properties": {
|
94
|
-
"name": {
|
95
|
-
"type": "string"
|
96
|
-
},
|
97
|
-
"variance": {
|
98
|
-
"enum": ["covariant", "contravariant", "invariant"]
|
99
|
-
},
|
100
|
-
"skip_validation": {
|
101
|
-
"type": "boolean"
|
102
|
-
}
|
103
|
-
},
|
104
|
-
"required": ["name", "variance", "skip_validation"]
|
105
|
-
},
|
106
85
|
"classMember": {
|
107
86
|
"oneOf": [
|
108
87
|
{
|
@@ -157,16 +136,10 @@
|
|
157
136
|
"type": "string"
|
158
137
|
},
|
159
138
|
"type_params": {
|
160
|
-
"type": "
|
161
|
-
"
|
162
|
-
"
|
163
|
-
|
164
|
-
"items": {
|
165
|
-
"$ref": "#/definitions/moduleTypeParam"
|
166
|
-
}
|
167
|
-
}
|
168
|
-
},
|
169
|
-
"required": ["params"]
|
139
|
+
"type": "array",
|
140
|
+
"items": {
|
141
|
+
"$ref": "typeParam.json"
|
142
|
+
}
|
170
143
|
},
|
171
144
|
"members": {
|
172
145
|
"type": "array",
|
@@ -221,16 +194,10 @@
|
|
221
194
|
"type": "string"
|
222
195
|
},
|
223
196
|
"type_params": {
|
224
|
-
"type": "
|
225
|
-
"
|
226
|
-
"
|
227
|
-
|
228
|
-
"items": {
|
229
|
-
"$ref": "#/definitions/moduleTypeParam"
|
230
|
-
}
|
231
|
-
}
|
232
|
-
},
|
233
|
-
"required": ["params"]
|
197
|
+
"type": "array",
|
198
|
+
"items": {
|
199
|
+
"$ref": "typeParam.json"
|
200
|
+
}
|
234
201
|
},
|
235
202
|
"members": {
|
236
203
|
"type": "array",
|
@@ -309,16 +276,10 @@
|
|
309
276
|
"type": "string"
|
310
277
|
},
|
311
278
|
"type_params": {
|
312
|
-
"type": "
|
313
|
-
"
|
314
|
-
"
|
315
|
-
|
316
|
-
"items": {
|
317
|
-
"$ref": "#/definitions/moduleTypeParam"
|
318
|
-
}
|
319
|
-
}
|
320
|
-
},
|
321
|
-
"required": ["params"]
|
279
|
+
"type": "array",
|
280
|
+
"items": {
|
281
|
+
"$ref": "typeParam.json"
|
282
|
+
}
|
322
283
|
},
|
323
284
|
"members": {
|
324
285
|
"type": "array",
|
data/schema/methodType.json
CHANGED
@@ -0,0 +1,36 @@
|
|
1
|
+
{
|
2
|
+
"$schema": "http://json-schema.org/draft-04/schema#",
|
3
|
+
"title": "Type param: `A`, `unchecked out A`, ...",
|
4
|
+
"type": "object",
|
5
|
+
"properties": {
|
6
|
+
"name": {
|
7
|
+
"type": "string"
|
8
|
+
},
|
9
|
+
"variance": {
|
10
|
+
"enum": ["covariant", "contravariant", "invariant"]
|
11
|
+
},
|
12
|
+
"unchecked": {
|
13
|
+
"type": "boolean"
|
14
|
+
},
|
15
|
+
"upper_bound": {
|
16
|
+
"oneOf": [
|
17
|
+
{
|
18
|
+
"$ref": "types.json#definitions/classInstance"
|
19
|
+
},
|
20
|
+
{
|
21
|
+
"$ref": "types.json#definitions/classSingleton"
|
22
|
+
},
|
23
|
+
{
|
24
|
+
"$ref": "types.json#definitions/interface"
|
25
|
+
},
|
26
|
+
{
|
27
|
+
"type": "null"
|
28
|
+
}
|
29
|
+
]
|
30
|
+
},
|
31
|
+
"location": {
|
32
|
+
"$ref": "location.json"
|
33
|
+
}
|
34
|
+
},
|
35
|
+
"required": ["name", "variance", "unchecked", "upper_bound", "location"]
|
36
|
+
}
|
@@ -8,11 +8,15 @@ module RBS
|
|
8
8
|
def versions: (Config::gem_entry) -> Array[String]
|
9
9
|
def install: (dest: Pathname, config_entry: Config::gem_entry, stdout: CLI::_IO) -> void
|
10
10
|
def to_lockfile: () -> source_entry
|
11
|
+
def manifest_of: (Config::gem_entry) -> manifest_entry?
|
11
12
|
end
|
12
13
|
|
13
14
|
type source_entry = Git::source_entry
|
14
15
|
| Stdlib::source_entry
|
15
16
|
| Rubygems::source_entry
|
17
|
+
type manifest_entry = {
|
18
|
+
"dependencies" => Array[{"name" => String}]?,
|
19
|
+
}
|
16
20
|
|
17
21
|
class Git
|
18
22
|
METADATA_FILENAME: String
|
@@ -42,6 +46,8 @@ module RBS
|
|
42
46
|
|
43
47
|
def to_lockfile: () -> source_entry
|
44
48
|
|
49
|
+
def manifest_of: (Config::gem_entry) -> manifest_entry?
|
50
|
+
|
45
51
|
private
|
46
52
|
|
47
53
|
def _install: (dest: Pathname , config_entry: Config::gem_entry) -> void
|
@@ -62,9 +68,9 @@ module RBS
|
|
62
68
|
|
63
69
|
def resolve_revision: () -> String
|
64
70
|
|
65
|
-
def git: (*String cmd) -> String
|
71
|
+
def git: (*String cmd, **untyped opt) -> String
|
66
72
|
|
67
|
-
def sh!: (*String cmd) -> String
|
73
|
+
def sh!: (*String cmd, **untyped opt) -> String
|
68
74
|
|
69
75
|
def format_config_entry: (Config::gem_entry) -> String
|
70
76
|
end
|
@@ -86,6 +92,8 @@ module RBS
|
|
86
92
|
|
87
93
|
def to_lockfile: () -> source_entry
|
88
94
|
|
95
|
+
def manifest_of: (Config::gem_entry) -> manifest_entry?
|
96
|
+
|
89
97
|
private
|
90
98
|
|
91
99
|
def gem_dir: (Config::gem_entry) -> Pathname
|
@@ -104,6 +112,7 @@ module RBS
|
|
104
112
|
def versions: (Config::gem_entry) -> Array[String]
|
105
113
|
def install: (dest: Pathname, config_entry: Config::gem_entry, stdout: CLI::_IO) -> void
|
106
114
|
def to_lockfile: () -> source_entry
|
115
|
+
def manifest_of: (Config::gem_entry) -> manifest_entry?
|
107
116
|
|
108
117
|
private
|
109
118
|
|
data/sig/collection/config.rbs
CHANGED
@@ -16,7 +16,7 @@ module RBS
|
|
16
16
|
|
17
17
|
private
|
18
18
|
|
19
|
-
def assign_gem: (
|
19
|
+
def assign_gem: (name: String, version: String?) -> void
|
20
20
|
|
21
21
|
def upsert_gem: (gem_entry? old, gem_entry new) -> void
|
22
22
|
|
@@ -24,7 +24,7 @@ module RBS
|
|
24
24
|
|
25
25
|
def remove_ignored_gems!: () -> void
|
26
26
|
|
27
|
-
def find_source: (
|
27
|
+
def find_source: (name: String) -> untyped
|
28
28
|
|
29
29
|
def find_best_version: (version: String?, versions: Array[String]) -> Gem::Version
|
30
30
|
end
|