From b5ef018c867bf211799d12aafe0f0777b12ae631 Mon Sep 17 00:00:00 2001 From: Yusuke Endoh Date: Tue, 24 Feb 2026 14:39:09 +0000 Subject: [PATCH] Fix missing ClassVariableWriteNode.new --- lib/typeprof/core/ast.rb | 1 + scenario/variable/cvar_operator_write.rb | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 scenario/variable/cvar_operator_write.rb diff --git a/lib/typeprof/core/ast.rb b/lib/typeprof/core/ast.rb index 46f41a8a7..887a8110a 100644 --- a/lib/typeprof/core/ast.rb +++ b/lib/typeprof/core/ast.rb @@ -132,6 +132,7 @@ def self.create_node(raw_node, lenv, use_result = true, allow_meta = false) when :class_variable_operator_write_node read = ClassVariableReadNode.new(raw_node, lenv) rhs = OperatorNode.new(raw_node, read, lenv) + ClassVariableWriteNode.new(raw_node, rhs, lenv) when :class_variable_or_write_node read = ClassVariableReadNode.new(raw_node, lenv) rhs = OrNode.new(raw_node, read, raw_node.value, lenv) diff --git a/scenario/variable/cvar_operator_write.rb b/scenario/variable/cvar_operator_write.rb new file mode 100644 index 000000000..f2e2ca490 --- /dev/null +++ b/scenario/variable/cvar_operator_write.rb @@ -0,0 +1,14 @@ +## update +class Foo + @@count = 0 + + def increment + @@count += 1 + @@count + end +end + +## assert +class Foo + def increment: -> Integer +end