summaryrefslogtreecommitdiff
path: root/test/lisp/emacs-lisp
diff options
context:
space:
mode:
Diffstat (limited to 'test/lisp/emacs-lisp')
-rw-r--r--test/lisp/emacs-lisp/bytecomp-resources/warn-variable-set-nonvariable.el3
-rw-r--r--test/lisp/emacs-lisp/bytecomp-tests.el15
2 files changed, 12 insertions, 6 deletions
diff --git a/test/lisp/emacs-lisp/bytecomp-resources/warn-variable-set-nonvariable.el b/test/lisp/emacs-lisp/bytecomp-resources/warn-variable-set-nonvariable.el
deleted file mode 100644
index 0c76c4d388b..00000000000
--- a/test/lisp/emacs-lisp/bytecomp-resources/warn-variable-set-nonvariable.el
+++ /dev/null
@@ -1,3 +0,0 @@
-;;; -*- lexical-binding: t -*-
-(defun foo ()
- (set '(a) nil))
diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el
index 1ca44dc7a48..e7c308213e4 100644
--- a/test/lisp/emacs-lisp/bytecomp-tests.el
+++ b/test/lisp/emacs-lisp/bytecomp-tests.el
@@ -59,6 +59,8 @@ inner loops respectively."
(setq i (1- i)))
res))
+(defvar bytecomp-tests--xx nil)
+
(defconst bytecomp-tests--test-cases
'(
;; some functional tests
@@ -692,6 +694,16 @@ inner loops respectively."
(f (lambda ()
(let ((y x)) (list y 3 y)))))
(funcall f))
+
+ ;; Test rewriting of `set' to `setq' (only done on dynamic variables).
+ (let ((xx 1)) (set 'xx 2) xx)
+ (let ((bytecomp-tests--xx 1))
+ (set 'bytecomp-tests--xx 2)
+ bytecomp-tests--xx)
+ (let ((aaa 1)) (set (make-local-variable 'aaa) 2) aaa)
+ (let ((bytecomp-tests--xx 1))
+ (set (make-local-variable 'bytecomp-tests--xx) 2)
+ bytecomp-tests--xx)
)
"List of expressions for cross-testing interpreted and compiled code.")
@@ -953,9 +965,6 @@ byte-compiled. Run with dynamic binding."
(bytecomp--define-warning-file-test "warn-variable-set-constant.el"
"attempt to set constant")
-(bytecomp--define-warning-file-test "warn-variable-set-nonvariable.el"
- "variable reference to nonvariable")
-
(bytecomp--define-warning-file-test "warn-variable-setq-nonvariable.el"
"attempt to set non-variable")