rbs 4.2.0.pre.1 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +0 -1
- data/CHANGELOG.md +24 -1
- data/core/io.rbs +2 -1
- data/lib/rbs/prototype/helpers.rb +19 -52
- data/lib/rbs/prototype/runtime/value_object_generator.rb +0 -1
- data/lib/rbs/prototype/runtime.rb +1 -1
- data/lib/rbs/version.rb +1 -1
- data/rbs.gemspec +1 -5
- data/stdlib/erb/0/erb.rbs +4 -4
- data/stdlib/monitor/0/monitor.rbs +4 -4
- data/stdlib/singleton/0/singleton.rbs +3 -0
- data/stdlib/stringio/0/stringio.rbs +2 -1
- data/stdlib/zlib/0/gzip_file.rbs +1 -1
- data/stdlib/zlib/0/gzip_writer.rbs +2 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3e76f94a794b829effcba20a9dc637da54915d4bb3a87fa1b4200c4091fa60a6
|
|
4
|
+
data.tar.gz: 5f6eb47e5f31023f56ccede03402493f223719fa5dc1033995fecc592e87e2f1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 168b150476b5515f06f4bc72a58854bc2c60cf073365761ceacf9dc48a5be22d41a0469c168e76ac9d85d03fbdb0e67ac2f7d3564ee6055191432514ff56b10c
|
|
7
|
+
data.tar.gz: 80e89dae7445279f1ee30c825280af61259363911fc78032812dfd1be5f4fc7677598732ca42b3366dff2bc1269fe8b7cd8e6bfa49ccd8a225fe318285bfdfb1
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,27 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
-
## 4.2.0
|
|
3
|
+
## 4.2.0 (2026-08-23)
|
|
4
|
+
|
|
5
|
+
RBS 4.2 accepts non-ASCII characters in identifiers. Method names, instance variable names and parameter names can be written in any script, and other names may contain non-ASCII characters as long as they start with an ASCII letter, which is what tells a constant from a method name.
|
|
6
|
+
|
|
7
|
+
```rbs
|
|
8
|
+
class Greeter
|
|
9
|
+
@挨拶: String
|
|
10
|
+
|
|
11
|
+
def こんにちは: () -> String
|
|
12
|
+
end
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
The parser and the AST support Ruby-style `...` forwarding parameters in method types, but the layers built on top of the parser do not yet. The syntax is disabled by default in 4.2 and is not enabled by the public `RBS::Parser` API, so it cannot be used in regular RBS signatures yet.
|
|
16
|
+
|
|
17
|
+
Ruby 3.2 reached EOL on 2026-04-01, and this release requires Ruby 3.3 or later. Applications on 3.2 stay on the 4.1 line.
|
|
18
|
+
|
|
19
|
+
### Signature updates
|
|
20
|
+
|
|
21
|
+
**Updated classes/modules/methods:** `ERB`, `ERB::DefMethod`, `IO`, `Monitor`, `MonitorMixin::ConditionVariable`, `Singleton`, `StringIO`, `Zlib::GzipFile`, `Zlib::GzipWriter`
|
|
22
|
+
|
|
23
|
+
* Replace deterministic `untyped` return types with concrete types ([#2966](https://github.com/ruby/rbs/pull/2966))
|
|
24
|
+
* Declare Singleton::SingletonInstanceMethods ([#3037](https://github.com/ruby/rbs/pull/3037))
|
|
4
25
|
|
|
5
26
|
### Language updates
|
|
6
27
|
|
|
@@ -10,6 +31,7 @@
|
|
|
10
31
|
|
|
11
32
|
### Library changes
|
|
12
33
|
|
|
34
|
+
* Drop runtime support for Ruby 3.2 ([#3095](https://github.com/ruby/rbs/pull/3095))
|
|
13
35
|
* Stop the lexer reading past the end of a byte_range ([#3040](https://github.com/ruby/rbs/pull/3040))
|
|
14
36
|
* Exclude CR from comment tokens to fix an off-by-one Location#end_line on CRLF files ([#3069](https://github.com/ruby/rbs/pull/3069))
|
|
15
37
|
* Handle the NULL parser in the WebAssembly shim ([#3085](https://github.com/ruby/rbs/pull/3085))
|
|
@@ -24,6 +46,7 @@
|
|
|
24
46
|
|
|
25
47
|
### Miscellaneous
|
|
26
48
|
|
|
49
|
+
* Omit forwarding parameter tests on JRuby ([#3092](https://github.com/ruby/rbs/pull/3092))
|
|
27
50
|
* Skip JSON 2-only tests with JSON 3 ([#3084](https://github.com/ruby/rbs/pull/3084))
|
|
28
51
|
* Pin GitHub Actions to commit hashes ([#3020](https://github.com/ruby/rbs/pull/3020))
|
|
29
52
|
|
data/core/io.rbs
CHANGED
|
@@ -5,58 +5,25 @@ module RBS
|
|
|
5
5
|
module Helpers
|
|
6
6
|
private
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
else
|
|
28
|
-
hash[line] = comment
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
else
|
|
34
|
-
require "ripper"
|
|
35
|
-
def parse_comments(string, include_trailing:)
|
|
36
|
-
Ripper.lex(string).yield_self do |tokens|
|
|
37
|
-
code_lines = {} #: Hash[Integer, bool]
|
|
38
|
-
tokens.each.with_object({}) do |token, hash| #$ Hash[Integer, AST::Comment]
|
|
39
|
-
case token[1]
|
|
40
|
-
when :on_sp, :on_ignored_nl
|
|
41
|
-
# skip
|
|
42
|
-
when :on_comment
|
|
43
|
-
line = token[0][0]
|
|
44
|
-
# skip like `module Foo # :nodoc:`
|
|
45
|
-
next if code_lines[line] && !include_trailing
|
|
46
|
-
body = token[2][2..-1] or raise
|
|
47
|
-
|
|
48
|
-
body = "\n" if body.empty?
|
|
49
|
-
|
|
50
|
-
comment = AST::Comment.new(string: body, location: nil)
|
|
51
|
-
if prev_comment = hash.delete(line - 1)
|
|
52
|
-
hash[line] = AST::Comment.new(string: prev_comment.string + comment.string,
|
|
53
|
-
location: nil)
|
|
54
|
-
else
|
|
55
|
-
hash[line] = comment
|
|
56
|
-
end
|
|
57
|
-
else
|
|
58
|
-
code_lines[token[0][0]] = true
|
|
59
|
-
end
|
|
8
|
+
def parse_comments(string, include_trailing:)
|
|
9
|
+
Prism.parse_comments(string, version: "current").yield_self do |prism_comments| # steep:ignore UnexpectedKeywordArgument
|
|
10
|
+
prism_comments.each_with_object({}) do |comment, hash| #$ Hash[Integer, AST::Comment]
|
|
11
|
+
# Skip EmbDoc comments
|
|
12
|
+
next unless comment.is_a?(Prism::InlineComment)
|
|
13
|
+
# skip like `module Foo # :nodoc:`
|
|
14
|
+
next if comment.trailing? && !include_trailing
|
|
15
|
+
|
|
16
|
+
line = comment.location.start_line
|
|
17
|
+
body = "#{comment.location.slice}\n"
|
|
18
|
+
body = body[2..-1] or raise
|
|
19
|
+
body = "\n" if body.empty?
|
|
20
|
+
|
|
21
|
+
comment = AST::Comment.new(string: body, location: nil)
|
|
22
|
+
if prev_comment = hash.delete(line - 1)
|
|
23
|
+
hash[line] = AST::Comment.new(string: prev_comment.string + comment.string,
|
|
24
|
+
location: nil)
|
|
25
|
+
else
|
|
26
|
+
hash[line] = comment
|
|
60
27
|
end
|
|
61
28
|
end
|
|
62
29
|
end
|
|
@@ -212,7 +212,6 @@ module RBS
|
|
|
212
212
|
|
|
213
213
|
class DataGenerator < ValueObjectBase
|
|
214
214
|
def self.generatable?(target)
|
|
215
|
-
return false unless RUBY_VERSION >= '3.2'
|
|
216
215
|
return false unless target < Data
|
|
217
216
|
# Avoid direct inherited class like `class Option < Data`
|
|
218
217
|
return false unless target.respond_to?(:members)
|
|
@@ -527,7 +527,7 @@ module RBS
|
|
|
527
527
|
|
|
528
528
|
generate_mixin(mod, decl, type_name, type_name_absolute)
|
|
529
529
|
|
|
530
|
-
unless mod < Struct ||
|
|
530
|
+
unless mod < Struct || mod < Data
|
|
531
531
|
generate_methods(mod, type_name, decl.members) unless outline
|
|
532
532
|
end
|
|
533
533
|
|
data/lib/rbs/version.rb
CHANGED
data/rbs.gemspec
CHANGED
|
@@ -67,14 +67,10 @@ Gem::Specification.new do |spec|
|
|
|
67
67
|
spec.extensions = %w{ext/rbs_extension/extconf.rb}
|
|
68
68
|
end
|
|
69
69
|
|
|
70
|
-
if false
|
|
71
|
-
spec.required_ruby_version = ">= 3.4"
|
|
72
|
-
end
|
|
73
|
-
|
|
74
70
|
spec.bindir = "exe"
|
|
75
71
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
76
72
|
spec.require_paths = ["lib"]
|
|
77
|
-
spec.required_ruby_version = ">= 3.
|
|
73
|
+
spec.required_ruby_version = ">= 3.3"
|
|
78
74
|
spec.add_dependency "logger"
|
|
79
75
|
spec.add_dependency "prism", ">= 1.6.0"
|
|
80
76
|
spec.add_dependency "tsort"
|
data/stdlib/erb/0/erb.rbs
CHANGED
|
@@ -619,7 +619,7 @@ class ERB
|
|
|
619
619
|
# It's good practice to choose a variable name that begins with an underscore:
|
|
620
620
|
# <code>'_'</code>.
|
|
621
621
|
#
|
|
622
|
-
def initialize: (String, ?eoutvar: String, ?trim_mode: Integer | String | NilClass) ->
|
|
622
|
+
def initialize: (String, ?eoutvar: String, ?trim_mode: Integer | String | NilClass) -> void
|
|
623
623
|
|
|
624
624
|
# <!-- rdoc-file=lib/erb.rb -->
|
|
625
625
|
# Returns the Ruby code that, when executed, generates the result;
|
|
@@ -702,7 +702,7 @@ class ERB
|
|
|
702
702
|
# Like #result, but prints the result string (instead of returning it);
|
|
703
703
|
# returns `nil`.
|
|
704
704
|
#
|
|
705
|
-
def run: (?Binding) ->
|
|
705
|
+
def run: (?Binding) -> nil
|
|
706
706
|
|
|
707
707
|
# <!--
|
|
708
708
|
# rdoc-file=lib/erb.rb
|
|
@@ -746,7 +746,7 @@ class ERB
|
|
|
746
746
|
# class MyClass; include MyModule; end
|
|
747
747
|
# MyClass.new.render('foo', 123) # => "foo 123"
|
|
748
748
|
#
|
|
749
|
-
def def_method: (Module, String, ?String) ->
|
|
749
|
+
def def_method: (Module, String, ?String) -> Symbol
|
|
750
750
|
|
|
751
751
|
# <!--
|
|
752
752
|
# rdoc-file=lib/erb.rb
|
|
@@ -913,7 +913,7 @@ class ERB
|
|
|
913
913
|
# define *methodname* as instance method of current module, using ERB object or
|
|
914
914
|
# eRuby file
|
|
915
915
|
#
|
|
916
|
-
def self.def_erb_method: (String methodname, (String | ERB) erb_or_fname) ->
|
|
916
|
+
def self.def_erb_method: (String methodname, (String | ERB) erb_or_fname) -> Symbol
|
|
917
917
|
end
|
|
918
918
|
|
|
919
919
|
# <!-- rdoc-file=lib/erb/util.rb -->
|
|
@@ -111,7 +111,7 @@ class Monitor
|
|
|
111
111
|
# - wait_for_cond(p1, p2)
|
|
112
112
|
# -->
|
|
113
113
|
#
|
|
114
|
-
def wait_for_cond: (::MonitorMixin::ConditionVariable, Numeric? timeout) ->
|
|
114
|
+
def wait_for_cond: (::MonitorMixin::ConditionVariable, Numeric? timeout) -> bool
|
|
115
115
|
end
|
|
116
116
|
|
|
117
117
|
# <!-- rdoc-file=ext/monitor/lib/monitor.rb -->
|
|
@@ -334,7 +334,7 @@ class MonitorMixin::ConditionVariable
|
|
|
334
334
|
# If `timeout` is given, this method returns after `timeout` seconds passed,
|
|
335
335
|
# even if no other thread doesn't signal.
|
|
336
336
|
#
|
|
337
|
-
def wait: (?Numeric? timeout) ->
|
|
337
|
+
def wait: (?Numeric? timeout) -> bool
|
|
338
338
|
|
|
339
339
|
# <!--
|
|
340
340
|
# rdoc-file=ext/monitor/lib/monitor.rb
|
|
@@ -342,7 +342,7 @@ class MonitorMixin::ConditionVariable
|
|
|
342
342
|
# -->
|
|
343
343
|
# Calls wait repeatedly until the given block yields a truthy value.
|
|
344
344
|
#
|
|
345
|
-
def wait_until: () { () -> boolish } ->
|
|
345
|
+
def wait_until: () { () -> boolish } -> nil
|
|
346
346
|
|
|
347
347
|
# <!--
|
|
348
348
|
# rdoc-file=ext/monitor/lib/monitor.rb
|
|
@@ -350,7 +350,7 @@ class MonitorMixin::ConditionVariable
|
|
|
350
350
|
# -->
|
|
351
351
|
# Calls wait repeatedly while the given block yields a truthy value.
|
|
352
352
|
#
|
|
353
|
-
def wait_while: () { () -> boolish } ->
|
|
353
|
+
def wait_while: () { () -> boolish } -> nil
|
|
354
354
|
|
|
355
355
|
private
|
|
356
356
|
|
data/stdlib/zlib/0/gzip_file.rbs
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rbs
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.2.0
|
|
4
|
+
version: 4.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Soutaro Matsumoto
|
|
@@ -644,14 +644,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
644
644
|
requirements:
|
|
645
645
|
- - ">="
|
|
646
646
|
- !ruby/object:Gem::Version
|
|
647
|
-
version: '3.
|
|
647
|
+
version: '3.3'
|
|
648
648
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
649
649
|
requirements:
|
|
650
650
|
- - ">="
|
|
651
651
|
- !ruby/object:Gem::Version
|
|
652
652
|
version: '0'
|
|
653
653
|
requirements: []
|
|
654
|
-
rubygems_version: 4.0.
|
|
654
|
+
rubygems_version: 4.0.19
|
|
655
655
|
specification_version: 4
|
|
656
656
|
summary: Type signature for Ruby.
|
|
657
657
|
test_files: []
|