mirror of
https://github.com/roc-lang/roc.git
synced 2025-12-23 08:48:03 +00:00
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:
parent
524f98943f
commit
49c842a4e0
1 changed files with 9 additions and 1 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue