mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 13:59:08 +00:00
format infinite float as the ∞ utf8 symbol
This commit is contained in:
parent
4a593a5b77
commit
0b0127f45e
2 changed files with 14 additions and 1 deletions
|
@ -1484,5 +1484,12 @@ fn number_literal_to_ast<T: std::fmt::Display>(arena: &Bump, num: T) -> Expr<'_>
|
|||
|
||||
let mut string = bumpalo::collections::String::with_capacity_in(64, arena);
|
||||
write!(string, "{num}").unwrap();
|
||||
Expr::Num(string.into_bump_str())
|
||||
|
||||
if string == "inf" {
|
||||
Expr::Num("∞")
|
||||
} else if string == "-inf" {
|
||||
Expr::Num("-∞")
|
||||
} else {
|
||||
Expr::Num(string.into_bump_str())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue