fix immutability of some syntax-e results

Internally, when scopes are propagated to nested syntax objects,
vectors and boxes were not reconstructed as immutable.

Closes #1745
This commit is contained in:
Matthew Flatt 2017-07-14 07:37:55 -06:00
parent 2e77279be0
commit d081586959
2 changed files with 9 additions and 0 deletions

View File

@ -228,6 +228,12 @@
(define-define-stx stx-with-property)
(test 'y syntax-property stx-with-property 'x)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Check immutability
(test #t immutable? (syntax-e #'#(1 2)))
(test #t immutable? (syntax-e #'#&1))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Plain s, se derived from part of s

View File

@ -2196,6 +2196,7 @@ static Scheme_Object *raw_stx_content(Scheme_Object *o)
shifts,
add_taint, false_insp);
v = scheme_box(result);
SCHEME_SET_BOX_IMMUTABLE(v);
} else if (SCHEME_VECTORP(v)) {
Scheme_Object *v2;
int size = SCHEME_VEC_SIZE(v), i;
@ -2209,6 +2210,8 @@ static Scheme_Object *raw_stx_content(Scheme_Object *o)
add_taint, false_insp);
SCHEME_VEC_ELS(v2)[i] = result;
}
SCHEME_SET_VECTOR_IMMUTABLE(v2);
v = v2;
} else if (SCHEME_HASHTRP(v)) {