brownplt / pyret-lang

The Pyret language.
Other
1.06k stars 106 forks source link

Module names shouldn't shadow if they refer to the same module #1744

Open jpolitz opened 1 month ago

jpolitz commented 1 month ago

This program reports a shadowing error:

import lists as lists
import lists as lists

It shouldn't. We have similar logic for cases like this (which is not a shadowing errror):

use context starter2024 # imports e.g. map, filter
import lists as lists
include from lists: map, filter end

We should make the first program not be a shadowing error, either (note it's the simple case – the more complex cases involve transitive includes, include from X: module Y end and so on). The function make-import-atom-for has the “right” logic, though finding the underlying URL of the referred module may take some more work.