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()));
}
if name == "float_to_str" {
// Deferred to iter 5+: needs runtime-allocated Str
// (currently the codegen Str path uses only static
// `@.str_*` globals; no malloc-backed dynamic-Str
// infrastructure). The typecheck path in iter 3
// installs `float_to_str : (Float) -> Str`; until the
// runtime gets a Str allocator, calling it crashes
// codegen. This is intentional: don't ship an
// unimplemented call to the LLM-author surface.
unimplemented!("Floats milestone iter 5+: float_to_str needs dynamic Str allocation");
// Codegen lowering is deferred to a follow-up iteration:
// it needs runtime-allocated Str, and the codegen Str
// path currently uses only static `@.str_*` globals (no
// malloc-backed dynamic-Str infrastructure). The
// typecheck path installs `float_to_str : (Float) -> Str`
// so the symbol resolves, but calling it has no codegen
// path yet — surface a structured error rather than
// panicking the compiler.
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.