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:
agra
2026-06-11 08:37:36 +03:00
parent 12bf61a9fc
commit 698f75d79a
7 changed files with 50 additions and 1 deletions

View File

@@ -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).