Fix abstract without contract.

This commit is contained in:
chriseth 2020-02-05 12:14:14 +01:00
parent 686b62b585
commit 0b9c842656
4 changed files with 10 additions and 1 deletions

View File

@ -10,6 +10,7 @@ Compiler Features:
Bugfixes:
* Parser: Fix an internal error for ``abstract`` without ``contract``.

View File

@ -278,7 +278,8 @@ std::pair<ContractKind, bool> Parser::parseContractKind()
kind = ContractKind::Library;
break;
default:
solAssert(false, "Invalid contract kind.");
parserError("Expected keyword \"contract\", \"interface\" or \"library\".");
return std::make_pair(ContractKind::Contract, abstract);
}
m_scanner->next();
return std::make_pair(kind, abstract);

View File

@ -0,0 +1,4 @@
abstract
// ----
// ParserError: (9-9): Expected keyword "contract", "interface" or "library".
// ParserError: (9-9): Expected identifier but got end of source

View File

@ -0,0 +1,3 @@
abstract A { }
// ----
// ParserError: (9-10): Expected keyword "contract", "interface" or "library".