syntax-debug-info: handle non-identifiers correctly

In particular, fix the handling of binding information
when the context includes prefixing on import.

Closes PR 15173
This commit is contained in:
Matthew Flatt 2015-10-30 11:28:14 -04:00
parent 31b035cc94
commit 342198625e
2 changed files with 15 additions and 0 deletions

View File

@ -1814,6 +1814,18 @@
(test #t free-identifier=? #'begin (syntax-case a-b-stx ()
[(b . _) (datum->syntax #'b 'begin)]))))
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; syntax-debug-info
(let ([check (lambda (syntax-debug-info)
(test 'x hash-ref (syntax-debug-info #'x) 'name)
(test 'nope hash-ref (syntax-debug-info #'1) 'name 'nope)
(test 'nope hash-ref (syntax-debug-info #'(x y)) 'name 'nope))])
(check syntax-debug-info)
(parameterize ([current-namespace (make-base-namespace)])
(eval '(require (prefix-in foo: racket/base)))
(check (lambda (stx) (syntax-debug-info (namespace-syntax-introduce stx))))))
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Check that attacks are thwarted via `syntax-local-get-shadower'
;; or `make-syntax-delta-introducer':

View File

@ -4679,6 +4679,9 @@ static Scheme_Object *unmarshal_lookup_adjust(Scheme_Object *sym, Scheme_Object
Scheme_Hash_Tree *excepts;
Scheme_Object *prefix;
if (!SCHEME_SYMBOLP(sym))
return scheme_false;
excepts = extract_unmarshal_excepts(SCHEME_VEC_ELS(pes)[3]);
prefix = extract_unmarshal_prefix(SCHEME_VEC_ELS(pes)[3]);