fix: Phase 9.78d重要修正 - 重複StringBox定義問題を解決
🐛 重大なレガシー問題修正: - StringBox重複定義による文字列演算子破綻を修正 - operators.rs: 統一レジストリStringBoxに変更 - 全アプリケーションの文字列連結(+)演算子が復旧 🎯 Phase 9.78d InstanceBox簡素化実装: - instance_v2.rs: 統一trait object設計 - from_any_box/from_declaration統一コンストラクタ - レガシーfiniシステム簡素化対応 📋 ドキュメント更新: - CURRENT_TASK.md: レガシー問題詳細記録 - 今後の対策・検証結果を文書化 🧪 検証結果: ✅ TinyProxy, KiloEditor等全アプリで文字列演算正常動作 ✅ InstanceBox v2統一実装テスト成功 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -4,24 +4,33 @@
|
||||
|
||||
// Removed super::* import - specific imports below
|
||||
use crate::ast::{ASTNode, BinaryOperator, UnaryOperator};
|
||||
use crate::box_trait::{NyashBox, IntegerBox, StringBox, BoolBox, CompareBox};
|
||||
use crate::box_trait::{NyashBox, IntegerBox, BoolBox, CompareBox};
|
||||
use crate::boxes::StringBox; // 🔧 統一レジストリと一致させる
|
||||
use crate::boxes::FloatBox;
|
||||
use crate::interpreter::core::{NyashInterpreter, RuntimeError};
|
||||
|
||||
// Local helper functions to bypass import issues
|
||||
pub(super) fn try_add_operation(left: &dyn NyashBox, right: &dyn NyashBox) -> Option<Box<dyn NyashBox>> {
|
||||
// 🔍 デバッグ出力追加
|
||||
eprintln!("🔍 try_add_operation: left={}, right={}", left.type_name(), right.type_name());
|
||||
|
||||
// IntegerBox + IntegerBox
|
||||
if let (Some(left_int), Some(right_int)) = (
|
||||
left.as_any().downcast_ref::<IntegerBox>(),
|
||||
right.as_any().downcast_ref::<IntegerBox>()
|
||||
) {
|
||||
eprintln!("🔍 IntegerBox + IntegerBox detected");
|
||||
return Some(Box::new(IntegerBox::new(left_int.value + right_int.value)));
|
||||
}
|
||||
|
||||
// StringBox + anything -> concatenation
|
||||
eprintln!("🔍 Checking StringBox downcast...");
|
||||
if let Some(left_str) = left.as_any().downcast_ref::<StringBox>() {
|
||||
eprintln!("🔍 StringBox downcast SUCCESS!");
|
||||
let right_str = right.to_string_box();
|
||||
return Some(Box::new(StringBox::new(format!("{}{}", left_str.value, right_str.value))));
|
||||
} else {
|
||||
eprintln!("🔍 StringBox downcast FAILED!");
|
||||
}
|
||||
|
||||
// BoolBox + BoolBox -> IntegerBox
|
||||
|
||||
Reference in New Issue
Block a user