rbs 2.8.4 → 3.0.0.dev.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +0 -3
- data/Gemfile +1 -1
- data/Gemfile.lock +17 -17
- data/README.md +1 -0
- data/Rakefile +66 -0
- data/core/array.rbs +1 -1
- data/core/builtin.rbs +1 -1
- data/core/hash.rbs +1 -1
- data/core/module.rbs +1 -1
- data/ext/rbs_extension/constants.c +18 -2
- data/ext/rbs_extension/constants.h +9 -1
- data/ext/rbs_extension/lexer.c +834 -777
- data/ext/rbs_extension/lexer.h +3 -1
- data/ext/rbs_extension/lexer.re +3 -1
- data/ext/rbs_extension/lexstate.c +4 -2
- data/ext/rbs_extension/parser.c +287 -57
- data/ext/rbs_extension/ruby_objs.c +71 -5
- data/ext/rbs_extension/ruby_objs.h +9 -2
- data/lib/rbs/annotate/rdoc_annotator.rb +1 -1
- data/lib/rbs/ast/declarations.rb +49 -2
- data/lib/rbs/ast/directives.rb +39 -0
- data/lib/rbs/ast/members.rb +49 -15
- data/lib/rbs/cli.rb +38 -19
- data/lib/rbs/collection/config/lockfile.rb +115 -0
- data/lib/rbs/collection/config/lockfile_generator.rb +99 -53
- data/lib/rbs/collection/config.rb +12 -40
- data/lib/rbs/collection/installer.rb +9 -13
- data/lib/rbs/collection/sources/base.rb +2 -2
- data/lib/rbs/collection/sources/git.rb +135 -62
- data/lib/rbs/collection/sources/rubygems.rb +10 -12
- data/lib/rbs/collection/sources/stdlib.rb +10 -13
- data/lib/rbs/collection/sources.rb +7 -1
- data/lib/rbs/collection.rb +1 -0
- data/lib/rbs/definition.rb +1 -1
- data/lib/rbs/definition_builder/ancestor_builder.rb +24 -8
- data/lib/rbs/definition_builder/method_builder.rb +3 -3
- data/lib/rbs/definition_builder.rb +456 -579
- data/lib/rbs/environment/use_map.rb +77 -0
- data/lib/rbs/environment.rb +356 -85
- data/lib/rbs/environment_loader.rb +20 -17
- data/lib/rbs/environment_walker.rb +1 -1
- data/lib/rbs/errors.rb +34 -37
- data/lib/rbs/locator.rb +3 -3
- data/lib/rbs/parser_aux.rb +8 -6
- data/lib/rbs/prototype/helpers.rb +29 -13
- data/lib/rbs/prototype/node_usage.rb +99 -0
- data/lib/rbs/prototype/rb.rb +3 -2
- data/lib/rbs/prototype/rbi.rb +6 -4
- data/lib/rbs/prototype/runtime.rb +25 -12
- data/lib/rbs/resolver/constant_resolver.rb +23 -7
- data/lib/rbs/resolver/type_name_resolver.rb +2 -1
- data/lib/rbs/sorter.rb +3 -3
- data/lib/rbs/substitution.rb +19 -0
- data/lib/rbs/test/setup.rb +1 -1
- data/lib/rbs/type_alias_dependency.rb +1 -1
- data/lib/rbs/type_alias_regularity.rb +3 -3
- data/lib/rbs/types.rb +1 -5
- data/lib/rbs/validator.rb +25 -3
- data/lib/rbs/variance_calculator.rb +2 -2
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs/writer.rb +54 -19
- data/lib/rbs.rb +3 -2
- data/lib/rdoc_plugin/parser.rb +3 -3
- data/schema/members.json +15 -10
- data/sig/ancestor_graph.rbs +22 -2
- data/sig/collection/config/lockfile.rbs +80 -0
- data/sig/collection/config/lockfile_generator.rbs +53 -0
- data/sig/collection/config.rbs +5 -48
- data/sig/collection/installer.rbs +1 -1
- data/sig/collection/sources.rbs +76 -33
- data/sig/constant.rbs +1 -1
- data/sig/declarations.rbs +36 -3
- data/sig/definition.rbs +1 -1
- data/sig/definition_builder.rbs +94 -82
- data/sig/directives.rbs +61 -0
- data/sig/environment.rbs +150 -28
- data/sig/environment_loader.rbs +2 -2
- data/sig/errors.rbs +42 -0
- data/sig/members.rbs +31 -7
- data/sig/parser.rbs +8 -15
- data/sig/prototype/node_usage.rbs +20 -0
- data/sig/resolver/constant_resolver.rbs +1 -2
- data/sig/shims/bundler.rbs +31 -0
- data/sig/shims/rubygems.rbs +15 -0
- data/sig/shims.rbs +0 -22
- data/sig/substitution.rbs +6 -0
- data/sig/use_map.rbs +35 -0
- data/sig/validator.rbs +12 -5
- data/sig/writer.rbs +6 -2
- metadata +16 -9
- data/lib/rbs/constant_table.rb +0 -167
- data/lib/rbs/type_name_resolver.rb +0 -67
- data/sig/constant_table.rbs +0 -30
- data/sig/type_name_resolver.rbs +0 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 37f0e00e909c3e55bf8f8a80187fe4825d325e8b5ffc392d749058dba6d37561
|
4
|
+
data.tar.gz: 541db099d371d39611212952a07f545be143dd26845532665ee3f7c48fe5e3f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 68e344e08d8aa8333dc8a4c4292e8b45ba7eab22027c570dc7c18f5e9f86289914ee742261e423bb5ea2924ccb3cbf9516de67150f86a8dd6aabdf573404c1ed
|
7
|
+
data.tar.gz: 680e1b9be1495dae9c1842c7e5b49984c819fe2c54fea9002d3508727b60847bc0fbee737ef2625f603e00406f612008f9b515be37cb662ed5dd4ee1b4af736f
|
data/.github/workflows/ruby.yml
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rbs (
|
4
|
+
rbs (3.0.0.dev.2)
|
5
5
|
|
6
6
|
PATH
|
7
7
|
remote: test/assets/test-gem
|
@@ -19,35 +19,35 @@ GEM
|
|
19
19
|
debase-ruby_core_source (>= 0.10.12)
|
20
20
|
debase-ruby_core_source (0.10.16)
|
21
21
|
diff-lcs (1.5.0)
|
22
|
-
digest (3.1.
|
22
|
+
digest (3.1.1)
|
23
23
|
forwardable (1.3.2)
|
24
24
|
goodcheck (3.1.0)
|
25
25
|
marcel (>= 1.0, < 2.0)
|
26
26
|
psych (>= 3.1, < 5.0)
|
27
27
|
rainbow (>= 3.0, < 4.0)
|
28
28
|
strong_json (>= 1.1, < 2.2)
|
29
|
-
json (2.6.
|
29
|
+
json (2.6.3)
|
30
30
|
json-schema (3.0.0)
|
31
31
|
addressable (>= 2.8)
|
32
32
|
marcel (1.0.2)
|
33
|
-
minitest (5.
|
33
|
+
minitest (5.17.0)
|
34
34
|
parallel (1.22.1)
|
35
|
-
parser (3.1.
|
35
|
+
parser (3.1.3.0)
|
36
36
|
ast (~> 2.4.1)
|
37
|
-
power_assert (2.0.
|
37
|
+
power_assert (2.0.2)
|
38
38
|
prime (0.1.2)
|
39
39
|
forwardable
|
40
40
|
singleton
|
41
|
-
psych (4.0.
|
41
|
+
psych (4.0.6)
|
42
42
|
stringio
|
43
43
|
public_suffix (4.0.7)
|
44
44
|
rainbow (3.1.1)
|
45
45
|
rake (13.0.6)
|
46
|
-
rake-compiler (1.2.
|
46
|
+
rake-compiler (1.2.1)
|
47
47
|
rake
|
48
48
|
rdoc (6.4.0)
|
49
49
|
psych (>= 4.0.0)
|
50
|
-
regexp_parser (2.6.
|
50
|
+
regexp_parser (2.6.1)
|
51
51
|
rexml (3.2.5)
|
52
52
|
rspec (3.12.0)
|
53
53
|
rspec-core (~> 3.12.0)
|
@@ -62,7 +62,7 @@ GEM
|
|
62
62
|
diff-lcs (>= 1.2.0, < 2.0)
|
63
63
|
rspec-support (~> 3.12.0)
|
64
64
|
rspec-support (3.12.0)
|
65
|
-
rubocop (1.
|
65
|
+
rubocop (1.40.0)
|
66
66
|
json (~> 2.3)
|
67
67
|
parallel (~> 1.10)
|
68
68
|
parser (>= 3.1.2.1)
|
@@ -72,7 +72,7 @@ GEM
|
|
72
72
|
rubocop-ast (>= 1.23.0, < 2.0)
|
73
73
|
ruby-progressbar (~> 1.7)
|
74
74
|
unicode-display_width (>= 1.4.0, < 3.0)
|
75
|
-
rubocop-ast (1.
|
75
|
+
rubocop-ast (1.24.0)
|
76
76
|
parser (>= 3.1.1.0)
|
77
77
|
rubocop-rubycw (0.1.6)
|
78
78
|
rubocop (~> 1.0)
|
@@ -80,11 +80,11 @@ GEM
|
|
80
80
|
rake (>= 0.8.1)
|
81
81
|
ruby-progressbar (1.11.0)
|
82
82
|
singleton (0.1.1)
|
83
|
-
stackprof (0.2.
|
84
|
-
stringio (3.0.
|
83
|
+
stackprof (0.2.23)
|
84
|
+
stringio (3.0.4)
|
85
85
|
strong_json (2.1.2)
|
86
|
-
tempfile (0.1.
|
87
|
-
test-unit (3.5.
|
86
|
+
tempfile (0.1.3)
|
87
|
+
test-unit (3.5.7)
|
88
88
|
power_assert
|
89
89
|
unicode-display_width (2.3.0)
|
90
90
|
|
@@ -105,7 +105,7 @@ DEPENDENCIES
|
|
105
105
|
rake-compiler
|
106
106
|
rbs!
|
107
107
|
rbs-amber!
|
108
|
-
rdoc
|
108
|
+
rdoc (< 6.5.0)
|
109
109
|
rspec
|
110
110
|
rubocop
|
111
111
|
rubocop-rubycw
|
@@ -115,4 +115,4 @@ DEPENDENCIES
|
|
115
115
|
test-unit
|
116
116
|
|
117
117
|
BUNDLED WITH
|
118
|
-
2.
|
118
|
+
2.4.6
|
data/README.md
CHANGED
data/Rakefile
CHANGED
@@ -233,3 +233,69 @@ task :test_generate_stdlib do
|
|
233
233
|
sh "RBS_GENERATE_TEST_PATH=/tmp/Thread_Mutex_test.rb rake 'generate:stdlib_test[Thread::Mutex]'"
|
234
234
|
sh "ruby -c /tmp/Thread_Mutex_test.rb"
|
235
235
|
end
|
236
|
+
|
237
|
+
Rake::Task[:release].enhance do
|
238
|
+
Rake::Task[:"release:note"].invoke
|
239
|
+
end
|
240
|
+
|
241
|
+
namespace :release do
|
242
|
+
desc "Explain the post-release steps automatically"
|
243
|
+
task :note do
|
244
|
+
version = Gem::Version.new(RBS::VERSION)
|
245
|
+
major, minor, patch, *_ = RBS::VERSION.split(".")
|
246
|
+
major = major.to_i
|
247
|
+
minor = minor.to_i
|
248
|
+
patch = patch.to_i
|
249
|
+
|
250
|
+
puts "🎉🎉🎉🎉 Congratulations for **#{version}** release! 🎉🎉🎉🎉"
|
251
|
+
puts
|
252
|
+
puts "There are a few things left to complete the release. 💪"
|
253
|
+
puts
|
254
|
+
|
255
|
+
if patch == 0 || version.prerelease?
|
256
|
+
puts "* [ ] Update release note: https://github.com/ruby/rbs/wiki/Release-Note-#{major}.#{minor}"
|
257
|
+
end
|
258
|
+
|
259
|
+
if patch == 0 && !version.prerelease?
|
260
|
+
puts "* [ ] Delete `RBS XYZ is the latest version of...` from release note: https://github.com/ruby/rbs/wiki/Release-Note-#{major}.#{minor}"
|
261
|
+
end
|
262
|
+
|
263
|
+
puts "* [ ] Publish a release at GitHub"
|
264
|
+
puts "* [ ] Make some announcements on Twitter/Mustdon/Slack/???"
|
265
|
+
|
266
|
+
puts
|
267
|
+
puts
|
268
|
+
|
269
|
+
puts "✏️ Making a draft release on GitHub..."
|
270
|
+
|
271
|
+
content = File.read(File.join(__dir__, "CHANGELOG.md"))
|
272
|
+
changelog = content.scan(/^## \d.*?(?=^## \d)/m)[0]
|
273
|
+
changelog = changelog.sub(/^.*\n^.*\n/, "").rstrip
|
274
|
+
|
275
|
+
notes = <<NOTES
|
276
|
+
[Release note](https://github.com/ruby/rbs/wiki/Release-Note-#{major}.#{minor})
|
277
|
+
|
278
|
+
#{changelog}
|
279
|
+
NOTES
|
280
|
+
|
281
|
+
command = [
|
282
|
+
"gh",
|
283
|
+
"release",
|
284
|
+
"create",
|
285
|
+
"--draft",
|
286
|
+
"v#{RBS::VERSION}",
|
287
|
+
"--title=#{RBS::VERSION}",
|
288
|
+
"--notes=#{notes}"
|
289
|
+
]
|
290
|
+
|
291
|
+
if version.prerelease?
|
292
|
+
command << "--prerelease"
|
293
|
+
end
|
294
|
+
|
295
|
+
require "open3"
|
296
|
+
output, status = Open3.capture2(*command)
|
297
|
+
if status.success?
|
298
|
+
puts " >> Done! Open #{output.chomp} and publish the release!"
|
299
|
+
end
|
300
|
+
end
|
301
|
+
end
|
data/core/array.rbs
CHANGED
@@ -850,7 +850,7 @@ class Array[unchecked out Elem] < Object
|
|
850
850
|
#
|
851
851
|
# Array#slice is an alias for Array#[].
|
852
852
|
#
|
853
|
-
def []: (int index) -> Elem
|
853
|
+
def []: %a{implicitly-returns-nil} (int index) -> Elem
|
854
854
|
| (int start, int length) -> ::Array[Elem]?
|
855
855
|
| (::Range[::Integer?] range) -> ::Array[Elem]?
|
856
856
|
|
data/core/builtin.rbs
CHANGED
data/core/hash.rbs
CHANGED
data/core/module.rbs
CHANGED
@@ -10,7 +10,7 @@ VALUE RBS_AST_TypeParam;
|
|
10
10
|
|
11
11
|
VALUE RBS_AST_Declarations;
|
12
12
|
|
13
|
-
VALUE
|
13
|
+
VALUE RBS_AST_Declarations_TypeAlias;
|
14
14
|
VALUE RBS_AST_Declarations_Constant;
|
15
15
|
VALUE RBS_AST_Declarations_Global;
|
16
16
|
VALUE RBS_AST_Declarations_Interface;
|
@@ -18,6 +18,13 @@ VALUE RBS_AST_Declarations_Module;
|
|
18
18
|
VALUE RBS_AST_Declarations_Module_Self;
|
19
19
|
VALUE RBS_AST_Declarations_Class;
|
20
20
|
VALUE RBS_AST_Declarations_Class_Super;
|
21
|
+
VALUE RBS_AST_Declarations_ModuleAlias;
|
22
|
+
VALUE RBS_AST_Declarations_ClassAlias;
|
23
|
+
|
24
|
+
VALUE RBS_AST_Directives;
|
25
|
+
VALUE RBS_AST_Directives_Use;
|
26
|
+
VALUE RBS_AST_Directives_Use_SingleClause;
|
27
|
+
VALUE RBS_AST_Directives_Use_WildcardClause;
|
21
28
|
|
22
29
|
VALUE RBS_AST_Members;
|
23
30
|
VALUE RBS_AST_Members_Alias;
|
@@ -30,6 +37,7 @@ VALUE RBS_AST_Members_Extend;
|
|
30
37
|
VALUE RBS_AST_Members_Include;
|
31
38
|
VALUE RBS_AST_Members_InstanceVariable;
|
32
39
|
VALUE RBS_AST_Members_MethodDefinition;
|
40
|
+
VALUE RBS_AST_Members_MethodDefinition_Overload;
|
33
41
|
VALUE RBS_AST_Members_Prepend;
|
34
42
|
VALUE RBS_AST_Members_Private;
|
35
43
|
VALUE RBS_AST_Members_Public;
|
@@ -79,7 +87,7 @@ void rbs__init_constants(void) {
|
|
79
87
|
|
80
88
|
RBS_AST_Declarations = rb_const_get(RBS_AST, rb_intern("Declarations"));
|
81
89
|
|
82
|
-
|
90
|
+
RBS_AST_Declarations_TypeAlias = rb_const_get(RBS_AST_Declarations, rb_intern("TypeAlias"));
|
83
91
|
RBS_AST_Declarations_Constant = rb_const_get(RBS_AST_Declarations, rb_intern("Constant"));
|
84
92
|
RBS_AST_Declarations_Global = rb_const_get(RBS_AST_Declarations, rb_intern("Global"));
|
85
93
|
RBS_AST_Declarations_Interface = rb_const_get(RBS_AST_Declarations, rb_intern("Interface"));
|
@@ -87,6 +95,13 @@ void rbs__init_constants(void) {
|
|
87
95
|
RBS_AST_Declarations_Module_Self = rb_const_get(RBS_AST_Declarations_Module, rb_intern("Self"));
|
88
96
|
RBS_AST_Declarations_Class = rb_const_get(RBS_AST_Declarations, rb_intern("Class"));
|
89
97
|
RBS_AST_Declarations_Class_Super = rb_const_get(RBS_AST_Declarations_Class, rb_intern("Super"));
|
98
|
+
RBS_AST_Declarations_ClassAlias = rb_const_get(RBS_AST_Declarations, rb_intern("ClassAlias"));
|
99
|
+
RBS_AST_Declarations_ModuleAlias = rb_const_get(RBS_AST_Declarations, rb_intern("ModuleAlias"));
|
100
|
+
|
101
|
+
RBS_AST_Directives = rb_const_get(RBS_AST, rb_intern("Directives"));
|
102
|
+
RBS_AST_Directives_Use = rb_const_get(RBS_AST_Directives, rb_intern("Use"));
|
103
|
+
RBS_AST_Directives_Use_SingleClause = rb_const_get(RBS_AST_Directives_Use, rb_intern("SingleClause"));
|
104
|
+
RBS_AST_Directives_Use_WildcardClause = rb_const_get(RBS_AST_Directives_Use, rb_intern("WildcardClause"));
|
90
105
|
|
91
106
|
RBS_AST_Members = rb_const_get(RBS_AST, rb_intern("Members"));
|
92
107
|
RBS_AST_Members_Alias = rb_const_get(RBS_AST_Members, rb_intern("Alias"));
|
@@ -99,6 +114,7 @@ void rbs__init_constants(void) {
|
|
99
114
|
RBS_AST_Members_Include = rb_const_get(RBS_AST_Members, rb_intern("Include"));
|
100
115
|
RBS_AST_Members_InstanceVariable = rb_const_get(RBS_AST_Members, rb_intern("InstanceVariable"));
|
101
116
|
RBS_AST_Members_MethodDefinition = rb_const_get(RBS_AST_Members, rb_intern("MethodDefinition"));
|
117
|
+
RBS_AST_Members_MethodDefinition_Overload = rb_const_get(RBS_AST_Members_MethodDefinition, rb_intern("Overload"));
|
102
118
|
RBS_AST_Members_Prepend = rb_const_get(RBS_AST_Members, rb_intern("Prepend"));
|
103
119
|
RBS_AST_Members_Private = rb_const_get(RBS_AST_Members, rb_intern("Private"));
|
104
120
|
RBS_AST_Members_Public = rb_const_get(RBS_AST_Members, rb_intern("Public"));
|
@@ -9,7 +9,7 @@ extern VALUE RBS_AST_Comment;
|
|
9
9
|
extern VALUE RBS_AST_TypeParam;
|
10
10
|
|
11
11
|
extern VALUE RBS_AST_Declarations;
|
12
|
-
extern VALUE
|
12
|
+
extern VALUE RBS_AST_Declarations_TypeAlias;
|
13
13
|
extern VALUE RBS_AST_Declarations_Class_Super;
|
14
14
|
extern VALUE RBS_AST_Declarations_Class;
|
15
15
|
extern VALUE RBS_AST_Declarations_Constant;
|
@@ -17,6 +17,13 @@ extern VALUE RBS_AST_Declarations_Global;
|
|
17
17
|
extern VALUE RBS_AST_Declarations_Interface;
|
18
18
|
extern VALUE RBS_AST_Declarations_Module_Self;
|
19
19
|
extern VALUE RBS_AST_Declarations_Module;
|
20
|
+
extern VALUE RBS_AST_Declarations_ModuleAlias;
|
21
|
+
extern VALUE RBS_AST_Declarations_ClassAlias;
|
22
|
+
|
23
|
+
extern VALUE RBS_AST_Directives;
|
24
|
+
extern VALUE RBS_AST_Directives_Use;
|
25
|
+
extern VALUE RBS_AST_Directives_Use_SingleClause;
|
26
|
+
extern VALUE RBS_AST_Directives_Use_WildcardClause;
|
20
27
|
|
21
28
|
extern VALUE RBS_AST_Members;
|
22
29
|
extern VALUE RBS_AST_Members_Alias;
|
@@ -29,6 +36,7 @@ extern VALUE RBS_AST_Members_Extend;
|
|
29
36
|
extern VALUE RBS_AST_Members_Include;
|
30
37
|
extern VALUE RBS_AST_Members_InstanceVariable;
|
31
38
|
extern VALUE RBS_AST_Members_MethodDefinition;
|
39
|
+
extern VALUE RBS_AST_Members_MethodDefinition_Overload;
|
32
40
|
extern VALUE RBS_AST_Members_Prepend;
|
33
41
|
extern VALUE RBS_AST_Members_Private;
|
34
42
|
extern VALUE RBS_AST_Members_Public;
|