From 8fe207254db54a7714731482b4d8af7d98b8891b Mon Sep 17 00:00:00 2001 From: tufusa Date: Mon, 19 Jan 2026 16:31:14 +0900 Subject: [PATCH 1/5] =?UTF-8?q?feat:=20`Module`=20=E3=82=92=E5=AE=9A?= =?UTF-8?q?=E7=BE=A9=20=E6=9C=80=E4=BD=8E=E9=99=90=E5=BF=85=E8=A6=81?= =?UTF-8?q?=E3=81=AA=E6=A8=A1=E6=A7=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/module.rbs | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 core/module.rbs diff --git a/core/module.rbs b/core/module.rbs new file mode 100644 index 0000000..d5bc92f --- /dev/null +++ b/core/module.rbs @@ -0,0 +1,2 @@ +class Module < Object +end From daf0582bb9f66e02270b57f2bfe5adea3091a162 Mon Sep 17 00:00:00 2001 From: tufusa Date: Mon, 19 Jan 2026 16:32:19 +0900 Subject: [PATCH 2/5] =?UTF-8?q?feat:=20=E3=83=86=E3=82=B9=E3=83=88?= =?UTF-8?q?=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/module.rb | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 test/module.rb diff --git a/test/module.rb b/test/module.rb new file mode 100644 index 0000000..0f4f360 --- /dev/null +++ b/test/module.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# @type const Mod: Mod +module Mod + # @type method method: () -> void + def self.method + puts + end +end From 9a3d07acbde8985e7439d73e6a361e4009adf080 Mon Sep 17 00:00:00 2001 From: tufusa Date: Mon, 19 Jan 2026 16:56:03 +0900 Subject: [PATCH 3/5] =?UTF-8?q?feat:=20`Object.#kind=5Fof=3F`=20=E3=81=AB?= =?UTF-8?q?=20`Module`=20=E3=82=92=E5=BC=95=E6=95=B0=E3=81=AB=E3=81=99?= =?UTF-8?q?=E3=82=8B=E3=83=91=E3=82=BF=E3=83=BC=E3=83=B3=E3=82=92=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/object.rbs | 5 ++--- test/object.rb | 9 +++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/core/object.rbs b/core/object.rbs index f0a8776..e756641 100644 --- a/core/object.rbs +++ b/core/object.rbs @@ -30,9 +30,8 @@ class Object < BasicObject def block_given?: () -> bool - # TODO: Module - def kind_of?: (Class) -> bool - def self.kind_of?: (Class) -> bool + def kind_of?: (Class | Module) -> bool + def self.kind_of?: (Class | Module) -> bool alias is_a? kind_of? alias self.is_a? self.kind_of? diff --git a/test/object.rb b/test/object.rb index 2a828a3..a34c0c0 100644 --- a/test/object.rb +++ b/test/object.rb @@ -7,6 +7,11 @@ # rubocop:disable Style/ClassCheck # rubocop:disable Style/FormatString # rubocop:disable Style/RedundantFormat +# rubocop:disable Style/MixinGrouping +# rubocop:disable Layout/EmptyLinesAroundAccessModifier + +# @type const TestMod: Module +module TestMod end object = Object.new @@ -43,10 +48,14 @@ object.block_given? object.kind_of? Object +object.kind_of? TestMod Object.kind_of? Object +Object.kind_of? TestMod object.is_a? Object +object.is_a? TestMod Object.is_a? Object +Object.is_a? TestMod object.nil? Object.nil? From 4bf65d0b819f021e059c317133a06601b9a3ea29 Mon Sep 17 00:00:00 2001 From: tufusa Date: Mon, 19 Jan 2026 16:57:23 +0900 Subject: [PATCH 4/5] =?UTF-8?q?chore:=20=E3=82=A2=E3=83=8E=E3=83=86?= =?UTF-8?q?=E3=83=BC=E3=82=B7=E3=83=A7=E3=83=B3=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/object.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/object.rb b/test/object.rb index a34c0c0..35b467c 100644 --- a/test/object.rb +++ b/test/object.rb @@ -80,7 +80,7 @@ module TestMod end object.raise object.raise 'error' -# @type const A: A +# @type const A: Class class A public From 4bff2d868c3fb65c3701ace0ff8855bad9c05fb3 Mon Sep 17 00:00:00 2001 From: tufusa Date: Mon, 19 Jan 2026 17:00:42 +0900 Subject: [PATCH 5/5] =?UTF-8?q?feat:=20`Object.#include`,=20`Object.#exten?= =?UTF-8?q?d`=20=E3=82=92=E5=AE=9F=E8=A3=85=20`Module`=20=E3=82=92?= =?UTF-8?q?=E5=BC=95=E6=95=B0=E3=81=AB=E6=8C=81=E3=81=A4=E3=81=9F=E3=82=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/object.rbs | 11 +++++------ test/object.rb | 15 +++++++++++++++ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/core/object.rbs b/core/object.rbs index e756641..b41c297 100644 --- a/core/object.rbs +++ b/core/object.rbs @@ -61,12 +61,11 @@ class Object < BasicObject # TODO: Symbol # def self.attr_accessor: (*Symbol names) -> void - # TODO: Module - # def include: (*Module mods) -> void - # def self.include: (*Module mods) -> void - # - # alias extend include - # alias self.extend include + def include: (Module, *Module mods) -> void + def self.include: (Module, *Module mods) -> void + + alias extend include + alias self.extend self.include # TODO: Array, Symbol # def self.constants: (?bool inherit) -> Array[Symbol] diff --git a/test/object.rb b/test/object.rb index 35b467c..7914663 100644 --- a/test/object.rb +++ b/test/object.rb @@ -82,6 +82,15 @@ module TestMod end # @type const A: Class class A + # @type const TestMod: Module + module TestMod end + + include TestMod + include TestMod, TestMod, TestMod + + extend TestMod + extend TestMod, TestMod, TestMod + public private @@ -89,6 +98,12 @@ class A protected end +Object.include TestMod +Object.include TestMod, TestMod, TestMod + +Object.extend TestMod +Object.extend TestMod, TestMod, TestMod + sprintf "%d\n", 123 printf "%d\n", 123