1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-15 09:47:20 +00:00
Commit Graph

4176 Commits

Author SHA1 Message Date
Andrea Corallo
725c7e1416 * Enumerate type specifier tests to ease debugging
* test/lisp/emacs-lisp/comp-cstr-tests.el
	(comp-cstr-typespec-tests-alist): Enumerate tests.

Acked-by: Andrea Corallo <akrl@sdf.org>
2020-12-12 16:30:16 +01:00
Andrea Corallo
c39fad909c * test/src/comp-tests.el (comp-tests-bootstrap): Temp fix bootstrap test. 2020-12-12 16:30:07 +01:00
Andrea Corallo
0474fda62d Merge remote-tracking branch 'savannah/master' into HEAD 2020-12-12 15:31:33 +01:00
Lars Ingebrigtsen
3ed3a33cb1 Fix copyright line 2020-12-11 23:18:01 +01:00
Lars Ingebrigtsen
49a4f06b06 Fix object-interval tests
* test/src/fns-tests.el (object-intervals): Fix tests.
2020-12-11 15:21:44 +01:00
Lars Ingebrigtsen
004d7e97e2 Add a new command `memory-report'
* doc/lispref/internals.texi (Garbage Collection): Document it.
* lisp/emacs-lisp/memory-report.el: New package.
2020-12-11 14:49:53 +01:00
Lars Ingebrigtsen
aa7e5ce651 Add new function `object-intervals'
* doc/lispref/text.texi (Examining Properties): Document it.
* src/fns.c (Fobject_intervals): New defun.
(collect_interval): New function.
2020-12-11 14:40:20 +01:00
Mattias Engdegård
6596b5541d Fupcase no longer maps ?ß to itself (bug#11309)
* test/src/casefiddle-tests.el (casefiddle-tests-char-casing):
(upcase ?ß) now returns ?ẞ (U+7838), partly for technical reasons but
the previous behaviour was arbitrary and arguably less useful.
Correct upcasing of ß is normally SS, which is what Fupcase returns if
given a string, or (for special purposes) ẞ.
2020-12-10 11:02:27 +01:00
Juri Linkov
303f0a19cc Support highlighting of ripgrep output (bug#44983)
* etc/grep.txt: Add ripgrep samples.

* lisp/progmodes/grep.el (grep-match-regexp): Highlight ripgrep matches too.
(grep-regexp-alist): Remove $ to highlight ripgrep binary file matches.
2020-12-09 21:16:03 +02:00
Mattias Engdegård
beebd2a85e Recognise ß properly as a lower-case letter (bug#11309)
ß was incorrectly treated as a caseless character and thus not matched
by the regexp [[:lower:]] (or, in case-folding mode, [[:upper:]]).
The reason is that the upcase table maps it to itself, which can be
remedied by mapping it to ẞ (U+7838) instead.  Doing so does not
affect upcasing since the special-uppercase property maps it to SS.

* lisp/international/characters.el (tbl): Map ß to ẞ in the upcase
table.
* test/src/regex-emacs-tests.el (regexp-eszett): Uncomment previously
failing tests.  Add checks to make sure that case transformations
remain valid.
2020-12-09 15:29:48 +01:00
Michael Albinus
2782d1e1a1 Improve tests for gio file notifications
* .gitlab-ci.yml (test-filenotify-gio): Call "make -k".

* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-notify-add-watch):
Set connection property "gio-file-monitor".

* lisp/net/tramp-sh.el (tramp-get-remote-gio-file-monitor): New defun.
(tramp-sh-handle-file-notify-add-watch): Use it.

* test/lisp/filenotify-tests.el (file-notify--test-read-event): Simplify.
(file-notify--test-monitor): Handle also remote "gio monitor".
(file-notify-test03-events, file-notify-test04-autorevert)
(file-notify-test05-file-validity, file-notify-test08-backup)
(file-notify-test09-watched-file-in-watched-dir):
Handle GKqueueFileMonitor.
2020-12-09 14:49:58 +01:00
Mattias Engdegård
be4d6b043f Fix [:upper:] and [:lower:] for Unicode characters (bug#11309)
* src/regex-emacs.c (execute_charset): Add canon_table argument to
allow expression of a correct predicate for [:upper:] and [:lower:].
(mutually_exclusive_p, re_match_2_internal): Pass extra argument.
* test/src/regex-emacs-tests.el (regexp-case-fold, regexp-eszett):
New tests.  Parts of regexp-eszett still fail and are commented out.
2020-12-09 10:35:13 +01:00
Basil L. Contovounesios
2581beba65 Make abbrev-tests.el more deterministic
* test/lisp/abbrev-tests.el (abbrev--table-symbols-test): Don't rely
on order of symbols in obarray.
2020-12-09 00:54:34 +00:00
Lars Ingebrigtsen
1fb099ceb0 Make rcirc nick renaming heed nickname max lengths
* lisp/net/rcirc.el (rcirc-server-parameters): New variable (bug#6795).
(rcirc-connect): Set it.
(rcirc-handler-433): Use the length from the server.
(rcirc-handler-005): Collect server data.
(rcirc-server-parameter-value): New utility function.
(rcirc--make-new-nick): New function.
2020-12-08 18:22:47 +01:00
Stefan Kangas
3b20c03316 Prefer setq-local in tests
* test/lisp/allout-tests.el (allout-test-resumption-prior-value-resumed)
(allout-test-resumption-multiple-holds)
(allout-test-resumption-unbinding):
* test/lisp/emacs-lisp/faceup-resources/faceup-test-mode.el
(faceup-test-mode):
* test/lisp/epg-tests.el (with-epg-tests):
* test/src/data-tests.el (binding-test-buffer-A): Prefer setq-local.
2020-12-08 08:57:22 +01:00
Philipp Stephani
0155bd0fdb Fix bug in how ERT invokes its debugger.
The debugger needs to receive a list of the error symbol and data;
cf. the documentation of the `debugger' variable.  This bug manifested
itself in ERT forms such as (should (integerp (ert-fail "Boo"))),
which resulted in an incorrect condition object.  Note that forms such
as (should (ert-fail "Boo")) weren't affected because they wouldn't
use the `ert--should-signal-hook'.

* test/emacs-lisp/ert.el (ert--should-signal-hook): Call debugger with
the right arguments.

* test/lisp/emacs-lisp/ert-tests.el (ert-test-fail-inside-should): Add
unit test.
2020-12-07 21:41:40 +01:00
Philipp Stephani
2d989e81b7 Unbreak a few unit tests that rely on lack of backtraces
* test/lisp/emacs-lisp/gv-tests.el (gv-dont-define-expander-in-file)
(gv-dont-define-expander-other-file):
* test/lisp/emacs-lisp/edebug-tests.el (edebug-tests-with-default-config):
Suppress backtraces in batch mode to unbreak unit tests.
2020-12-07 11:59:06 +01:00
Philipp Stephani
3970f4ac40 Add new variable to selectively suppress backtraces in batch mode.
* src/eval.c (syms_of_eval): Define new variable
'backtrace-on-error-noninteractive' to selectively enable backtrace
printing in batch mode.
(signal_or_quit): Use it.

* etc/NEWS: Document new variable.

* test/src/eval-tests.el (eval-tests/backtrace-in-batch-mode/inhibit):
New unit test.
2020-12-07 11:59:06 +01:00
Andrea Corallo
715a1ca174 Merge remote-tracking branch 'savannah/master' into HEAD 2020-12-06 18:07:27 +01:00
Andrea Corallo
ac40a60696 Couple of `comp-cstr-union-1-no-mem' improvements for mixed neg pos union
* 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.
2020-12-06 18:02:18 +01:00
Philipp Stephani
40e11743ca Print a backtrace on unhandled errors in batch mode (Bug#44942).
* src/eval.c (signal_or_quit): Print a backtrace in batch mode if no
error handler was found.

* test/src/eval-tests.el (eval-tests/backtrace-in-batch-mode)
(eval-tests/backtrace-in-batch-mode/demoted-errors): New unit tests.

* etc/NEWS: Document change.
2020-12-06 17:47:52 +01:00
Andrea Corallo
2eb41ec137 More improvements to `comp-cstr-union-1' for mixed positive/negative cases
* 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.
2020-12-05 19:01:04 +01:00
Andrea Corallo
726e40fb7c Fix union of homogeneously negated input constraints
* 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.
2020-12-05 19:01:03 +01:00
Andrea Corallo
7c1d90a41d Initial support for union of negated constraints
* 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.
2020-12-05 19:01:03 +01:00
Andrea Corallo
9b85ae6aa5 Initial constraint negation support
* 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.
2020-12-05 19:01:03 +01:00
Stefan Monnier
fc54c83518 * lisp/progmodes/perl-mode.el: Fix handling of s'foo'bar'
(perl-syntax-propertize-function): Don't put a syntax-property
on regexp-op delimiters if they're already handled correctly
by the normal syntax tables.
(perl-syntax-propertize-special-constructs): Mark the middle
quote of s'foo'bar' as punctuation.

* test/manual/indent/perl.perl: Add new test cases.
2020-12-05 10:41:20 -05:00
Mattias Engdegård
7bdc40e8d1 Speed up match-substitute-replacement
* lisp/subr.el (match-substitute-replacement): Use match-data--translate.
* src/search.c (Fmatch_data__translate): Remove string restriction.
* test/lisp/subr-tests.el (subr-match-substitute-replacement): New test.
2020-12-04 18:39:13 +01:00
Stefan Kangas
55300e6cdc Add tests for several byte-compiler warnings
* test/lisp/emacs-lisp/bytecomp-tests.el
(bytecomp/warn-autoload-not-on-top-level\.el)
(bytecomp/warn-callargs\.el)
(bytecomp/warn-defcustom-nogroup\.el)
(bytecomp/warn-defcustom-notype\.el)
(bytecomp/warn-defvar-lacks-prefix\.el)
(bytecomp/warn-format\.el)
(bytecomp/warn-lambda-malformed-interactive-spec\.el)
(bytecomp/warn-make-variable-buffer-local\.el)
(bytecomp/warn-redefine-defun-as-macro\.el)
(bytecomp/warn-redefine-defun\.el)
(bytecomp/warn-redefine-macro-as-defun\.el)
(bytecomp/warn-save-excursion\.el)
(bytecomp/warn-variable-let-bind-constant\.el)
(bytecomp/warn-variable-let-bind-nonvariable\.el)
(bytecomp/warn-variable-set-constant\.el)
(bytecomp/warn-variable-set-nonvariable\.el): New tests.
* test/lisp/emacs-lisp/bytecomp-resources/warn-autoload-not-on-top-level.el:
* test/lisp/emacs-lisp/bytecomp-resources/warn-callargs.el:
* test/lisp/emacs-lisp/bytecomp-resources/warn-defcustom-nogroup.el:
* test/lisp/emacs-lisp/bytecomp-resources/warn-defcustom-notype.el:
* test/lisp/emacs-lisp/bytecomp-resources/warn-defvar-lacks-prefix.el:
* test/lisp/emacs-lisp/bytecomp-resources/warn-format.el:
* test/lisp/emacs-lisp/bytecomp-resources/warn-lambda-malformed-interactive-spec.el:
* test/lisp/emacs-lisp/bytecomp-resources/warn-make-variable-buffer-local.el:
* test/lisp/emacs-lisp/bytecomp-resources/warn-redefine-defun-as-macro.el:
* test/lisp/emacs-lisp/bytecomp-resources/warn-redefine-defun.el:
* test/lisp/emacs-lisp/bytecomp-resources/warn-redefine-macro-as-defun.el:
* test/lisp/emacs-lisp/bytecomp-resources/warn-save-excursion.el:
* test/lisp/emacs-lisp/bytecomp-resources/warn-variable-let-bind-constant.el:
* test/lisp/emacs-lisp/bytecomp-resources/warn-variable-let-bind-nonvariable.el:
* test/lisp/emacs-lisp/bytecomp-resources/warn-variable-set-constant.el:
* test/lisp/emacs-lisp/bytecomp-resources/warn-variable-set-nonvariable.el:
* test/lisp/emacs-lisp/bytecomp-tests.el: New files.
2020-12-03 17:08:28 +01:00
Michael Albinus
62fa6d19b3 Fix auto-revert-test07-auto-revert-several-buffers
* test/lisp/autorevert-tests.el
(auto-revert-test07-auto-revert-several-buffers): Adapt times values.
2020-12-03 15:58:40 +01:00
Stefan Kangas
cf90856946 Remove redundant requires of 'font-core'
* lisp/ibuffer.el:
* test/lisp/erc/erc-track-tests.el: Don't require 'font-core'; it is
preloaded since version 22.1.
2020-12-03 08:51:15 +01:00
Stefan Kangas
1b2547de23 Remove redundant requires of faces
* lisp/htmlfontify.el:
* lisp/term/ns-win.el:
* lisp/term/w32-win.el:
* lisp/term/x-win.el:
* test/lisp/faces-tests.el: Don't require 'faces'; it is preloaded
since version 19.34.
2020-12-02 18:21:44 +01:00
Michael Albinus
9f462496ae Add test to autorevert-tests.el
* test/lisp/autorevert-tests.el (auto-revert--wait-for-revert):
Handle `auto-revert--messages' being nil.
(auto-revert-test07-auto-revert-several-buffers): New test.
2020-12-02 16:09:20 +01:00
Stefan Kangas
17d9d90ec2 Improve sectioning in bytecomp-tests.el
* test/lisp/emacs-lisp/bytecomp-tests.el: Add section comments.
(test-eager-load-macro-expansion)
(test-eager-load-macro-expansion-eval-and-compile): Move definitions.
2020-12-02 13:11:07 +01:00
Lars Ingebrigtsen
4bb554cf24 Add tests for xsd-regexp 2020-12-02 12:26:04 +01:00
Stefan Kangas
ace6eba036 Fix byte-compiler warning for failed uses of lexical vars
* lisp/emacs-lisp/bytecomp.el (byte-compile-form): Fix byte-compiler
warning for failed uses of lexical vars.  (Bug#44980)
* test/lisp/emacs-lisp/bytecomp-tests.el
(bytecomp--define-warning-file-test): Don't prefix tests with
'warn'.
(bytecomp/error-lexical-var-with-add-hook\.el)
(bytecomp/error-lexical-var-with-remove-hook\.el)
(bytecomp/error-lexical-var-with-run-hook-with-args-until-failure\.el)
(bytecomp/error-lexical-var-with-run-hook-with-args-until-success\.el)
(bytecomp/error-lexical-var-with-run-hook-with-args\.el)
(bytecomp/error-lexical-var-with-symbol-value\.el): New tests.
* test/lisp/emacs-lisp/bytecomp-resources/error-lexical-var-with-symbol-value.el:
* test/lisp/emacs-lisp/bytecomp-resources/error-lexical-var-with-run-hook-with-args.el:
* test/lisp/emacs-lisp/bytecomp-resources/error-lexical-var-with-run-hook-with-args-until-success.el:
* test/lisp/emacs-lisp/bytecomp-resources/error-lexical-var-with-run-hook-with-args-until-failure.el:
* test/lisp/emacs-lisp/bytecomp-resources/error-lexical-var-with-remove-hook.el:
* test/lisp/emacs-lisp/bytecomp-resources/error-lexical-var-with-add-hook.el:
New files.
2020-12-01 13:35:03 +01:00
Stefan Kangas
4457b9590c Add tests for some byte-compiler warnings
* test/lisp/emacs-lisp/bytecomp-tests.el
(bytecomp-warn/warn-interactive-only\.el)
(bytecomp-warn/warn-obsolete-defun\.el)
(bytecomp-warn/warn-obsolete-hook\.el)
(bytecomp-warn/warn-obsolete-variable-same-file\.el)
(bytecomp-warn/warn-obsolete-variable\.el): New tests.
* test/lisp/emacs-lisp/bytecomp-resources/warn-interactive-only.el:
* test/lisp/emacs-lisp/bytecomp-resources/warn-obsolete-defun.el:
* test/lisp/emacs-lisp/bytecomp-resources/warn-obsolete-hook.el:
* test/lisp/emacs-lisp/bytecomp-resources/warn-obsolete-variable-same-file.el:
* test/lisp/emacs-lisp/bytecomp-resources/warn-obsolete-variable.el:
New files.
2020-12-01 04:49:10 +01:00
Andrea Corallo
21104e6808 Fix comp-mvar-symbol-p' and comp-mvar-cons-p' (bug#44968)
* lisp/emacs-lisp/comp.el (comp-mvar-symbol-p): As all slots into
	a `comp-cstr' are in or fix this logic.
	(comp-mvar-cons-p): Likewise.
	* test/src/comp-tests.el (bug-44968): New testcase.
	* test/src/comp-test-funcs.el (comp-test-44968-f): New test
	function.
2020-12-01 00:09:46 +01:00
Stefan Kangas
a126c3684f Test byte-compiler free variable warning
* test/lisp/emacs-lisp/bytecomp-tests.el (ert-x): Require.
(bytecomp--define-warning-file-test): New macro.
(bytecomp-warn/warn-free-setq\.el)
(bytecomp-warn/warn-free-variable-reference\.el): New tests.
* test/lisp/emacs-lisp/bytecomp-resources/warn-free-setq.el:
* test/lisp/emacs-lisp/bytecomp-resources/warn-free-variable-reference.el:
New files.
2020-11-30 22:43:37 +01:00
Michael Albinus
31dcc70e55 Some adaptions to tramp-tests.el
* test/lisp/net/tramp-tests.el (tramp-test-vec): Check for remote
`tramp-test-temporary-file-directory'.
(tramp-test11-copy-file, tramp-test12-rename-file):
Do not skip for tramp-gvfs.el.
(tramp--test-sh-p): Use `tramp-test-vec'.
2020-11-30 13:54:29 +01:00
Philipp Stephani
41c338474d Fix double-free bug when finalizing module runtimes.
* src/emacs-module.c (finalize_runtime_unwind): Don't finalize initial
environment twice.

* test/src/emacs-module-resources/mod-test.c (emacs_module_init):
Allocate lots of values during module initialization to trigger the
bug.
2020-11-29 21:13:02 +01:00
Andrea Corallo
6523b84015 Merge remote-tracking branch 'savannah/master' into HEAD 2020-11-29 15:11:38 +01:00
Andrea Corallo
2e0256e0a0 Add intersection support into comp-cstr.el 2020-11-27 23:30:02 +01:00
Philipp Stephani
23974cfa48 Fix incorrect handling of module runtime and environment pointers.
We used to store module runtime and environment pointers in the static
lists Vmodule_runtimes and Vmodule_environments.  However, this is
incorrect because these objects have to be kept per-thread.  With this
naive approach, interleaving module function calls in separate threads
leads to environments being removed in the wrong order, which in turn
can cause local module values to be incorrectly garbage-collected.
The fix isn't completely trivial: specbinding the lists wouldn't work
either, because then the garbage collector wouldn't find the
environments in other threads than the current ones, again leading to
objects being garbage-collected incorrectly.  While introducing custom
pseudovector types would fix this, it's simpler to put the runtime and
environment pointers into the specbinding list as new specbinding
kinds.  This works since we need to unwind them anyway, and we only
ever treat the lists as a stack.  The thread switching machinery
ensures that the specbinding lists are thread-local, and that all
elements of the specbinding lists in all threads are marked during
garbage collection.

Module assertions now have to walk the specbinding list for the
current thread, which is more correct since they now only find
environments for the current thread.  As a result, we can now remove
the faulty Vmodule_runtimes and Vmodule_environments variables
entirely.

Also add a unit test that exemplifies the problem.  It interleaves two
module calls in two threads so that the first call ends while the
second one is still active.  Without this change, this test triggers
an assertion failure.

* src/lisp.h (enum specbind_tag): Add new tags for module runtimes and
environments.

* src/eval.c (record_unwind_protect_module): New function to record a
module object in the specpdl list.
(do_one_unbind): Unwind module objects.
(backtrace_eval_unrewind, default_toplevel_binding, lexbound_p)
(Fbacktrace__locals): Deal with new specbinding types.
(mark_specpdl): Mark module environments as needed.

* src/alloc.c (garbage_collect): Remove call to 'mark-modules'.
Garbage collection of module values is now handled as part of marking
the specpdl of each thread.

* src/emacs-module.c (Fmodule_load, funcall_module): Use specpdl to
record module runtimes and environments.
(module_assert_runtime, module_assert_env, value_to_lisp): Walk
through specpdl list instead of list variables.
(mark_module_environment): Rename from 'mark_modules'.  Don't attempt
to walk though current thread's environments only, since that would
miss other threads.
(initialize_environment, finalize_environment): Don't change
Vmodule_environments variable; environments are now in the specpdl
list.
(finalize_environment_unwind, finalize_runtime_unwind): Make 'extern'
since do_one_unbind now calls them.
(finalize_runtime_unwind): Don't change Vmodule_runtimes variable;
runtimes are now in the specpdl list.
(syms_of_module): Remove Vmodule_runtimes and Vmodule_environments.

* test/data/emacs-module/mod-test.c (Fmod_test_funcall): New test
function.
(emacs_module_init): Bind it.

* test/src/emacs-module-tests.el (emacs-module-tests--variable): New
helper type to guard access to state in a thread-safe way.
(emacs-module-tests--wait-for-variable)
(emacs-module-tests--change-variable): New helper functions.
(emacs-module-tests/interleaved-threads): New unit test.
2020-11-27 20:15:33 +01:00
Stefan Monnier
1f633311c1 * lisp/subr.el (activate-change-group): Refine fix for bug#33341 2020-11-27 10:19:21 -05:00
Mattias Engdegård
8ebf041d5f Make the 'cucumber' compilation pattern work without 'omake'
When 'omake' is included in compilation-error-regexp-alist, which it
still is by default, then all other rules are modified to match with
an extra leading 6 spaces as well. The 'cucumber' pattern relied on
this in order to work as intended.

* lisp/progmodes/compile.el (compilation-error-regexp-alist-alist):
Extend the 'cucumber' pattern so that it works even when 'omake'
is not included.  Move it below the 'gnu' rule so that it doesn't
match anything else.
2020-11-27 16:17:19 +01:00
Stefan Monnier
66eeaaa488 * lisp/subr.el (activate-change-group): Fix bug#33341 2020-11-27 09:43:56 -05:00
Andrea Corallo
949b49cf77 Move some tests from comp-tests.el to comp-cstr-tests.el
* 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.
2020-11-26 22:03:22 +01:00
Andrea Corallo
23c082638e Add comp-cstr.el and comp-cstr-tests.el
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.
2020-11-26 22:02:30 +01:00
Mattias Engdegård
558b6dbca7 Fix replace-regexp-in-string substring match data translation
For certain patterns, re-matching the same regexp on the matched
substring does not produce correctly translated match data
(bug#15107 and bug#44861).

Using a new builtin function also improves performance since the
number of calls to string-match is halved.

Reported by Kevin Ryde and Shigeru Fukaya.

* lisp/subr.el (replace-regexp-in-string): Translate the match data
using match-data--translate instead of trusting a call to string-match
on the matched string to do the job.
* test/lisp/subr-tests.el (subr-replace-regexp-in-string):
Add test cases.
* src/search.c (Fmatch_data__translate): New internal function.
(syms_of_search): Register it as a subroutine.
2020-11-26 14:20:13 +01:00
Mattias Engdegård
d148d0259a Add tests for replace-regexp-in-string
* test/lisp/subr-tests.el (subr-replace-regexp-in-string): New.
2020-11-25 13:57:16 +01:00