solidity icon indicating copy to clipboard operation
solidity copied to clipboard

Improve Error Reporting of SemVer Parser

Open vinayman opened this issue 2 years ago • 7 comments

vinayman avatar Mar 15 '22 18:03 vinayman

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

vinayman avatar Mar 15 '22 18:03 vinayman

This looks very good already!

chriseth avatar Mar 17 '22 11:03 chriseth

Needs review again

leonardoalt avatar Apr 04 '22 10:04 leonardoalt

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?

vinayman avatar Apr 21 '22 15:04 vinayman

@nishant-sachdeva Maybe you could help @vinayman with the test here?

cameel avatar Apr 25 '22 20:04 cameel

is @nishant-sachdeva taking over this PR?

leonardoalt avatar Aug 13 '22 13:08 leonardoalt

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...

matheusaaguiar avatar Sep 20 '22 14:09 matheusaaguiar

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 of SyntaxChecker.cpp
  • add message when pragma version suddenly ends (broken test)
  • removed error code 9981 (added earlier i guess but then not used currently)
  • rebased

matheusaaguiar avatar Sep 22 '22 13:09 matheusaaguiar

Rebased on develop after applying review suggestions.

matheusaaguiar avatar Oct 20 '22 16:10 matheusaaguiar

@matheusaaguiar another rebase pleae :D

nikola-matic avatar Nov 01 '22 12:11 nikola-matic

Rebased!

matheusaaguiar avatar Nov 01 '22 23:11 matheusaaguiar

Hmm, looks good now, but I'm wondering whether this will need a changelog entry due to the changed error messages? @ekpyron

nikola-matic avatar Nov 02 '22 10:11 nikola-matic

I have defaulted to a 'yes' and added an entry, as recommended in the other PR.

matheusaaguiar avatar Nov 02 '22 19:11 matheusaaguiar

Rebased.

matheusaaguiar avatar Nov 02 '22 19:11 matheusaaguiar

@cameel I have added the tests and made the changes you suggested. Also rebased.

matheusaaguiar avatar Nov 25 '22 15:11 matheusaaguiar

Also review fixes should be squashed.

cameel avatar Nov 25 '22 15:11 cameel