cs: fix incorrect impersonator discard in chaperone-of?

This commit is contained in:
Matthew Flatt 2019-05-15 10:41:43 -06:00
parent b3f66a4973
commit cc487a4d9a
2 changed files with 10 additions and 2 deletions

View File

@ -196,6 +196,15 @@
(test (void) vector-set! b2 1 'fine)
(test 'fine vector-ref b 1)))
;; impersonator-of does not imply chaperone-of
(let ()
(define vec1 (vector 1 2 3))
(define vec2 (impersonate-vector vec1 (lambda (v i x) x) (lambda (v i x) x)))
(test #t impersonator-of? vec2 vec1)
(test #f chaperone-of? vec2 vec1)
(test #f impersonator-of? vec1 vec2)
(test #f chaperone-of? vec1 vec2))
;; test chaperone-of checks in a chaperone:
(let ([b (vector 0)])
(let ([b2 (chaperone-vector b

View File

@ -42,8 +42,7 @@
(let ([ctx (deeper-context ctx)])
(equal? a2 b ctx)))]
[else #f]))]
[(and (eq? mode 'chaperone-of?)
(chaperone? b))
[(eq? mode 'chaperone-of?)
;; `a` does not include `b`, so give up
#f]
[else