Forbid base prefix for numbers with a unit (#5548)

Co-authored-by: Laurenz <laurmaedje@gmail.com>
This commit is contained in:
wznmickey 2024-12-09 05:56:42 -05:00 committed by GitHub
parent f960fe6012
commit bb0c814095
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 0 deletions

View File

@ -766,6 +766,12 @@ impl Lexer<'_> {
return self.error(eco_format!("invalid number suffix: {}", suffix));
}
if base != 10 {
let kind = self.error(eco_format!("invalid base-{base} prefix"));
self.hint("numbers with a unit cannot have a base prefix");
return kind;
}
SyntaxKind::Numeric
}

View File

@ -74,3 +74,8 @@
// Hint: 2-24 use `length.to-absolute()` to resolve its em component (requires context)
// Hint: 2-24 or use `length.abs.inches()` instead to ignore its em component
#(4.5em + 6in).inches()
--- issue-5519-length-base ---
// Error: 2-9 invalid base-2 prefix
// Hint: 2-9 numbers with a unit cannot have a base prefix
#0b100pt