rbs 1.8.1 → 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 +51 -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 +9 -0
- 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 +20 -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 +56 -1
- 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 +9 -0
- data/sig/collection/config.rbs +2 -2
- data/sig/declarations.rbs +8 -58
- data/sig/definition.rbs +11 -1
- data/sig/definition_builder.rbs +1 -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/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 +19 -4
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
@@ -72,7 +72,7 @@ module RBS
|
|
72
72
|
result = calculator.in_type_alias(name: type_name)
|
73
73
|
if set = result.incompatible?(entry.decl.type_params)
|
74
74
|
set.each do |param_name|
|
75
|
-
param = entry.decl.type_params
|
75
|
+
param = entry.decl.type_params.find {|param| param.name == param_name } or raise
|
76
76
|
raise InvalidVarianceAnnotationError.new(
|
77
77
|
type_name: type_name,
|
78
78
|
param: param,
|
@@ -80,6 +80,61 @@ module RBS
|
|
80
80
|
)
|
81
81
|
end
|
82
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
|
83
138
|
end
|
84
139
|
end
|
85
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
|
@@ -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
|
data/sig/declarations.rbs
CHANGED
@@ -6,56 +6,6 @@ module RBS
|
|
6
6
|
class Base
|
7
7
|
end
|
8
8
|
|
9
|
-
type variance = :invariant | :covariant | :contravariant
|
10
|
-
|
11
|
-
class ModuleTypeParams
|
12
|
-
class TypeParam
|
13
|
-
# Key
|
14
|
-
# ^^^ name
|
15
|
-
#
|
16
|
-
# unchecked out Elem
|
17
|
-
# ^^^^^^^^^ unchecked
|
18
|
-
# ^^^ variance
|
19
|
-
# ^^^^ name
|
20
|
-
type loc = Location[:name, :variance | :unchecked]
|
21
|
-
|
22
|
-
attr_reader name: Symbol
|
23
|
-
attr_reader variance: variance
|
24
|
-
attr_reader skip_validation: bool
|
25
|
-
attr_reader location: loc?
|
26
|
-
|
27
|
-
def initialize: (name: Symbol, variance: variance, skip_validation: boolish, location: loc?) -> void
|
28
|
-
|
29
|
-
include _ToJson
|
30
|
-
end
|
31
|
-
|
32
|
-
attr_reader params: Array[TypeParam]
|
33
|
-
|
34
|
-
def initialize: () -> void
|
35
|
-
|
36
|
-
def add: (TypeParam param) -> self
|
37
|
-
|
38
|
-
include _HashEqual
|
39
|
-
include _ToJson
|
40
|
-
|
41
|
-
def []: (Symbol) -> TypeParam?
|
42
|
-
|
43
|
-
def each: { (TypeParam) -> void } -> void
|
44
|
-
| () -> Enumerator[TypeParam, void]
|
45
|
-
|
46
|
-
def self.empty: () -> instance
|
47
|
-
|
48
|
-
def variance: (Symbol) -> variance
|
49
|
-
|
50
|
-
def skip_validation?: (Symbol) -> bool
|
51
|
-
|
52
|
-
def empty?: () -> bool
|
53
|
-
|
54
|
-
def size: () -> Integer
|
55
|
-
|
56
|
-
def rename_to: (Array[Symbol] names) -> ModuleTypeParams
|
57
|
-
end
|
58
|
-
|
59
9
|
interface _WithMember
|
60
10
|
def members: () -> Array[untyped]
|
61
11
|
end
|
@@ -118,14 +68,14 @@ module RBS
|
|
118
68
|
include MixinHelper
|
119
69
|
|
120
70
|
attr_reader name: TypeName
|
121
|
-
attr_reader type_params:
|
71
|
+
attr_reader type_params: Array[TypeParam]
|
122
72
|
attr_reader members: Array[member]
|
123
73
|
attr_reader super_class: Super?
|
124
74
|
attr_reader annotations: Array[Annotation]
|
125
75
|
attr_reader location: loc?
|
126
76
|
attr_reader comment: Comment?
|
127
77
|
|
128
|
-
def initialize: (name: TypeName, type_params:
|
78
|
+
def initialize: (name: TypeName, type_params: Array[TypeParam], members: Array[member], super_class: Super?, annotations: Array[Annotation], location: loc?, comment: Comment?) -> void
|
129
79
|
|
130
80
|
include _HashEqual
|
131
81
|
include _ToJson
|
@@ -172,14 +122,14 @@ module RBS
|
|
172
122
|
include MixinHelper
|
173
123
|
|
174
124
|
attr_reader name: TypeName
|
175
|
-
attr_reader type_params:
|
125
|
+
attr_reader type_params: Array[TypeParam]
|
176
126
|
attr_reader members: Array[member]
|
177
127
|
attr_reader location: loc?
|
178
128
|
attr_reader annotations: Array[Annotation]
|
179
129
|
attr_reader self_types: Array[Self]
|
180
130
|
attr_reader comment: Comment?
|
181
131
|
|
182
|
-
def initialize: (name: TypeName, type_params:
|
132
|
+
def initialize: (name: TypeName, type_params: Array[TypeParam], members: Array[member], location: loc?, annotations: Array[Annotation], self_types: Array[Self], comment: Comment?) -> void
|
183
133
|
|
184
134
|
include _HashEqual
|
185
135
|
include _ToJson
|
@@ -202,13 +152,13 @@ module RBS
|
|
202
152
|
type loc = Location[:name | :keyword | :end, :type_params]
|
203
153
|
|
204
154
|
attr_reader name: TypeName
|
205
|
-
attr_reader type_params:
|
155
|
+
attr_reader type_params: Array[TypeParam]
|
206
156
|
attr_reader members: Array[member]
|
207
157
|
attr_reader annotations: Array[Annotation]
|
208
158
|
attr_reader location: loc?
|
209
159
|
attr_reader comment: Comment?
|
210
160
|
|
211
|
-
def initialize: (name: TypeName, type_params:
|
161
|
+
def initialize: (name: TypeName, type_params: Array[TypeParam], members: Array[member], annotations: Array[Annotation], location: loc?, comment: Comment?) -> void
|
212
162
|
|
213
163
|
include MixinHelper
|
214
164
|
|
@@ -226,13 +176,13 @@ module RBS
|
|
226
176
|
type loc = Location[:keyword | :name | :eq, :type_params]
|
227
177
|
|
228
178
|
attr_reader name: TypeName
|
229
|
-
attr_reader type_params:
|
179
|
+
attr_reader type_params: Array[TypeParam]
|
230
180
|
attr_reader type: Types::t
|
231
181
|
attr_reader annotations: Array[Annotation]
|
232
182
|
attr_reader location: loc?
|
233
183
|
attr_reader comment: Comment?
|
234
184
|
|
235
|
-
def initialize: (name: TypeName, type_params:
|
185
|
+
def initialize: (name: TypeName, type_params: Array[TypeParam], type: Types::t, annotations: Array[Annotation], location: loc?, comment: Comment?) -> void
|
236
186
|
|
237
187
|
include _HashEqual
|
238
188
|
include _ToJson
|