feat(llvm): Phase 131-15 - print/concat segfault 根治修正

## P1-1/P1-2: TypeFacts 優先化
- binop.py: operand facts が dst_type ヒントより優先
- mir_json_emit.rs: Unknown 時に dst_type を出さない
- function_lower.py: value_types を metadata から読み込み

## P2: handle concat 統一(根治)
- print シグネチャ修正: i64(i64) → void(i8*)
- Mixed concat を handle ベースに統一:
  - concat_si/concat_is → concat_hh
  - box.from_i64 で integer を handle 化
  - Everything is Box 哲学に統一
- legacy 関数は互換性のために保持

## 結果
-  print("Result: " + 3) → Result: 3
-  segfault 解消
-  Everything is Box 統一

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
nyash-codex
2025-12-15 01:36:34 +09:00
parent 7f57a1bb05
commit a955dd6b18
9 changed files with 234 additions and 88 deletions

View File

@ -73,6 +73,22 @@ def lower_function(builder, func_data: Dict[str, Any]):
except Exception:
pass
# Phase 131-15-P1: Load value_types metadata from JSON into resolver
try:
metadata = func_data.get('metadata', {})
value_types_json = metadata.get('value_types', {})
# Convert string keys to integers and store in resolver
builder.resolver.value_types = {}
for vid_str, vtype in value_types_json.items():
try:
vid = int(vid_str)
builder.resolver.value_types[vid] = vtype
except (ValueError, TypeError):
pass
except Exception:
# If metadata loading fails, ensure value_types exists (empty fallback)
builder.resolver.value_types = {}
# Create or reuse function
func = None
for f in builder.module.functions: