floats iter 4.4 fixup: float_to_str returns CodegenError::Internal instead of panic

This commit is contained in:
2026-05-10 16:18:39 +02:00
parent 581144a4f9
commit 613aa39f0f
+12 -9
View File
@@ -1851,15 +1851,18 @@ impl<'a> Emitter<'a> {
return Ok((dst, "i1".into())); return Ok((dst, "i1".into()));
} }
if name == "float_to_str" { if name == "float_to_str" {
// Deferred to iter 5+: needs runtime-allocated Str // Codegen lowering is deferred to a follow-up iteration:
// (currently the codegen Str path uses only static // it needs runtime-allocated Str, and the codegen Str
// `@.str_*` globals; no malloc-backed dynamic-Str // path currently uses only static `@.str_*` globals (no
// infrastructure). The typecheck path in iter 3 // malloc-backed dynamic-Str infrastructure). The
// installs `float_to_str : (Float) -> Str`; until the // typecheck path installs `float_to_str : (Float) -> Str`
// runtime gets a Str allocator, calling it crashes // so the symbol resolves, but calling it has no codegen
// codegen. This is intentional: don't ship an // path yet — surface a structured error rather than
// unimplemented call to the LLM-author surface. // panicking the compiler.
unimplemented!("Floats milestone iter 5+: float_to_str needs dynamic Str allocation"); return Err(CodegenError::Internal(
"`float_to_str` codegen lowering is not yet implemented \
(requires dynamic Str allocation in the runtime)".into(),
));
} }
// Cross-module call: exactly one dot in the name → resolve via import map. // Cross-module call: exactly one dot in the name → resolve via import map.