fix expander tracking of unbound phase-1 identifiers

Thanks to Mitchell McLean and Jacob Ginspark for the report.
This commit is contained in:
Matthew Flatt 2018-02-11 13:23:54 -07:00
parent 60b6b43485
commit ecde607a62
2 changed files with 21 additions and 4 deletions

View File

@ -2037,4 +2037,19 @@
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(module provide-transformer-set!-and-broken-module-begin racket
(provide
(for-syntax set!)
(rename-out (defined-begin #%module-begin)))
(define-syntax (defined-begin stx)
(syntax-case stx ()
[(_ e ...)
#`(#%plain-module-begin #,@(map expand (syntax->list #'(e ...))))])))
(err/rt-test (eval '(module m 'provide-transformer-set!-and-broken-module-begin (set! x 1)))
exn:fail:syntax?)
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(report-errs)

View File

@ -692,10 +692,12 @@ void scheme_register_unbound_toplevel(Scheme_Comp_Env *env, Scheme_Object *id)
{
Comp_Prefix *cp = env->prefix;
if (!cp->unbound) cp->unbound = scheme_null;
id = scheme_make_pair(id, cp->unbound);
cp->unbound = id;
if (cp) {
if (!cp->unbound) cp->unbound = scheme_null;
id = scheme_make_pair(id, cp->unbound);
cp->unbound = id;
}
}
void scheme_merge_undefineds(Scheme_Comp_Env *exp_env, Scheme_Comp_Env *env)