fix checking of attempt to impersonte non-struct via mutator

This commit is contained in:
Matthew Flatt 2014-02-10 06:48:03 -07:00
parent dc0653383f
commit ca3757367d
2 changed files with 10 additions and 1 deletions

View File

@ -1508,4 +1508,10 @@
;; ----------------------------------------
(let ()
(struct s ([a #:mutable]))
(err/rt-test (impersonate-struct 5 set-s-a! (lambda (a b) b))))
;; ----------------------------------------
(report-errs)

View File

@ -5458,7 +5458,10 @@ static Scheme_Object *do_chaperone_struct(const char *name, int is_impersonator,
if (SCHEME_CHAPERONEP(proc)) proc = SCHEME_CHAPERONE_VAL(proc);
if (SCHEME_TRUEP(struct_setter_p(1, a))) {
kind = "mutator";
offset = stype->num_slots;
if (stype)
offset = stype->num_slots;
else
offset = 0;
} else if (SCHEME_TRUEP(struct_getter_p(1, a))) {
kind = "accessor";
offset = 0;