lang: reject dir-vs-file ambiguous #import
An extensionless import path that names a directory next to a same-named
.sx file ('modules/std' with both modules/std.sx and modules/std/ present)
no longer silently resolves to the directory — it errors and asks for the
explicit .sx spelling. Exemption: a file importing its own companion
directory (X.sx importing X/, the multi-file test layout) stays legal —
the sibling file is the importer itself, so the directory is the only
sensible target.
This commit is contained in:
@@ -398,6 +398,10 @@ Direct C header import:
|
||||
math :: #import "modules/math"; // namespaced import (directory: all .sx files merged)
|
||||
```
|
||||
|
||||
A path that matches both a file and a same-named sibling directory
|
||||
(`modules/std.sx` next to `modules/std/`) is rejected as ambiguous — write the
|
||||
`.sx` path to import the file.
|
||||
|
||||
When two flat-imported modules each define a function of the same name, every
|
||||
module's own code binds its OWN author — a bare call resolves to the same-name
|
||||
function in the caller's module (or in its single flat import that provides it).
|
||||
|
||||
Reference in New Issue
Block a user