diff options
| author | Andrea Corallo | 2021-03-01 19:39:00 +0100 |
|---|---|---|
| committer | Andrea Corallo | 2021-03-01 18:09:40 +0100 |
| commit | 3d014e1bf48f661f0b229ddf735608ff0ba7cfe6 (patch) | |
| tree | 43546114820b1146cd0bc37c015ccd8a9a1dfed5 /test/src | |
| parent | 5bc08559e8f171eafc3c034232f8cfd9eaf89862 (diff) | |
| download | emacs-3d014e1bf48f661f0b229ddf735608ff0ba7cfe6.tar.gz emacs-3d014e1bf48f661f0b229ddf735608ff0ba7cfe6.zip | |
Fix `eql' `equal' propagation of non hash consed values (bug#46843)
Extend assumes allowing the following form:
(assume dst (and-nhc src1 src2))
`and-nhc' assume operator allow for constraining correctly
intersections where non hash consed values are not propagated as
values but rather promoted to their types.
* lisp/emacs-lisp/comp-cstr.el
(comp-cstr-intersection-no-hashcons): New function.
* lisp/emacs-lisp/comp.el (comp-emit-assume): Logic update to emit
`and-nhc' operator (implemented in fwprop by
`comp-cstr-intersection-no-hashcons').
(comp-add-cond-cstrs): Map `eq' to `and' assume operator and
`equal' `eql' into `and-nhc'.
(comp-fwprop-insn): Update to handle `and-nhc'.
* test/src/comp-tests.el (comp-tests-type-spec-tests): Add two
tests covering `eql' and `equal' propagation of non hash consed
values.
Diffstat (limited to 'test/src')
| -rw-r--r-- | test/src/comp-tests.el | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el index 0598eeeb05d..651df332966 100644 --- a/test/src/comp-tests.el +++ b/test/src/comp-tests.el | |||
| @@ -1279,7 +1279,21 @@ Return a list of results." | |||
| 1279 | (if (= x 1) | 1279 | (if (= x 1) |
| 1280 | x | 1280 | x |
| 1281 | (error ""))) | 1281 | (error ""))) |
| 1282 | (or (member 1.0) (integer 1 1))))) | 1282 | (or (member 1.0) (integer 1 1))) |
| 1283 | |||
| 1284 | ;; 66 | ||
| 1285 | ((defun comp-tests-ret-type-spec-f (x) | ||
| 1286 | (if (eql x 0.0) | ||
| 1287 | x | ||
| 1288 | (error ""))) | ||
| 1289 | float) | ||
| 1290 | |||
| 1291 | ;; 67 | ||
| 1292 | ((defun comp-tests-ret-type-spec-f (x) | ||
| 1293 | (if (equal x '(1 2 3)) | ||
| 1294 | x | ||
| 1295 | (error ""))) | ||
| 1296 | cons))) | ||
| 1283 | 1297 | ||
| 1284 | (defun comp-tests-define-type-spec-test (number x) | 1298 | (defun comp-tests-define-type-spec-test (number x) |
| 1285 | `(comp-deftest ,(intern (format "ret-type-spec-%d" number)) () | 1299 | `(comp-deftest ,(intern (format "ret-type-spec-%d" number)) () |