From 111a7e085de61c2b613f4e4933d120e0376eaba2 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Fri, 14 Aug 2015 07:23:33 -0600 Subject: [PATCH] fix prefab checking in printer Mishandling of a chaproned prefab when, for example, determining whether to use quoted printing caused the `tests/compiler/zo` test to sometimes fail. --- racket/src/racket/src/print.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/racket/src/racket/src/print.c b/racket/src/racket/src/print.c index 5228663ab4..38c338849d 100644 --- a/racket/src/racket/src/print.c +++ b/racket/src/racket/src/print.c @@ -159,7 +159,9 @@ static Scheme_Object *writable_struct_subs(Scheme_Object *s, int for_write, Prin #define print_compact(pp, v) print_this_string(pp, &compacts[v], 0, 1) #define PRINTABLE_STRUCT(obj, pp) (scheme_inspector_sees_part(obj, pp->inspector, -1)) -#define SCHEME_PREFABP(obj) (((Scheme_Structure *)(obj))->stype->prefab_key) +#define SCHEME_PREFABP(obj) (SCHEME_CHAPERONEP(obj) \ + ? ((Scheme_Structure *)SCHEME_CHAPERONE_VAL(obj))->stype->prefab_key \ + : ((Scheme_Structure *)(obj))->stype->prefab_key) #define SCHEME_HASHTPx(obj) ((SCHEME_HASHTP(obj) && !(MZ_OPT_HASH_KEY(&(((Scheme_Hash_Table *)obj)->iso)) & 0x1))) #define SCHEME_CHAPERONE_HASHTPx(obj) (SCHEME_HASHTPx(obj) \ @@ -2508,8 +2510,7 @@ print(Scheme_Object *obj, int notdisplay, int compact, Scheme_Hash_Table *ht, } else if (SCHEME_CHAPERONE_STRUCTP(obj)) { - if (compact && (SCHEME_PREFABP(obj) || (SCHEME_CHAPERONEP(obj) - && SCHEME_PREFABP(SCHEME_CHAPERONE_VAL(obj))))) { + if (compact && SCHEME_PREFABP(obj)) { Scheme_Object *vec, *prefab; print_compact(pp, CPT_PREFAB); prefab = scheme_prefab_struct_key(obj);