adjust error message for impersonate-struct to match its actual contract

This commit is contained in:
Robby Findler 2014-02-12 14:35:24 -06:00
parent d32e0eda7c
commit 73bbabe7d4
2 changed files with 10 additions and 5 deletions

View File

@ -1510,7 +1510,12 @@
(let ()
(struct s ([a #:mutable]))
(err/rt-test (impersonate-struct 5 set-s-a! (lambda (a b) b))))
(err/rt-test (impersonate-struct 5 set-s-a! (lambda (a b) b)))
(err/rt-test (impersonate-struct (s 1) #f (λ (a b) v))
(λ (x)
(and (exn:application:type? x)
(regexp-match #rx"struct-type-property-accessor-procedure[?]"
(exn-message x))))))
;; ----------------------------------------

View File

@ -5473,10 +5473,10 @@ static Scheme_Object *do_chaperone_struct(const char *name, int is_impersonator,
offset = -2;
} else {
scheme_wrong_contract(name,
(is_impersonator
? "(or/c struct-accessor-procedure? struct-mutator-procedure?)"
: ("(or/c struct-accessor-procedure? struct-mutator-procedure?"
" struct-type-property-accessor-procedure? (one-of/c struct-info))")),
"(or/c struct-accessor-procedure?\n"
" struct-mutator-procedure?\n"
" struct-type-property-accessor-procedure?\n"
" (one-of/c struct-info))",
i, argc, argv);
return NULL;
}