summaryrefslogtreecommitdiff
path: root/test/src
diff options
context:
space:
mode:
authorAndrea Corallo <akrl@sdf.org>2021-03-02 08:43:39 +0100
committerAndrea Corallo <akrl@sdf.org>2021-03-02 14:36:09 +0100
commit8c7228e8cde9a33f8128933f991f6432e58cfde3 (patch)
tree5667a439dc918805f0a0e541e46847eddd656614 /test/src
parent3d014e1bf48f661f0b229ddf735608ff0ba7cfe6 (diff)
downloademacs-8c7228e8cde9a33f8128933f991f6432e58cfde3.tar.gz
Fix = propagation semantic for constrained inputs
* lisp/emacs-lisp/comp-cstr.el (comp-cstr): Synthesize `comp-cstr-shallow-copy'. (comp-cstr-=): Relax inputs before intersecting them. * test/src/comp-tests.el (comp-tests-type-spec-tests): Add three tests.
Diffstat (limited to 'test/src')
-rw-r--r--test/src/comp-tests.el29
1 files changed, 28 insertions, 1 deletions
diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el
index 651df332966..3f007d2a592 100644
--- a/test/src/comp-tests.el
+++ b/test/src/comp-tests.el
@@ -1293,7 +1293,34 @@ Return a list of results."
(if (equal x '(1 2 3))
x
(error "")))
- cons)))
+ cons)
+
+ ;; 69
+ ((defun comp-tests-ret-type-spec-f (x)
+ (if (and (floatp x)
+ (= x 0))
+ x
+ (error "")))
+ ;; Conservative (see cstr relax in `comp-cstr-=').
+ (or (member 0.0) (integer 0 0)))
+
+ ;; 70
+ ((defun comp-tests-ret-type-spec-f (x)
+ (if (and (integer x)
+ (= x 0))
+ x
+ (error "")))
+ ;; Conservative (see cstr relax in `comp-cstr-=').
+ (or (member 0.0) (integer 0 0)))
+
+ ;; 71
+ ((defun comp-tests-ret-type-spec-f (x y)
+ (if (and (floatp x)
+ (integerp y)
+ (= x y))
+ x
+ (error "")))
+ (or float integer))))
(defun comp-tests-define-type-spec-test (number x)
`(comp-deftest ,(intern (format "ret-type-spec-%d" number)) ()