fix: reject inexact integer literals in float context

This commit is contained in:
2026-10-24 01:02:20 +02:00
parent 9c1bd2a20e
commit 5fd8d9eb89
5 changed files with 58 additions and 4 deletions
+2
View File
@@ -48,6 +48,7 @@ Code :: enum {
missing_entry,
invalid_entry,
literal_out_of_range,
inexact_integer_literal,
invalid_escape,
read_before_initialization,
write_before_initialization,
@@ -131,6 +132,7 @@ messages :: $enummap.init(Code, []u8, {
missing_entry = "program requires a main function",
invalid_entry = "main must be a function with no parameters",
literal_out_of_range = "numeric literal is outside its runtime type's range",
inexact_integer_literal = "integer literal is not exactly representable as float; use a floating literal to allow rounding",
invalid_escape = "invalid string escape",
read_before_initialization = "local value was read before initialization",
write_before_initialization = "local value was assigned before initialization",