Skip to content

Commit

Permalink
Merge pull request ethereum#8864 from a3d4/fix-error-reporting-source…
Browse files Browse the repository at this point in the history
…-code-format

Fix error reporting source code format
  • Loading branch information
chriseth authored May 7, 2020
2 parents 5ba7a75 + 7e1835a commit aa7684f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
4 changes: 3 additions & 1 deletion libsolidity/analysis/ContractLevelChecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,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.");

Expand Down
3 changes: 2 additions & 1 deletion libsolidity/analysis/SyntaxChecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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."
);
Expand Down
6 changes: 3 additions & 3 deletions libsolidity/analysis/TypeChecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down Expand Up @@ -3135,8 +3136,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.";

Expand Down

0 comments on commit aa7684f

Please sign in to comment.