rbs 3.0.0.dev.1 → 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/CHANGELOG.md +28 -0
- data/Gemfile.lock +2 -2
- data/README.md +1 -0
- data/Rakefile +75 -1
- 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 +16 -2
- data/ext/rbs_extension/constants.h +8 -1
- data/ext/rbs_extension/extconf.rb +1 -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 +264 -44
- data/ext/rbs_extension/ruby_objs.c +56 -2
- data/ext/rbs_extension/ruby_objs.h +7 -1
- 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/cli.rb +32 -18
- data/lib/rbs/collection/config/lockfile_generator.rb +25 -20
- data/lib/rbs/collection/config.rb +2 -2
- data/lib/rbs/collection/sources/git.rb +1 -1
- data/lib/rbs/definition_builder/ancestor_builder.rb +24 -8
- data/lib/rbs/definition_builder.rb +8 -8
- data/lib/rbs/environment/use_map.rb +77 -0
- data/lib/rbs/environment.rb +352 -83
- data/lib/rbs/environment_loader.rb +9 -7
- data/lib/rbs/environment_walker.rb +1 -1
- data/lib/rbs/errors.rb +34 -37
- data/lib/rbs/locator.rb +1 -1
- data/lib/rbs/parser_aux.rb +8 -6
- 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/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/validator.rb +23 -2
- data/lib/rbs/variance_calculator.rb +2 -2
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs/writer.rb +28 -2
- data/lib/rbs.rb +2 -2
- data/lib/rdoc_plugin/parser.rb +2 -2
- data/rbs.gemspec +1 -1
- data/sig/ancestor_graph.rbs +22 -2
- data/sig/collection/config/lockfile_generator.rbs +8 -10
- data/sig/collection/config.rbs +1 -1
- data/sig/collection/sources.rbs +12 -6
- data/sig/constant.rbs +1 -1
- data/sig/declarations.rbs +36 -3
- data/sig/definition.rbs +1 -1
- data/sig/definition_builder.rbs +0 -1
- data/sig/directives.rbs +61 -0
- data/sig/environment.rbs +150 -28
- data/sig/environment_loader.rbs +1 -1
- data/sig/errors.rbs +22 -1
- data/sig/parser.rbs +8 -15
- data/sig/resolver/constant_resolver.rbs +1 -2
- data/sig/shims/bundler.rbs +18 -0
- data/sig/shims/rubygems.rbs +6 -0
- data/sig/use_map.rbs +35 -0
- data/sig/validator.rbs +12 -5
- data/sig/writer.rbs +4 -2
- metadata +7 -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
- data/steep/Gemfile +0 -3
- data/steep/Gemfile.lock +0 -61
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/CHANGELOG.md
CHANGED
@@ -2,6 +2,34 @@
|
|
2
2
|
|
3
3
|
## master
|
4
4
|
|
5
|
+
## 2.8.4 (2023-01-20)
|
6
|
+
|
7
|
+
### Miscellaneous
|
8
|
+
|
9
|
+
* Make `rake stdlib_test` run with single process (Backport [#1207](https://github.com/ruby/rbs/pull/1207), [#1211](https://github.com/ruby/rbs/pull/1211))
|
10
|
+
* Remove `steep/*` files from `.gem` (Backport [#1214](https://github.com/ruby/rbs/pull/1214), [#1216](https://github.com/ruby/rbs/pull/1216))
|
11
|
+
|
12
|
+
## 2.8.3 (2023-01-06)
|
13
|
+
|
14
|
+
### Library changes
|
15
|
+
|
16
|
+
* Use `-std=gnu99` instead of `-std=c99` (Backport [#973](https://github.com/ruby/rbs/pull/973))
|
17
|
+
* Add `rbs_` prefix to `skip` function (Backport [#1186](https://github.com/ruby/rbs/pull/1186))
|
18
|
+
|
19
|
+
## 2.8.2 (2022-12-21)
|
20
|
+
|
21
|
+
### Signature updates
|
22
|
+
|
23
|
+
* `YAML.load` ([#1170](https://github.com/ruby/rbs/pull/1170))
|
24
|
+
|
25
|
+
### Library changes
|
26
|
+
|
27
|
+
* Add the methods of the `prepend`ed module itself ([#1182](https://github.com/ruby/rbs/pull/1182))
|
28
|
+
|
29
|
+
### Miscellaneous
|
30
|
+
|
31
|
+
* Add `TestSkip` module to skip tests that fails in ruby CI ([#1167](https://github.com/ruby/rbs/pull/1167))
|
32
|
+
|
5
33
|
## 2.8.1 (2022-11-28)
|
6
34
|
|
7
35
|
### Signature updates
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
data/Rakefile
CHANGED
@@ -69,7 +69,15 @@ FileList["test/stdlib/**/*_test.rb"].each do |test|
|
|
69
69
|
task test => :compile do
|
70
70
|
sh "#{ruby} -Ilib #{bin}/test_runner.rb #{test}"
|
71
71
|
end
|
72
|
-
|
72
|
+
end
|
73
|
+
|
74
|
+
task :stdlib_test do
|
75
|
+
test_files = FileList["test/stdlib/**/*_test.rb"].reject do |path|
|
76
|
+
path =~ %r{Ractor}
|
77
|
+
end
|
78
|
+
sh "#{ruby} -Ilib #{bin}/test_runner.rb #{test_files.join(' ')}"
|
79
|
+
# TODO: Ractor tests need to be run in a separate process
|
80
|
+
sh "#{ruby} -Ilib #{bin}/test_runner.rb test/stdlib/Ractor_test.rb"
|
73
81
|
end
|
74
82
|
|
75
83
|
task :rubocop do
|
@@ -225,3 +233,69 @@ task :test_generate_stdlib do
|
|
225
233
|
sh "RBS_GENERATE_TEST_PATH=/tmp/Thread_Mutex_test.rb rake 'generate:stdlib_test[Thread::Mutex]'"
|
226
234
|
sh "ruby -c /tmp/Thread_Mutex_test.rb"
|
227
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;
|
@@ -80,7 +87,7 @@ void rbs__init_constants(void) {
|
|
80
87
|
|
81
88
|
RBS_AST_Declarations = rb_const_get(RBS_AST, rb_intern("Declarations"));
|
82
89
|
|
83
|
-
|
90
|
+
RBS_AST_Declarations_TypeAlias = rb_const_get(RBS_AST_Declarations, rb_intern("TypeAlias"));
|
84
91
|
RBS_AST_Declarations_Constant = rb_const_get(RBS_AST_Declarations, rb_intern("Constant"));
|
85
92
|
RBS_AST_Declarations_Global = rb_const_get(RBS_AST_Declarations, rb_intern("Global"));
|
86
93
|
RBS_AST_Declarations_Interface = rb_const_get(RBS_AST_Declarations, rb_intern("Interface"));
|
@@ -88,6 +95,13 @@ void rbs__init_constants(void) {
|
|
88
95
|
RBS_AST_Declarations_Module_Self = rb_const_get(RBS_AST_Declarations_Module, rb_intern("Self"));
|
89
96
|
RBS_AST_Declarations_Class = rb_const_get(RBS_AST_Declarations, rb_intern("Class"));
|
90
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"));
|
91
105
|
|
92
106
|
RBS_AST_Members = rb_const_get(RBS_AST, rb_intern("Members"));
|
93
107
|
RBS_AST_Members_Alias = rb_const_get(RBS_AST_Members, rb_intern("Alias"));
|
@@ -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;
|