Fix error reporting source code format

This commit is contained in:
a3d4 2020-05-07 03:52:53 +02:00
parent 5e46ef7df5
commit 7e1835af71
3 changed files with 8 additions and 5 deletions

View File

@ -220,7 +220,9 @@ void ContractLevelChecker::checkAbstractDefinitions(ContractDefinition const& _c
for (auto declaration: _contract.annotation().unimplementedDeclarations)
ssl.append("Missing implementation: ", declaration->location());
m_errorReporter.typeError(
3656_error,_contract.location(), ssl,
3656_error,
_contract.location(),
ssl,
"Contract \"" + _contract.annotation().canonicalName
+ "\" should be marked as abstract.");

View File

@ -291,7 +291,8 @@ bool SyntaxChecker::visit(ContractDefinition const& _contract)
for (FunctionDefinition const* function: _contract.definedFunctions())
if (function->name() == contractName)
m_errorReporter.syntaxError(
5796_error,function->location(),
5796_error,
function->location(),
"Functions are not allowed to have the same name as the contract. "
"If you intend this to be a constructor, use \"constructor(...) { ... }\" to define it."
);

View File

@ -493,7 +493,8 @@ bool TypeChecker::visit(VariableDeclaration const& _variable)
unsupportedTypes.emplace_back(param->toString());
if (!unsupportedTypes.empty())
m_errorReporter.typeError(
2763_error,_variable.location(),
2763_error,
_variable.location(),
"The following types are only supported for getters in ABIEncoderV2: " +
joinHumanReadable(unsupportedTypes) +
". Either remove \"public\" or use \"pragma experimental ABIEncoderV2;\" to enable the feature."
@ -3125,8 +3126,7 @@ void TypeChecker::requireLValue(Expression const& _expression, bool _ordinaryAss
if (_expression.annotation().isLValue)
return;
return m_errorReporter.typeError(
1123_error,_expression.location(), [&]() {
return m_errorReporter.typeError(1123_error, _expression.location(), [&]() {
if (_expression.annotation().isConstant)
return "Cannot assign to a constant variable.";