fix error message for set-field! and dynamic-set-field!

This commit is contained in:
Robby Findler 2014-02-03 10:06:06 -06:00
parent a75e770534
commit f774a9098e
2 changed files with 6 additions and 2 deletions

View File

@ -1296,6 +1296,10 @@
(error-test #'(set-field! x 1 2))
(error-test #'(set-field! x (new object%) 2) exn:fail:object?)
(error-test #'(set-field! x (new object%) 2)
(λ (exn) (regexp-match? #rx"^set-field!" (exn-message exn))))
(error-test #'(dynamic-set-field! 'x (new object%) 2)
(λ (exn) (regexp-match? #rx"^dynamic-set-field!" (exn-message exn))))
(error-test #'(set-field! x (new (class object% (define x 1) (super-new))) 2)
exn:fail:object?)
(error-test #'(let ([o (let ()

View File

@ -3764,7 +3764,7 @@ An example
(define (do-set-field! who id obj val)
(unless (object? obj)
(raise-argument-error 'set-field!
(raise-argument-error who
"object?"
obj))
(let* ([cls (object-ref/unwrap obj)]
@ -3772,7 +3772,7 @@ An example
[fi (hash-ref field-ht id #f)])
(if fi
((field-info-external-set! fi) obj val)
(obj-error 'get-field
(obj-error who
"given object does not have the requested field"
"field name" (as-write id)
"object" obj))))