Fix: Parse boolean literals as identifiers

Boolean literals `true` and `false` are now parsed as identifiers,
matching the behavior of other constants like `NaN`. This change aligns
the AST representation of boolean literals with their runtime constants.
This commit is contained in:
Michael Schimmel
2026-02-19 13:56:49 +01:00
parent 07bf59eb47
commit 125cf039d5
3 changed files with 5 additions and 5 deletions
+3 -3
View File
@@ -493,9 +493,9 @@ mod tests {
if let UntypedKind::Block { exprs } = &expanded.kind {
if let UntypedKind::Expansion { call: _, expanded: result } = &exprs[1].kind {
if let UntypedKind::If { cond, then_br, else_br } = &result.kind {
if let UntypedKind::Constant(Value::Bool(b)) = &cond.kind {
assert_eq!(*b, false);
} else { panic!("Expected false, got {:?}", cond.kind); }
if let UntypedKind::Identifier(sym) = &cond.kind {
assert_eq!(sym.name.as_ref(), "false");
} else { panic!("Expected identifier 'false', got {:?}", cond.kind); }
assert!(matches!(then_br.kind, UntypedKind::Constant(Value::Void)));
if let Some(eb) = else_br {
if let UntypedKind::Constant(Value::Int(n)) = &eb.kind {