diff --git a/pkgs/racket-test-core/tests/racket/basic.rktl b/pkgs/racket-test-core/tests/racket/basic.rktl index 81bbaed768c..57c2f631bc4 100644 --- a/pkgs/racket-test-core/tests/racket/basic.rktl +++ b/pkgs/racket-test-core/tests/racket/basic.rktl @@ -118,6 +118,19 @@ (test #t equal? 2 2) (test #t equal? (make-vector 5 'a) (make-vector 5 'a)) (test #t equal? (box "a") (box "a")) +(test #t equal? (make-flvector 5 0.0) (make-flvector 5 0.0)) +(test #t equal? (make-fxvector 5 0) (make-fxvector 5 0)) +(test #t equal? (stencil-vector #b10010 'a 'b) (stencil-vector #b10010 'a 'b)) +(test #t eq? + (equal-hash-code (make-flvector 5 0.0)) + (equal-hash-code (make-flvector 5 0.0))) +(test #t eq? + (equal-hash-code (make-fxvector 5 0)) + (equal-hash-code (make-fxvector 5 0))) +(test #t eq? + (equal-hash-code (stencil-vector #b10010 'a 'b)) + (equal-hash-code (stencil-vector #b10010 'a 'b))) + (test #f equal? "" (string #\null)) (test #f equal? 'a "a") @@ -158,6 +171,18 @@ (test #f equal-always? (make-hash '((a . 1))) (make-hash '((a . 1)))) (test #f equal-always? (mcons 'a '()) (mcons 'a '())) (test #f equal-always? (string #\a) (string #\a)) +(test #f equal-always? (make-flvector 5 0.0) (make-flvector 5 0.0)) +(test #f equal-always? (make-fxvector 5 0) (make-fxvector 5 0)) +(test #f equal-always? (stencil-vector #b10010 'a 'b) (stencil-vector #b10010 'a 'b)) +(test #f eq? + (equal-always-hash-code (make-flvector 5 0.0)) + (equal-always-hash-code (make-flvector 5 0.0))) +(test #f eq? + (equal-always-hash-code (make-fxvector 5 0)) + (equal-always-hash-code (make-fxvector 5 0))) +(test #f eq? + (equal-always-hash-code (stencil-vector #b10010 'a 'b)) + (equal-always-hash-code (stencil-vector #b10010 'a 'b))) (let () (struct s (x) #:property prop:procedure 0) diff --git a/racket/src/cs/rumble/equal.ss b/racket/src/cs/rumble/equal.ss index f9e9d41c61f..112cba127fd 100644 --- a/racket/src/cs/rumble/equal.ss +++ b/racket/src/cs/rumble/equal.ss @@ -104,6 +104,7 @@ (equal? a b ctx)))))))] [(stencil-vector? a) (and (stencil-vector? b) + (not (or (eq? mode 'chaperone-of?) (eq? mode 'equal-always?))) (fx= (stencil-vector-mask a) (stencil-vector-mask b)) (let ([len (stencil-vector-length a)] [ctx (deeper-context ctx)]) @@ -169,15 +170,11 @@ (|#%app| rec-equal? orig-a orig-b eql? (or (eq? mode 'equal?) (eq? mode 'impersonator-of?))) (|#%app| rec-equal? orig-a orig-b eql?)))])))))])))] - [(and (or (eq? mode 'chaperone-of?) (eq? mode 'equal-always?)) - ;; Mutable strings and bytevectors must be `eq?` for `chaperone-of?` and `equal-always?` - (or (mutable-string? a) - (mutable-string? b) - (mutable-bytevector? a) - (mutable-bytevector? b))) - #f] [else - (#%equal? a b)]))))) + (and (or (not (or (eq? mode 'chaperone-of?) (eq? mode 'equal-always?))) + (and (immutable-string? a) (immutable-string? b)) + (and (immutable-bytevector? a) (immutable-bytevector? b))) + (#%equal? a b))]))))) (define (equal? a b) (do-equal? a b 'equal? #f)) (define (impersonator-of? a b) (do-equal? a b 'impersonator-of? #f))