From a6cfe3d5fbdf8c8f38fc6470fcdb9320d4debc7d Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Sun, 11 Nov 2012 06:26:57 -0700 Subject: [PATCH] fix `resolve-module-path-index' when w.r.t. is submodule A submodule path on the w.r.t. path was incorrectly (in most cases) added to the resolved path. --- collects/syntax/modresolve.rkt | 30 ++++++++++++------------------ collects/tests/racket/moddep.rktl | 5 +++++ 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/collects/syntax/modresolve.rkt b/collects/syntax/modresolve.rkt index 903f50c61a..6980a3efe7 100644 --- a/collects/syntax/modresolve.rkt +++ b/collects/syntax/modresolve.rkt @@ -67,34 +67,28 @@ [(string? s) ;; Parse Unix-style relative path string (define-values (dir submod) (get-dir)) - (combine-submod - (path-ss->rkt - (apply build-path dir (explode-relpath-string s))) - submod)] + (path-ss->rkt + (apply build-path dir (explode-relpath-string s)))] [(and (or (not (pair? s)) (not (list? s))) (not (path? s))) #f] [(or (path? s) (eq? (car s) 'file)) (let ([p (if (path? s) s (expand-user-path (cadr s)))]) (define-values (d submod) (get-dir)) - (combine-submod - (path-ss->rkt - (path->complete-path - p - (if (path-string? d) - d - (or (current-load-relative-directory) - (current-directory))))) - submod))] + (path-ss->rkt + (path->complete-path + p + (if (path-string? d) + d + (or (current-load-relative-directory) + (current-directory))))))] [(or (eq? (car s) 'lib) (eq? (car s) 'quote) (eq? (car s) 'planet)) ;; use resolver handler in this case, too: (define-values (d submod) (force-relto relto #f #:path? #f)) - (combine-submod - (resolved-module-path-name - (module-path-index-resolve - (module-path-index-join s #f))) - submod)] + (resolved-module-path-name + (module-path-index-resolve + (module-path-index-join s #f)))] [(eq? (car s) 'submod) (define r (cond [(or (equal? (cadr s) ".") diff --git a/collects/tests/racket/moddep.rktl b/collects/tests/racket/moddep.rktl index 909b7eef97..82e27fb847 100644 --- a/collects/tests/racket/moddep.rktl +++ b/collects/tests/racket/moddep.rktl @@ -98,6 +98,11 @@ (module-path-index-join #f #f '(sub1))) `(submod ,(build-path (current-directory) "x.rkt") sub3)) +(test (build-path (current-directory) "z.rkt") + resolve-module-path-index + (module-path-index-join "z.rkt" #f) + `(submod ,(build-path (current-directory) "x.rkt") sub3)) + ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; collapse-module-path[-index]