[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] branch master updated: analyze: 'unbound-variable' warni
From: |
Ludovic Courtès |
Subject: |
[Guile-commits] branch master updated: analyze: 'unbound-variable' warning handles re-exported bindings. |
Date: |
Sat, 01 May 2021 19:25:05 -0400 |
This is an automated email from the git hooks/post-receive script.
civodul pushed a commit to branch master
in repository guile.
The following commit(s) were added to refs/heads/master by this push:
new 5969490 analyze: 'unbound-variable' warning handles re-exported
bindings.
5969490 is described below
commit 5969490f55e5a167a3eb2573a3c5241c0ce079f3
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Sat May 1 23:12:17 2021 +0200
analyze: 'unbound-variable' warning handles re-exported bindings.
Fixes <https://bugs.gnu.org/47031>.
* module/language/tree-il/analyze.scm (make-use-before-definition-analysis)
[resolve]: Add case for when NAME is re-exported by MOD.
* test-suite/tests/tree-il.test ("warnings")["re-exported binding"]: New
test.
---
module/language/tree-il/analyze.scm | 5 +++++
test-suite/tests/tree-il.test | 13 +++++++++++++
2 files changed, 18 insertions(+)
diff --git a/module/language/tree-il/analyze.scm
b/module/language/tree-il/analyze.scm
index 766568f..1567e3e 100644
--- a/module/language/tree-il/analyze.scm
+++ b/module/language/tree-il/analyze.scm
@@ -510,6 +510,11 @@ given `tree-il' element."
;; The variable is an import. At the time of use, the
;; name is bound to the import.
'import)
+ ((and=> (module-public-interface mod)
+ (lambda (interface)
+ (module-variable interface name)))
+ ;; The variable is re-exported from another module.
+ 'import)
(else
;; Variable unbound in the module.
'unbound))))))
diff --git a/test-suite/tests/tree-il.test b/test-suite/tests/tree-il.test
index 97bf17a..686eab9 100644
--- a/test-suite/tests/tree-il.test
+++ b/test-suite/tests/tree-il.test
@@ -578,6 +578,19 @@
#:env m
#:opts %opts-w-unbound))))))))
+ (pass-if "re-exported binding" ;<https://bugs.gnu.org/47031>
+ (null? (call-with-warnings
+ (lambda ()
+ (compile '(begin
+ (use-modules (srfi srfi-35))
+
+ ;; This 'condition' form expands to a
+ ;; 'make-compound-condition' call, which is
+ ;; re-exported from (ice-9 exceptions).
+ (condition (&error)
+ (&message (message "oh!"))))
+ #:opts %opts-w-unbound)))))
+
(with-test-prefix "use-before-definition"
(define-syntax-rule (pass-if-warnings expr pat test)
(pass-if 'expr
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Guile-commits] branch master updated: analyze: 'unbound-variable' warning handles re-exported bindings.,
Ludovic Courtès <=