From 16dc10ee968ef478eacc4ce1b4b9c22622daba17 Mon Sep 17 00:00:00 2001 From: Mark Thom Date: Sun, 7 Dec 2025 15:15:18 -0800 Subject: [PATCH] assert rational(3) as true in tests/builtins.pl --- src/codegen.rs | 16 +++++++++++----- src/tests/builtins.pl | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/codegen.rs b/src/codegen.rs index c5a0c857..67ba2dbf 100644 --- a/src/codegen.rs +++ b/src/codegen.rs @@ -639,7 +639,10 @@ impl CodeGenerator { } }, InlinedClauseType::IsRational(..) => match terms[0] { - Term::Literal(_, Literal::Rational(_)) => { + Term::Literal( + _, + Literal::Rational(_) | Literal::Fixnum(_) | Literal::Integer(_), + ) => { instr!("$succeed") } Term::Var(ref vr, ref name) => { @@ -679,10 +682,13 @@ impl CodeGenerator { } }, InlinedClauseType::IsNumber(..) => match terms[0] { - Term::Literal(_, Literal::F64(..)) - | Term::Literal(_, Literal::Rational(_)) - | Term::Literal(_, Literal::Integer(_)) - | Term::Literal(_, Literal::Fixnum(_)) => { + Term::Literal( + _, + Literal::F64(..) + | Literal::Rational(_) + | Literal::Integer(_) + | Literal::Fixnum(_), + ) => { instr!("$succeed") } Term::Var(ref vr, ref name) => { diff --git a/src/tests/builtins.pl b/src/tests/builtins.pl index a87fc22a..1a437413 100644 --- a/src/tests/builtins.pl +++ b/src/tests/builtins.pl @@ -46,7 +46,7 @@ test_queries_on_builtins :- \+ float([1,2,_]), \+ (X is 3 rdiv 4, float(X)), \+ \+ (X is 3 rdiv 4, rational(X)), - \+ rational(3), + rational(3), \+ rational(f(_)), \+ rational("sdfa"), \+ rational(atom), -- 2.54.0