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/sig/definition.rbs
CHANGED
@@ -54,10 +54,20 @@ module RBS
|
|
54
54
|
|
55
55
|
def private?: () -> bool
|
56
56
|
|
57
|
+
# Substitutes type variables to some types.
|
58
|
+
# Takes care of type parameter bounds.
|
59
|
+
#
|
57
60
|
def sub: (Substitution) -> Method
|
58
61
|
|
62
|
+
# Applies the mapping from `Types::t` to `Types::t`.
|
63
|
+
#
|
64
|
+
# Note this method doesn't handle upper bound in type params.
|
65
|
+
# You may want to use `#map_type_bound` explicitly, or `#sub` for simple substitution.
|
66
|
+
#
|
59
67
|
def map_type: () { (Types::t) -> Types::t } -> Method
|
60
68
|
|
69
|
+
def map_type_bound: () { (AST::TypeParam::bound) -> AST::TypeParam::bound } -> Method
|
70
|
+
|
61
71
|
def map_method_type: () { (MethodType) -> MethodType } -> Method
|
62
72
|
end
|
63
73
|
|
@@ -127,7 +137,7 @@ module RBS
|
|
127
137
|
|
128
138
|
def type_params: () -> Array[Symbol]
|
129
139
|
|
130
|
-
def type_params_decl: () -> AST::
|
140
|
+
def type_params_decl: () -> Array[AST::TypeParam]
|
131
141
|
|
132
142
|
def sub: (Substitution) -> Definition
|
133
143
|
|
data/sig/definition_builder.rbs
CHANGED
@@ -33,7 +33,7 @@ module RBS
|
|
33
33
|
def try_cache: (TypeName, cache: Hash[TypeName, Definition | false | nil]) { () -> Definition } -> Definition
|
34
34
|
| [A] (TypeName, cache: Hash[A, Definition | false | nil], key: A) { () -> Definition } -> Definition
|
35
35
|
|
36
|
-
def validate_params_with: (AST::
|
36
|
+
def validate_params_with: (Array[AST::TypeParam], result: VarianceCalculator::Result) { (AST::TypeParam) -> void } -> void
|
37
37
|
|
38
38
|
def validate_type_params: (Definition, ancestors: AncestorBuilder::OneAncestors, methods: MethodBuilder::Methods) -> void
|
39
39
|
|
data/sig/environment.rbs
CHANGED
@@ -31,7 +31,9 @@ module RBS
|
|
31
31
|
|
32
32
|
def validate_type_params: () -> void
|
33
33
|
|
34
|
-
def
|
34
|
+
def compatible_params?: (Array[AST::TypeParam], Array[AST::TypeParam]) -> boolish
|
35
|
+
|
36
|
+
def type_params: () -> Array[AST::TypeParam]
|
35
37
|
|
36
38
|
def primary: () -> D[module_decl]
|
37
39
|
end
|
@@ -96,6 +98,10 @@ module RBS
|
|
96
98
|
|
97
99
|
def resolve_member: (TypeNameResolver, AST::Members::t, context: Array[Namespace]) -> AST::Members::t
|
98
100
|
|
101
|
+
def resolve_method_type: (TypeNameResolver, RBS::MethodType, context: Array[Namespace]) -> RBS::MethodType
|
102
|
+
|
103
|
+
def resolve_type_params: (TypeNameResolver resolver, Array[AST::TypeParam], context: Array[Namespace]) -> Array[AST::TypeParam]
|
104
|
+
|
99
105
|
def absolute_type: (TypeNameResolver, Types::t, context: Array[Namespace]) -> Types::t
|
100
106
|
|
101
107
|
def absolute_type_name: (TypeNameResolver, TypeName, context: Array[Namespace]) -> TypeName
|
data/sig/errors.rbs
CHANGED
@@ -179,10 +179,10 @@ module RBS
|
|
179
179
|
|
180
180
|
class InvalidVarianceAnnotationError < DefinitionError
|
181
181
|
attr_reader type_name: TypeName
|
182
|
-
attr_reader param: AST::
|
182
|
+
attr_reader param: AST::TypeParam
|
183
183
|
attr_reader location: Location[untyped, untyped]?
|
184
184
|
|
185
|
-
def initialize: (type_name: TypeName, param: AST::
|
185
|
+
def initialize: (type_name: TypeName, param: AST::TypeParam, location: Location[untyped, untyped]?) -> void
|
186
186
|
end
|
187
187
|
|
188
188
|
class RecursiveAliasDefinitionError < DefinitionError
|
@@ -212,7 +212,7 @@ module RBS
|
|
212
212
|
def mixin_name: () -> String
|
213
213
|
end
|
214
214
|
|
215
|
-
class RecursiveTypeAliasError <
|
215
|
+
class RecursiveTypeAliasError < BaseError
|
216
216
|
attr_reader alias_names: Array[TypeName]
|
217
217
|
attr_reader location: Location[untyped, untyped]?
|
218
218
|
|
@@ -221,7 +221,7 @@ module RBS
|
|
221
221
|
def name: () -> String
|
222
222
|
end
|
223
223
|
|
224
|
-
class NonregularTypeAliasError <
|
224
|
+
class NonregularTypeAliasError < BaseError
|
225
225
|
# Diagnostic reported from `TypeAliasRegularity`.
|
226
226
|
attr_reader diagnostic: TypeAliasRegularity::Diagnostic
|
227
227
|
|
@@ -230,4 +230,19 @@ module RBS
|
|
230
230
|
|
231
231
|
def initialize: (diagnostic: TypeAliasRegularity::Diagnostic, location: Location[untyped, untyped]?) -> void
|
232
232
|
end
|
233
|
+
|
234
|
+
class CyclicTypeParameterBound < BaseError
|
235
|
+
attr_reader location: Location[untyped, untyped]?
|
236
|
+
|
237
|
+
# Array of parameters which contains cyclic dependencies.
|
238
|
+
attr_reader params: Array[AST::TypeParam]
|
239
|
+
|
240
|
+
# Type name
|
241
|
+
attr_reader type_name: TypeName
|
242
|
+
|
243
|
+
# Method name
|
244
|
+
attr_reader method_name: Symbol?
|
245
|
+
|
246
|
+
def initialize: (type_name: TypeName, method_name: Symbol?, params: Array[AST::TypeParam], location: Location[untyped, untyped]?) -> void
|
247
|
+
end
|
233
248
|
end
|
data/sig/location.rbs
CHANGED
@@ -8,7 +8,7 @@ module RBS
|
|
8
8
|
#
|
9
9
|
# ```
|
10
10
|
#
|
11
|
-
class Location[RequiredChildKeys, OptionalChildKeys]
|
11
|
+
class Location[in RequiredChildKeys, in OptionalChildKeys]
|
12
12
|
# The buffer this location points on.
|
13
13
|
attr_reader buffer (): Buffer
|
14
14
|
|
@@ -79,6 +79,8 @@ module RBS
|
|
79
79
|
| (OptionalChildKeys) -> Location[bot, bot]?
|
80
80
|
| (Symbol) -> Location[bot, bot]?
|
81
81
|
|
82
|
+
alias aref []
|
83
|
+
|
82
84
|
def each_optional_key: () { (Symbol) -> void } -> void
|
83
85
|
| () -> Enumerator[Symbol, void]
|
84
86
|
|
data/sig/locator.rbs
CHANGED
data/sig/method_types.rbs
CHANGED
@@ -1,27 +1,48 @@
|
|
1
1
|
module RBS
|
2
2
|
class MethodType
|
3
|
-
|
3
|
+
# () -> void
|
4
|
+
# ^^^^^^^^^^ type
|
5
|
+
#
|
6
|
+
# [A] () { () -> A } -> A
|
7
|
+
# ^^^ type_params
|
8
|
+
# ^^^^^^^^^^^^^^^^^^^ type
|
9
|
+
#
|
10
|
+
type loc = Location[:type, :type_params]
|
11
|
+
|
12
|
+
attr_reader type_params: Array[AST::TypeParam]
|
4
13
|
attr_reader type: Types::Function
|
5
14
|
attr_reader block: Types::Block?
|
6
|
-
attr_reader location:
|
15
|
+
attr_reader location: loc?
|
7
16
|
|
8
|
-
def initialize: (type_params: Array[
|
17
|
+
def initialize: (type_params: Array[AST::TypeParam], type: Types::Function, block: Types::Block?, location: loc?) -> void
|
9
18
|
|
10
19
|
def ==: (untyped other) -> bool
|
11
20
|
|
12
21
|
include _ToJson
|
13
22
|
|
23
|
+
# Substitute type variables to some types.
|
24
|
+
# Takes care of type parameter bounds.
|
25
|
+
#
|
14
26
|
def sub: (Substitution) -> MethodType
|
15
27
|
|
16
|
-
def update: (?type_params: Array[
|
28
|
+
def update: (?type_params: Array[AST::TypeParam], ?type: Types::Function, ?block: Types::Block?, ?location: loc?) -> MethodType
|
17
29
|
|
18
30
|
def free_variables: (?Set[Symbol] set) -> Set[Symbol]
|
19
31
|
|
32
|
+
# Apply the mapping included in the MethodType.
|
33
|
+
#
|
34
|
+
# Note that type bound in generics parameter is not handled by this method.
|
35
|
+
# You may want to use `#map_type_bound` explicitly, or `#sub` for simple substitution.
|
36
|
+
#
|
20
37
|
def map_type: () { (Types::t) -> Types::t } -> MethodType
|
21
38
|
|
39
|
+
def map_type_bound: () { (AST::TypeParam::bound) -> AST::TypeParam::bound } -> MethodType
|
40
|
+
|
22
41
|
def each_type: () { (Types::t) -> void } -> void
|
23
42
|
| () -> Enumerator[Types::t, void]
|
24
43
|
|
25
44
|
def to_s: () -> String
|
45
|
+
|
46
|
+
def type_param_names: () -> Array[Symbol]
|
26
47
|
end
|
27
48
|
end
|
data/sig/type_param.rbs
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
module RBS
|
2
|
+
module AST
|
3
|
+
class TypeParam
|
4
|
+
# Key
|
5
|
+
# ^^^ name
|
6
|
+
#
|
7
|
+
# unchecked out Elem < _ToJson
|
8
|
+
# ^^^^^^^^^ unchecked
|
9
|
+
# ^^^ variance
|
10
|
+
# ^^^^ name
|
11
|
+
# ^^^^^^^^^ upper_bound
|
12
|
+
type loc = Location[:name, :variance | :unchecked | :upper_bound]
|
13
|
+
|
14
|
+
type variance = :invariant | :covariant | :contravariant
|
15
|
+
|
16
|
+
type bound = Types::ClassInstance | Types::ClassSingleton | Types::Interface
|
17
|
+
|
18
|
+
attr_reader name: Symbol
|
19
|
+
attr_reader variance: variance
|
20
|
+
attr_reader location: loc?
|
21
|
+
|
22
|
+
attr_reader upper_bound: bound?
|
23
|
+
|
24
|
+
def initialize: (name: Symbol, variance: variance, upper_bound: bound?, location: loc?) -> void
|
25
|
+
|
26
|
+
include _ToJson
|
27
|
+
|
28
|
+
def ==: (untyped) -> bool
|
29
|
+
|
30
|
+
def eql?: (untyped) -> bool
|
31
|
+
|
32
|
+
def hash: () -> Integer
|
33
|
+
|
34
|
+
@unchecked: bool
|
35
|
+
|
36
|
+
def unchecked!: (?boolish) -> self
|
37
|
+
|
38
|
+
def unchecked?: () -> bool
|
39
|
+
|
40
|
+
def map_type: () { (bound) -> bound } -> TypeParam
|
41
|
+
|
42
|
+
# Helper function to resolve _class instance types_ to _type variables_.
|
43
|
+
#
|
44
|
+
# We need this step because RBS language has an identical syntax for both unqualified class instance types and type variables.
|
45
|
+
# `String` may be an instance of `::String` class or type variable depending on the list of bound type variables.
|
46
|
+
#
|
47
|
+
# So, we need second pass to parse the following generics parameter declaration.
|
48
|
+
#
|
49
|
+
# ```rbs
|
50
|
+
# class Foo[X < _Each[Y], Y]
|
51
|
+
# # ^ We want this `Y` to be a type variable.
|
52
|
+
# end
|
53
|
+
# ```
|
54
|
+
#
|
55
|
+
def self.resolve_variables: (Array[TypeParam]) -> void
|
56
|
+
|
57
|
+
def self.subst_var: (Set[Symbol], Types::t) -> Types::t
|
58
|
+
|
59
|
+
# Rename type parameter name.
|
60
|
+
#
|
61
|
+
# The renaming cannot be done separately because a set of `TypeParam` decls may be mutual recursive.
|
62
|
+
#
|
63
|
+
# Example:
|
64
|
+
#
|
65
|
+
# * Renaming `A -> X, B -> Y`
|
66
|
+
# * Input `[A, B < _Pushable[A]]`
|
67
|
+
# * Result `[X, Y < _Pushable[X]]`
|
68
|
+
#
|
69
|
+
def self.rename: (Array[TypeParam], new_names: Array[Symbol]) -> Array[TypeParam]
|
70
|
+
|
71
|
+
def to_s: () -> String
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
data/sig/types.rbs
CHANGED
@@ -55,6 +55,11 @@ module RBS
|
|
55
55
|
module EmptyEachType
|
56
56
|
def each_type: () { (t) -> void } -> void
|
57
57
|
| () -> Enumerator[t, void]
|
58
|
+
|
59
|
+
# `map_type` returns itself, because there is no sub type.
|
60
|
+
#
|
61
|
+
def map_type: () { (t) -> t } -> self
|
62
|
+
| () -> Enumerator[t, self]
|
58
63
|
end
|
59
64
|
|
60
65
|
module NoTypeName
|
@@ -199,6 +204,9 @@ module RBS
|
|
199
204
|
include _TypeBase
|
200
205
|
|
201
206
|
attr_reader location: loc?
|
207
|
+
|
208
|
+
def map_type: () { (t) -> t } -> Interface
|
209
|
+
| () -> Enumerator[t, Interface]
|
202
210
|
end
|
203
211
|
|
204
212
|
# ClassInstance represents a type of an instance of a class.
|
@@ -224,6 +232,9 @@ module RBS
|
|
224
232
|
attr_reader location: loc?
|
225
233
|
|
226
234
|
include _TypeBase
|
235
|
+
|
236
|
+
def map_type: () { (t) -> t } -> ClassInstance
|
237
|
+
| () -> Enumerator[t, ClassInstance]
|
227
238
|
end
|
228
239
|
|
229
240
|
class Alias
|
@@ -242,6 +253,9 @@ module RBS
|
|
242
253
|
|
243
254
|
include _TypeBase
|
244
255
|
include Application
|
256
|
+
|
257
|
+
def map_type: () { (t) -> t } -> Alias
|
258
|
+
| () -> Enumerator[t, Alias]
|
245
259
|
end
|
246
260
|
|
247
261
|
class Tuple
|
@@ -254,6 +268,9 @@ module RBS
|
|
254
268
|
include _TypeBase
|
255
269
|
|
256
270
|
attr_reader location: loc?
|
271
|
+
|
272
|
+
def map_type: () { (t) -> t } -> Tuple
|
273
|
+
| () -> Enumerator[t, Tuple]
|
257
274
|
end
|
258
275
|
|
259
276
|
class Record
|
@@ -266,6 +283,9 @@ module RBS
|
|
266
283
|
include _TypeBase
|
267
284
|
|
268
285
|
attr_reader location: loc?
|
286
|
+
|
287
|
+
def map_type: () { (t) -> t } -> Record
|
288
|
+
| () -> Enumerator[t, Record]
|
269
289
|
end
|
270
290
|
|
271
291
|
class Optional
|
@@ -278,6 +298,9 @@ module RBS
|
|
278
298
|
include _TypeBase
|
279
299
|
|
280
300
|
attr_reader location: loc?
|
301
|
+
|
302
|
+
def map_type: () { (t) -> t } -> Optional
|
303
|
+
| () -> Enumerator[t, Optional]
|
281
304
|
end
|
282
305
|
|
283
306
|
class Union
|
@@ -395,7 +418,7 @@ module RBS
|
|
395
418
|
|
396
419
|
def sub: (Substitution) -> Block
|
397
420
|
|
398
|
-
def map_type: () { (
|
421
|
+
def map_type: () { (t) -> t } -> Block
|
399
422
|
end
|
400
423
|
|
401
424
|
class Proc
|
@@ -409,6 +432,9 @@ module RBS
|
|
409
432
|
include _TypeBase
|
410
433
|
|
411
434
|
attr_reader location: loc?
|
435
|
+
|
436
|
+
def map_type: () { (t) -> t } -> Proc
|
437
|
+
| () -> Enumerator[t, Proc]
|
412
438
|
end
|
413
439
|
|
414
440
|
class Literal
|
data/sig/validator.rbs
CHANGED
@@ -12,10 +12,39 @@ module RBS
|
|
12
12
|
|
13
13
|
def initialize: (env: Environment, resolver: TypeNameResolver) -> void
|
14
14
|
|
15
|
-
|
16
|
-
|
15
|
+
# Validates the presence of type names and type application arity match.
|
16
|
+
#
|
17
17
|
def validate_type: (Types::t, context: TypeNameResolver::context) -> void
|
18
18
|
|
19
|
+
# Validates type alias definition:
|
20
|
+
#
|
21
|
+
# - There is no circular definition between aliases
|
22
|
+
# - The type alias is _regular_
|
23
|
+
# - The generics type parameter variance annotation is consistent with respect to their usage
|
24
|
+
# - There is no circular dependencies between the generics type parameter bounds
|
25
|
+
#
|
19
26
|
def validate_type_alias: (entry: Environment::SingleEntry[TypeName, AST::Declarations::Alias]) -> void
|
27
|
+
|
28
|
+
# Validates the type parameters in generic methods.
|
29
|
+
#
|
30
|
+
def validate_method_definition: (AST::Members::MethodDefinition, type_name: TypeName) -> void
|
31
|
+
|
32
|
+
# Validates the type parameters if there is no circular dependencies between the bounds.
|
33
|
+
#
|
34
|
+
# ```rbs
|
35
|
+
# [X, Y] # OK
|
36
|
+
# [X, Y < _Foo[X]] # OK
|
37
|
+
# [X < _Foo[Y], Y] # OK
|
38
|
+
# [X < _Foo[Y], Y < _Foo[X]] # Error
|
39
|
+
# ```
|
40
|
+
#
|
41
|
+
def validate_type_params: (Array[AST::TypeParam] params, type_name: TypeName, ?method_name: Symbol?, location: Location[untyped, untyped]?) -> void
|
42
|
+
|
43
|
+
private
|
44
|
+
|
45
|
+
# Resolves relative type names to absolute type names in given context.
|
46
|
+
# Yields the type when the type name resolution using `#resolver` fails.
|
47
|
+
#
|
48
|
+
def absolute_type: (Types::t, context: TypeNameResolver::context) { (Types::t) -> TypeName } -> Types::t
|
20
49
|
end
|
21
50
|
end
|
data/sig/variance_calculator.rbs
CHANGED
@@ -59,7 +59,7 @@ module RBS
|
|
59
59
|
|
60
60
|
def compatible?: (Symbol, with_annotation: variance) -> bool
|
61
61
|
|
62
|
-
def incompatible?: (AST::
|
62
|
+
def incompatible?: (Array[AST::TypeParam]) -> Set[Symbol]?
|
63
63
|
end
|
64
64
|
|
65
65
|
attr_reader builder: DefinitionBuilder
|
data/sig/writer.rbs
CHANGED
@@ -27,7 +27,7 @@ module RBS
|
|
27
27
|
|
28
28
|
def write_member: (AST::Declarations::Module::member) -> void
|
29
29
|
|
30
|
-
def name_and_params: (TypeName, AST::
|
30
|
+
def name_and_params: (TypeName, Array[AST::TypeParam]) -> String?
|
31
31
|
|
32
32
|
def name_and_args: (TypeName, Array[Types::t]) -> String?
|
33
33
|
|
data/stdlib/uri/0/common.rbs
CHANGED
@@ -154,7 +154,7 @@ module URI
|
|
154
154
|
#
|
155
155
|
# See URI.encode_www_form_component, URI.decode_www_form.
|
156
156
|
#
|
157
|
-
def self.encode_www_form: (Enumerable[[ _ToS, _ToS ]] enum, ?encoding enc) -> String
|
157
|
+
def self.encode_www_form: (Enumerable[[ _ToS, _ToS ]] enum, ?encoding? enc) -> String
|
158
158
|
|
159
159
|
# Encodes given `str` to URL-encoded form data.
|
160
160
|
#
|
@@ -168,7 +168,7 @@ module URI
|
|
168
168
|
#
|
169
169
|
# See URI.decode_www_form_component, URI.encode_www_form.
|
170
170
|
#
|
171
|
-
def self.encode_www_form_component: (
|
171
|
+
def self.encode_www_form_component: (_ToS str, ?encoding? enc) -> String
|
172
172
|
|
173
173
|
# ## Synopsis
|
174
174
|
#
|
@@ -268,7 +268,7 @@ module URI
|
|
268
268
|
# It's recommended to first ::escape the provided `uri_str` if there are any
|
269
269
|
# invalid URI characters.
|
270
270
|
#
|
271
|
-
def self.parse: (
|
271
|
+
def self.parse: (_ToStr uri) -> (File | FTP | HTTP | HTTPS | LDAP | LDAPS | MailTo | WS | WSS | Generic)
|
272
272
|
|
273
273
|
# ## Synopsis
|
274
274
|
#
|
@@ -302,12 +302,17 @@ module URI
|
|
302
302
|
# p $&
|
303
303
|
# end
|
304
304
|
#
|
305
|
-
def self.regexp: (?Array[String] schemes) -> Regexp
|
305
|
+
def self.regexp: (?Array[String]? schemes) -> Regexp
|
306
306
|
|
307
307
|
# Returns a Hash of the defined schemes.
|
308
308
|
#
|
309
309
|
def self.scheme_list: () -> Hash[String, Class]
|
310
310
|
|
311
|
+
# Construct a URI instance, using the scheme to detect the appropriate class
|
312
|
+
# from +URI.scheme_list+.
|
313
|
+
#
|
314
|
+
def self.for: (String scheme, *untyped arguments, ?default: Class) -> (File | FTP | HTTP | HTTPS | LDAP | LDAPS | MailTo | WS | WSS | Generic)
|
315
|
+
|
311
316
|
# ## Synopsis
|
312
317
|
#
|
313
318
|
# URI::split(uri)
|
@@ -340,7 +345,7 @@ module URI
|
|
340
345
|
# URI.split("http://www.ruby-lang.org/")
|
341
346
|
# # => ["http", nil, "www.ruby-lang.org", nil, nil, "/", nil, nil, nil]
|
342
347
|
#
|
343
|
-
def self.split: (
|
348
|
+
def self.split: (_ToStr uri) -> [ String?, String?, String?, String?, nil, String?, String?, String?, String? ]
|
344
349
|
end
|
345
350
|
|
346
351
|
URI::ABS_PATH: Regexp
|
@@ -0,0 +1,10 @@
|
|
1
|
+
module URI
|
2
|
+
# FTP URI syntax is defined by RFC1738 section 3.2.
|
3
|
+
#
|
4
|
+
# This class will be redesigned because of difference of implementations;
|
5
|
+
# the structure of its path. draft-hoffman-ftp-uri-04 is a draft but it
|
6
|
+
# is a good summary about the de facto spec.
|
7
|
+
# http://tools.ietf.org/html/draft-hoffman-ftp-uri-04
|
8
|
+
class FTP < Generic
|
9
|
+
end
|
10
|
+
end
|
data/stdlib/uri/0/ws.rbs
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
module URI
|
2
|
+
# The syntax of WS URIs is defined in RFC6455 section 3.
|
3
|
+
#
|
4
|
+
# Note that the Ruby URI library allows WS URLs containing usernames and
|
5
|
+
# passwords. This is not legal as per the RFC, but used to be
|
6
|
+
# supported in Internet Explorer 5 and 6, before the MS04-004 security
|
7
|
+
# update. See <URL:http://support.microsoft.com/kb/834489>.
|
8
|
+
class WS < Generic
|
9
|
+
end
|
10
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0.pre1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Soutaro Matsumoto
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-12-
|
11
|
+
date: 2021-12-23 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: RBS is the language for type signatures for Ruby and standard library
|
14
14
|
definitions.
|
@@ -124,6 +124,7 @@ files:
|
|
124
124
|
- lib/rbs/ast/comment.rb
|
125
125
|
- lib/rbs/ast/declarations.rb
|
126
126
|
- lib/rbs/ast/members.rb
|
127
|
+
- lib/rbs/ast/type_param.rb
|
127
128
|
- lib/rbs/buffer.rb
|
128
129
|
- lib/rbs/builtin_names.rb
|
129
130
|
- lib/rbs/char_scanner.rb
|
@@ -191,6 +192,7 @@ files:
|
|
191
192
|
- schema/location.json
|
192
193
|
- schema/members.json
|
193
194
|
- schema/methodType.json
|
195
|
+
- schema/typeParam.json
|
194
196
|
- schema/types.json
|
195
197
|
- sig/ancestor_builder.rbs
|
196
198
|
- sig/ancestor_graph.rbs
|
@@ -228,6 +230,7 @@ files:
|
|
228
230
|
- sig/type_alias_dependency.rbs
|
229
231
|
- sig/type_alias_regularity.rbs
|
230
232
|
- sig/type_name_resolver.rbs
|
233
|
+
- sig/type_param.rbs
|
231
234
|
- sig/typename.rbs
|
232
235
|
- sig/types.rbs
|
233
236
|
- sig/util.rbs
|
@@ -240,10 +243,12 @@ files:
|
|
240
243
|
- stdlib/base64/0/base64.rbs
|
241
244
|
- stdlib/benchmark/0/benchmark.rbs
|
242
245
|
- stdlib/bigdecimal-math/0/big_math.rbs
|
246
|
+
- stdlib/bigdecimal-math/0/manifest.yaml
|
243
247
|
- stdlib/bigdecimal/0/big_decimal.rbs
|
244
248
|
- stdlib/cgi/0/core.rbs
|
245
249
|
- stdlib/coverage/0/coverage.rbs
|
246
250
|
- stdlib/csv/0/csv.rbs
|
251
|
+
- stdlib/csv/0/manifest.yaml
|
247
252
|
- stdlib/date/0/date.rbs
|
248
253
|
- stdlib/date/0/date_time.rbs
|
249
254
|
- stdlib/dbm/0/dbm.rbs
|
@@ -259,20 +264,25 @@ files:
|
|
259
264
|
- stdlib/logger/0/formatter.rbs
|
260
265
|
- stdlib/logger/0/log_device.rbs
|
261
266
|
- stdlib/logger/0/logger.rbs
|
267
|
+
- stdlib/logger/0/manifest.yaml
|
262
268
|
- stdlib/logger/0/period.rbs
|
263
269
|
- stdlib/logger/0/severity.rbs
|
264
270
|
- stdlib/monitor/0/monitor.rbs
|
265
271
|
- stdlib/mutex_m/0/mutex_m.rbs
|
272
|
+
- stdlib/net-http/0/manifest.yaml
|
266
273
|
- stdlib/net-http/0/net-http.rbs
|
267
274
|
- stdlib/objspace/0/objspace.rbs
|
275
|
+
- stdlib/openssl/0/manifest.yaml
|
268
276
|
- stdlib/openssl/0/openssl.rbs
|
269
277
|
- stdlib/optparse/0/optparse.rbs
|
270
278
|
- stdlib/pathname/0/pathname.rbs
|
271
279
|
- stdlib/prettyprint/0/prettyprint.rbs
|
272
280
|
- stdlib/prime/0/integer-extension.rbs
|
281
|
+
- stdlib/prime/0/manifest.yaml
|
273
282
|
- stdlib/prime/0/prime.rbs
|
274
283
|
- stdlib/pstore/0/pstore.rbs
|
275
284
|
- stdlib/pty/0/pty.rbs
|
285
|
+
- stdlib/resolv/0/manifest.yaml
|
276
286
|
- stdlib/resolv/0/resolv.rbs
|
277
287
|
- stdlib/rubygems/0/basic_specification.rbs
|
278
288
|
- stdlib/rubygems/0/config_file.rbs
|
@@ -311,14 +321,19 @@ files:
|
|
311
321
|
- stdlib/tsort/0/tsort.rbs
|
312
322
|
- stdlib/uri/0/common.rbs
|
313
323
|
- stdlib/uri/0/file.rbs
|
324
|
+
- stdlib/uri/0/ftp.rbs
|
314
325
|
- stdlib/uri/0/generic.rbs
|
315
326
|
- stdlib/uri/0/http.rbs
|
316
327
|
- stdlib/uri/0/https.rbs
|
317
328
|
- stdlib/uri/0/ldap.rbs
|
318
329
|
- stdlib/uri/0/ldaps.rbs
|
330
|
+
- stdlib/uri/0/mailto.rbs
|
319
331
|
- stdlib/uri/0/rfc2396_parser.rbs
|
320
332
|
- stdlib/uri/0/rfc3986_parser.rbs
|
333
|
+
- stdlib/uri/0/ws.rbs
|
334
|
+
- stdlib/uri/0/wss.rbs
|
321
335
|
- stdlib/yaml/0/dbm.rbs
|
336
|
+
- stdlib/yaml/0/manifest.yaml
|
322
337
|
- stdlib/yaml/0/store.rbs
|
323
338
|
- stdlib/zlib/0/zlib.rbs
|
324
339
|
- steep/Gemfile
|
@@ -342,9 +357,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
342
357
|
version: '2.6'
|
343
358
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
344
359
|
requirements:
|
345
|
-
- - "
|
360
|
+
- - ">"
|
346
361
|
- !ruby/object:Gem::Version
|
347
|
-
version:
|
362
|
+
version: 1.3.1
|
348
363
|
requirements: []
|
349
364
|
rubygems_version: 3.2.22
|
350
365
|
signing_key:
|