rbs 3.6.0 → 3.7.0.dev.1
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 +3 -1
- data/CHANGELOG.md +12 -1
- data/Rakefile +11 -1
- data/core/io.rbs +2 -2
- data/core/kernel.rbs +1 -1
- data/ext/rbs_extension/main.c +3 -0
- data/ext/rbs_extension/parser.c +1 -1
- data/ext/rbs_extension/rbs_extension.h +0 -8
- data/lib/rbs/definition.rb +10 -8
- data/lib/rbs/definition_builder.rb +6 -3
- data/lib/rbs/test/hook.rb +45 -40
- data/lib/rbs/types.rb +6 -0
- data/lib/rbs/version.rb +1 -1
- data/rbs.gemspec +1 -1
- data/sig/definition.rbs +20 -5
- data/stdlib/cgi/0/core.rbs +3 -3
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86a893f83a116311b7161ef437a811c4c81adae584063b690acf0711f94eb633
|
4
|
+
data.tar.gz: d5cdbec208cd2c8c7671712e1e94215e1d83ea487d6eb9eca8499d0d3016b9a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e17695da454b8df97db782759c1e63f7d01af6a33ec258c43ec0c1759fa6c768d83e4b9a5cd98c7229370bfad0c2865c202b06fcb86568821ec62148139fbbf0
|
7
|
+
data.tar.gz: 274d1c7db8d8e97e68ede7d0f21ed69b9a2403243c1f5c0e1c02429b669f3b0ff1d6c28e8c7d64b4ff658bd22c4f20b0d3318bf396e1cdd6dcca8ceca9f2bb3c
|
data/.github/workflows/ruby.yml
CHANGED
@@ -13,7 +13,7 @@ jobs:
|
|
13
13
|
strategy:
|
14
14
|
fail-fast: false
|
15
15
|
matrix:
|
16
|
-
ruby: ['3.
|
16
|
+
ruby: ['3.1', '3.2', '3.3', head]
|
17
17
|
rubyopt: [""]
|
18
18
|
job:
|
19
19
|
- test
|
@@ -34,6 +34,8 @@ jobs:
|
|
34
34
|
job: rubocop validate test_doc build test_generate_stdlib raap
|
35
35
|
- ruby: "3.3"
|
36
36
|
job: typecheck_test
|
37
|
+
env:
|
38
|
+
RANDOMIZE_STDLIB_TEST_ORDER: "true"
|
37
39
|
steps:
|
38
40
|
- uses: actions/checkout@v4
|
39
41
|
- uses: ruby/setup-ruby@v1
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,17 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
-
##
|
3
|
+
## 3.6.1 (2024-10-03)
|
4
|
+
|
5
|
+
### Library changes
|
6
|
+
|
7
|
+
* Mark as ractor-safe ([#2041](https://github.com/ruby/rbs/pull/2041))
|
8
|
+
|
9
|
+
### Miscellaneous
|
10
|
+
|
11
|
+
* Omit IOConsoleTest with Windows platform ([#2044](https://github.com/ruby/rbs/pull/2044))
|
12
|
+
* Recover `$stdout` after test ([#2042](https://github.com/ruby/rbs/pull/2042))
|
13
|
+
|
14
|
+
## 3.6.0 (2024-09-30)
|
4
15
|
|
5
16
|
Nothing changed since `3.6.0.pre.3`.
|
6
17
|
|
data/Rakefile
CHANGED
@@ -63,7 +63,12 @@ task :validate => :compile do
|
|
63
63
|
# Skip RBS validation because Ruby CI runs without rubygems
|
64
64
|
case skip_rbs_validation = ENV["SKIP_RBS_VALIDATION"]
|
65
65
|
when nil
|
66
|
-
|
66
|
+
begin
|
67
|
+
Gem::Specification.find_by_name("rbs")
|
68
|
+
libs << "rbs"
|
69
|
+
rescue Gem::MissingSpecError
|
70
|
+
STDERR.puts "🚨🚨🚨🚨 Skipping `rbs` gem because it's not found"
|
71
|
+
end
|
67
72
|
when "true"
|
68
73
|
# Skip
|
69
74
|
else
|
@@ -86,6 +91,11 @@ task :stdlib_test => :compile do
|
|
86
91
|
test_files = FileList["test/stdlib/**/*_test.rb"].reject do |path|
|
87
92
|
path =~ %r{Ractor} || path =~ %r{Encoding}
|
88
93
|
end
|
94
|
+
|
95
|
+
if ENV["RANDOMIZE_STDLIB_TEST_ORDER"] == "true"
|
96
|
+
test_files.shuffle!
|
97
|
+
end
|
98
|
+
|
89
99
|
sh "#{ruby} -Ilib #{bin}/test_runner.rb #{test_files.join(' ')}"
|
90
100
|
# TODO: Ractor tests need to be run in a separate process
|
91
101
|
sh "#{ruby} -Ilib #{bin}/test_runner.rb test/stdlib/Ractor_test.rb"
|
data/core/io.rbs
CHANGED
@@ -1638,7 +1638,7 @@ class IO < Object
|
|
1638
1638
|
# Optional keyword argument `chomp` specifies whether line separators are to be
|
1639
1639
|
# omitted.
|
1640
1640
|
#
|
1641
|
-
def readline: (?String sep, ?Integer limit) -> String
|
1641
|
+
def readline: (?String sep, ?Integer limit, ?chomp: boolish) -> String
|
1642
1642
|
|
1643
1643
|
# <!--
|
1644
1644
|
# rdoc-file=io.c
|
@@ -1701,7 +1701,7 @@ class IO < Object
|
|
1701
1701
|
# # => ["First line", "Second line", "", "Fourth line", "Fifth line"]
|
1702
1702
|
# f.close
|
1703
1703
|
#
|
1704
|
-
def readlines: (?String sep, ?Integer limit) -> ::Array[String]
|
1704
|
+
def readlines: (?String sep, ?Integer limit, ?chomp: boolish) -> ::Array[String]
|
1705
1705
|
|
1706
1706
|
# <!--
|
1707
1707
|
# rdoc-file=io.c
|
data/core/kernel.rbs
CHANGED
data/ext/rbs_extension/main.c
CHANGED
data/ext/rbs_extension/parser.c
CHANGED
@@ -9,14 +9,6 @@
|
|
9
9
|
#include "constants.h"
|
10
10
|
#include "ruby_objs.h"
|
11
11
|
|
12
|
-
/**
|
13
|
-
* Unescape escape sequences in the given string inplace:
|
14
|
-
*
|
15
|
-
* '\\n' => "\n"
|
16
|
-
*
|
17
|
-
* */
|
18
|
-
void rbs_unescape_string(VALUE string, bool dq_string);
|
19
|
-
|
20
12
|
/**
|
21
13
|
* Receives `parserstate` and `range`, which represents a string token or symbol token, and returns a string VALUE.
|
22
14
|
*
|
data/lib/rbs/definition.rb
CHANGED
@@ -28,12 +28,18 @@ module RBS
|
|
28
28
|
attr_reader :member
|
29
29
|
attr_reader :defined_in
|
30
30
|
attr_reader :implemented_in
|
31
|
+
attr_reader :member_annotations
|
32
|
+
attr_reader :overload_annotations
|
33
|
+
attr_reader :annotations
|
31
34
|
|
32
|
-
def initialize(type:, member:, defined_in:, implemented_in:)
|
35
|
+
def initialize(type:, member:, defined_in:, implemented_in:, overload_annotations: [])
|
33
36
|
@type = type
|
34
37
|
@member = member
|
35
38
|
@defined_in = defined_in
|
36
39
|
@implemented_in = implemented_in
|
40
|
+
@member_annotations = member.annotations
|
41
|
+
@overload_annotations = overload_annotations
|
42
|
+
@annotations = member.annotations + overload_annotations
|
37
43
|
end
|
38
44
|
|
39
45
|
def ==(other)
|
@@ -54,12 +60,8 @@ module RBS
|
|
54
60
|
member.comment
|
55
61
|
end
|
56
62
|
|
57
|
-
def annotations
|
58
|
-
member.annotations
|
59
|
-
end
|
60
|
-
|
61
63
|
def update(type: self.type, member: self.member, defined_in: self.defined_in, implemented_in: self.implemented_in)
|
62
|
-
TypeDef.new(type: type, member: member, defined_in: defined_in, implemented_in: implemented_in)
|
64
|
+
TypeDef.new(type: type, member: member, defined_in: defined_in, implemented_in: implemented_in, overload_annotations: overload_annotations)
|
63
65
|
end
|
64
66
|
|
65
67
|
def overload?
|
@@ -82,7 +84,7 @@ module RBS
|
|
82
84
|
@super_method = super_method
|
83
85
|
@defs = defs
|
84
86
|
@accessibility = accessibility
|
85
|
-
@extra_annotations =
|
87
|
+
@extra_annotations = []
|
86
88
|
@alias_of = alias_of
|
87
89
|
end
|
88
90
|
|
@@ -124,7 +126,7 @@ module RBS
|
|
124
126
|
end
|
125
127
|
|
126
128
|
def annotations
|
127
|
-
@annotations ||=
|
129
|
+
@annotations ||= defs.flat_map {|d| d.member_annotations }
|
128
130
|
end
|
129
131
|
|
130
132
|
def members
|
@@ -386,7 +386,8 @@ module RBS
|
|
386
386
|
type: method_type,
|
387
387
|
member: initialize_def.member,
|
388
388
|
defined_in: initialize_def.defined_in,
|
389
|
-
implemented_in: initialize_def.implemented_in
|
389
|
+
implemented_in: initialize_def.implemented_in,
|
390
|
+
overload_annotations: initialize_def.overload_annotations
|
390
391
|
)
|
391
392
|
end,
|
392
393
|
accessibility: :public,
|
@@ -641,7 +642,8 @@ module RBS
|
|
641
642
|
type: subst.empty? ? overload.method_type : overload.method_type.sub(subst),
|
642
643
|
member: original,
|
643
644
|
defined_in: defined_in,
|
644
|
-
implemented_in: implemented_in
|
645
|
+
implemented_in: implemented_in,
|
646
|
+
overload_annotations: overload.annotations
|
645
647
|
)
|
646
648
|
end
|
647
649
|
|
@@ -750,7 +752,8 @@ module RBS
|
|
750
752
|
type: subst.empty? ? overload.method_type : overload.method_type.sub(subst),
|
751
753
|
member: overloading_def,
|
752
754
|
defined_in: defined_in,
|
753
|
-
implemented_in: implemented_in
|
755
|
+
implemented_in: implemented_in,
|
756
|
+
overload_annotations: overload.annotations
|
754
757
|
)
|
755
758
|
|
756
759
|
method_definition.defs.unshift(type_def)
|
data/lib/rbs/test/hook.rb
CHANGED
@@ -96,50 +96,55 @@ def #{with_name}(#{param_source.join(", ")}, &#{block_param})
|
|
96
96
|
block_calls = []
|
97
97
|
|
98
98
|
if block_given?
|
99
|
-
receiver = self
|
100
99
|
block_receives_block = #{block_param}.parameters.last&.yield_self {|type, _| type == :block }
|
101
100
|
|
102
|
-
wrapped_block =
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
101
|
+
wrapped_block = Object.new.instance_exec do
|
102
|
+
new_object = self
|
103
|
+
|
104
|
+
proc do |*block_args, &block2|
|
105
|
+
return_from_block = false
|
106
|
+
|
107
|
+
begin
|
108
|
+
block_result = if self.equal?(new_object)
|
109
|
+
if block_receives_block
|
110
|
+
#{block_param}.call(*block_args, &block2)
|
111
|
+
else
|
112
|
+
yield(*block_args)
|
113
|
+
end
|
114
|
+
else
|
115
|
+
# Detected that `self` inside `proc` is not equal to the `self` outside block (which is saved to `new_object`).
|
116
|
+
# This means that the block is called with `instance_exec` or `instance_eval`.
|
117
|
+
self.instance_exec(*block_args, &#{block_param})
|
118
|
+
end
|
119
|
+
|
120
|
+
return_from_block = true
|
121
|
+
ensure
|
122
|
+
exn = $!
|
123
|
+
|
124
|
+
case
|
125
|
+
when return_from_block
|
126
|
+
# Returned from yield
|
127
|
+
block_calls << ::RBS::Test::ArgumentsReturn.return(
|
128
|
+
arguments: block_args,
|
129
|
+
value: block_result
|
130
|
+
)
|
131
|
+
when exn
|
132
|
+
# Exception
|
133
|
+
block_calls << ::RBS::Test::ArgumentsReturn.exception(
|
134
|
+
arguments: block_args,
|
135
|
+
exception: exn
|
136
|
+
)
|
137
|
+
else
|
138
|
+
# break?
|
139
|
+
block_calls << ::RBS::Test::ArgumentsReturn.break(
|
140
|
+
arguments: block_args
|
141
|
+
)
|
142
|
+
end
|
138
143
|
end
|
139
|
-
end
|
140
144
|
|
141
|
-
|
142
|
-
|
145
|
+
block_result
|
146
|
+
end.ruby2_keywords
|
147
|
+
end
|
143
148
|
|
144
149
|
result = __send__(:"#{without_name}", *args, &wrapped_block)
|
145
150
|
else
|
data/lib/rbs/types.rb
CHANGED
data/lib/rbs/version.rb
CHANGED
data/rbs.gemspec
CHANGED
@@ -40,6 +40,6 @@ Gem::Specification.new do |spec|
|
|
40
40
|
spec.bindir = "exe"
|
41
41
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
42
42
|
spec.require_paths = ["lib"]
|
43
|
-
spec.required_ruby_version = ">= 3.
|
43
|
+
spec.required_ruby_version = ">= 3.1"
|
44
44
|
spec.add_dependency "logger"
|
45
45
|
end
|
data/sig/definition.rbs
CHANGED
@@ -21,11 +21,18 @@ module RBS
|
|
21
21
|
attr_reader defined_in: TypeName
|
22
22
|
attr_reader implemented_in: TypeName?
|
23
23
|
|
24
|
-
|
24
|
+
# Annotations given to `#member`
|
25
|
+
attr_reader member_annotations: Array[AST::Annotation]
|
25
26
|
|
26
|
-
|
27
|
+
# Annotations given to the overload associated to the method type
|
28
|
+
attr_reader overload_annotations: Array[AST::Annotation]
|
29
|
+
|
30
|
+
# Concatnation of `member_annotations` and `overload_annotations`
|
31
|
+
attr_reader annotations: Array[AST::Annotation]
|
27
32
|
|
28
|
-
def
|
33
|
+
def initialize: (type: MethodType, member: method_member, defined_in: TypeName, implemented_in: TypeName?, ?overload_annotations: Array[AST::Annotation]) -> void
|
34
|
+
|
35
|
+
def comment: () -> AST::Comment?
|
29
36
|
|
30
37
|
def update: (?type: MethodType, ?member: method_member, ?defined_in: TypeName, ?implemented_in: TypeName?) -> TypeDef
|
31
38
|
|
@@ -35,15 +42,23 @@ module RBS
|
|
35
42
|
attr_reader super_method: Method?
|
36
43
|
attr_reader defs: Array[TypeDef]
|
37
44
|
attr_reader accessibility: accessibility
|
38
|
-
|
45
|
+
|
39
46
|
attr_reader defined_in: TypeName?
|
40
47
|
attr_reader implemented_in: TypeName?
|
41
48
|
attr_reader method_types: Array[MethodType]
|
42
49
|
attr_reader comments: Array[AST::Comment]
|
43
|
-
|
50
|
+
|
44
51
|
attr_reader members: Array[method_member]
|
45
52
|
attr_reader alias_of: Method?
|
46
53
|
|
54
|
+
# Unused, always returns empty array
|
55
|
+
attr_reader extra_annotations: Array[AST::Annotation]
|
56
|
+
|
57
|
+
# Union of annotations given to `defs`, not contains annotations given to each overload
|
58
|
+
attr_reader annotations: Array[AST::Annotation]
|
59
|
+
|
60
|
+
# Note that the annotations given through `annotations:` keyword is ignored.
|
61
|
+
#
|
47
62
|
def initialize: (super_method: Method?,
|
48
63
|
defs: Array[TypeDef],
|
49
64
|
accessibility: accessibility,
|
data/stdlib/cgi/0/core.rbs
CHANGED
@@ -360,7 +360,7 @@ class CGI
|
|
360
360
|
# -->
|
361
361
|
# Return the accept character set for all new CGI instances.
|
362
362
|
#
|
363
|
-
def self.accept_charset: () ->
|
363
|
+
def self.accept_charset: () -> encoding
|
364
364
|
|
365
365
|
# <!--
|
366
366
|
# rdoc-file=lib/cgi/core.rb
|
@@ -368,7 +368,7 @@ class CGI
|
|
368
368
|
# -->
|
369
369
|
# Set the accept character set for all new CGI instances.
|
370
370
|
#
|
371
|
-
def self.accept_charset=: (
|
371
|
+
def self.accept_charset=: (encoding accept_charset) -> encoding
|
372
372
|
|
373
373
|
# <!--
|
374
374
|
# rdoc-file=lib/cgi/core.rb
|
@@ -385,7 +385,7 @@ class CGI
|
|
385
385
|
# <!-- rdoc-file=lib/cgi/core.rb -->
|
386
386
|
# Return the accept character set for this CGI instance.
|
387
387
|
#
|
388
|
-
attr_reader accept_charset:
|
388
|
+
attr_reader accept_charset: encoding
|
389
389
|
|
390
390
|
# <!-- rdoc-file=lib/cgi/core.rb -->
|
391
391
|
# This method is an alias for #http_header, when HTML5 tag maker is inactive.
|
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.
|
4
|
+
version: 3.7.0.dev.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Soutaro Matsumoto
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logger
|
@@ -525,14 +525,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
525
525
|
requirements:
|
526
526
|
- - ">="
|
527
527
|
- !ruby/object:Gem::Version
|
528
|
-
version: '3.
|
528
|
+
version: '3.1'
|
529
529
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
530
530
|
requirements:
|
531
531
|
- - ">="
|
532
532
|
- !ruby/object:Gem::Version
|
533
533
|
version: '0'
|
534
534
|
requirements: []
|
535
|
-
rubygems_version: 3.5.
|
535
|
+
rubygems_version: 3.5.23
|
536
536
|
signing_key:
|
537
537
|
specification_version: 4
|
538
538
|
summary: Type signature for Ruby.
|