expander: correct some namespace-mismatch error formats

Related to #1352
This commit is contained in:
Matthew Flatt 2021-04-28 07:11:00 -06:00
parent 8962b027fe
commit f4ccd0fdc6
4 changed files with 58 additions and 37 deletions

View File

@ -14370,7 +14370,15 @@ static const char *startup_source =
"(if or-part_1"
" or-part_1"
"(if complain-on-failure?_0"
" (error \"no module instance found:\" name_0 0-phase_0)"
"(error"
" 'require"
"(string-append"
" \"namespace mismatch;\\n\""
" \" reference to a module that is not instantiated\\n\""
" \" module: ~a\\n\""
" \" phase: ~a\")"
" name_0"
" 0-phase_0)"
" #f)))))))"
"(if(if mi_0 check-available-at-phase-level_0 #f)"
"(check-availablilty mi_0 check-available-at-phase-level_0 unavailable-callback_0)"
@ -15460,17 +15468,18 @@ static const char *startup_source =
"(if mi_0"
"(void)"
"(let-values()"
"(error"
" 'expand"
"(raise-syntax-error$1"
" #f"
"(format"
"(string-append"
" \"namespace mismatch; cannot locate module instance\\n\""
" \" module: ~s\\n\""
" \"namespace mismatch;\\n\""
" \" cannot locate module instance\\n\""
" \" module: ~a\\n\""
" \" use phase: ~a\\n\""
" \" definition phase: ~a\\n\""
" \" for identifier: ~s\")"
"(module-binding-module b_0)"
" \" definition phase: ~a\")"
"(1/module-path-index-resolve(module-binding-module b_0))"
" phase_0"
"(module-binding-phase b_0)"
"(module-binding-phase b_0))"
" id_0)))"
" mi_0))))))"
"(define-values"

View File

@ -17294,7 +17294,12 @@
or-part_2
(if complain-on-failure?55_0
(error
"no module instance found:"
'require
(string-append
"namespace mismatch;\n"
" reference to a module that is not instantiated\n"
" module: ~a\n"
" phase: ~a")
name62_0
0-phase63_0)
#f))))))))
@ -18366,21 +18371,20 @@
(void))
(if mi_0
(void)
(raise-syntax-error$1
#f
(let ((app_0
(string-append
"namespace mismatch; cannot locate module instance\n"
" module: ~s\n"
"namespace mismatch;\n"
" cannot locate module instance\n"
" module: ~a\n"
" use phase: ~a\n"
" definition phase: ~a\n"
" for identifier: ~s")))
(let ((app_1 (module-binding-module b_0)))
(error
'expand
app_0
app_1
phase_0
(module-binding-phase b_0)
id_0))))
" definition phase: ~a")))
(let ((app_1
(1/module-path-index-resolve
(module-binding-module b_0))))
(format app_0 app_1 phase_0 (module-binding-phase b_0))))
id_0))
mi_0)))))
(define check-access
(lambda (b_0 mi_0 id_0 in-s_0 what_0)

View File

@ -30,14 +30,15 @@
(phase+ at-phase (module-binding-phase b)))
id))
(unless mi
(error 'expand
(string-append "namespace mismatch; cannot locate module instance\n"
" module: ~s\n"
(raise-syntax-error
#f
(format (string-append "namespace mismatch;\n"
" cannot locate module instance\n"
" module: ~a\n"
" use phase: ~a\n"
" definition phase: ~a\n"
" for identifier: ~s")
(module-binding-module b)
" definition phase: ~a")
(module-path-index-resolve (module-binding-module b))
phase
(module-binding-phase b)
(module-binding-phase b))
id))
mi)

View File

@ -270,7 +270,14 @@
(let ([c-ns (or (namespace-root-namespace ns) ns)])
(hash-ref (namespace-module-instances c-ns) name #f))
(and complain-on-failure?
(error "no module instance found:" name 0-phase))))
(error 'require
(string-append
"namespace mismatch;\n"
" reference to a module that is not instantiated\n"
" module: ~a\n"
" phase: ~a")
name
0-phase))))
(if (and mi check-available-at-phase-level)
(check-availablilty mi check-available-at-phase-level unavailable-callback)
mi))