Inconsistent name resolution if module and type names are the same
Take the example above - file Mod.enso has contents:
type Mod
Ctor
static = "ms"
member self = "mm"
type Other
static = "os"
then run Main.enso:
from Standard.Base import all
from project.Mod import Mod
main =
ms = Panic.recover Any Mod.static
os = Panic.recover Any Mod.Other.static
m4 = Panic.recover Any Mod.Mod.Mod.Mod
m4s = Panic.recover Any Mod.Mod.Mod.Mod.static
[ms, os, m4, m4s]
Actual behaviour
The above script yields:
m4s = Error:Error Mod UnresolvedSymbol<static>
['ms', 'os', Mod, (Error: (No_Such_Method.Error Mod UnresolvedSymbol<static>))]
Expected behaviour
A few things are inconsistent here.
We are importing type Mod from module Mod.
Thus in main, the binding Mod should refer to the type Mod, right?
Thus the value of ms is correct.
However, Mod.Other.static should not resolve - since Other is not defined on type Mod but it's its sibling defined on the module Mod.
Interestingly m4 also shows that we have some kind of circular reasoning - Mod.Mod.Mod.Mod (repeating as many times as you like) resolves back to Mod. But m4s shows that this type is somehow broken (maybe it's the module?) because it lacks the expected method static (found at ms).
I think the expected behaviour should be that actually only ms == 'ms' and the other 3 should be errors, some of which can even be caught at compile time.