summaryrefslogtreecommitdiff
path: root/test/lisp/emacs-lisp/comp-cstr-tests.el
Commit message (Collapse)AuthorAgeFilesLines
* ; Add 2022 to copyright years.Eli Zaretskii2022-01-011-1/+1
|
* Have `comp-cstr-intersection-no-mem' intersect pos neg value setsAndrea Corallo2021-04-271-8/+12
| | | | | | | | * lisp/emacs-lisp/comp-cstr.el (comp-cstr-intersection-no-mem): intersect pos and neg value sets * test/lisp/emacs-lisp/comp-cstr-tests.el (comp-cstr-typespec-tests-alist): Add two tests and fix some test number.
* Rework where `comp-ctxt' is defined.Andrea Corallo2021-04-261-2/+0
| | | | | | | * test/lisp/emacs-lisp/comp-cstr-tests.el (comp-ctxt): Remove `comp-ctxt' definition. * lisp/emacs-lisp/comp.el (comp-ctxt): Likewise. * lisp/emacs-lisp/comp-cstr.el (comp-ctxt): Define it here.
* * Fix comp-cstr tests for vanilla build (bug#48021)Andrea Corallo2021-04-261-0/+2
| | | | | * test/lisp/emacs-lisp/comp-cstr-tests.el (comp-ctxt): Fix tests for vanilla build (bug#48021)
* ; Add 2021 to copyright yearsGlenn Morris2021-04-251-1/+1
|
* * Fix two comp-cstr testsAndrea Corallo2021-04-131-2/+2
| | | | | * test/lisp/emacs-lisp/comp-cstr-tests.el (comp-cstr-typespec-tests-alist): Fix test 53 70.
* * Fix union constraint for mixed pos/neg constraintsAndrea Corallo2021-02-221-1/+3
| | | | | | | | * lisp/emacs-lisp/comp-cstr.el (comp-cstr-union-1-no-mem): Fix neg type shadowing pos values. * test/lisp/emacs-lisp/comp-cstr-tests.el (comp-cstr-typespec-tests-alist): Add testcase. * test/src/comp-tests.el (comp-tests-type-spec-tests): Fix testcase.
* * Add a type specifier testAndrea Corallo2021-01-071-1/+3
| | | | | * test/lisp/emacs-lisp/comp-cstr-tests.el (comp-cstr-typespec-tests-alist): Add testcase.
* * Fix a type specifier testAndrea Corallo2021-01-041-1/+1
| | | | | * test/lisp/emacs-lisp/comp-cstr-tests.el (comp-cstr-typespec-tests-alist): Fix a testcase.
* Fix type inference for bug#45635Andrea Corallo2021-01-041-1/+3
| | | | | | | | | * lisp/emacs-lisp/comp-cstr.el (comp-cstr-union-1-no-mem): Fix missing mixed pos neg handling. * test/lisp/emacs-lisp/comp-cstr-tests.el (comp-cstr-typespec-tests-alist): Add a test. * test/src/comp-tests.el (45635): New testcase. * test/src/comp-test-funcs.el (comp-test-45635-f): New function.
* Symplify (not t) => nil and (not nil) => tAndrea Corallo2020-12-241-1/+5
| | | | | | | * lisp/emacs-lisp/comp-cstr.el (comp-cstr-negation): Symplify (not t) => nil and (not nil) => t. * test/lisp/emacs-lisp/comp-cstr-tests.el (comp-cstr-typespec-tests-alist): Add two tests.
* Fix native compiler tests when they are bytecompiledAndrea Corallo2020-12-211-174/+176
| | | | | | | | * test/lisp/emacs-lisp/comp-cstr-tests.el (comp-cstr-test-ts) (comp-cstr-typespec-test, comp-cstr-typespec-tests-alist): Eval also at compile time. * test/src/comp-tests.el (comp-tests-type-spec-tests) (comp-tests-define-type-spec-test): Likewise.
* Simplify correctly (or (integer 1 1) (not (integer 1 1))) as tAndrea Corallo2020-12-211-1/+3
| | | | | | | * lisp/emacs-lisp/comp-cstr.el (comp-cstr-union-1-no-mem): Logic update. * test/lisp/emacs-lisp/comp-cstr-tests.el (comp-cstr-typespec-tests-alist): Add a test.
* Symplify type specifier (not t) as nilAndrea Corallo2020-12-211-1/+5
| | | | | | | * lisp/emacs-lisp/comp-cstr.el (comp-cstr-intersection-no-mem): Add logic. * test/lisp/emacs-lisp/comp-cstr-tests.el (comp-cstr-typespec-tests-alist): Add two tests.
* * Add a type specifier test to comp-cstr-tests.elAndrea Corallo2020-12-211-1/+3
| | | | | * test/lisp/emacs-lisp/comp-cstr-tests.el (comp-cstr-typespec-tests-alist): Add a test.
* * Fix a number of type specifier simplification testsAndrea Corallo2020-12-211-12/+28
| | | | | * test/lisp/emacs-lisp/comp-cstr-tests.el (comp-cstr-typespec-tests-alist): Fix a number of tests.
* * Add initial negated non-negegated intersection supportAndrea Corallo2020-12-131-1/+23
| | | | | | | * lisp/emacs-lisp/comp-cstr.el (comp-range-intersection): Cosmetic. (comp-cstr-intersection-homogeneous): Rename from `comp-cstr-intersection'. (comp-cstr-intersection): New function.
* Normalize cstrs for cache hint effectiveness and test stabilityAndrea Corallo2020-12-121-6/+6
| | | | | | | | | | | * lisp/emacs-lisp/comp-cstr.el (comp-normalize-valset) (comp-union-valsets, comp-intersection-valsets) (comp-normalize-typeset): New functions. (comp-union-typesets, comp-intersect-typesets) (comp-cstr-union-homogeneous-no-range, comp-cstr-union-1-no-mem): Update to return normalized results. * test/lisp/emacs-lisp/comp-cstr-tests.el (comp-cstr-typespec-tests-alist): Normalize expected type specifiers.
* * Enumerate type specifier tests to ease debuggingAndrea Corallo2020-12-121-6/+60
| | | | | | | * test/lisp/emacs-lisp/comp-cstr-tests.el (comp-cstr-typespec-tests-alist): Enumerate tests. Acked-by: Andrea Corallo <akrl@sdf.org>
* Couple of `comp-cstr-union-1-no-mem' improvements for mixed neg pos unionAndrea Corallo2020-12-061-2/+5
| | | | | | | | | * lisp/emacs-lisp/comp-cstr.el (comp-cstr-union-1-no-mem): Generalize disjoint pos types vs neg values conditions. (comp-cstr-union-1-no-mem): Do not propagate ranges when we are already returning integer as generic type. * test/lisp/emacs-lisp/comp-cstr-tests.el (comp-cstr-typespec-tests-alist): Add corresponding tests.
* More improvements to `comp-cstr-union-1' for mixed positive/negative casesAndrea Corallo2020-12-051-2/+13
| | | | | | | * lisp/emacs-lisp/comp-cstr.el (comp-cstr-union-1): Better handle mixed positive/negated cases. * test/lisp/emacs-lisp/comp-cstr-tests.el (comp-cstr-typespec-tests-alist): Add a number of tests.
* Fix union of homogeneously negated input constraintsAndrea Corallo2020-12-051-1/+3
| | | | | | * lisp/emacs-lisp/comp-cstr.el (comp-cstr-union-1): Fix logic. * test/lisp/emacs-lisp/comp-cstr-tests.el (comp-cstr-typespec-tests-alist): Add a couple of tests.
* Initial support for union of negated constraintsAndrea Corallo2020-12-051-1/+8
| | | | | | | | | | | | | * lisp/emacs-lisp/comp-cstr.el (comp-range-negation): New function. (comp-cstr-union-homogeneous-no-range): Rename from `comp-cstr-union-no-range'. (comp-cstr-union-homogeneous): Rename from `comp-cstr-union'. (comp-cstr-union-1): New function. (comp-cstr-union-no-range, comp-cstr-union): Rewrite in function of `comp-cstr-union-1'. * test/lisp/emacs-lisp/comp-cstr-tests.el (comp-cstr-typespec-tests-alist): Add a bunch of tests.
* Initial constraint negation supportAndrea Corallo2020-12-051-1/+2
| | | | | | | | | | * lisp/emacs-lisp/comp-cstr.el (comp-cstr): Add `neg' slot. (comp-range-negation, comp-cstr-negation) (comp-cstr-negation-make): New functions. (comp-type-spec-to-cstr): Enable `not` in type specifiers. (comp-cstr-to-type-spec): Update logic to handle negation. * test/lisp/emacs-lisp/comp-cstr-tests.el (comp-cstr-typespec-tests-alist): Add a test.
* Add intersection support into comp-cstr.elAndrea Corallo2020-11-271-5/+18
|
* Move some tests from comp-tests.el to comp-cstr-tests.elAndrea Corallo2020-11-261-4/+16
| | | | | | | | * test/lisp/emacs-lisp/comp-cstr-tests.el (comp-cstr-typespec-tests-alist): Add tests covering what was in: `range-simple-union', `union-types', `destructure-type-spec'. * test/src/comp-tests.el (range-simple-intersection, union-types) (destructure-type-spec): Remove tests.
* Add comp-cstr.el and comp-cstr-tests.elAndrea Corallo2020-11-261-0/+68
As the constraint logic of the compiler is not trivial and largely independent from the rest of the code move it into comp-cstr.el to ease separation and maintainability. This commit improve the conversion type specifier -> constraint for generality. Lastly this should help with bootstrap time as comp.el compilation unit is slimmed down. * lisp/emacs-lisp/comp-cstr.el: New file. (comp--typeof-types, comp--all-builtin-types): Move from comp.el. (comp-cstr, comp-cstr-f): Same + rename. (comp-cstr-ctxt): New struct. (comp-supertypes, comp-common-supertype-2) (comp-common-supertype, comp-subtype-p, comp-union-typesets) (comp-range-1+, comp-range-1-, comp-range-<, comp-range-union) (comp-range-intersection): Move from comp.el. (comp-cstr-union-no-range, comp-cstr-union): Move from comp.el and rename. (comp-cstr-union-make): New function. (comp-type-spec-to-cstr, comp-cstr-to-type-spec): Move from comp.el, rename it and rework it. * lisp/emacs-lisp/comp.el (comp-known-func-cstr-h): Rework. (comp-ctxt): Remove two fields and include `comp-cstr-ctxt'. (comp-mvar, comp-fwprop-call): Update for `comp-cstr' being renamed. (comp-fwprop-insn): Use `comp-cstr-union-no-range' or `comp-cstr-union'. (comp-ret-type-spec): Use `comp-cstr-union' and rework. * test/lisp/emacs-lisp/comp-cstr-tests.el: New file. (comp-cstr-test-ts, comp-cstr-typespec-test): New functions. (comp-cstr-typespec-tests-alist): New defconst to generate tests on. (comp-cstr-generate-tests): New macro. * test/src/comp-tests.el (comp-tests-type-spec-tests): Update. (ret-type-spec): Initialize constraint context.