A leading lib segment in an import path is special syntax: classifyModulePath (src/Solcore/Frontend/Parser/Decl.hs:96-98) strips it and resolves the rest from the library root. This appears to be undocumented, and the SC0109 diagnostic does not reveal it, which makes the failure genuinely hard to debug when a file physically exists at <root>/lib/X.solc:
repro/
A.solc
lib/
helpers.solc
// A.solc
import std.{*};
import std.dispatch.{*};
import lib.helpers.{*};
contract A {
constructor() {}
public function f() -> uint256 { return fortytwo(); }
}
// lib/helpers.solc
import std.{*};
export {
fortytwo
};
function fortytwo() -> uint256 {
return uint256(42);
}
sol-core -f repro/A.solc --root repro
->
error[SC0109]: import lib.helpers: file not found
--> repro/A.solc:3:8
|
3 | import lib.helpers.{*};
| ^^^^^^^^^^^ module reference
help: check the module path or add the missing source file
The file the import names in the obvious reading (repro/lib/helpers.solc) exists; the candidate actually probed is repro/helpers.solc, but the diagnostic never says so. Moving the file to repro/helpers.solc (keeping import lib.helpers) compiles fine.
Seen on current main (1d490d8, nix build).
A leading
libsegment in an import path is special syntax:classifyModulePath(src/Solcore/Frontend/Parser/Decl.hs:96-98) strips it and resolves the rest from the library root. This appears to be undocumented, and the SC0109 diagnostic does not reveal it, which makes the failure genuinely hard to debug when a file physically exists at<root>/lib/X.solc:->
The file the import names in the obvious reading (
repro/lib/helpers.solc) exists; the candidate actually probed isrepro/helpers.solc, but the diagnostic never says so. Moving the file torepro/helpers.solc(keepingimport lib.helpers) compiles fine.Seen on current main (1d490d8, nix build).