Merge pull request #8242 from ethereum/abstractWithoutContract

Fix abstract without contract.
This commit is contained in:
chriseth 2020-02-05 12:49:51 +01:00 committed by GitHub
commit 913d5f3221
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 1 deletions

View File

@ -10,6 +10,7 @@ Compiler Features:
Bugfixes: 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; kind = ContractKind::Library;
break; break;
default: default:
solAssert(false, "Invalid contract kind."); parserError("Expected keyword \"contract\", \"interface\" or \"library\".");
return std::make_pair(ContractKind::Contract, abstract);
} }
m_scanner->next(); m_scanner->next();
return std::make_pair(kind, abstract); 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".