fix problem with parameter impersonator

Closes #2228
This commit is contained in:
Matthew Flatt 2018-08-14 12:27:33 -07:00
parent bbde12991c
commit a58d115bf2
3 changed files with 20 additions and 1 deletions

View File

@ -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)

View File

@ -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)) {

View File

@ -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;