Top-level cyclic imports fail
Bug #408296 reported by
Matt Giuca
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Mars |
Fix Released
|
Medium
|
Matt Giuca |
Bug Description
If the top-level module of a Mars program is involved in a cyclic import, its functions are duplicated and a compiler error occurs.
This is demonstrated in test case compiler/
import2b.mar:
import import2c
def b(...):
...
import2c.mar:
def c(...):
...
import import2b
$ mars -i import2b.mar
import2b.mar:25: Duplicate function name: b.
This only happens at the top level. (import2a.mar imports import2b which has a cyclic import, and that is handled correctly).
(The "top level" refers to the module being directly opened in the mars interpreter).
Related branches
Changed in mars: | |
assignee: | nobody → Matt Giuca (mgiuca) |
importance: | Undecided → Medium |
status: | New → Confirmed |
Changed in mars: | |
status: | Confirmed → Triaged |
Changed in mars: | |
milestone: | none → 0.2.1 |
Changed in mars: | |
status: | Triaged → In Progress |
Changed in mars: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
This happens since this file is not imported, but loaded directly. It doesn't have a "module name", so it isn't caught - this causes "duplicate function defined" errors.
First, fix bug #439168 ("add :l command to load a module"). Then, replace top-level loading with an invocation of :l, which does a proper import of a module.