Parsing difference between "0x00." and "0X00." literals #2371

This commit is contained in:
Christoffer Lerno
2025-08-05 13:09:53 +02:00
parent aa910a1c44
commit abd3585c44
3 changed files with 6 additions and 1 deletions

View File

@@ -17,6 +17,7 @@
- Detect recursive creation of generics #2366.
- Compiler assertion when defining a function with return type untyped_list #2368.
- Compiler assert when using generic parameters list without any parameters. #2369
- Parsing difference between "0x00." and "0X00." literals #2371
### Stdlib changes
- Add `==` to `Pair`, `Triple` and TzDateTime. Add print to `Pair` and `Triple`.

View File

@@ -1883,7 +1883,7 @@ static Expr *parse_double(ParseContext *c, Expr *left, SourceSpan lhs_start)
char *err;
Expr *number = EXPR_NEW_TOKEN(EXPR_CONST);
const char *original = symstr(c);
bool is_hex = original[0] == '0' && original[1] == 'x';
bool is_hex = original[0] == '0' && (original[1] == 'x' || original[1] == 'X');
// This is set to try to print in a similar manner as the input.
number->const_expr.is_hex = is_hex;
if (c->data.lex_len > 3)

View File

@@ -0,0 +1,4 @@
fn void main()
{
$echo $typeof(0X00.).nameof; // #error: Hex floating points must end with 'p' or 'P'
}