Top-level cyclic imports fail

Bug #408296 reported by Matt Giuca
6
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 and import2c.mar.

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

Matt Giuca (mgiuca)
Changed in mars:
assignee: nobody → Matt Giuca (mgiuca)
importance: Undecided → Medium
status: New → Confirmed
Matt Giuca (mgiuca)
Changed in mars:
status: Confirmed → Triaged
Revision history for this message
Matt Giuca (mgiuca) wrote :

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.

Matt Giuca (mgiuca)
Changed in mars:
milestone: none → 0.2.1
Matt Giuca (mgiuca)
Changed in mars:
status: Triaged → In Progress
Revision history for this message
Matt Giuca (mgiuca) wrote :

Fixed in trunk r922.

Changed in mars:
status: In Progress → Fix Committed
Matt Giuca (mgiuca)
Changed in mars:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.