expander: fix order of unbound-identifier compilants at phase > 0

Closes #2167
This commit is contained in:
Matthew Flatt 2018-07-11 04:25:43 -06:00
parent 6bc8369af5
commit 80e353c143
3 changed files with 18 additions and 2 deletions

View File

@ -2277,6 +2277,22 @@
(begin-for-syntax
(local-expand #'(#%plain-module-begin (m #f)) 'module-begin '())))
;; ----------------------------------------
;; Check order of complaints for unbound identifiers
(define (check-complain-first m)
(err/rt-test (eval m)
(lambda (x)
(regexp-match? #rx"complain-about-this-one" (exn-message x)))))
(check-complain-first '(module m racket/base
(define (f a)
(complain-about-this-one (not-about-this-one)))))
(check-complain-first '(module m racket/base
(require (for-syntax racket/base))
(define-syntax (f a)
(complain-about-this-one (not-about-this-one)))))
;; ----------------------------------------
(report-errs)

View File

@ -1035,7 +1035,7 @@
(define (check-defined-by-now need-eventually-defined self ctx requires+provides)
;; If `need-eventually-defined` is not empty, report an error
(for ([(phase l) (in-hash need-eventually-defined)])
(for ([id (in-list l)])
(for ([id (in-list (reverse l))])
(define b (resolve+shift id phase))
(define bound-here? (and b
(module-binding? b)

View File

@ -75577,7 +75577,7 @@ static const char *startup_source =
"(begin"
"(let-values()"
"(begin"
"(let-values(((lst_447) l_89))"
"(let-values(((lst_447)(reverse$1 l_89)))"
"(begin"
"(if(variable-reference-from-unsafe?"
"(#%variable-reference))"