rbs 3.5.1 → 3.5.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3dc7a972ca885618f8bcb3beb35d5096ddd9cc3dc6880fb6ae6b06d4a1845be0
4
- data.tar.gz: 3fd84cf6a4869385f16e98cb1319855fcc1fcc242e16731b6bbdd5d249f1df8a
3
+ metadata.gz: dd64311918171dfbd09f9f589ce34a9f090f145f31d7a687ef1117551913e35d
4
+ data.tar.gz: e9abb9591ee16228cea0b0f07806fc1eef6271944222ed07f4d7d849b8962611
5
5
  SHA512:
6
- metadata.gz: 0b79dcac9fa9f94eff95b2c098208784f45e8ee891b94202f8e82886d15e0af04bbb26acdff5428277470536cfef164f79b5a1f73ded288b320600bd15568500
7
- data.tar.gz: c0c6f53213e0b0aac09747c2aef470548b2b872b8ace2647ebdedca292a55b8aa0dbbebfa5c3ff75c47d3f76e87643f23f75883cacc49726fd778f95e1c3ee9e
6
+ metadata.gz: 046b790474ee8c0cd8f3c1a69531ccf3b3d95df6ef9cd46cf3f89224a6ac0964776025d01c2bb2d094c211e88cb93925a03693e66a7d7986961384cc5d5e229a
7
+ data.tar.gz: 1a191fe2488617141c975b3479666138e75a31f37cbdbadcae7a6032e5031e09a8e74c2699e5f928692c0a12fb8dfa9e8332edd3ac45ae46001e88652bff589f
data/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 3.5.3 (2024-08-23)
4
+
5
+ ### Library changes
6
+
7
+ * Backport GC fix PR ([#1977](https://github.com/ruby/rbs/pull/1977))
8
+
9
+ ## 3.5.2 (2024-07-10)
10
+
11
+ ### Library changes
12
+
13
+ * Update docs for ruby-3.3.4 ([#1923](https://github.com/ruby/rbs/pull/1923), Backported in [#1925](https://github.com/ruby/rbs/pull/1925))
14
+ * Update docs for ruby-3.3.3 ([#1889](https://github.com/ruby/rbs/pull/1889), Backported in [#1925](https://github.com/ruby/rbs/pull/1925))
15
+ * Fix #1905: Fix typo in `UntypedFunction` ([#1906](https://github.com/ruby/rbs/pull/1906), Backported in [#1925](https://github.com/ruby/rbs/pull/1925))
16
+
17
+ ### Miscellaneous
18
+
19
+ * Use `File.open` instead of `IO.sysopen` ([#1913](https://github.com/ruby/rbs/pull/1913))
20
+
3
21
  ## 3.5.1 (2024-06-07)
4
22
 
5
23
  ### Library changes
@@ -94,6 +94,72 @@
94
94
  #
95
95
  # -The RubyGems Team
96
96
  #
97
+ # <!-- rdoc-file=lib/rubygems/deprecate.rb -->
98
+ # Provides 3 methods for declaring when something is going away.
99
+ #
100
+ # +deprecate(name, repl, year, month)+:
101
+ # Indicate something may be removed on/after a certain date.
102
+ #
103
+ # +rubygems_deprecate(name, replacement=:none)+:
104
+ # Indicate something will be removed in the next major RubyGems version,
105
+ # and (optionally) a replacement for it.
106
+ #
107
+ # `rubygems_deprecate_command`:
108
+ # Indicate a RubyGems command (in +lib/rubygems/commands/*.rb+) will be
109
+ # removed in the next RubyGems version.
110
+ #
111
+ # Also provides `skip_during` for temporarily turning off deprecation warnings.
112
+ # This is intended to be used in the test suite, so deprecation warnings don't
113
+ # cause test failures if you need to make sure stderr is otherwise empty.
114
+ #
115
+ # Example usage of `deprecate` and `rubygems_deprecate`:
116
+ #
117
+ # class Legacy
118
+ # def self.some_class_method
119
+ # # ...
120
+ # end
121
+ #
122
+ # def some_instance_method
123
+ # # ...
124
+ # end
125
+ #
126
+ # def some_old_method
127
+ # # ...
128
+ # end
129
+ #
130
+ # extend Gem::Deprecate
131
+ # deprecate :some_instance_method, "X.z", 2011, 4
132
+ # rubygems_deprecate :some_old_method, "Modern#some_new_method"
133
+ #
134
+ # class << self
135
+ # extend Gem::Deprecate
136
+ # deprecate :some_class_method, :none, 2011, 4
137
+ # end
138
+ # end
139
+ #
140
+ # Example usage of `rubygems_deprecate_command`:
141
+ #
142
+ # class Gem::Commands::QueryCommand < Gem::Command
143
+ # extend Gem::Deprecate
144
+ # rubygems_deprecate_command
145
+ #
146
+ # # ...
147
+ # end
148
+ #
149
+ # Example usage of `skip_during`:
150
+ #
151
+ # class TestSomething < Gem::Testcase
152
+ # def test_some_thing_with_deprecations
153
+ # Gem::Deprecate.skip_during do
154
+ # actual_stdout, actual_stderr = capture_output do
155
+ # Gem.something_deprecated
156
+ # end
157
+ # assert_empty actual_stdout
158
+ # assert_equal(expected, actual_stderr)
159
+ # end
160
+ # end
161
+ # end
162
+ #
97
163
  module Gem
98
164
  # <!-- rdoc-file=lib/rubygems/errors.rb -->
99
165
  # Raised when RubyGems is unable to load or activate a gem. Contains the name
@@ -94,6 +94,72 @@
94
94
  #
95
95
  # -The RubyGems Team
96
96
  #
97
+ # <!-- rdoc-file=lib/rubygems/deprecate.rb -->
98
+ # Provides 3 methods for declaring when something is going away.
99
+ #
100
+ # +deprecate(name, repl, year, month)+:
101
+ # Indicate something may be removed on/after a certain date.
102
+ #
103
+ # +rubygems_deprecate(name, replacement=:none)+:
104
+ # Indicate something will be removed in the next major RubyGems version,
105
+ # and (optionally) a replacement for it.
106
+ #
107
+ # `rubygems_deprecate_command`:
108
+ # Indicate a RubyGems command (in +lib/rubygems/commands/*.rb+) will be
109
+ # removed in the next RubyGems version.
110
+ #
111
+ # Also provides `skip_during` for temporarily turning off deprecation warnings.
112
+ # This is intended to be used in the test suite, so deprecation warnings don't
113
+ # cause test failures if you need to make sure stderr is otherwise empty.
114
+ #
115
+ # Example usage of `deprecate` and `rubygems_deprecate`:
116
+ #
117
+ # class Legacy
118
+ # def self.some_class_method
119
+ # # ...
120
+ # end
121
+ #
122
+ # def some_instance_method
123
+ # # ...
124
+ # end
125
+ #
126
+ # def some_old_method
127
+ # # ...
128
+ # end
129
+ #
130
+ # extend Gem::Deprecate
131
+ # deprecate :some_instance_method, "X.z", 2011, 4
132
+ # rubygems_deprecate :some_old_method, "Modern#some_new_method"
133
+ #
134
+ # class << self
135
+ # extend Gem::Deprecate
136
+ # deprecate :some_class_method, :none, 2011, 4
137
+ # end
138
+ # end
139
+ #
140
+ # Example usage of `rubygems_deprecate_command`:
141
+ #
142
+ # class Gem::Commands::QueryCommand < Gem::Command
143
+ # extend Gem::Deprecate
144
+ # rubygems_deprecate_command
145
+ #
146
+ # # ...
147
+ # end
148
+ #
149
+ # Example usage of `skip_during`:
150
+ #
151
+ # class TestSomething < Gem::Testcase
152
+ # def test_some_thing_with_deprecations
153
+ # Gem::Deprecate.skip_during do
154
+ # actual_stdout, actual_stderr = capture_output do
155
+ # Gem.something_deprecated
156
+ # end
157
+ # assert_empty actual_stdout
158
+ # assert_equal(expected, actual_stderr)
159
+ # end
160
+ # end
161
+ # end
162
+ #
97
163
  module Gem
98
164
  interface _HashLike[K, V]
99
165
  def each_pair: () { ([ K, V ]) -> untyped } -> self
data/core/string.rbs CHANGED
@@ -699,6 +699,10 @@ class String
699
699
  # String.new(capacity: 1)
700
700
  # String.new('foo', capacity: 4096)
701
701
  #
702
+ # Note that Ruby strings are null-terminated internally, so the internal buffer
703
+ # size will be one or more bytes larger than the requested capacity depending on
704
+ # the encoding.
705
+ #
702
706
  # The `string`, `encoding`, and `capacity` arguments may all be used together:
703
707
  #
704
708
  # String.new('hello', encoding: 'UTF-8', capacity: 25)
@@ -2836,7 +2836,10 @@ parse_type_try(VALUE a) {
2836
2836
  static VALUE
2837
2837
  rbsparser_parse_type(VALUE self, VALUE buffer, VALUE start_pos, VALUE end_pos, VALUE variables, VALUE require_eof)
2838
2838
  {
2839
- parserstate *parser = alloc_parser(buffer, FIX2INT(start_pos), FIX2INT(end_pos), variables);
2839
+ VALUE string = rb_funcall(buffer, rb_intern("content"), 0);
2840
+ StringValue(string);
2841
+ lexstate *lexer = alloc_lexer(string, FIX2INT(start_pos), FIX2INT(end_pos));
2842
+ parserstate *parser = alloc_parser(buffer, lexer, FIX2INT(start_pos), FIX2INT(end_pos), variables);
2840
2843
  struct parse_type_arg arg = {
2841
2844
  parser,
2842
2845
  require_eof
@@ -2864,7 +2867,10 @@ parse_method_type_try(VALUE a) {
2864
2867
  static VALUE
2865
2868
  rbsparser_parse_method_type(VALUE self, VALUE buffer, VALUE start_pos, VALUE end_pos, VALUE variables, VALUE require_eof)
2866
2869
  {
2867
- parserstate *parser = alloc_parser(buffer, FIX2INT(start_pos), FIX2INT(end_pos), variables);
2870
+ VALUE string = rb_funcall(buffer, rb_intern("content"), 0);
2871
+ StringValue(string);
2872
+ lexstate *lexer = alloc_lexer(string, FIX2INT(start_pos), FIX2INT(end_pos));
2873
+ parserstate *parser = alloc_parser(buffer, lexer, FIX2INT(start_pos), FIX2INT(end_pos), variables);
2868
2874
  struct parse_type_arg arg = {
2869
2875
  parser,
2870
2876
  require_eof
@@ -2881,13 +2887,18 @@ parse_signature_try(VALUE a) {
2881
2887
  static VALUE
2882
2888
  rbsparser_parse_signature(VALUE self, VALUE buffer, VALUE end_pos)
2883
2889
  {
2884
- parserstate *parser = alloc_parser(buffer, 0, FIX2INT(end_pos), Qnil);
2890
+ VALUE string = rb_funcall(buffer, rb_intern("content"), 0);
2891
+ StringValue(string);
2892
+ lexstate *lexer = alloc_lexer(string, 0, FIX2INT(end_pos));
2893
+ parserstate *parser = alloc_parser(buffer, lexer, 0, FIX2INT(end_pos), Qnil);
2885
2894
  return rb_ensure(parse_signature_try, (VALUE)parser, ensure_free_parser, (VALUE)parser);
2886
2895
  }
2887
2896
 
2888
2897
  static VALUE
2889
2898
  rbsparser_lex(VALUE self, VALUE buffer, VALUE end_pos) {
2890
- lexstate *lexer = alloc_lexer(buffer, 0, FIX2INT(end_pos));
2899
+ VALUE string = rb_funcall(buffer, rb_intern("content"), 0);
2900
+ StringValue(string);
2901
+ lexstate *lexer = alloc_lexer(string, 0, FIX2INT(end_pos));
2891
2902
  VALUE results = rb_ary_new();
2892
2903
 
2893
2904
  token token = NullToken;
@@ -2906,6 +2917,7 @@ rbsparser_lex(VALUE self, VALUE buffer, VALUE end_pos) {
2906
2917
 
2907
2918
  void rbs__init_parser(void) {
2908
2919
  RBS_Parser = rb_define_class_under(RBS, "Parser", rb_cObject);
2920
+ rb_gc_register_mark_object(RBS_Parser);
2909
2921
  rb_define_singleton_method(RBS_Parser, "_parse_type", rbsparser_parse_type, 5);
2910
2922
  rb_define_singleton_method(RBS_Parser, "_parse_method_type", rbsparser_parse_method_type, 5);
2911
2923
  rb_define_singleton_method(RBS_Parser, "_parse_signature", rbsparser_parse_signature, 2);
@@ -274,11 +274,7 @@ VALUE comment_to_ruby(comment *com, VALUE buffer) {
274
274
  );
275
275
  }
276
276
 
277
- lexstate *alloc_lexer(VALUE buffer, int start_pos, int end_pos) {
278
- VALUE string = rb_funcall(buffer, rb_intern("content"), 0);
279
-
280
- StringValue(string);
281
-
277
+ lexstate *alloc_lexer(VALUE string, int start_pos, int end_pos) {
282
278
  if (start_pos < 0 || end_pos < 0) {
283
279
  rb_raise(rb_eArgError, "negative position range: %d...%d", start_pos, end_pos);
284
280
  }
@@ -295,8 +291,7 @@ lexstate *alloc_lexer(VALUE buffer, int start_pos, int end_pos) {
295
291
  return lexer;
296
292
  }
297
293
 
298
- parserstate *alloc_parser(VALUE buffer, int start_pos, int end_pos, VALUE variables) {
299
- lexstate *lexer = alloc_lexer(buffer, start_pos, end_pos);
294
+ parserstate *alloc_parser(VALUE buffer, lexstate *lexer, int start_pos, int end_pos, VALUE variables) {
300
295
  parserstate *parser = calloc(1, sizeof(parserstate));
301
296
  parser->lexstate = lexer;
302
297
  parser->buffer = buffer;
@@ -97,20 +97,21 @@ bool parser_typevar_member(parserstate *state, ID id);
97
97
  * Allocate new lexstate object.
98
98
  *
99
99
  * ```
100
- * alloc_lexer(buffer, 0, 31) // New lexstate with buffer
100
+ * VALUE string = rb_funcall(buffer, rb_intern("content"), 0);
101
+ * alloc_lexer(string, 0, 31) // New lexstate with buffer content
101
102
  * ```
102
103
  * */
103
- lexstate *alloc_lexer(VALUE buffer, int start_pos, int end_pos);
104
+ lexstate *alloc_lexer(VALUE string, int start_pos, int end_pos);
104
105
 
105
106
  /**
106
107
  * Allocate new parserstate object.
107
108
  *
108
109
  * ```
109
- * alloc_parser(buffer, 0, 1, variables) // New parserstate with variables
110
- * alloc_parser(buffer, 3, 5, Qnil) // New parserstate without variables
110
+ * alloc_parser(buffer, lexer, 0, 1, variables) // New parserstate with variables
111
+ * alloc_parser(buffer, lexer, 3, 5, Qnil) // New parserstate without variables
111
112
  * ```
112
113
  * */
113
- parserstate *alloc_parser(VALUE buffer, int start_pos, int end_pos, VALUE variables);
114
+ parserstate *alloc_parser(VALUE buffer, lexstate *lexer, int start_pos, int end_pos, VALUE variables);
114
115
  void free_parser(parserstate *parser);
115
116
  /**
116
117
  * Advance one token.
data/lib/rbs/types.rb CHANGED
@@ -1267,7 +1267,7 @@ module RBS
1267
1267
  return_type.has_classish_type?
1268
1268
  end
1269
1269
 
1270
- def with_nonreturn_void
1270
+ def with_nonreturn_void?
1271
1271
  false
1272
1272
  end
1273
1273
 
data/lib/rbs/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RBS
4
- VERSION = "3.5.1"
4
+ VERSION = "3.5.3"
5
5
  end
@@ -184,10 +184,10 @@ class StringScanner
184
184
  # If nothing was priorly matched, it returns nil.
185
185
  #
186
186
  # s = StringScanner.new("Fri Dec 12 1975 14:39")
187
- # s.scan(/(\w+) (\w+) (\d+) /) # -> "Fri Dec 12 "
188
- # s.captures # -> ["Fri", "Dec", "12"]
189
- # s.scan(/(\w+) (\w+) (\d+) /) # -> nil
190
- # s.captures # -> nil
187
+ # s.scan(/(\w+) (\w+) (\d+) (1980)?/) # -> "Fri Dec 12 "
188
+ # s.captures # -> ["Fri", "Dec", "12", nil]
189
+ # s.scan(/(\w+) (\w+) (\d+) (1980)?/) # -> nil
190
+ # s.captures # -> nil
191
191
  #
192
192
  def captures: () -> Array[String]?
193
193
 
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.5.1
4
+ version: 3.5.3
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-06-07 00:00:00.000000000 Z
11
+ date: 2024-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logger
@@ -527,7 +527,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
527
527
  - !ruby/object:Gem::Version
528
528
  version: '0'
529
529
  requirements: []
530
- rubygems_version: 3.5.3
530
+ rubygems_version: 3.5.17
531
531
  signing_key:
532
532
  specification_version: 4
533
533
  summary: Type signature for Ruby.