diff --git a/racket/src/expander/extract/flatten.rkt b/racket/src/expander/extract/flatten.rkt index a905ba94e0..df8ced8c09 100644 --- a/racket/src/expander/extract/flatten.rkt +++ b/racket/src/expander/extract/flatten.rkt @@ -150,8 +150,11 @@ (cond [(find-knot-tying-alternate knot-ties lnk (car external+local) linklets) => (lambda (alt-lnk) - (unless (eq? alt-lnk 'ignore) - (add-subst! alt-lnk external+local knot-ties)))] + (if (eq? alt-lnk 'ignore) + ;; Map to original name: + (hash-set! substs (cdr external+local) (car external+local)) + ;; Map to alt-link: + (add-subst! alt-lnk external+local knot-ties)))] [else (hash-set! substs (cdr external+local) @@ -180,7 +183,15 @@ 'ignore] [else (define alt-lnk (link alt-path 0)) - (define li (hash-ref linklets alt-lnk)) + (define li (hash-ref linklets alt-lnk + (lambda () + (error 'flatten + (string-append "module for knot tying is not part" + " of the flattened module's implementation\n" + " module: ~a\n" + " attempted redirect for: ~a") + (link-name alt-lnk) + (link-name lnk))))) (define exports+locals (bootstrap:s-expr-linklet-exports+locals (linklet-info-linklet li))) (for/or ([export+local (in-list exports+locals)]) (and (eq? external (car export+local)) diff --git a/racket/src/expander/run.rkt b/racket/src/expander/run.rkt index 13f6bc837d..4c6671bbdd 100644 --- a/racket/src/expander/run.rkt +++ b/racket/src/expander/run.rkt @@ -108,19 +108,20 @@ [("-B") "Print extracted bootstrap as bytecode" (set! extract-to-bytecode? #t)] #:multi - [("++knot") sym path "Redirect imports from to flattened from " + [("++knot") primitive-table path ("Redirect imports from #% to flattened from ;" + " use `-` for to leave as-is, effectively redirecting to a primitive use") (hash-update! instance-knot-ties - (string->symbol (format "#%~a" sym)) + (string->symbol (format "#%~a" primitive-table)) (lambda (l) (cons (if (equal? path "-") 'ignore (path->complete-path (normal-case-path path))) l)) null)] - [("++direct") primitive-table "Redirect imports from #% to direct references" + [("++direct") primitive-table "Redirect from `(primitive-table '#%)` to primitive use" (hash-set! primitive-table-directs (string->symbol (string-append "#%" primitive-table)) "")] - [("++direct-prefixed") primitive-table "Like ++direct, but prefixes with :" + [("++direct-prefixed") primitive-table "Like ++direct, but prefix with :" (hash-set! primitive-table-directs (string->symbol (string-append "#%" primitive-table)) (string-append primitive-table ":"))]