morloc-project / morloc

A typed, polyglot, functional language
GNU General Public License v3.0
195 stars 4 forks source link

Importing both a parent and grandparent raises a "Cyclic Dependency" error #10

Closed arendsee closed 4 years ago

arendsee commented 4 years ago

The following code raises a "Cyclic dependency" error.

import math (sqrt, sum, mul)
import cppbase (map)

export square;
export rms;

square x = mul x x;
rms xs = sqrt (sum (map square xs));

The reason is that, since math imports cppbase, cppbase is imported twice. There are two problems with this. First of all, this is definitely not a cycle, so the error message is deceptive. Second, there shouldn't be an error message since it is perfectly OK for a module to import functions from both a parent and grandparent.

arendsee commented 4 years ago

After ignoring this bug for 8 days, it got bored and wandered off. Rerunning the code above raises no errors. I do not understand what happened.

I am writing a test for this case in the current dev branch. If it returns, I will catch it and reopen this issue.