diff --git a/pkgs/racket-test-core/tests/racket/chaperone.rktl b/pkgs/racket-test-core/tests/racket/chaperone.rktl index da446b6779..ed4f435002 100644 --- a/pkgs/racket-test-core/tests/racket/chaperone.rktl +++ b/pkgs/racket-test-core/tests/racket/chaperone.rktl @@ -3374,6 +3374,23 @@ (test #t f (posn 0 p)) (test #f f (posn 0 #f))) +;; ---------------------------------------- +;; Check no-op impersonation of a parameter procedure + +(let () + (define-values [impersonator-prop:x impersonator-x? impersonator-x] + (make-impersonator-property 'x)) + + (define impersonated-current-pseudo-random-generator + (impersonate-procedure current-pseudo-random-generator #f + impersonator-prop:x #f)) + + (define gen (make-pseudo-random-generator)) + (parameterize ([impersonated-current-pseudo-random-generator + gen]) + (test gen current-pseudo-random-generator) + (test gen impersonated-current-pseudo-random-generator))) + ;; ---------------------------------------- (report-errs) diff --git a/racket/src/racket/src/fun.c b/racket/src/racket/src/fun.c index 3acc0b71e8..6d68267368 100644 --- a/racket/src/racket/src/fun.c +++ b/racket/src/racket/src/fun.c @@ -3715,6 +3715,8 @@ Scheme_Object *scheme_apply_chaperone(Scheme_Object *o, int argc, Scheme_Object } if (SCHEME_CHAPERONE_FLAGS(px) & SCHEME_PROC_CHAPERONE_CALL_DIRECT) { + if (auto_val) + return argv[0]; simple_call = SCHEME_VEC_ELS(px->redirects)[0]; /* no redirection procedure */ if (SCHEME_IMMUTABLEP(px->redirects)) { diff --git a/racket/src/racket/src/thread.c b/racket/src/racket/src/thread.c index c86608b738..bca98d2f50 100644 --- a/racket/src/racket/src/thread.c +++ b/racket/src/racket/src/thread.c @@ -7614,7 +7614,7 @@ Scheme_Object *scheme_extend_parameterization(int argc, Scheme_Object *argv[]) key = argv[i + 1]; if (SCHEME_CHAPERONEP(param)) { a[0] = key; - key = scheme_apply_chaperone(param, 1, a, scheme_void, 0); + key = scheme_apply_chaperone(param, 1, a, scheme_void, 0x3); param = SCHEME_CHAPERONE_VAL(param); } a[0] = key;