Change collapse-module-path-index's contract so that it accepts a #false return value, as this can occur when collapsing an empty module-path-index such as the one occurring on an identifier created by syntax-local-lift-expression
This commit is contained in:
parent
81cb99038c
commit
b55b74ec16
|
@ -54,7 +54,7 @@ base.
|
|||
(-> module-path?))])
|
||||
module-path?]
|
||||
[(collapse-module-path-index [module-path-index module-path-index?])
|
||||
module-path?])]{
|
||||
(or/c module-path? #f)])]{
|
||||
|
||||
Like @racket[collapse-module-path] when given two arguments, but the
|
||||
input is a @techlink[#:doc refman]{module path index}; in this case,
|
||||
|
@ -67,7 +67,14 @@ is relative. The resulting module path is not necessarily normalized.
|
|||
|
||||
@history[#:changed "6.1.1.8" @elem{Added the one-argument variant for
|
||||
collapsing a relative module path
|
||||
index.}]}
|
||||
index.}
|
||||
#:changed "6.9.0.4" @elem{The one-argument variant may return
|
||||
@racket{#false}, e.g. for an empty
|
||||
module path index such as the
|
||||
@racket{source-mod} and
|
||||
@racket{nominal-source-mod} of an
|
||||
identifier created with
|
||||
@racket{syntax-local-lift-expression}.}]}
|
||||
|
||||
|
||||
@close-eval[evaluator]
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#lang racket/base
|
||||
(require syntax/modcollapse)
|
||||
(require syntax/modcollapse
|
||||
(for-syntax racket/base
|
||||
syntax/modcollapse))
|
||||
|
||||
(define (check got expected)
|
||||
(unless (equal? got expected)
|
||||
|
@ -153,3 +155,15 @@
|
|||
here)
|
||||
(build-path here-dir "x" "apple.rkt"))
|
||||
|
||||
|
||||
(define-syntax (try-collapse-empty-module-path-index stx)
|
||||
(datum->syntax
|
||||
#f
|
||||
#`'#,(collapse-module-path-index
|
||||
(car
|
||||
(identifier-binding
|
||||
(syntax-local-lift-expression
|
||||
(quote-syntax 1)))))))
|
||||
|
||||
(check (try-collapse-empty-module-path-index)
|
||||
#f)
|
|
@ -32,7 +32,7 @@
|
|||
. -> . simple-rel-to-module-path-v/c)]
|
||||
[collapse-module-path-index (case->
|
||||
(module-path-index?
|
||||
. -> . module-path?)
|
||||
. -> . (or/c module-path? #f))
|
||||
((or/c symbol? module-path-index?)
|
||||
rel-to-module-path-v/c
|
||||
. -> . simple-rel-to-module-path-v/c))])
|
||||
|
|
Loading…
Reference in New Issue
Block a user