[plt-dev] Weird bug

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Tue Mar 17 20:51:43 EDT 2009

At Tue, 17 Mar 2009 16:30:35 -0600, Jay McCarthy wrote:
> I have a planet package with a file called main that exports 'error'
> 
> When I try to run the following module:
> 
> #lang scheme
> (require (planet cce/scheme:4:1/planet))
> (require (for-label (only-in (this-package-in main)
>                               error)))
> 
> I get the following error:
> 
> module: identifier already imported from a different source in:
>   error
>   (rename (planet plai/plai:1:0/main) error error)
>   (rename (planet plai/plai:1:0/main) error error)

I can provoke this error by creating "main.ss" as

 #lang scheme
 (require "other.ss")
 (define-for-syntax error 5)
 (provide error 
          (for-syntax error))

where "other.ss" also exports `error' (at phase level 0).

So, "main.ss" exports different `error' bindings at phase levels 0 and
1. That creates a conflict for the `for-label' import, because
`for-label' collapses all phases, and thus ends up with two different
`error' bindings.

Is that what happens in your program? 


I see that defining "main.ss" as

 #lang scheme
 (define error 5)
 (define-for-syntax error 5)
 (provide error 
          (for-syntax error))

doesn't trigger an error, but that's a bug. The `require' form is
apparently checking just the id and module, which is the same, but it
should also compare the source phase levels.



Posted on the dev mailing list.