From 217c5447c9a6a28be4a3f45df306e3c62869f589 Mon Sep 17 00:00:00 2001 From: ksss Date: Mon, 5 Oct 2026 14:57:59 +0900 Subject: [PATCH] Revert IO::Buffer subclass-preserving types and drop BufferSubclass tests ruby-head (5b6f593531, "Introduce (internal) IO::Buffer::Storage and Slice") removed the allocator from IO::Buffer and made Storage the allocatable subclass. The test-only `Class.new(IO::Buffer)` subclass can no longer be instantiated, and IO::Buffer.for/.string reject it, which broke the stdlib_test job on ruby-head. Since that design is still internal and likely to change, go back to the plain `Buffer` types for IO::Buffer.for, .string, #slice and #transfer, and exercise the remaining `self`-returning methods with plain IO::Buffer instances. The optional-argument forms of #slice are kept. Co-Authored-By: Claude Sonnet 5.5 --- core/io/buffer.rbs | 10 +++--- test/stdlib/io/Buffer_test.rb | 68 +++++++++++------------------------ 2 files changed, 26 insertions(+), 52 deletions(-) diff --git a/core/io/buffer.rbs b/core/io/buffer.rbs index 285f16a50..c1597ed1d 100644 --- a/core/io/buffer.rbs +++ b/core/io/buffer.rbs @@ -124,8 +124,8 @@ class IO # # => "Test" # end # - def self.for: (string) -> instance - | [A] (string) { (instance) -> A } -> A + def self.for: (string) -> Buffer + | [A] (string) { (Buffer) -> A } -> A #