1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-10 05:50:26 +02:00

Don't simplify 'equal?' to 'eq?' when constant is an *inexact* small integer.

* module/language/tree-il/primitives.scm (*primitive-expand-table*):
  Refine test for fixnums to verify that the small integer is exact.

* test-suite/tests/tree-il.test ("primitives"): Add test.
This commit is contained in:
Mark H Weaver 2012-10-07 23:57:13 -04:00
parent 2446f8e126
commit ebd363161e
2 changed files with 5 additions and 0 deletions

View file

@ -509,6 +509,7 @@
(eq? #nil v)
(symbol? v)
(and (integer? v)
(exact? v)
(<= v most-positive-fixnum)
(>= v most-negative-fixnum)))
(make-application src (make-primitive-ref #f 'eq?)

View file

@ -106,6 +106,10 @@
(apply (primitive equal?) (const 42) (toplevel x))
(apply (primitive eq?) (const 42) (toplevel x)))
(pass-if-primitives-resolved
(apply (primitive equal?) (const 42.0) (toplevel x))
(apply (primitive equal?) (const 42.0) (toplevel x)))
(pass-if-primitives-resolved
(apply (primitive equal?) (const #nil) (toplevel x))
(apply (primitive eq?) (const #nil) (toplevel x))))