﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	difficulty
1548	Extra modules leak into environment when using -j	megane		"Found by dieggsy on IRC.

When defining multiple modules in a single file and generating an import file for only one of those the namespace from the other modules leaks into the importing code.

In this case it's the srfi-13 leaking into the importing code. Just saying `(import m)` should only bring module `m`'s imports into the environment.

This seems to be a regression from C4.

{{{
(module helper *
        (import scheme)
        (import srfi-13)
        ;; (import chicken) (use srfi-13) ; for C4

        (define-syntax complex-foreign-lambda
          (ir-macro-transformer
           (lambda (e i c)
             `(begin)))))

(module m *)
}}}

;; 4.13.0
;; $ csc -s m.scm -j m && csi -qbn -e '(import m) (print (string-null? """") (string-null? ""1""))'
;; 
;; Error: unbound variable: string-null?

;; chicken-5.0.0rc2
;; $ csc -s m.scm -j m && csi -qbn -e '(import m) (print (string-null? """") (string-null? ""1""))'
;; #t#f

;; $ csc -debug 2 -s m.scm -j m
;; [canonicalized]
;; (##core#callunit library)
;; 
;; (##core#callunit eval)
;; 
;; (##core#callunit expand)
;; 
;; (##core#undefined)
;; 
;; (##core#undefined)
;; 
;; (##core#undefined)
;; 
;; (let ((t43 (##core#provide helper#)))
;;   (let ((t44 (scheme#eval '(import-syntax scheme srfi-13)))) ; <---- offending import
;;     (let ((t45 (##sys#register-compiled-module
;;                  'helper
;;                  'helper
;;                  (scheme#list)
;;                  '()
;;                  (scheme#list
;;                    (scheme#cons
;;                      'complex-foreign-lambda
;;                      (chicken.syntax#ir-macro-transformer
;;                        (##core#lambda (e37 i38 c39) (##sys#list 'begin)))))
;;                  (scheme#list))))
;;       (let ((t46 (chicken.load#load-extension 'srfi-13 '(srfi-13#) 'require)))
;;         (##core#undefined)))))
;; 
;; (##core#provide m#)
;; 
;; (##core#undefined)


"	defect	closed	major	5.2	compiler	5.0.0	fixed	macro		
