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

@@ -0,0 +1,5 @@
error: ambiguous import 'modules/std': both a file 'modules/std.sx' and a directory 'modules/std' exist — write "modules/std.sx" to import the file
--> examples/1158-diagnostics-import-dir-file-ambiguous.sx:7:1
|
7 | #import "modules/std";
| ^^^^^^^^^^^^^^^^^^^^^^