fix expand on a module containing a #%declare form

This commit is contained in:
Matthew Flatt 2014-07-30 08:49:28 +01:00
parent 21f78ecd14
commit b95baa1d25
2 changed files with 17 additions and 3 deletions

View File

@ -116,5 +116,21 @@
'(module m '#%kernel
(#%declare #:cross-phase-persistent))))))
;; Check that `expand` produces valies syntax
(let ()
(define e
(syntax->datum
(parameterize ([current-namespace (make-base-namespace)])
(expand '(module m '#%kernel
(#%declare #:cross-phase-persistent))))))
(let loop ([e e])
(cond
[(syntax? e) (loop (syntax-e e))]
[(pair? e) (loop (car e)) (loop (cdr e))]
[(null? e) (void)]
[(symbol? e) (void)]
[(keyword? e) (void)]
[else (error 'expand-test "unexpected value: ~e" e)])))
(displayln "All tests passed.")

View File

@ -9312,9 +9312,7 @@ static Scheme_Object *do_module_begin_at_phase(Scheme_Object *form, Scheme_Comp_
SCHEME_EXPAND_OBSERVE_NEXT(observer);
if (kind == SAVED_MODFORM_KIND) {
expanded_l = scheme_make_pair(SCHEME_CDR(e), expanded_l);
SCHEME_CAR(p) = SCHEME_CAR(e);
prev_p = p;
expanded_l = scheme_make_pair(e, expanded_l);
p = SCHEME_CDR(p);
} else if ((kind == PROVIDE_MODFORM_KIND)
|| (kind == MODULE_MODFORM_KIND)) {