summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/records.scm20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/records.scm b/tests/records.scm
index 9c071334d50..57a21d2effc 100644
--- a/tests/records.scm
+++ b/tests/records.scm
@@ -302,6 +302,26 @@
=>
(,(foo-bar child) ,(foo-baz child))))))
+(test-assert "define-record-type* & inherited value shadowing"
+ (let ((exp '(begin
+ (define-record-type* <foo> foo make-foo
+ foo?
+ (bar foo-bar)
+ (baz foo-baz (thunked)))
+
+ (let ((x (foo (bar 1) (baz 2)))
+ (baz 123))
+ ;; Below, the 'baz' binding for the inherited field value
+ ;; shadows the 'baz' above, which should trigger a warning.
+ (foo (inherit x)
+ (baz (* baz 2)))))))
+ (string-contains
+ (call-with-output-string
+ (lambda (port)
+ (parameterize ((current-warning-port port))
+ (eval exp (test-module)))))
+ "shadows local variable")))
+
(test-assert "define-record-type* & delayed"
(begin
(define-record-type* <foo> foo make-foo