cs: fix problem getting structure hash codes

This commit is contained in:
Matthew Flatt 2020-03-05 11:27:45 -07:00
parent 8a63d80379
commit b4dd4684d9
3 changed files with 19 additions and 4 deletions

View File

@ -3597,6 +3597,22 @@
(test #f hash-ref-key ht1 "absent" #f)
(err/rt-test (hash-ref-key ht2 "absent") exn:fail:contract?))
;; ----------------------------------------
;; regression test to make sure a hash-code function
;; is inherited for a chaperoned struct
(let ()
(struct a ()
#:property prop:equal+hash (list
(lambda (a b eql?) #t)
(lambda (a hc) 1)
(lambda (a hc) 1)))
(struct b a (x))
(test #t integer? (equal-hash-code (chaperone-struct (b 0) b-x (lambda (b v) v)))))
;; ----------------------------------------
(report-errs)

View File

@ -56,7 +56,7 @@
(loop args))]
[(get-opt args "--srcloc" 0)
=> (lambda (args)
(generate-procedure-source-information #f)
(generate-procedure-source-information #t)
(loop args))]
[(get-opt args "--unsafe" 0)
=> (lambda (args)

View File

@ -675,9 +675,8 @@
(define (set-impersonator-hash!)
(let ([struct-impersonator-hash-code
(escapes-ok
(lambda (c hash-code)
((record-type-hash-procedure
(record-rtd (impersonator-val c)))
(lambda (c hash-code)
((record-hash-procedure (impersonator-val c))
c
hash-code)))])
(let ([add (lambda (rtd)