rbs 3.0.4 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +37 -0
- data/Gemfile.lock +13 -13
- data/Steepfile +1 -1
- data/core/io/buffer.rbs +1 -3
- data/core/module.rbs +4 -4
- data/core/object.rbs +2 -2
- data/core/rubygems/rubygems.rbs +0 -9
- data/core/string.rbs +4 -2
- data/ext/rbs_extension/parser.c +15 -11
- data/lib/rbs/cli.rb +107 -13
- data/lib/rbs/collection/config/lockfile_generator.rb +31 -29
- data/lib/rbs/definition_builder.rb +6 -9
- data/lib/rbs/environment.rb +2 -2
- data/lib/rbs/environment_loader.rb +3 -23
- data/lib/rbs/errors.rb +59 -2
- data/lib/rbs/file_finder.rb +31 -0
- data/lib/rbs/parser_aux.rb +4 -4
- data/lib/rbs/prototype/rb.rb +2 -1
- data/lib/rbs/subtractor.rb +184 -0
- data/lib/rbs/vendorer.rb +3 -3
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs/writer.rb +12 -0
- data/lib/rbs.rb +2 -0
- data/sig/cli.rbs +2 -0
- data/sig/collection/config/lockfile_generator.rbs +3 -1
- data/sig/environment_loader.rbs +17 -15
- data/sig/file_finder.rbs +6 -0
- data/sig/manifest.yaml +1 -0
- data/sig/parser.rbs +26 -8
- data/sig/repository.rbs +7 -5
- data/sig/shims/bundler.rbs +2 -0
- data/sig/subtractor.rbs +33 -0
- data/sig/types.rbs +10 -6
- metadata +6 -2
data/sig/repository.rbs
CHANGED
@@ -3,12 +3,14 @@ module RBS
|
|
3
3
|
#
|
4
4
|
# A repository object can handle multiple repository roots.
|
5
5
|
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
6
|
+
# ```ruby
|
7
|
+
# repo = RBS::Repository.new()
|
8
|
+
# repo.add(Pathname("vendor/rbs/gem-rbs"))
|
9
|
+
# repo.add(Pathname("vendor/rbs/internal-rbs"))
|
10
|
+
# repo.add(Pathname("vendor/rbs/definitely-rbs"))
|
10
11
|
#
|
11
|
-
#
|
12
|
+
# repo.lookup("minitest", "2.1.3") # => Pathname or nil
|
13
|
+
# ```
|
12
14
|
#
|
13
15
|
# If one gem version can resolve to several directories, the last added dir wins.
|
14
16
|
#
|
data/sig/shims/bundler.rbs
CHANGED
data/sig/subtractor.rbs
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
module RBS
|
2
|
+
class Subtractor
|
3
|
+
type decl_with_members = AST::Declarations::Class | AST::Declarations::Module
|
4
|
+
|
5
|
+
@minuend: Array[AST::Declarations::t]
|
6
|
+
@subtrahend: Environment
|
7
|
+
|
8
|
+
def initialize: (Array[AST::Declarations::t] minuend, Environment subtrahend) -> void
|
9
|
+
|
10
|
+
def call: (?Array[AST::Declarations::t], ?context: Resolver::context) -> Array[AST::Declarations::t]
|
11
|
+
|
12
|
+
private def filter_members: (decl_with_members, context: Resolver::context) -> decl_with_members?
|
13
|
+
|
14
|
+
private def member_exist?: (TypeName owner, AST::Members::t, context: Resolver::context) -> boolish
|
15
|
+
|
16
|
+
private def method_exist?: (TypeName owner, Symbol method_name, AST::Members::MethodDefinition::kind) -> boolish
|
17
|
+
|
18
|
+
private def ivar_exist?: (TypeName owner, Symbol ivar_name, AST::Members::Attribute::kind) -> boolish
|
19
|
+
|
20
|
+
private def cvar_exist?: (TypeName owner, Symbol cvar_name) -> boolish
|
21
|
+
|
22
|
+
private def each_member: (TypeName owner) { (AST::Members::t | AST::Declarations::t) -> void } -> void
|
23
|
+
| (TypeName owner) -> Enumerator[(AST::Members::t | AST::Declarations::t), void]
|
24
|
+
|
25
|
+
private def mixin_exist?: (TypeName owner, AST::Members::Include | AST::Members::Extend | AST::Members::Prepend, context: Resolver::context) -> boolish
|
26
|
+
|
27
|
+
private def update_decl: (decl_with_members, members: Array[AST::Declarations::t | AST::Members::t]) -> decl_with_members
|
28
|
+
|
29
|
+
private def absolute_typename: (TypeName, context: Resolver::context) -> TypeName
|
30
|
+
|
31
|
+
private def typename_candidates: (TypeName, context: Resolver::context) -> Array[TypeName]
|
32
|
+
end
|
33
|
+
end
|
data/sig/types.rbs
CHANGED
@@ -18,9 +18,11 @@ module RBS
|
|
18
18
|
# Yields all direct sub types included in the type.
|
19
19
|
# It doesn't yield the type itself.
|
20
20
|
#
|
21
|
-
#
|
22
|
-
#
|
23
|
-
#
|
21
|
+
# ```ruby
|
22
|
+
# parse("Hash[String, Array[Symbol]]").each_type do |ty|
|
23
|
+
# ... # Yields String and Array[Symbol]
|
24
|
+
# end
|
25
|
+
# ```
|
24
26
|
#
|
25
27
|
def each_type: () { (t) -> void } -> void
|
26
28
|
| () -> Enumerator[t, void]
|
@@ -32,9 +34,11 @@ module RBS
|
|
32
34
|
# Returns a String representation.
|
33
35
|
# `level` is used internally.
|
34
36
|
#
|
35
|
-
#
|
36
|
-
#
|
37
|
-
#
|
37
|
+
# ```ruby
|
38
|
+
# parse("String").to_s # => "String"
|
39
|
+
# parse("String | Integer").to_s() # => "String | Integer"
|
40
|
+
# parse("String | Integer").to_s(1) # => "(String | Integer)"
|
41
|
+
# ```
|
38
42
|
#
|
39
43
|
def to_s: (?Integer level) -> String
|
40
44
|
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: 3.0
|
4
|
+
version: 3.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Soutaro Matsumoto
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-04-26 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.
|
@@ -182,6 +182,7 @@ files:
|
|
182
182
|
- lib/rbs/environment_walker.rb
|
183
183
|
- lib/rbs/errors.rb
|
184
184
|
- lib/rbs/factory.rb
|
185
|
+
- lib/rbs/file_finder.rb
|
185
186
|
- lib/rbs/location_aux.rb
|
186
187
|
- lib/rbs/locator.rb
|
187
188
|
- lib/rbs/method_type.rb
|
@@ -201,6 +202,7 @@ files:
|
|
201
202
|
- lib/rbs/resolver/type_name_resolver.rb
|
202
203
|
- lib/rbs/sorter.rb
|
203
204
|
- lib/rbs/substitution.rb
|
205
|
+
- lib/rbs/subtractor.rb
|
204
206
|
- lib/rbs/test.rb
|
205
207
|
- lib/rbs/test/errors.rb
|
206
208
|
- lib/rbs/test/hook.rb
|
@@ -259,6 +261,7 @@ files:
|
|
259
261
|
- sig/environment_walker.rbs
|
260
262
|
- sig/errors.rbs
|
261
263
|
- sig/factory.rbs
|
264
|
+
- sig/file_finder.rbs
|
262
265
|
- sig/location.rbs
|
263
266
|
- sig/locator.rbs
|
264
267
|
- sig/manifest.yaml
|
@@ -284,6 +287,7 @@ files:
|
|
284
287
|
- sig/shims/rubygems.rbs
|
285
288
|
- sig/sorter.rbs
|
286
289
|
- sig/substitution.rbs
|
290
|
+
- sig/subtractor.rbs
|
287
291
|
- sig/type_alias_dependency.rbs
|
288
292
|
- sig/type_alias_regularity.rbs
|
289
293
|
- sig/type_param.rbs
|