diff --git a/pkgs/racket-test-core/tests/racket/syntax.rktl b/pkgs/racket-test-core/tests/racket/syntax.rktl index eea7ec4b72..2c19b8a6a6 100644 --- a/pkgs/racket-test-core/tests/racket/syntax.rktl +++ b/pkgs/racket-test-core/tests/racket/syntax.rktl @@ -2185,6 +2185,26 @@ (test 'cons exn:fail:contract:variable-id e) (test #t regexp-match? #rx"^cons: " (exn-message e))) +;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Check immutability after saving and restoring quoted constants + +(let ([m `(module defines-immutable-objects racket/base + (provide objs) + (define objs + '(#"x" + "x" + #() + #(1) + #(#:x) + #(#"x") + #&1 + #&#:x + #&#"x" + #hasheq((a . b)))))]) + (define c (compile m)) + (eval c) + (test #t andmap immutable? (dynamic-require ''defines-immutable-objects 'objs))) + ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (report-errs) diff --git a/racket/src/schemify/serialize.rkt b/racket/src/schemify/serialize.rkt index 3aa2a99316..b1de1f3403 100644 --- a/racket/src/schemify/serialize.rkt +++ b/racket/src/schemify/serialize.rkt @@ -181,16 +181,14 @@ `(cons ,a ,d))))] [(vector? q) (let ([args (map make-construct (vector->list q))]) - (if (and (andmap quote? args) - (not (impersonator? q))) - `(quote ,q) - `(vector ,@args)))] + `(vector->immutable-vector + ,(if (and (andmap quote? args) + (not (impersonator? q))) + `(quote ,q) + `(vector ,@args))))] [(box? q) (let ([arg (make-construct (unbox q))]) - (if (and (quote? arg) - (not (impersonator? q))) - `(quote ,q) - `(box ,arg)))] + `(box-immutable ,arg))] [(prefab-struct-key q) => (lambda (key) `(make-prefab-struct ',key ,@(map make-construct