authorchloe caruso <git@paperclover.net> 2024-07-27 05:11:48-07:00
committerchloe caruso <git@paperclover.net> 2024-07-27 05:11:48-07:00
log438a43d6761f19cb71d1d0928fe76b8734888ee0
treee70a588d10c9511b3ad9ad80ffee3dc8bfed8cde
parent2768b7a704977ffc4c1eefaafddc548b42aec0e4

fix hex literal warning


2 files changed, 10 insertions(+), 1 deletions(-)

CHANGELOG.md+1
...@@ -7,6 +7,7 @@...@@ -7,6 +7,7 @@
7- fix(sema): fix passing structs as function params7- fix(sema): fix passing structs as function params
8- fix: diagnostic box drawing characters line up after line 98- fix: diagnostic box drawing characters line up after line 9
9- fix: diagnostics on last line of file print correctly9- fix: diagnostics on last line of file print correctly
10- fix: diagnostics with the leading zero warning
1011
11## 0.1.412## 0.1.4
1213
src/core/Transform.zig+9-1
...@@ -881,7 +881,15 @@ fn transformExpression(...@@ -881,7 +881,15 @@ fn transformExpression(
881 else => @compileError(unreachable),881 else => @compileError(unreachable),
882 };882 };
883883
884 if (value != 0 and text[0] == '0' and (text.len == 1 or text[1] != '.')) {884 const has_zero_prefix = value != 0 and
885 text[0] == '0' and
886 (text.len == 1 or switch (tag) {
887 .number_int => text[1] >= '0' and text[1] < '9',
888 .number_float => text[1] != '.',
889 else => @compileError(unreachable),
890 });
891
892 if (has_zero_prefix) {
885 try t.report.warn(.zero_prefixed_literal, .{ .token = t.ast.nodeToken(node) });893 try t.report.warn(.zero_prefixed_literal, .{ .token = t.ast.nodeToken(node) });
886 }894 }
887895