summaryrefslogtreecommitdiff
path: root/test/lisp/emacs-lisp/bytecomp-resources
diff options
context:
space:
mode:
authorAndrea Corallo <akrl@sdf.org>2021-01-24 21:05:33 +0100
committerAndrea Corallo <akrl@sdf.org>2021-01-24 21:05:33 +0100
commitb8d3ae78c54db7c7bb65d367a80f9be3d8744c48 (patch)
tree982f190d1dd79685c43a9829dd66e6a7cbbd0c67 /test/lisp/emacs-lisp/bytecomp-resources
parent0ffb3dfaa483b0c5cf1f7f367efcb5e9c041ab53 (diff)
parente5aaa1251cfb9d6d18682a5eda137a2e12ca4213 (diff)
downloademacs-b8d3ae78c54db7c7bb65d367a80f9be3d8744c48.tar.gz
emacs-b8d3ae78c54db7c7bb65d367a80f9be3d8744c48.tar.bz2
emacs-b8d3ae78c54db7c7bb65d367a80f9be3d8744c48.zip
Merge remote-tracking branch 'savannah/master' into native-comp
Diffstat (limited to 'test/lisp/emacs-lisp/bytecomp-resources')
-rw-r--r--test/lisp/emacs-lisp/bytecomp-resources/foo-inlinable.el6
-rw-r--r--test/lisp/emacs-lisp/bytecomp-resources/nowarn-inline-after-defvar.el17
2 files changed, 23 insertions, 0 deletions
diff --git a/test/lisp/emacs-lisp/bytecomp-resources/foo-inlinable.el b/test/lisp/emacs-lisp/bytecomp-resources/foo-inlinable.el
new file mode 100644
index 00000000000..47481574ea8
--- /dev/null
+++ b/test/lisp/emacs-lisp/bytecomp-resources/foo-inlinable.el
@@ -0,0 +1,6 @@
+;; -*- lexical-binding: t; -*-
+
+(defsubst foo-inlineable (foo-var)
+ (+ foo-var 2))
+
+(provide 'foo-inlinable)
diff --git a/test/lisp/emacs-lisp/bytecomp-resources/nowarn-inline-after-defvar.el b/test/lisp/emacs-lisp/bytecomp-resources/nowarn-inline-after-defvar.el
new file mode 100644
index 00000000000..5582b2ab0ea
--- /dev/null
+++ b/test/lisp/emacs-lisp/bytecomp-resources/nowarn-inline-after-defvar.el
@@ -0,0 +1,17 @@
+;; -*- lexical-binding: t; -*-
+
+;; In this test, we try and make sure that inlined functions's code isn't
+;; mistakenly re-interpreted in the caller's context: we import an
+;; inlinable function from another file where `foo-var' is a normal
+;; lexical variable, and then call(inline) it in a function where
+;; `foo-var' is a dynamically-scoped variable.
+
+(require 'foo-inlinable
+ (expand-file-name "foo-inlinable.el"
+ (file-name-directory
+ (or byte-compile-current-file load-file-name))))
+
+(defvar foo-var)
+
+(defun foo-fun ()
+ (+ (foo-inlineable 5) 1))