diff options
| author | Andrea Corallo | 2021-02-27 22:00:11 +0100 |
|---|---|---|
| committer | Andrea Corallo | 2021-02-28 23:30:03 +0100 |
| commit | 5bc08559e8f171eafc3c034232f8cfd9eaf89862 (patch) | |
| tree | a8337beeb2bbb180603cccc754fbc52a0700ff38 /test/src | |
| parent | 2acc46b55bdf518ece6301913ffa074f31563fa4 (diff) | |
| download | emacs-5bc08559e8f171eafc3c034232f8cfd9eaf89862.tar.gz emacs-5bc08559e8f171eafc3c034232f8cfd9eaf89862.zip | |
Don't treat '=' as simple equality emitting constraints (bug#46812)
Extend assumes allowing the following form
(assume dst (= src1 src2))
to caputure '=' semanting during fwprop handling float integer
conversions.
* lisp/emacs-lisp/comp.el (comp-equality-fun-p): Don't treat '=' as
simple equality.
(comp-arithm-cmp-fun-p, comp-negate-arithm-cmp-fun)
(comp-reverse-arithm-fun): Rename and add '=' '!='.
(comp-emit-assume, comp-add-cond-cstrs, comp-fwprop-insn): Update
for new function nameing and to handle '='.
* lisp/emacs-lisp/comp-cstr.el (comp-cstr-=): New function.
* test/src/comp-tests.el (comp-tests-type-spec-tests): Add a bunch
of '=' specific tests.
Diffstat (limited to 'test/src')
| -rw-r--r-- | test/src/comp-tests.el | 47 |
1 files changed, 41 insertions, 6 deletions
diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el index 402ba7cd8b8..0598eeeb05d 100644 --- a/test/src/comp-tests.el +++ b/test/src/comp-tests.el | |||
| @@ -891,24 +891,24 @@ Return a list of results." | |||
| 891 | 891 | ||
| 892 | ;; 10 | 892 | ;; 10 |
| 893 | ((defun comp-tests-ret-type-spec-f (x) | 893 | ((defun comp-tests-ret-type-spec-f (x) |
| 894 | (if (= x 3) | 894 | (if (eql x 3) |
| 895 | x | 895 | x |
| 896 | 'foo)) | 896 | 'foo)) |
| 897 | (or (member foo) (integer 3 3))) | 897 | (or (member foo) (integer 3 3))) |
| 898 | 898 | ||
| 899 | ;; 11 | 899 | ;; 11 |
| 900 | ((defun comp-tests-ret-type-spec-f (x) | 900 | ((defun comp-tests-ret-type-spec-f (x) |
| 901 | (if (= 3 x) | 901 | (if (eql 3 x) |
| 902 | x | 902 | x |
| 903 | 'foo)) | 903 | 'foo)) |
| 904 | (or (member foo) (integer 3 3))) | 904 | (or (member foo) (integer 3 3))) |
| 905 | 905 | ||
| 906 | ;; 12 | 906 | ;; 12 |
| 907 | ((defun comp-tests-ret-type-spec-f (x) | 907 | ((defun comp-tests-ret-type-spec-f (x) |
| 908 | (if (= x 3) | 908 | (if (eql x 3) |
| 909 | 'foo | 909 | 'foo |
| 910 | x)) | 910 | x)) |
| 911 | (or (member foo) marker number)) | 911 | (not (integer 3 3))) |
| 912 | 912 | ||
| 913 | ;; 13 | 913 | ;; 13 |
| 914 | ((defun comp-tests-ret-type-spec-f (x y) | 914 | ((defun comp-tests-ret-type-spec-f (x y) |
| @@ -1214,7 +1214,7 @@ Return a list of results." | |||
| 1214 | ;; 57 | 1214 | ;; 57 |
| 1215 | ((defun comp-tests-ret-type-spec-f (x) | 1215 | ((defun comp-tests-ret-type-spec-f (x) |
| 1216 | (unless (or (eq x 'foo) | 1216 | (unless (or (eq x 'foo) |
| 1217 | (= x 3)) | 1217 | (eql x 3)) |
| 1218 | (error "Not foo or 3")) | 1218 | (error "Not foo or 3")) |
| 1219 | x) | 1219 | x) |
| 1220 | (or (member foo) (integer 3 3))) | 1220 | (or (member foo) (integer 3 3))) |
| @@ -1244,7 +1244,42 @@ Return a list of results." | |||
| 1244 | (>= x y)) | 1244 | (>= x y)) |
| 1245 | x | 1245 | x |
| 1246 | (error ""))) | 1246 | (error ""))) |
| 1247 | (or float (integer 3 10))))) | 1247 | (or float (integer 3 10))) |
| 1248 | |||
| 1249 | ;; 61 | ||
| 1250 | ((defun comp-tests-ret-type-spec-f (x) | ||
| 1251 | (if (= x 1.0) | ||
| 1252 | x | ||
| 1253 | (error ""))) | ||
| 1254 | (or (member 1.0) (integer 1 1))) | ||
| 1255 | |||
| 1256 | ;; 62 | ||
| 1257 | ((defun comp-tests-ret-type-spec-f (x) | ||
| 1258 | (if (= x 1.0) | ||
| 1259 | x | ||
| 1260 | (error ""))) | ||
| 1261 | (or (member 1.0) (integer 1 1))) | ||
| 1262 | |||
| 1263 | ;; 63 | ||
| 1264 | ((defun comp-tests-ret-type-spec-f (x) | ||
| 1265 | (if (= x 1.1) | ||
| 1266 | x | ||
| 1267 | (error ""))) | ||
| 1268 | (member 1.1)) | ||
| 1269 | |||
| 1270 | ;; 64 | ||
| 1271 | ((defun comp-tests-ret-type-spec-f (x) | ||
| 1272 | (if (= x 1) | ||
| 1273 | x | ||
| 1274 | (error ""))) | ||
| 1275 | (or (member 1.0) (integer 1 1))) | ||
| 1276 | |||
| 1277 | ;; 65 | ||
| 1278 | ((defun comp-tests-ret-type-spec-f (x) | ||
| 1279 | (if (= x 1) | ||
| 1280 | x | ||
| 1281 | (error ""))) | ||
| 1282 | (or (member 1.0) (integer 1 1))))) | ||
| 1248 | 1283 | ||
| 1249 | (defun comp-tests-define-type-spec-test (number x) | 1284 | (defun comp-tests-define-type-spec-test (number x) |
| 1250 | `(comp-deftest ,(intern (format "ret-type-spec-%d" number)) () | 1285 | `(comp-deftest ,(intern (format "ret-type-spec-%d" number)) () |