rbs 1.7.0 → 2.0.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +95 -3
- data/core/array.rbs +3 -3
- data/core/builtin.rbs +4 -0
- data/core/enumerable.rbs +3 -3
- data/core/thread.rbs +1 -1
- data/docs/collection.md +23 -1
- data/docs/syntax.md +117 -61
- data/ext/rbs_extension/constants.c +2 -6
- data/ext/rbs_extension/constants.h +1 -2
- data/ext/rbs_extension/parser.c +221 -185
- data/ext/rbs_extension/parserstate.c +6 -2
- data/ext/rbs_extension/parserstate.h +10 -0
- data/ext/rbs_extension/ruby_objs.c +17 -17
- data/ext/rbs_extension/ruby_objs.h +3 -4
- data/lib/rbs/ast/declarations.rb +6 -99
- data/lib/rbs/ast/type_param.rb +134 -0
- data/lib/rbs/cli.rb +33 -5
- 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 +78 -16
- data/lib/rbs/environment.rb +32 -8
- data/lib/rbs/environment_loader.rb +0 -2
- data/lib/rbs/environment_walker.rb +4 -1
- data/lib/rbs/errors.rb +31 -6
- 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/type_alias_regularity.rb +115 -0
- data/lib/rbs/types.rb +100 -23
- data/lib/rbs/validator.rb +99 -15
- data/lib/rbs/variance_calculator.rb +60 -31
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs/writer.rb +2 -14
- data/lib/rbs.rb +2 -0
- data/schema/decls.json +19 -46
- data/schema/methodType.json +1 -1
- data/schema/typeParam.json +36 -0
- data/schema/types.json +8 -2
- data/sig/collection/collections.rbs +13 -2
- data/sig/collection/config.rbs +2 -2
- data/sig/declarations.rbs +15 -62
- data/sig/definition.rbs +11 -1
- data/sig/definition_builder.rbs +37 -1
- data/sig/environment.rbs +7 -1
- data/sig/environment_walker.rbs +26 -0
- data/sig/errors.rbs +28 -3
- data/sig/location.rbs +3 -1
- data/sig/locator.rbs +1 -1
- data/sig/method_types.rbs +25 -4
- data/sig/type_alias_regularity.rbs +92 -0
- data/sig/type_param.rbs +74 -0
- data/sig/types.rbs +37 -8
- data/sig/validator.rbs +38 -2
- data/sig/variance_calculator.rbs +50 -0
- 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/date/0/date.rbs +2 -2
- 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/set/0/set.rbs +3 -3
- data/stdlib/uri/0/common.rbs +10 -5
- data/stdlib/uri/0/ftp.rbs +10 -0
- 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
- data/steep/Gemfile.lock +10 -10
- metadata +21 -5
- data/lib/ruby/signature.rb +0 -7
data/lib/rbs/validator.rb
CHANGED
@@ -2,10 +2,12 @@ module RBS
|
|
2
2
|
class Validator
|
3
3
|
attr_reader :env
|
4
4
|
attr_reader :resolver
|
5
|
+
attr_reader :definition_builder
|
5
6
|
|
6
7
|
def initialize(env:, resolver:)
|
7
8
|
@env = env
|
8
9
|
@resolver = resolver
|
10
|
+
@definition_builder = DefinitionBuilder.new(env: env)
|
9
11
|
end
|
10
12
|
|
11
13
|
def absolute_type(type, context:)
|
@@ -17,25 +19,25 @@ module RBS
|
|
17
19
|
# Validates presence of the relative type, and application arity match.
|
18
20
|
def validate_type(type, context:)
|
19
21
|
case type
|
20
|
-
when Types::ClassInstance, Types::Interface
|
21
|
-
# @type var type: Types::ClassInstance | Types::Interface
|
22
|
+
when Types::ClassInstance, Types::Interface, Types::Alias
|
23
|
+
# @type var type: Types::ClassInstance | Types::Interface | Types::Alias
|
22
24
|
if type.name.namespace.relative?
|
23
25
|
type = _ = absolute_type(type, context: context) do |_|
|
24
26
|
NoTypeFoundError.check!(type.name.absolute!, env: env, location: type.location)
|
25
27
|
end
|
26
28
|
end
|
27
29
|
|
30
|
+
definition_builder.validate_type_name(type.name, type.location)
|
31
|
+
|
28
32
|
type_params = case type
|
29
33
|
when Types::ClassInstance
|
30
|
-
env.class_decls[type.name]
|
34
|
+
env.class_decls[type.name].type_params
|
31
35
|
when Types::Interface
|
32
|
-
env.interface_decls[type.name]
|
36
|
+
env.interface_decls[type.name].decl.type_params
|
37
|
+
when Types::Alias
|
38
|
+
env.alias_decls[type.name].decl.type_params
|
33
39
|
end
|
34
40
|
|
35
|
-
unless type_params
|
36
|
-
raise NoTypeFoundError.new(type_name: type.name, location: type.location)
|
37
|
-
end
|
38
|
-
|
39
41
|
InvalidTypeApplicationError.check!(
|
40
42
|
type_name: type.name,
|
41
43
|
args: type.args,
|
@@ -43,10 +45,8 @@ module RBS
|
|
43
45
|
location: type.location
|
44
46
|
)
|
45
47
|
|
46
|
-
when Types::
|
47
|
-
|
48
|
-
type = _ = absolute_type(type, context: context) { type.name.absolute! }
|
49
|
-
NoTypeFoundError.check!(type.name, env: env, location: type.location)
|
48
|
+
when Types::ClassSingleton
|
49
|
+
definition_builder.validate_type_presence(type)
|
50
50
|
end
|
51
51
|
|
52
52
|
type.each_type do |type|
|
@@ -55,11 +55,95 @@ module RBS
|
|
55
55
|
end
|
56
56
|
|
57
57
|
def validate_type_alias(entry:)
|
58
|
-
|
59
|
-
|
58
|
+
type_name = entry.decl.name
|
59
|
+
|
60
|
+
if type_alias_dependency.circular_definition?(type_name)
|
60
61
|
location = entry.decl.location or raise
|
61
|
-
raise RecursiveTypeAliasError.new(alias_names: [
|
62
|
+
raise RecursiveTypeAliasError.new(alias_names: [type_name], location: location)
|
63
|
+
end
|
64
|
+
|
65
|
+
if diagnostic = type_alias_regularity.nonregular?(type_name)
|
66
|
+
location = entry.decl.location or raise
|
67
|
+
raise NonregularTypeAliasError.new(diagnostic: diagnostic, location: location)
|
68
|
+
end
|
69
|
+
|
70
|
+
unless entry.decl.type_params.empty?
|
71
|
+
calculator = VarianceCalculator.new(builder: definition_builder)
|
72
|
+
result = calculator.in_type_alias(name: type_name)
|
73
|
+
if set = result.incompatible?(entry.decl.type_params)
|
74
|
+
set.each do |param_name|
|
75
|
+
param = entry.decl.type_params.find {|param| param.name == param_name } or raise
|
76
|
+
raise InvalidVarianceAnnotationError.new(
|
77
|
+
type_name: type_name,
|
78
|
+
param: param,
|
79
|
+
location: entry.decl.type.location
|
80
|
+
)
|
81
|
+
end
|
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
|
62
138
|
end
|
63
139
|
end
|
140
|
+
|
141
|
+
def type_alias_dependency
|
142
|
+
@type_alias_dependency ||= TypeAliasDependency.new(env: env)
|
143
|
+
end
|
144
|
+
|
145
|
+
def type_alias_regularity
|
146
|
+
@type_alias_regularity ||= TypeAliasRegularity.validate(env: env)
|
147
|
+
end
|
64
148
|
end
|
65
149
|
end
|
@@ -54,6 +54,21 @@ module RBS
|
|
54
54
|
false
|
55
55
|
end
|
56
56
|
end
|
57
|
+
|
58
|
+
def incompatible?(params)
|
59
|
+
# @type set: Hash[Symbol]
|
60
|
+
set = Set[]
|
61
|
+
|
62
|
+
params.each do |param|
|
63
|
+
unless compatible?(param.name, with_annotation: param.variance)
|
64
|
+
set << param.name
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
unless set.empty?
|
69
|
+
set
|
70
|
+
end
|
71
|
+
end
|
57
72
|
end
|
58
73
|
|
59
74
|
attr_reader :builder
|
@@ -69,19 +84,12 @@ module RBS
|
|
69
84
|
def in_method_type(method_type:, variables:)
|
70
85
|
result = Result.new(variables: variables)
|
71
86
|
|
72
|
-
method_type.type
|
73
|
-
type(param.type, result: result, context: :contravariant)
|
74
|
-
end
|
87
|
+
function(method_type.type, result: result, context: :covariant)
|
75
88
|
|
76
89
|
if block = method_type.block
|
77
|
-
block.type
|
78
|
-
type(param.type, result: result, context: :covariant)
|
79
|
-
end
|
80
|
-
type(block.type.return_type, result: result, context: :contravariant)
|
90
|
+
function(block.type, result: result, context: :contravariant)
|
81
91
|
end
|
82
92
|
|
83
|
-
type(method_type.type.return_type, result: result, context: :covariant)
|
84
|
-
|
85
93
|
result
|
86
94
|
end
|
87
95
|
|
@@ -97,6 +105,14 @@ module RBS
|
|
97
105
|
end
|
98
106
|
end
|
99
107
|
|
108
|
+
def in_type_alias(name:)
|
109
|
+
decl = env.alias_decls[name].decl or raise
|
110
|
+
variables = decl.type_params.each.map(&:name)
|
111
|
+
Result.new(variables: variables).tap do |result|
|
112
|
+
type(decl.type, result: result, context: :covariant)
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
100
116
|
def type(type, result:, context:)
|
101
117
|
case type
|
102
118
|
when Types::Variable
|
@@ -110,7 +126,7 @@ module RBS
|
|
110
126
|
result.invariant(type.name)
|
111
127
|
end
|
112
128
|
end
|
113
|
-
when Types::ClassInstance, Types::Interface
|
129
|
+
when Types::ClassInstance, Types::Interface, Types::Alias
|
114
130
|
NoTypeFoundError.check!(type.name,
|
115
131
|
env: env,
|
116
132
|
location: type.location)
|
@@ -120,36 +136,49 @@ module RBS
|
|
120
136
|
env.class_decls[type.name].type_params
|
121
137
|
when Types::Interface
|
122
138
|
env.interface_decls[type.name].decl.type_params
|
139
|
+
when Types::Alias
|
140
|
+
env.alias_decls[type.name].decl.type_params
|
123
141
|
end
|
124
142
|
|
125
143
|
type.args.each.with_index do |ty, i|
|
126
|
-
var = type_params
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
when :invariant
|
136
|
-
:invariant
|
137
|
-
when :covariant
|
138
|
-
:contravariant
|
139
|
-
when :contravariant
|
140
|
-
:covariant
|
141
|
-
else
|
142
|
-
raise
|
143
|
-
end
|
144
|
-
type(ty, result: result, context: con)
|
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
|
145
153
|
end
|
146
154
|
end
|
147
|
-
when Types::
|
148
|
-
|
155
|
+
when Types::Proc
|
156
|
+
function(type.type, result: result, context: context)
|
157
|
+
else
|
149
158
|
type.each_type do |ty|
|
150
159
|
type(ty, result: result, context: context)
|
151
160
|
end
|
152
161
|
end
|
153
162
|
end
|
163
|
+
|
164
|
+
def function(type, result:, context:)
|
165
|
+
type.each_param do |param|
|
166
|
+
type(param.type, result: result, context: negate(context))
|
167
|
+
end
|
168
|
+
type(type.return_type, result: result, context: context)
|
169
|
+
end
|
170
|
+
|
171
|
+
def negate(variance)
|
172
|
+
case variance
|
173
|
+
when :invariant
|
174
|
+
:invariant
|
175
|
+
when :covariant
|
176
|
+
:contravariant
|
177
|
+
when :contravariant
|
178
|
+
:covariant
|
179
|
+
else
|
180
|
+
raise
|
181
|
+
end
|
182
|
+
end
|
154
183
|
end
|
155
184
|
end
|
data/lib/rbs/version.rb
CHANGED
data/lib/rbs/writer.rb
CHANGED
@@ -119,7 +119,7 @@ module RBS
|
|
119
119
|
when AST::Declarations::Alias
|
120
120
|
write_comment decl.comment
|
121
121
|
write_annotation decl.annotations
|
122
|
-
puts "type #{decl.name} = #{decl.type}"
|
122
|
+
puts "type #{name_and_params(decl.name, decl.type_params)} = #{decl.type}"
|
123
123
|
|
124
124
|
when AST::Declarations::Interface
|
125
125
|
write_comment decl.comment
|
@@ -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
@@ -16,6 +16,7 @@ require "rbs/namespace"
|
|
16
16
|
require "rbs/type_name"
|
17
17
|
require "rbs/types"
|
18
18
|
require "rbs/method_type"
|
19
|
+
require "rbs/ast/type_param"
|
19
20
|
require "rbs/ast/declarations"
|
20
21
|
require "rbs/ast/members"
|
21
22
|
require "rbs/ast/annotation"
|
@@ -45,6 +46,7 @@ require "rbs/repository"
|
|
45
46
|
require "rbs/ancestor_graph"
|
46
47
|
require "rbs/locator"
|
47
48
|
require "rbs/type_alias_dependency"
|
49
|
+
require "rbs/type_alias_regularity"
|
48
50
|
require "rbs/collection"
|
49
51
|
|
50
52
|
require "rbs_extension"
|
data/schema/decls.json
CHANGED
@@ -12,6 +12,12 @@
|
|
12
12
|
"name": {
|
13
13
|
"type": "string"
|
14
14
|
},
|
15
|
+
"type_params": {
|
16
|
+
"type": "array",
|
17
|
+
"items": {
|
18
|
+
"$ref": "typeParam.json"
|
19
|
+
}
|
20
|
+
},
|
15
21
|
"type": {
|
16
22
|
"$ref": "types.json"
|
17
23
|
},
|
@@ -28,7 +34,7 @@
|
|
28
34
|
"$ref": "comment.json"
|
29
35
|
}
|
30
36
|
},
|
31
|
-
"required": ["declaration", "name", "type", "annotations", "location", "comment"]
|
37
|
+
"required": ["declaration", "name", "type_params", "type", "annotations", "location", "comment"]
|
32
38
|
},
|
33
39
|
"constant": {
|
34
40
|
"title": "Constant declaration: `VERSION: String`, ...",
|
@@ -76,21 +82,6 @@
|
|
76
82
|
},
|
77
83
|
"required": ["declaration", "name", "type", "comment", "location"]
|
78
84
|
},
|
79
|
-
"moduleTypeParam": {
|
80
|
-
"type": "object",
|
81
|
-
"properties": {
|
82
|
-
"name": {
|
83
|
-
"type": "string"
|
84
|
-
},
|
85
|
-
"variance": {
|
86
|
-
"enum": ["covariant", "contravariant", "invariant"]
|
87
|
-
},
|
88
|
-
"skip_validation": {
|
89
|
-
"type": "boolean"
|
90
|
-
}
|
91
|
-
},
|
92
|
-
"required": ["name", "variance", "skip_validation"]
|
93
|
-
},
|
94
85
|
"classMember": {
|
95
86
|
"oneOf": [
|
96
87
|
{
|
@@ -145,16 +136,10 @@
|
|
145
136
|
"type": "string"
|
146
137
|
},
|
147
138
|
"type_params": {
|
148
|
-
"type": "
|
149
|
-
"
|
150
|
-
"
|
151
|
-
|
152
|
-
"items": {
|
153
|
-
"$ref": "#/definitions/moduleTypeParam"
|
154
|
-
}
|
155
|
-
}
|
156
|
-
},
|
157
|
-
"required": ["params"]
|
139
|
+
"type": "array",
|
140
|
+
"items": {
|
141
|
+
"$ref": "typeParam.json"
|
142
|
+
}
|
158
143
|
},
|
159
144
|
"members": {
|
160
145
|
"type": "array",
|
@@ -209,16 +194,10 @@
|
|
209
194
|
"type": "string"
|
210
195
|
},
|
211
196
|
"type_params": {
|
212
|
-
"type": "
|
213
|
-
"
|
214
|
-
"
|
215
|
-
|
216
|
-
"items": {
|
217
|
-
"$ref": "#/definitions/moduleTypeParam"
|
218
|
-
}
|
219
|
-
}
|
220
|
-
},
|
221
|
-
"required": ["params"]
|
197
|
+
"type": "array",
|
198
|
+
"items": {
|
199
|
+
"$ref": "typeParam.json"
|
200
|
+
}
|
222
201
|
},
|
223
202
|
"members": {
|
224
203
|
"type": "array",
|
@@ -297,16 +276,10 @@
|
|
297
276
|
"type": "string"
|
298
277
|
},
|
299
278
|
"type_params": {
|
300
|
-
"type": "
|
301
|
-
"
|
302
|
-
"
|
303
|
-
|
304
|
-
"items": {
|
305
|
-
"$ref": "#/definitions/moduleTypeParam"
|
306
|
-
}
|
307
|
-
}
|
308
|
-
},
|
309
|
-
"required": ["params"]
|
279
|
+
"type": "array",
|
280
|
+
"items": {
|
281
|
+
"$ref": "typeParam.json"
|
282
|
+
}
|
310
283
|
},
|
311
284
|
"members": {
|
312
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
|
+
}
|
data/schema/types.json
CHANGED
@@ -106,7 +106,7 @@
|
|
106
106
|
"required": ["class", "name", "args", "location"]
|
107
107
|
},
|
108
108
|
"alias": {
|
109
|
-
"title": "Type alias: `u`, `ty`, `json`, ...",
|
109
|
+
"title": "Type alias: `u`, `ty`, `json`, `list[Integer]`, ...",
|
110
110
|
"type": "object",
|
111
111
|
"properties": {
|
112
112
|
"class": {
|
@@ -116,11 +116,17 @@
|
|
116
116
|
"name": {
|
117
117
|
"type": "string"
|
118
118
|
},
|
119
|
+
"args": {
|
120
|
+
"type": "array",
|
121
|
+
"items": {
|
122
|
+
"$ref": "#"
|
123
|
+
}
|
124
|
+
},
|
119
125
|
"location": {
|
120
126
|
"$ref": "location.json"
|
121
127
|
}
|
122
128
|
},
|
123
|
-
"required": ["class", "name", "location"]
|
129
|
+
"required": ["class", "name", "args", "location"]
|
124
130
|
},
|
125
131
|
"tuple": {
|
126
132
|
"title": "Tuple type: `[Foo, bar]`, ...",
|
@@ -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,10 +46,14 @@ 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
|
48
54
|
|
55
|
+
def cp_r: (Pathname, Pathname) -> void
|
56
|
+
|
49
57
|
def setup!: (revision: String) -> void
|
50
58
|
|
51
59
|
def need_to_fetch?: (String revision ) -> bool
|
@@ -60,9 +68,9 @@ module RBS
|
|
60
68
|
|
61
69
|
def resolve_revision: () -> String
|
62
70
|
|
63
|
-
def git: (*String cmd) -> String
|
71
|
+
def git: (*String cmd, **untyped opt) -> String
|
64
72
|
|
65
|
-
def sh!: (*String cmd) -> String
|
73
|
+
def sh!: (*String cmd, **untyped opt) -> String
|
66
74
|
|
67
75
|
def format_config_entry: (Config::gem_entry) -> String
|
68
76
|
end
|
@@ -84,6 +92,8 @@ module RBS
|
|
84
92
|
|
85
93
|
def to_lockfile: () -> source_entry
|
86
94
|
|
95
|
+
def manifest_of: (Config::gem_entry) -> manifest_entry?
|
96
|
+
|
87
97
|
private
|
88
98
|
|
89
99
|
def gem_dir: (Config::gem_entry) -> Pathname
|
@@ -102,6 +112,7 @@ module RBS
|
|
102
112
|
def versions: (Config::gem_entry) -> Array[String]
|
103
113
|
def install: (dest: Pathname, config_entry: Config::gem_entry, stdout: CLI::_IO) -> void
|
104
114
|
def to_lockfile: () -> source_entry
|
115
|
+
def manifest_of: (Config::gem_entry) -> manifest_entry?
|
105
116
|
|
106
117
|
private
|
107
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
|