Conversation
58efdde to
cc6e5fc
Compare
362d656 to
654dc3f
Compare
|
Here's a short update on the current status on this PR:
|
2a89fdc to
52c5c9e
Compare
c2e67e1 to
c1e4cb8
Compare
b5820f0 to
db0029b
Compare
c1e4cb8 to
d85b750
Compare
7e9230d to
350a950
Compare
d85b750 to
992c868
Compare
0763219 to
9cd715b
Compare
|
This PR is now working correctly on all platforms. It still depends on the CLI refactor so I have created an equivalent PR without the CLI tests that does not: #11617. These tests turned out to be crucial as I suspected though. There were tons of weird cases and the |
b1ba2bd to
444d863
Compare
|
|
||
| void FileReader::setBasePath(boost::filesystem::path const& _path) | ||
| { | ||
| m_basePath = (_path.empty() ? "" : normalizeCLIPathForVFS(_path)); |
There was a problem hiding this comment.
What about setting normalizeCLIPathForVFS(".") already here, if _path is empty? With this m_basePath would always contain a valid path.
There was a problem hiding this comment.
The problem is that "" is a special case that is not equivalent to any specific path.
For example if I use the working dir as you're suggesting, it will break absolute paths - import "/x/y.sol" will try to load x.y.sol from work dir rather than the absolute /x/y.sol.
Using / would keep absolute paths working but it would relative paths - import "x/y.sol" would try to load /x.y.sol.
So these two values are out and I can't think of any other path that would keep --base-path="" working as it does now.
444d863 to
fa9576f
Compare
|
While working on #11409 I found a small bug introduced in this PR: standard input was not being handled correctly in combination with base path. I have also squashed the older fixups. |
| @@ -451,7 +451,7 @@ bool CommandLineInterface::readInputFiles() | |||
| m_standardJsonInput = readUntilEnd(m_sin); | |||
There was a problem hiding this comment.
Not related but this line seems to have its indentation off. Could you fix it since you're touching the file already?
There was a problem hiding this comment.
Sure, but the indent on this line and others around it look fine to me (it's all tabs). Is this the right line?
There was a problem hiding this comment.
Hm it looked weird on GitHub, not sure then.
There was a problem hiding this comment.
Yeah, github renders tabs in a weird way - as if they were shifted left relative to the beginning of the line. Really annoying.
| } | ||
| else | ||
| m_fileReader.setSource(g_stdinFileName, readUntilEnd(m_sin)); | ||
| m_fileReader.setStdin(readUntilEnd(m_sin)); |
There was a problem hiding this comment.
Is this the only place we read from stdin?
There was a problem hiding this comment.
Yeah. This and the one 3 lines up. It used to be done separately for Standard JSON but I unified that in #11544 so that it's now done here for all input modes.
|
|
||
| void FileReader::setStdin(SourceCode _source) | ||
| { | ||
| m_sourceCodes["<stdin>"] = std::move(_source); |
There was a problem hiding this comment.
Where do we use m_sourceCodes["<stdin>"]? I'm wondering if the key "<stdin>" can get misused/misplaced somewhere
There was a problem hiding this comment.
It's passed along with all the other input files to the compiler stack. You can technically import it just like a normal file with import "<stdin>" because that's its source unit name. This is a pre-existing behavior documented in https://docs.soliditylang.org/en/latest/path-resolution.html#index-3.
It's possible to have a file that gets the same source unit name:
echo 'contract A {}' > '<stdin>'
echo 'contract B {}' | solc '<stdin>' - --base-path .this line would then overwrite the content of that file in FileReader and replace it with the content of standard input. Not great but I think that <stdin> as a file name is obscure enough that it does not really matter all that much.
In any case this is how the compiler already worked before and my PR does not change that. I only added a dedicated function for adding content for this source unit name because setSource() now performs normalization and we obviously do not want that here.
fa9576f to
37fed1e
Compare
|
I just pushed an updated version. It removes |
| libsolidity/SyntaxTest.h | ||
| libsolidity/ViewPureChecker.cpp | ||
| libsolidity/analysis/FunctionCallGraph.cpp | ||
| libsolidity/interface/FileReader.cpp |
There was a problem hiding this comment.
What about libsolidity/interface/FileReader.h?
There was a problem hiding this comment.
Boost tests typically do not have header files. Boost can find and run them without it.
The ones that do have headers here are actually a part of soltest/isoltest implementation and not test cases.
37fed1e to
83a9983
Compare
|
@aarlt Fixes applied. Ready for another round. |
83a9983 to
13f46eb
Compare
|
Thanks @leonardoalt! Could you reapprove? I just squashed the fixups. |
Fixes #4702.
Implements the
solcpart of #11408.solc-jschanges will be submitted in that repo.Depends on #11544.Merged.This still work in progress. I'd say It's about 90% done. There's not much implementation left (it's very small overall) but some corner cases are not yet handled or not handled properly:
//(UNC paths)...to go beyond filesystem root (boost's normalization does not squash/../into/)./(rather than drive letter on Windows) when they're on the same partition as CWD.