Deprecate f32, f64 and f128 suffixes.

This commit is contained in:
Christoffer Lerno
2025-05-28 13:01:49 +02:00
parent 83d6b35afe
commit 9f30b56e13
2 changed files with 9 additions and 0 deletions

View File

@@ -20,6 +20,7 @@
- `@jump` now included in `--list-attributes` #2155.
- Add `$$matrix_mul` and `$$matrix_transpose` builtins.
- Add `d` as floating point suffix for `double` types.
- Deprecate `f32`, `f64` and `f128` suffixes.
### Fixes
- Assert triggered when casting from `int[2]` to `uint[2]` #2115

View File

@@ -1822,6 +1822,14 @@ static Expr *parse_double(ParseContext *c, Expr *left)
bool is_hex = original[0] == '0' && 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)
{
const char *last = c->data.lex_start + c->data.lex_len - 3;
if (last[0] == 'f' && ((last[1] == '3' && last[2] == '2') || (last[1] == '6' && last[2] == '4')))
{
SEMA_DEPRECATED(number, "Float number suffixes are deprecated, use 'f' and 'd' instead.'");
}
}
Float f = is_hex ? float_from_hex(original, &err) : float_from_string(original, &err);
if (f.type == TYPE_POISONED)
{