From c1d2e4031ebd6629ab112f105f4a67baa6752a1b Mon Sep 17 00:00:00 2001 From: Sam Tobin-Hochstadt Date: Sat, 17 Nov 2018 22:26:11 -0500 Subject: [PATCH] =?UTF-8?q?Guard=20`free-identifier=3D=3F`=20comparisons?= =?UTF-8?q?=20in=20`shared`.=20(#2382)?= Fixes #2381. --- .../racket-test-core/tests/racket/shared.rktl | 2 ++ .../collects/racket/private/shared-body.rkt | 26 ++++++++++--------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/pkgs/racket-test-core/tests/racket/shared.rktl b/pkgs/racket-test-core/tests/racket/shared.rktl index 2e1f4c2171..2ed35dc51c 100644 --- a/pkgs/racket-test-core/tests/racket/shared.rktl +++ b/pkgs/racket-test-core/tests/racket/shared.rktl @@ -49,4 +49,6 @@ (test an-a 'an-a (shared ([t (a 1 t)]) t))) +(test 42 values (shared ((b ((thunk 42)))) b)) +(test 42 unbox (shared ((b (box-immutable ((thunk 42))))) b)) (report-errs) diff --git a/racket/collects/racket/private/shared-body.rkt b/racket/collects/racket/private/shared-body.rkt index f3337d396c..3aec1bfd16 100644 --- a/racket/collects/racket/private/shared-body.rkt +++ b/racket/collects/racket/private/shared-body.rkt @@ -76,18 +76,20 @@ [same-special-id? (lambda (a b) ;; Almost module-or-top-identifier=?, ;; but handle `the-cons' specially - (or (free-identifier=? - a - (if (eq? 'the-cons (syntax-e b)) - cons-id - b)) - (free-identifier=? - a - (datum->syntax - #f - (if (eq? 'the-cons (syntax-e b)) - 'cons - (syntax-e b))))))] + (and (identifier? a) + (identifier? b) + (or (free-identifier=? + a + (if (eq? 'the-cons (syntax-e b)) + cons-id + b)) + (free-identifier=? + a + (datum->syntax + #f + (if (eq? 'the-cons (syntax-e b)) + 'cons + (syntax-e b)))))))] [remove-all (lambda (lst rmv-lst) (define (remove e l) (cond