solidity
solidity copied to clipboard
Improve Error Reporting of SemVer Parser
Hi @chriseth Apologies for taking so long to coming around to this. I've made some of the edits you mentioned but I see some tests failing , e.g.,:
/solidity/test/boostTest.cpp:120: error: in "syntaxTests/pragma/broken_version_5": Exception during extracted test: /solidity/libsolidity/parsing/Parser.cpp(166): Throw in function void solidity::frontend::Parser::parsePragmaVersion(const solidity::langutil::SourceLocation &, const vector<solidity::langutil::Token> &, const vector<std::string> &) Dynamic exception type: boost::wrapexcept<solidity::langutil::SemVerError> std::exception::what: Invalid versionPart: _ [solidity::util::tag_comment*] = Invalid versionPart: _
/solidity/test/boostTest.cpp:120: error: in "syntaxTests/pragma/broken_version_4": Exception during extracted test: /solidity/libsolidity/parsing/Parser.cpp(166): Throw in function void solidity::frontend::Parser::parsePragmaVersion(const solidity::langutil::SourceLocation &, const vector<solidity::langutil::Token> &, const vector<std::string> &) Dynamic exception type: boost::wrapexcept<solidity::langutil::SemVerError> std::exception::what: Invalid versionPart: ( [solidity::util::tag_comment*] = Invalid versionPart: (
Whilst I debug them I was hoping you might be able to take a look and see whether this is more inline with what you were thinking following your comments.
I had to decline the old PR as trying to sync with the branch I accidentally pulled a load of unwanted commits.
Thanks
This looks very good already!
Needs review again
Hey @chriseth - just a friendly chase on this PR - the only outstanding thing I believe is now the failing test broken_version_7.sol
mentioned previously and a subsequent re-review. Any suggestions on how to progress so we can get this merged?
@nishant-sachdeva Maybe you could help @vinayman with the test here?
is @nishant-sachdeva taking over this PR?
I am taking over instead of @nishant-sachdeva. Unless, OP decides to return, but it seems a long time has already passed with no contact...
Summary of changes since takeover:
- small case pragma in error msgs
- minor changes in string concatenation in error msgs
- assert no
SemVerError
before getting value out of variant at line 160 ofSyntaxChecker.cpp
- add message when pragma version suddenly ends (broken test)
- removed error code 9981 (added earlier i guess but then not used currently)
- rebased
Rebased on develop after applying review suggestions.
@matheusaaguiar another rebase pleae :D
Rebased!
Hmm, looks good now, but I'm wondering whether this will need a changelog entry due to the changed error messages? @ekpyron
I have defaulted to a 'yes' and added an entry, as recommended in the other PR.
Rebased.
@cameel I have added the tests and made the changes you suggested. Also rebased.
Also review fixes should be squashed.