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:
11
examples/1158-diagnostics-import-dir-file-ambiguous.sx
Normal file
11
examples/1158-diagnostics-import-dir-file-ambiguous.sx
Normal file
@@ -0,0 +1,11 @@
|
||||
// An extensionless #import that matches BOTH a `.sx` file and a sibling
|
||||
// directory of the same name is ambiguous — the compiler refuses to pick
|
||||
// silently and asks for the explicit `.sx` spelling. `modules/std` is the
|
||||
// canonical collision: `modules/std.sx` (the prelude) sits next to
|
||||
// `modules/std/` (mem/fs/process/...).
|
||||
|
||||
#import "modules/std";
|
||||
|
||||
main :: () -> s32 {
|
||||
0
|
||||
}
|
||||
Reference in New Issue
Block a user