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

@ -44,6 +44,8 @@ pub extern "C" fn nyash_string_concat_ss(a: *const i8, b: *const i8) -> *mut i8
}
// Exported as: nyash.string.concat_si(i8* a, i64 b) -> i8*
// NOTE: Phase 131-15-P1 - Kept for diagnostic/compatibility purposes
// LLVM backend now uses concat_hh(handle, handle) for all mixed concatenations
#[export_name = "nyash.string.concat_si"]
pub extern "C" fn nyash_string_concat_si(a: *const i8, b: i64) -> *mut i8 {
let mut s = String::new();
@ -63,6 +65,8 @@ pub extern "C" fn nyash_string_concat_si(a: *const i8, b: i64) -> *mut i8 {
}
// Exported as: nyash.string.concat_is(i64 a, i8* b) -> i8*
// NOTE: Phase 131-15-P1 - Kept for diagnostic/compatibility purposes
// LLVM backend now uses concat_hh(handle, handle) for all mixed concatenations
#[export_name = "nyash.string.concat_is"]
pub extern "C" fn nyash_string_concat_is(a: i64, b: *const i8) -> *mut i8 {
let mut s = a.to_string();