Strip Num. prefix from number type display

Number types are stored internally as 'Num.U8', 'Num.F32', etc.
(because they're nested in the Num module in Builtin.roc), but
should display to users as just 'U8', 'F32', etc.

Updated TypeWriter.getDisplayName() to strip the 'Num.' prefix
when displaying nominal number types.

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Richard Feldman 2025-11-18 19:26:51 -05:00
parent 524f98943f
commit 49c842a4e0
No known key found for this signature in database

View file

@ -1043,5 +1043,13 @@ fn getDisplayName(self: *const TypeWriter, idx: Ident.Idx) []const u8 {
return self.idents.getText(display_idx);
}
return self.idents.getText(idx);
const name = self.idents.getText(idx);
// Strip "Num." prefix from builtin number types for display
// Number types are stored as "Num.U8", "Num.F32", etc. but should display as "U8", "F32"
if (std.mem.startsWith(u8, name, "Num.")) {
return name[4..]; // Skip "Num."
}
return name;
}