mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Use quote function for all errors/warnings
This commit is contained in:
parent
70a2902714
commit
593e2515e7
12
Changelog.md
12
Changelog.md
@ -1,3 +1,15 @@
|
||||
### 0.6.2 (unreleased)
|
||||
|
||||
Language Features:
|
||||
|
||||
|
||||
CompilerFeatures:
|
||||
|
||||
|
||||
Bugfixes:
|
||||
* Made usage of quotes in error and warning messages consistent
|
||||
|
||||
|
||||
### 0.6.1 (2020-01-02)
|
||||
|
||||
Bugfixes:
|
||||
|
@ -28,6 +28,20 @@ using namespace std;
|
||||
using namespace solidity;
|
||||
using namespace solidity::langutil;
|
||||
|
||||
namespace solidity::langutil {
|
||||
|
||||
std::string quote(std::string const& _name)
|
||||
{
|
||||
return "\"" + _name + "\"";
|
||||
}
|
||||
|
||||
std::string quoteSpace(std::string const& _name)
|
||||
{
|
||||
return " " +quote(_name) + " ";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ErrorReporter& ErrorReporter::operator=(ErrorReporter const& _errorReporter)
|
||||
{
|
||||
if (&_errorReporter == this)
|
||||
|
@ -33,6 +33,9 @@
|
||||
namespace solidity::langutil
|
||||
{
|
||||
|
||||
std::string quote(std::string const& _name);
|
||||
std::string quoteSpace(std::string const& _name);
|
||||
|
||||
class ErrorReporter
|
||||
{
|
||||
public:
|
||||
|
@ -65,14 +65,14 @@ string ParserBase::tokenName(Token _token)
|
||||
else if (_token == Token::EOS)
|
||||
return "end of source";
|
||||
else if (TokenTraits::isReservedKeyword(_token))
|
||||
return "reserved keyword '" + TokenTraits::friendlyName(_token) + "'";
|
||||
return "reserved keyword " + quote(TokenTraits::friendlyName(_token));
|
||||
else if (TokenTraits::isElementaryTypeName(_token)) //for the sake of accuracy in reporting
|
||||
{
|
||||
ElementaryTypeNameToken elemTypeName = m_scanner->currentElementaryTypeNameToken();
|
||||
return "'" + elemTypeName.toString() + "'";
|
||||
return quote(elemTypeName.toString());
|
||||
}
|
||||
else
|
||||
return "'" + TokenTraits::friendlyName(_token) + "'";
|
||||
return quote(TokenTraits::friendlyName(_token));
|
||||
}
|
||||
|
||||
void ParserBase::expectToken(Token _value, bool _advance)
|
||||
|
@ -47,12 +47,13 @@ void ConstantEvaluator::endVisit(BinaryOperation const& _operation)
|
||||
if (!commonType)
|
||||
m_errorReporter.fatalTypeError(
|
||||
_operation.location(),
|
||||
"Operator " +
|
||||
string(TokenTraits::toString(_operation.getOperator())) +
|
||||
" not compatible with types " +
|
||||
left->toString() +
|
||||
" and " +
|
||||
right->toString()
|
||||
"Operator" +
|
||||
langutil::quoteSpace(string(TokenTraits::toString(_operation.getOperator()))) +
|
||||
"not compatible with types" +
|
||||
langutil::quoteSpace(left->toString()) +
|
||||
"and " +
|
||||
langutil::quote(right->toString()) +
|
||||
"."
|
||||
);
|
||||
setType(
|
||||
_operation,
|
||||
|
@ -209,7 +209,7 @@ void ContractLevelChecker::checkAbstractFunctions(ContractDefinition const& _con
|
||||
if (_contract.abstract())
|
||||
{
|
||||
if (_contract.contractKind() == ContractDefinition::ContractKind::Interface)
|
||||
m_errorReporter.typeError(_contract.location(), "Interfaces do not need the \"abstract\" keyword, they are abstract implicitly.");
|
||||
m_errorReporter.typeError(_contract.location(), "Interfaces do not need the" + quoteSpace("abstract") + "keyword, they are abstract implicitly.");
|
||||
else if (_contract.contractKind() == ContractDefinition::ContractKind::Library)
|
||||
m_errorReporter.typeError(_contract.location(), "Libraries cannot be abstract.");
|
||||
else
|
||||
@ -228,8 +228,8 @@ void ContractLevelChecker::checkAbstractFunctions(ContractDefinition const& _con
|
||||
for (auto function: _contract.annotation().unimplementedFunctions)
|
||||
ssl.append("Missing implementation:", function->location());
|
||||
m_errorReporter.typeError(_contract.location(), ssl,
|
||||
"Contract \"" + _contract.annotation().canonicalName
|
||||
+ "\" should be marked as abstract.");
|
||||
"Contract" + quoteSpace(_contract.annotation().canonicalName)
|
||||
+ "should be marked as abstract.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -368,7 +368,7 @@ void ContractLevelChecker::checkHashCollisions(ContractDefinition const& _contra
|
||||
if (hashes.count(hash))
|
||||
m_errorReporter.typeError(
|
||||
_contract.location(),
|
||||
string("Function signature hash collision for ") + it.second->externalSignature()
|
||||
string("Function signature hash collision for ") + quote(it.second->externalSignature()) + "."
|
||||
);
|
||||
hashes.insert(hash);
|
||||
}
|
||||
@ -425,11 +425,11 @@ void ContractLevelChecker::checkBaseABICompatibility(ContractDefinition const& _
|
||||
m_errorReporter.fatalTypeError(
|
||||
_contract.location(),
|
||||
errors,
|
||||
std::string("Contract \"") +
|
||||
_contract.name() +
|
||||
"\" does not use ABIEncoderV2 but wants to inherit from a contract " +
|
||||
std::string("Contract") +
|
||||
quoteSpace(_contract.name()) +
|
||||
"does not use ABIEncoderV2 but wants to inherit from a contract " +
|
||||
"which uses types that require it. " +
|
||||
"Use \"pragma experimental ABIEncoderV2;\" for the inheriting contract as well to enable the feature."
|
||||
"Use" + quoteSpace("pragma experimental ABIEncoderV2;") + "for the inheriting contract as well to enable the feature."
|
||||
);
|
||||
|
||||
}
|
||||
|
@ -86,9 +86,9 @@ void DocStringAnalyser::checkParameters(
|
||||
for (auto i = paramRange.first; i != paramRange.second; ++i)
|
||||
if (!validParams.count(i->second.paramName))
|
||||
appendError(
|
||||
"Documented parameter \"" +
|
||||
i->second.paramName +
|
||||
"\" not found in the parameter list of the function."
|
||||
"Documented parameter" +
|
||||
quoteSpace(i->second.paramName) +
|
||||
"not found in the parameter list of the function."
|
||||
);
|
||||
|
||||
}
|
||||
@ -134,7 +134,7 @@ void DocStringAnalyser::parseDocStrings(
|
||||
for (auto const& docTag: _annotation.docTags)
|
||||
{
|
||||
if (!_validTags.count(docTag.first))
|
||||
appendError("Documentation tag @" + docTag.first + " not valid for " + _nodeName + ".");
|
||||
appendError("Documentation tag" + quoteSpace("@" + docTag.first) + "not valid for " + _nodeName + ".");
|
||||
else
|
||||
if (docTag.first == "return")
|
||||
{
|
||||
@ -145,15 +145,15 @@ void DocStringAnalyser::parseDocStrings(
|
||||
string firstWord = content.substr(0, content.find_first_of(" \t"));
|
||||
|
||||
if (returnTagsVisited > function->returnParameters().size())
|
||||
appendError("Documentation tag \"@" + docTag.first + " " + docTag.second.content + "\"" +
|
||||
" exceedes the number of return parameters."
|
||||
appendError("Documentation tag" + quoteSpace("@" + docTag.first + " " + docTag.second.content) +
|
||||
"exceedes the number of return parameters."
|
||||
);
|
||||
else
|
||||
{
|
||||
auto parameter = function->returnParameters().at(returnTagsVisited - 1);
|
||||
if (!parameter->name().empty() && parameter->name() != firstWord)
|
||||
appendError("Documentation tag \"@" + docTag.first + " " + docTag.second.content + "\"" +
|
||||
" does not contain the name of its return parameter."
|
||||
appendError("Documentation tag" + quoteSpace("@" + docTag.first + " " + docTag.second.content) +
|
||||
"does not contain the name of its return parameter."
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ bool NameAndTypeResolver::performImports(SourceUnit& _sourceUnit, map<string, So
|
||||
{
|
||||
m_errorReporter.declarationError(
|
||||
imp->location(),
|
||||
"Import \"" + path + "\" (referenced as \"" + imp->path() + "\") not found."
|
||||
"Import" + quoteSpace(path) + "(referenced as " + quote(imp->path()) + ") not found."
|
||||
);
|
||||
error = true;
|
||||
continue;
|
||||
@ -96,13 +96,13 @@ bool NameAndTypeResolver::performImports(SourceUnit& _sourceUnit, map<string, So
|
||||
{
|
||||
m_errorReporter.declarationError(
|
||||
imp->location(),
|
||||
"Declaration \"" +
|
||||
alias.symbol->name() +
|
||||
"\" not found in \"" +
|
||||
path +
|
||||
"\" (referenced as \"" +
|
||||
imp->path() +
|
||||
"\")."
|
||||
"Declaration" +
|
||||
quoteSpace(alias.symbol->name()) +
|
||||
"not found in" +
|
||||
quoteSpace(path) +
|
||||
"(referenced as " +
|
||||
quote(imp->path()) +
|
||||
")."
|
||||
);
|
||||
error = true;
|
||||
}
|
||||
|
@ -495,7 +495,7 @@ void OverrideChecker::checkOverride(OverrideProxy const& _overriding, OverridePr
|
||||
);
|
||||
|
||||
if (!_overriding.overrides())
|
||||
overrideError(_overriding, _super, "Overriding " + _overriding.astNodeName() + " is missing \"override\" specifier.");
|
||||
overrideError(_overriding, _super, "Overriding " + _overriding.astNodeName() + " is missing" + quoteSpace("override") + "specifier.");
|
||||
|
||||
if (_super.isVariable())
|
||||
overrideError(
|
||||
@ -508,7 +508,7 @@ void OverrideChecker::checkOverride(OverrideProxy const& _overriding, OverridePr
|
||||
overrideError(
|
||||
_super,
|
||||
_overriding,
|
||||
"Trying to override non-virtual " + _super.astNodeName() + ". Did you forget to add \"virtual\"?",
|
||||
"Trying to override non-virtual " + _super.astNodeName() + ". Did you forget to add " + quote("virtual") + "?",
|
||||
"Overriding " + _overriding.astNodeName() + " is here:"
|
||||
);
|
||||
|
||||
@ -546,11 +546,11 @@ void OverrideChecker::checkOverride(OverrideProxy const& _overriding, OverridePr
|
||||
overrideError(
|
||||
_overriding,
|
||||
_super,
|
||||
"Overriding function changes state mutability from \"" +
|
||||
stateMutabilityToString(_super.stateMutability()) +
|
||||
"\" to \"" +
|
||||
stateMutabilityToString(_overriding.stateMutability()) +
|
||||
"\"."
|
||||
"Overriding function changes state mutability from" +
|
||||
quoteSpace(stateMutabilityToString(_super.stateMutability())) +
|
||||
"to " +
|
||||
quote(stateMutabilityToString(_overriding.stateMutability())) +
|
||||
"."
|
||||
);
|
||||
|
||||
if (_overriding.unimplemented() && !_super.unimplemented())
|
||||
@ -576,7 +576,7 @@ void OverrideChecker::overrideListError(
|
||||
for (Declaration const* c: _secondary)
|
||||
{
|
||||
ssl.append("This contract: ", c->location());
|
||||
names.insert("\"" + c->name() + "\"");
|
||||
names.insert(quote(c->name()));
|
||||
}
|
||||
string contractSingularPlural = "contract ";
|
||||
if (_secondary.size() > 1)
|
||||
@ -699,9 +699,9 @@ void OverrideChecker::checkAmbiguousOverridesInternal(set<OverrideProxy> _baseCa
|
||||
foundVariable = true;
|
||||
|
||||
string message =
|
||||
"Derived contract must override " + callableName + " \"" +
|
||||
_baseCallables.begin()->name() +
|
||||
"\". Two or more base classes define " + callableName + " with same " + distinguishigProperty + ".";
|
||||
"Derived contract must override " + callableName + " " +
|
||||
quote(_baseCallables.begin()->name()) +
|
||||
". Two or more base classes define " + callableName + " with same " + distinguishigProperty + ".";
|
||||
|
||||
if (foundVariable)
|
||||
message +=
|
||||
@ -758,11 +758,11 @@ void OverrideChecker::checkOverrideList(OverrideProxy _item, OverrideProxyBySign
|
||||
m_errorReporter.typeError(
|
||||
list[i]->location(),
|
||||
ssl,
|
||||
"Duplicate contract \"" +
|
||||
joinHumanReadable(list[i]->namePath(), ".") +
|
||||
"\" found in override list of \"" +
|
||||
_item.name() +
|
||||
"\"."
|
||||
"Duplicate contract" +
|
||||
quoteSpace(joinHumanReadable(list[i]->namePath(), ".")) +
|
||||
"found in override list of " +
|
||||
quote(_item.name()) +
|
||||
"."
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -89,8 +89,8 @@ struct ConstStateVarCircularReferenceChecker: public PostTypeChecker::Checker
|
||||
if (auto identifier = findCycle(*declaration))
|
||||
m_errorReporter.typeError(
|
||||
declaration->location(),
|
||||
"The value of the constant " + declaration->name() +
|
||||
" has a cyclic dependency via " + identifier->name() + "."
|
||||
"The value of the constant" + quoteSpace(declaration->name()) +
|
||||
"has a cyclic dependency via " + quote(identifier->name()) + "."
|
||||
);
|
||||
|
||||
m_constVariables.clear();
|
||||
|
@ -200,7 +200,7 @@ void ReferencesResolver::endVisit(FunctionTypeName const& _typeName)
|
||||
case Visibility::External:
|
||||
break;
|
||||
default:
|
||||
fatalTypeError(_typeName.location(), "Invalid visibility, can only be \"external\" or \"internal\".");
|
||||
fatalTypeError(_typeName.location(), "Invalid visibility, can only be" + quoteSpace("external") + "or " + quote("internal") + ".");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -284,7 +284,7 @@ bool ReferencesResolver::visit(InlineAssembly const& _inlineAssembly)
|
||||
{
|
||||
string namePrefix = _identifier.name.str().substr(0, _identifier.name.str().find('.'));
|
||||
if (isSlot || isOffset)
|
||||
declarationError(_identifier.location, "In variable declarations _slot and _offset can not be used as a suffix.");
|
||||
declarationError(_identifier.location, "In variable declarations" + quoteSpace("_slot") + "and" + quoteSpace("_offset") + "can not be used as a suffix.");
|
||||
else if (
|
||||
auto declarations = m_resolver.nameFromCurrentScope(namePrefix);
|
||||
!declarations.empty()
|
||||
@ -318,7 +318,7 @@ bool ReferencesResolver::visit(InlineAssembly const& _inlineAssembly)
|
||||
));
|
||||
if (realName.empty())
|
||||
{
|
||||
declarationError(_identifier.location, "In variable names _slot and _offset can only be used as a suffix.");
|
||||
declarationError(_identifier.location, "In variable names" + quoteSpace("_slot") + "and" + quoteSpace("_offset") + "can only be used as a suffix.");
|
||||
return size_t(-1);
|
||||
}
|
||||
declarations = m_resolver.nameFromCurrentScope(realName);
|
||||
@ -367,7 +367,7 @@ void ReferencesResolver::endVisit(VariableDeclaration const& _variable)
|
||||
return;
|
||||
|
||||
if (_variable.isConstant() && !_variable.isStateVariable())
|
||||
m_errorReporter.declarationError(_variable.location(), "The \"constant\" keyword can only be used for state variables.");
|
||||
m_errorReporter.declarationError(_variable.location(), "The" + quoteSpace("constant") + "keyword can only be used for state variables.");
|
||||
|
||||
if (!_variable.typeName())
|
||||
{
|
||||
|
@ -197,12 +197,12 @@ bool StaticAnalyzer::visit(MemberAccess const& _memberAccess)
|
||||
if (type->kind() == MagicType::Kind::Message && _memberAccess.memberName() == "gas")
|
||||
m_errorReporter.typeError(
|
||||
_memberAccess.location(),
|
||||
"\"msg.gas\" has been deprecated in favor of \"gasleft()\""
|
||||
quote("msg.gas") + " has been deprecated in favor of " + quote("gasleft()") + "."
|
||||
);
|
||||
else if (type->kind() == MagicType::Kind::Block && _memberAccess.memberName() == "blockhash")
|
||||
m_errorReporter.typeError(
|
||||
_memberAccess.location(),
|
||||
"\"block.blockhash()\" has been deprecated in favor of \"blockhash()\""
|
||||
quote("block.blockhash()") + " has been deprecated in favor of " + quote("blockhash()") + "."
|
||||
);
|
||||
else if (type->kind() == MagicType::Kind::MetaType && _memberAccess.memberName() == "runtimeCode")
|
||||
{
|
||||
@ -223,7 +223,7 @@ bool StaticAnalyzer::visit(MemberAccess const& _memberAccess)
|
||||
if (type->kind() == FunctionType::Kind::BareCallCode)
|
||||
m_errorReporter.typeError(
|
||||
_memberAccess.location(),
|
||||
"\"callcode\" has been deprecated in favour of \"delegatecall\"."
|
||||
quote("callcode") + " has been deprecated in favour of" + quote("delegatecall") + "."
|
||||
);
|
||||
|
||||
if (m_constructor)
|
||||
@ -236,7 +236,7 @@ bool StaticAnalyzer::visit(MemberAccess const& _memberAccess)
|
||||
if (id->name() == "this")
|
||||
m_errorReporter.warning(
|
||||
id->location(),
|
||||
"\"this\" used in constructor. "
|
||||
quote("this") + " used in constructor. "
|
||||
"Note that external functions of a contract "
|
||||
"cannot be called while it is being constructed.");
|
||||
break;
|
||||
|
@ -60,13 +60,16 @@ void SyntaxChecker::endVisit(SourceUnit const& _sourceUnit)
|
||||
SemVerVersion recommendedVersion{string(VersionString)};
|
||||
if (!recommendedVersion.isPrerelease())
|
||||
errorString +=
|
||||
" Consider adding \"pragma solidity ^" +
|
||||
to_string(recommendedVersion.major()) +
|
||||
string(".") +
|
||||
to_string(recommendedVersion.minor()) +
|
||||
string(".") +
|
||||
to_string(recommendedVersion.patch()) +
|
||||
string(";\"");
|
||||
" Consider adding " +
|
||||
quoteSpace("pragma solidity ^" +
|
||||
to_string(recommendedVersion.major()) +
|
||||
string(".") +
|
||||
to_string(recommendedVersion.minor()) +
|
||||
string(".") +
|
||||
to_string(recommendedVersion.patch()) +
|
||||
string(";")
|
||||
) +
|
||||
".";
|
||||
|
||||
m_errorReporter.warning(_sourceUnit.location(), errorString);
|
||||
}
|
||||
@ -78,7 +81,7 @@ bool SyntaxChecker::visit(PragmaDirective const& _pragma)
|
||||
solAssert(!_pragma.tokens().empty(), "");
|
||||
solAssert(_pragma.tokens().size() == _pragma.literals().size(), "");
|
||||
if (_pragma.tokens()[0] != Token::Identifier)
|
||||
m_errorReporter.syntaxError(_pragma.location(), "Invalid pragma \"" + _pragma.literals()[0] + "\"");
|
||||
m_errorReporter.syntaxError(_pragma.location(), "Invalid pragma " + quote(_pragma.literals()[0]) + ".");
|
||||
else if (_pragma.literals()[0] == "experimental")
|
||||
{
|
||||
solAssert(m_sourceUnit, "");
|
||||
@ -128,7 +131,7 @@ bool SyntaxChecker::visit(PragmaDirective const& _pragma)
|
||||
m_versionPragmaFound = true;
|
||||
}
|
||||
else
|
||||
m_errorReporter.syntaxError(_pragma.location(), "Unknown pragma \"" + _pragma.literals()[0] + "\"");
|
||||
m_errorReporter.syntaxError(_pragma.location(), "Unknown pragma " + quoteSpace(_pragma.literals()[0]) + ".");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -141,7 +144,7 @@ bool SyntaxChecker::visit(ModifierDefinition const&)
|
||||
void SyntaxChecker::endVisit(ModifierDefinition const& _modifier)
|
||||
{
|
||||
if (!m_placeholderFound)
|
||||
m_errorReporter.syntaxError(_modifier.body().location(), "Modifier body does not contain '_'.");
|
||||
m_errorReporter.syntaxError(_modifier.body().location(), "Modifier body does not contain " + quote("_") + ".");
|
||||
m_placeholderFound = false;
|
||||
}
|
||||
|
||||
@ -188,7 +191,7 @@ bool SyntaxChecker::visit(Continue const& _continueStatement)
|
||||
{
|
||||
if (m_inLoopDepth <= 0)
|
||||
// we're not in a for/while loop, report syntax error
|
||||
m_errorReporter.syntaxError(_continueStatement.location(), "\"continue\" has to be in a \"for\" or \"while\" loop.");
|
||||
m_errorReporter.syntaxError(_continueStatement.location(), quote("continue") + " has to be in a" + quoteSpace("for") + "or" + quoteSpace("while") + "loop.");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -196,7 +199,7 @@ bool SyntaxChecker::visit(Break const& _breakStatement)
|
||||
{
|
||||
if (m_inLoopDepth <= 0)
|
||||
// we're not in a for/while loop, report syntax error
|
||||
m_errorReporter.syntaxError(_breakStatement.location(), "\"break\" has to be in a \"for\" or \"while\" loop.");
|
||||
m_errorReporter.syntaxError(_breakStatement.location(), quote("break") + " has to be in a" + quoteSpace("for") + "or" + quoteSpace("while") + "loop.");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -204,7 +207,7 @@ bool SyntaxChecker::visit(Throw const& _throwStatement)
|
||||
{
|
||||
m_errorReporter.syntaxError(
|
||||
_throwStatement.location(),
|
||||
"\"throw\" is deprecated in favour of \"revert()\", \"require()\" and \"assert()\"."
|
||||
quote("throw") + " is deprecated in favour of " + quote("revert()") + "," + quoteSpace("require()") + "and " + quote("assert()") + "."
|
||||
);
|
||||
|
||||
return true;
|
||||
@ -218,32 +221,31 @@ bool SyntaxChecker::visit(Literal const& _literal)
|
||||
ASTString const& value = _literal.value();
|
||||
solAssert(!value.empty(), "");
|
||||
|
||||
static string const errMsgBegin = "Invalid use of underscores in number literal. ";
|
||||
|
||||
// Generic checks no matter what base this number literal is of:
|
||||
if (value.back() == '_')
|
||||
{
|
||||
m_errorReporter.syntaxError(_literal.location(), "Invalid use of underscores in number literal. No trailing underscores allowed.");
|
||||
m_errorReporter.syntaxError(_literal.location(), errMsgBegin + "No trailing underscores allowed.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (value.find("__") != ASTString::npos)
|
||||
{
|
||||
m_errorReporter.syntaxError(_literal.location(), "Invalid use of underscores in number literal. Only one consecutive underscores between digits allowed.");
|
||||
m_errorReporter.syntaxError(_literal.location(), errMsgBegin + "Only one consecutive underscores between digits allowed.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!_literal.isHexNumber()) // decimal literal
|
||||
{
|
||||
if (value.find("._") != ASTString::npos)
|
||||
m_errorReporter.syntaxError(_literal.location(), "Invalid use of underscores in number literal. No underscores in front of the fraction part allowed.");
|
||||
|
||||
if (value.find("_.") != ASTString::npos)
|
||||
m_errorReporter.syntaxError(_literal.location(), "Invalid use of underscores in number literal. No underscores in front of the fraction part allowed.");
|
||||
if (value.find("._") != ASTString::npos || value.find("_.") != ASTString::npos)
|
||||
m_errorReporter.syntaxError(_literal.location(), errMsgBegin + "No underscores in front of the fraction part allowed.");
|
||||
|
||||
if (value.find("_e") != ASTString::npos)
|
||||
m_errorReporter.syntaxError(_literal.location(), "Invalid use of underscores in number literal. No underscore at the end of the mantissa allowed.");
|
||||
m_errorReporter.syntaxError(_literal.location(), errMsgBegin + "No underscore at the end of the mantissa allowed.");
|
||||
|
||||
if (value.find("e_") != ASTString::npos)
|
||||
m_errorReporter.syntaxError(_literal.location(), "Invalid use of underscores in number literal. No underscore in front of exponent allowed.");
|
||||
m_errorReporter.syntaxError(_literal.location(), errMsgBegin + "No underscore in front of exponent allowed.");
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -252,7 +254,7 @@ bool SyntaxChecker::visit(Literal const& _literal)
|
||||
bool SyntaxChecker::visit(UnaryOperation const& _operation)
|
||||
{
|
||||
if (_operation.getOperator() == Token::Add)
|
||||
m_errorReporter.syntaxError(_operation.location(), "Use of unary + is disallowed.");
|
||||
m_errorReporter.syntaxError(_operation.location(), "Use of unary" + quoteSpace("+") + "is disallowed.");
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -286,7 +288,7 @@ bool SyntaxChecker::visit(ContractDefinition const& _contract)
|
||||
if (function->name() == contractName)
|
||||
m_errorReporter.syntaxError(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."
|
||||
"If you intend this to be a constructor, use" + quoteSpace("constructor(...) { ... }") + "to define it."
|
||||
);
|
||||
return true;
|
||||
}
|
||||
@ -298,7 +300,7 @@ bool SyntaxChecker::visit(FunctionDefinition const& _function)
|
||||
string suggestedVisibility = _function.isFallback() || _function.isReceive() || m_isInterface ? "external" : "public";
|
||||
m_errorReporter.syntaxError(
|
||||
_function.location(),
|
||||
"No visibility specified. Did you intend to add \"" + suggestedVisibility + "\"?"
|
||||
"No visibility specified. Did you intend to add " + quote(suggestedVisibility) + "?"
|
||||
);
|
||||
}
|
||||
|
||||
@ -327,7 +329,7 @@ bool SyntaxChecker::visit(VariableDeclarationStatement const& _statement)
|
||||
if (boost::algorithm::all_of_equal(_statement.declarations(), nullptr))
|
||||
m_errorReporter.syntaxError(
|
||||
_statement.location(),
|
||||
"The use of the \"var\" keyword is disallowed. The declaration part of the statement can be removed, since it is empty."
|
||||
"The use of the" + quoteSpace("var") + "keyword is disallowed. The declaration part of the statement can be removed, since it is empty."
|
||||
);
|
||||
|
||||
return true;
|
||||
|
@ -143,9 +143,9 @@ TypePointers TypeChecker::typeCheckABIDecodeAndRetrieveReturnType(FunctionCall c
|
||||
)
|
||||
m_errorReporter.typeError(
|
||||
arguments.front()->location(),
|
||||
"The first argument to \"abi.decode\" must be implicitly convertible to "
|
||||
"bytes memory or bytes calldata, but is of type " +
|
||||
type(*arguments.front())->toString() +
|
||||
"The first argument to" + quoteSpace("abi.decode") + "must be implicitly convertible to" +
|
||||
quoteSpace("bytes memory") + "or " + quote("bytes calldata") + ", but is of type " +
|
||||
quote(type(*arguments.front())->toString()) +
|
||||
"."
|
||||
);
|
||||
|
||||
@ -159,7 +159,7 @@ TypePointers TypeChecker::typeCheckABIDecodeAndRetrieveReturnType(FunctionCall c
|
||||
{
|
||||
m_errorReporter.typeError(
|
||||
arguments[1]->location(),
|
||||
"The second argument to \"abi.decode\" has to be a tuple of types."
|
||||
"The second argument to" + quoteSpace("abi.decode") + "has to be a tuple of types."
|
||||
);
|
||||
return {};
|
||||
}
|
||||
@ -187,7 +187,7 @@ TypePointers TypeChecker::typeCheckABIDecodeAndRetrieveReturnType(FunctionCall c
|
||||
if (!actualType->fullEncodingType(false, _abiEncoderV2, false))
|
||||
m_errorReporter.typeError(
|
||||
typeArgument->location(),
|
||||
"Decoding type " + actualType->toString(false) + " not supported."
|
||||
"Decoding type" + quoteSpace(actualType->toString(false)) + "not supported."
|
||||
);
|
||||
components.push_back(actualType);
|
||||
}
|
||||
@ -222,9 +222,9 @@ TypePointers TypeChecker::typeCheckMetaTypeFunctionAndRetrieveReturnType(Functio
|
||||
m_errorReporter.typeError(
|
||||
arguments.front()->location(),
|
||||
"Invalid type for argument in function call. "
|
||||
"Contract type required, but " +
|
||||
type(*arguments.front())->toString(true) +
|
||||
" provided."
|
||||
"Contract type required, but" +
|
||||
quoteSpace(type(*arguments.front())->toString(true)) +
|
||||
"provided."
|
||||
);
|
||||
return {};
|
||||
}
|
||||
@ -269,11 +269,11 @@ void TypeChecker::endVisit(InheritanceSpecifier const& _inheritance)
|
||||
m_errorReporter.typeErrorConcatenateDescriptions(
|
||||
(*arguments)[i]->location(),
|
||||
"Invalid type for argument in constructor call. "
|
||||
"Invalid implicit conversion from " +
|
||||
type(*(*arguments)[i])->toString() +
|
||||
" to " +
|
||||
parameterTypes[i]->toString() +
|
||||
" requested.",
|
||||
"Invalid implicit conversion from" +
|
||||
quoteSpace(type(*(*arguments)[i])->toString()) +
|
||||
"to" +
|
||||
quoteSpace(parameterTypes[i]->toString()) +
|
||||
"requested.",
|
||||
result.message()
|
||||
);
|
||||
}
|
||||
@ -332,9 +332,9 @@ bool TypeChecker::visit(FunctionDefinition const& _function)
|
||||
if (_function.markedVirtual())
|
||||
{
|
||||
if (_function.annotation().contract->isInterface())
|
||||
m_errorReporter.warning(_function.location(), "Interface functions are implicitly \"virtual\"");
|
||||
m_errorReporter.warning(_function.location(), "Interface functions are implicitly " + quote("virtual") + ".");
|
||||
if (_function.visibility() == Visibility::Private)
|
||||
m_errorReporter.typeError(_function.location(), "\"virtual\" and \"private\" cannot be used together.");
|
||||
m_errorReporter.typeError(_function.location(), quote("virtual") + " and" + quoteSpace("private") + "cannot be used together.");
|
||||
}
|
||||
|
||||
if (_function.isPayable())
|
||||
@ -350,9 +350,9 @@ bool TypeChecker::visit(FunctionDefinition const& _function)
|
||||
if (var.referenceLocation() != VariableDeclaration::Location::Storage)
|
||||
{
|
||||
if (!isLibraryFunction && _function.isPublic())
|
||||
m_errorReporter.typeError(var.location(), "Mapping types can only have a data location of \"storage\" and thus only be parameters or return variables for internal or library functions.");
|
||||
m_errorReporter.typeError(var.location(), "Mapping types can only have a data location of" + quoteSpace("storage") + "and thus only be parameters or return variables for internal or library functions.");
|
||||
else
|
||||
m_errorReporter.typeError(var.location(), "Mapping types can only have a data location of \"storage\"." );
|
||||
m_errorReporter.typeError(var.location(), "Mapping types can only have a data location of " + quote("storage") + ".");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -382,7 +382,7 @@ bool TypeChecker::visit(FunctionDefinition const& _function)
|
||||
m_errorReporter.typeError(
|
||||
var.location(),
|
||||
"This type is only supported in ABIEncoderV2. "
|
||||
"Use \"pragma experimental ABIEncoderV2;\" to enable the feature."
|
||||
"Use" + quoteSpace("pragma experimental ABIEncoderV2;") + "to enable the feature."
|
||||
);
|
||||
};
|
||||
for (ASTPointer<VariableDeclaration> const& var: _function.parameters())
|
||||
@ -486,7 +486,7 @@ bool TypeChecker::visit(VariableDeclaration const& _variable)
|
||||
}
|
||||
|
||||
if (!_variable.value())
|
||||
m_errorReporter.typeError(_variable.location(), "Uninitialized \"constant\" variable.");
|
||||
m_errorReporter.typeError(_variable.location(), "Uninitialized" + quoteSpace("constant") + "variable.");
|
||||
else if (!_variable.value()->annotation().isPure)
|
||||
m_errorReporter.typeError(
|
||||
_variable.value()->location(),
|
||||
@ -497,7 +497,7 @@ bool TypeChecker::visit(VariableDeclaration const& _variable)
|
||||
{
|
||||
if (varType->dataStoredIn(DataLocation::Memory) || varType->dataStoredIn(DataLocation::CallData))
|
||||
if (!varType->canLiveOutsideStorage())
|
||||
m_errorReporter.typeError(_variable.location(), "Type " + varType->toString() + " is only valid in storage.");
|
||||
m_errorReporter.typeError(_variable.location(), "Type" + quoteSpace(varType->toString()) + "is only valid in storage.");
|
||||
}
|
||||
else if (_variable.visibility() >= Visibility::Public)
|
||||
{
|
||||
@ -512,7 +512,7 @@ bool TypeChecker::visit(VariableDeclaration const& _variable)
|
||||
m_errorReporter.typeError(_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."
|
||||
". Either remove" + quoteSpace("public") + "or use" + quoteSpace("pragma experimental ABIEncoderV2;") + "to enable the feature."
|
||||
);
|
||||
}
|
||||
if (!getter.interfaceFunctionType())
|
||||
@ -593,11 +593,11 @@ void TypeChecker::visitManually(
|
||||
m_errorReporter.typeErrorConcatenateDescriptions(
|
||||
arguments[i]->location(),
|
||||
"Invalid type for argument in modifier invocation. "
|
||||
"Invalid implicit conversion from " +
|
||||
type(*arguments[i])->toString() +
|
||||
" to " +
|
||||
type(*(*parameters)[i])->toString() +
|
||||
" requested.",
|
||||
"Invalid implicit conversion from" +
|
||||
quoteSpace(type(*arguments[i])->toString()) +
|
||||
"to" +
|
||||
quoteSpace(type(*(*parameters)[i])->toString()) +
|
||||
"requested.",
|
||||
result.message()
|
||||
);
|
||||
}
|
||||
@ -622,7 +622,7 @@ bool TypeChecker::visit(EventDefinition const& _eventDef)
|
||||
m_errorReporter.typeError(
|
||||
var->location(),
|
||||
"This type is only supported in ABIEncoderV2. "
|
||||
"Use \"pragma experimental ABIEncoderV2;\" to enable the feature."
|
||||
"Use" + quoteSpace("pragma experimental ABIEncoderV2;") + "to enable the feature."
|
||||
);
|
||||
}
|
||||
if (_eventDef.isAnonymous() && numIndexed > 4)
|
||||
@ -682,7 +682,7 @@ bool TypeChecker::visit(InlineAssembly const& _inlineAssembly)
|
||||
}
|
||||
else if (requiresStorage)
|
||||
{
|
||||
m_errorReporter.typeError(_identifier.location, "The suffixes _offset and _slot can only be used on non-constant storage variables.");
|
||||
m_errorReporter.typeError(_identifier.location, "The suffixes" + quoteSpace("_offset") + "and" + quoteSpace("_slot") + "can only be used on non-constant storage variables.");
|
||||
return size_t(-1);
|
||||
}
|
||||
}
|
||||
@ -691,7 +691,7 @@ bool TypeChecker::visit(InlineAssembly const& _inlineAssembly)
|
||||
{
|
||||
if (!var->isStateVariable() && !var->type()->dataStoredIn(DataLocation::Storage))
|
||||
{
|
||||
m_errorReporter.typeError(_identifier.location, "The suffixes _offset and _slot can only be used on storage variables.");
|
||||
m_errorReporter.typeError(_identifier.location, "The suffixes" + quoteSpace("_offset") + "and" + quoteSpace("_slot") + "can only be used on storage variables.");
|
||||
return size_t(-1);
|
||||
}
|
||||
else if (_context != yul::IdentifierContext::RValue)
|
||||
@ -702,18 +702,18 @@ bool TypeChecker::visit(InlineAssembly const& _inlineAssembly)
|
||||
}
|
||||
else if (!var->isConstant() && var->isStateVariable())
|
||||
{
|
||||
m_errorReporter.typeError(_identifier.location, "Only local variables are supported. To access storage variables, use the _slot and _offset suffixes.");
|
||||
m_errorReporter.typeError(_identifier.location, "Only local variables are supported. To access storage variables, use the" + quoteSpace("_slot") + "and" + quoteSpace("_offset") + "suffixes.");
|
||||
return size_t(-1);
|
||||
}
|
||||
else if (var->type()->dataStoredIn(DataLocation::Storage))
|
||||
{
|
||||
m_errorReporter.typeError(_identifier.location, "You have to use the _slot or _offset suffix to access storage reference variables.");
|
||||
m_errorReporter.typeError(_identifier.location, "You have to use the" + quoteSpace("_slot") + "or" + quoteSpace("_offset") + "suffix to access storage reference variables.");
|
||||
return size_t(-1);
|
||||
}
|
||||
else if (var->type()->sizeOnStack() != 1)
|
||||
{
|
||||
if (var->type()->dataStoredIn(DataLocation::CallData))
|
||||
m_errorReporter.typeError(_identifier.location, "Call data elements cannot be accessed directly. Copy to a local variable first or use \"calldataload\" or \"calldatacopy\" with manually determined offsets and sizes.");
|
||||
m_errorReporter.typeError(_identifier.location, "Call data elements cannot be accessed directly. Copy to a local variable first or use" + quoteSpace("calldataload") + "or" + quoteSpace("calldatacopy") + "with manually determined offsets and sizes.");
|
||||
else
|
||||
m_errorReporter.typeError(_identifier.location, "Only types that use one stack slot are supported.");
|
||||
return size_t(-1);
|
||||
@ -721,7 +721,7 @@ bool TypeChecker::visit(InlineAssembly const& _inlineAssembly)
|
||||
}
|
||||
else if (requiresStorage)
|
||||
{
|
||||
m_errorReporter.typeError(_identifier.location, "The suffixes _offset and _slot can only be used on storage variables.");
|
||||
m_errorReporter.typeError(_identifier.location, "The suffixes" + quoteSpace("_offset") + "and" + quoteSpace("_slot") + "can only be used on storage variables.");
|
||||
return size_t(-1);
|
||||
}
|
||||
else if (_context == yul::IdentifierContext::LValue)
|
||||
@ -834,10 +834,10 @@ void TypeChecker::endVisit(TryStatement const& _tryStatement)
|
||||
if (parameters[i] && *parameters[i]->annotation().type != *returnTypes[i])
|
||||
m_errorReporter.typeError(
|
||||
parameters[i]->location(),
|
||||
"Invalid type, expected " +
|
||||
returnTypes[i]->toString(false) +
|
||||
" but got " +
|
||||
parameters[i]->annotation().type->toString() +
|
||||
"Invalid type, expected" +
|
||||
quoteSpace(returnTypes[i]->toString(false)) +
|
||||
"but got " +
|
||||
quote(parameters[i]->annotation().type->toString()) +
|
||||
"."
|
||||
);
|
||||
}
|
||||
@ -863,13 +863,13 @@ void TypeChecker::endVisit(TryStatement const& _tryStatement)
|
||||
clause.parameters()->parameters().size() != 1 ||
|
||||
*clause.parameters()->parameters().front()->type() != *TypeProvider::bytesMemory()
|
||||
)
|
||||
m_errorReporter.typeError(clause.location(), "Expected `catch (bytes memory ...) { ... }` or `catch { ... }`.");
|
||||
m_errorReporter.typeError(clause.location(), "Expected" + quoteSpace("catch (bytes memory ...) { ... }") + "or " + quote("catch { ... }") + ".");
|
||||
if (!m_evmVersion.supportsReturndata())
|
||||
m_errorReporter.typeError(
|
||||
clause.location(),
|
||||
"This catch clause type cannot be used on the selected EVM version (" +
|
||||
m_evmVersion.name() +
|
||||
"). You need at least a Byzantium-compatible EVM or use `catch { ... }`."
|
||||
"). You need at least a Byzantium-compatible EVM or use " + quote("catch { ... }") + "."
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -880,14 +880,14 @@ void TypeChecker::endVisit(TryStatement const& _tryStatement)
|
||||
clause.location(),
|
||||
"This catch clause type cannot be used on the selected EVM version (" +
|
||||
m_evmVersion.name() +
|
||||
"). You need at least a Byzantium-compatible EVM or use `catch { ... }`."
|
||||
"). You need at least a Byzantium-compatible EVM or use " + quote("catch { ... }") + "."
|
||||
);
|
||||
|
||||
if (errorClause)
|
||||
m_errorReporter.typeError(
|
||||
clause.location(),
|
||||
SecondarySourceLocation{}.append("The first clause is here:", errorClause->location()),
|
||||
"This try statement already has an \"Error\" catch clause."
|
||||
"This try statement already has an" + quoteSpace("Error") + "catch clause."
|
||||
);
|
||||
errorClause = &clause;
|
||||
if (
|
||||
@ -895,7 +895,7 @@ void TypeChecker::endVisit(TryStatement const& _tryStatement)
|
||||
clause.parameters()->parameters().size() != 1 ||
|
||||
*clause.parameters()->parameters().front()->type() != *TypeProvider::stringMemory()
|
||||
)
|
||||
m_errorReporter.typeError(clause.location(), "Expected `catch Error(string memory ...) { ... }`.");
|
||||
m_errorReporter.typeError(clause.location(), "Expected " + quote("catch Error(string memory ...) { ... }") + ".");
|
||||
}
|
||||
else
|
||||
m_errorReporter.typeError(
|
||||
@ -951,10 +951,10 @@ void TypeChecker::endVisit(Return const& _return)
|
||||
if (!result)
|
||||
m_errorReporter.typeErrorConcatenateDescriptions(
|
||||
_return.expression()->location(),
|
||||
"Return argument type " +
|
||||
type(*_return.expression())->toString() +
|
||||
" is not implicitly convertible to expected type " +
|
||||
TupleType(returnTypes).toString(false) + ".",
|
||||
"Return argument type" +
|
||||
quoteSpace(type(*_return.expression())->toString()) +
|
||||
"is not implicitly convertible to expected type " +
|
||||
quote(TupleType(returnTypes).toString(false)) + ".",
|
||||
result.message()
|
||||
);
|
||||
}
|
||||
@ -968,10 +968,10 @@ void TypeChecker::endVisit(Return const& _return)
|
||||
if (!result)
|
||||
m_errorReporter.typeErrorConcatenateDescriptions(
|
||||
_return.expression()->location(),
|
||||
"Return argument type " +
|
||||
type(*_return.expression())->toString() +
|
||||
" is not implicitly convertible to expected type (type of first return variable) " +
|
||||
expected->toString() + ".",
|
||||
"Return argument type" +
|
||||
quoteSpace(type(*_return.expression())->toString()) +
|
||||
"is not implicitly convertible to expected type (type of first return variable) " +
|
||||
quote(expected->toString()) + ".",
|
||||
result.message()
|
||||
);
|
||||
}
|
||||
@ -1053,12 +1053,12 @@ bool TypeChecker::visit(VariableDeclarationStatement const& _statement)
|
||||
}
|
||||
else
|
||||
// Bailing out *fatal* here, as those (untyped) vars may be used later, and diagnostics wouldn't be helpful then.
|
||||
m_errorReporter.fatalTypeError(_statement.location(), "Use of the \"var\" keyword is disallowed.");
|
||||
m_errorReporter.fatalTypeError(_statement.location(), "Use of the" + quoteSpace("var") + "keyword is disallowed.");
|
||||
}
|
||||
|
||||
VariableDeclaration const& varDecl = *_statement.declarations().front();
|
||||
if (!varDecl.annotation().type)
|
||||
m_errorReporter.fatalTypeError(_statement.location(), "Use of the \"var\" keyword is disallowed.");
|
||||
m_errorReporter.fatalTypeError(_statement.location(), "Use of the" + quoteSpace("var") + "keyword is disallowed.");
|
||||
|
||||
if (auto ref = dynamic_cast<ReferenceType const*>(type(varDecl)))
|
||||
{
|
||||
@ -1125,9 +1125,9 @@ bool TypeChecker::visit(VariableDeclarationStatement const& _statement)
|
||||
if (valueComponentType->category() == Type::Category::RationalNumber)
|
||||
m_errorReporter.fatalTypeError(
|
||||
_statement.initialValue()->location(),
|
||||
"Invalid rational " +
|
||||
valueComponentType->toString() +
|
||||
" (absolute value too large or division by zero)."
|
||||
"Invalid rational" +
|
||||
quoteSpace(valueComponentType->toString()) +
|
||||
"(absolute value too large or division by zero)."
|
||||
);
|
||||
else
|
||||
solAssert(false, "");
|
||||
@ -1167,10 +1167,10 @@ bool TypeChecker::visit(VariableDeclarationStatement const& _statement)
|
||||
BoolResult result = valueComponentType->isImplicitlyConvertibleTo(*var.annotation().type);
|
||||
if (!result)
|
||||
{
|
||||
auto errorMsg = "Type " +
|
||||
valueComponentType->toString() +
|
||||
" is not implicitly convertible to expected type " +
|
||||
var.annotation().type->toString();
|
||||
auto errorMsg = "Type" +
|
||||
quoteSpace(valueComponentType->toString()) +
|
||||
"is not implicitly convertible to expected type " +
|
||||
quote(var.annotation().type->toString());
|
||||
if (
|
||||
valueComponentType->category() == Type::Category::RationalNumber &&
|
||||
dynamic_cast<RationalNumberType const&>(*valueComponentType).isFractional() &&
|
||||
@ -1186,9 +1186,9 @@ bool TypeChecker::visit(VariableDeclarationStatement const& _statement)
|
||||
m_errorReporter.typeError(
|
||||
_statement.location(),
|
||||
errorMsg +
|
||||
". Try converting to type " +
|
||||
valueComponentType->mobileType()->toString() +
|
||||
" or use an explicit conversion."
|
||||
". Try converting to type" +
|
||||
quoteSpace(valueComponentType->mobileType()->toString()) +
|
||||
"or use an explicit conversion."
|
||||
);
|
||||
}
|
||||
else
|
||||
@ -1214,14 +1214,14 @@ bool TypeChecker::visit(VariableDeclarationStatement const& _statement)
|
||||
if (!typeCanBeExpressed(variables))
|
||||
m_errorReporter.syntaxError(
|
||||
_statement.location(),
|
||||
"Use of the \"var\" keyword is disallowed. "
|
||||
"Use of the" + quoteSpace("var") + "keyword is disallowed. "
|
||||
"Type cannot be expressed in syntax."
|
||||
);
|
||||
else
|
||||
m_errorReporter.syntaxError(
|
||||
_statement.location(),
|
||||
"Use of the \"var\" keyword is disallowed. "
|
||||
"Use explicit declaration `" + createTupleDecl(variables) + " = ...´ instead."
|
||||
"Use of the" + quoteSpace("var") + "keyword is disallowed. "
|
||||
"Use explicit declaration" + quoteSpace(createTupleDecl(variables) + " = ...") + "instead."
|
||||
);
|
||||
}
|
||||
|
||||
@ -1247,7 +1247,7 @@ void TypeChecker::endVisit(ExpressionStatement const& _statement)
|
||||
)
|
||||
m_errorReporter.warning(_statement.location(), "Return value of low-level calls not used.");
|
||||
else if (kind == FunctionType::Kind::Send)
|
||||
m_errorReporter.warning(_statement.location(), "Failure condition of 'send' ignored. Consider using 'transfer' instead.");
|
||||
m_errorReporter.warning(_statement.location(), "Failure condition of" + quoteSpace("send") + "ignored. Consider using" + quoteSpace("transfer") + "instead.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1284,10 +1284,10 @@ bool TypeChecker::visit(Conditional const& _conditional)
|
||||
{
|
||||
m_errorReporter.typeError(
|
||||
_conditional.location(),
|
||||
"True expression's type " +
|
||||
trueType->toString() +
|
||||
" doesn't match false expression's type " +
|
||||
falseType->toString() +
|
||||
"True expression's type" +
|
||||
quoteSpace(trueType->toString()) +
|
||||
"doesn't match false expression's type " +
|
||||
quote(falseType->toString()) +
|
||||
"."
|
||||
);
|
||||
// even we can't find a common type, we have to set a type here,
|
||||
@ -1379,12 +1379,13 @@ bool TypeChecker::visit(Assignment const& _assignment)
|
||||
if (!resultType || *resultType != *t)
|
||||
m_errorReporter.typeError(
|
||||
_assignment.location(),
|
||||
"Operator " +
|
||||
string(TokenTraits::toString(_assignment.assignmentOperator())) +
|
||||
" not compatible with types " +
|
||||
t->toString() +
|
||||
" and " +
|
||||
type(_assignment.rightHandSide())->toString()
|
||||
"Operator" +
|
||||
quoteSpace(string(TokenTraits::toString(_assignment.assignmentOperator()))) +
|
||||
"not compatible with types" +
|
||||
quoteSpace(t->toString()) +
|
||||
"and " +
|
||||
quote(type(_assignment.rightHandSide())->toString()) +
|
||||
"."
|
||||
);
|
||||
}
|
||||
return false;
|
||||
@ -1465,7 +1466,7 @@ bool TypeChecker::visit(TupleExpression const& _tuple)
|
||||
if (!inlineArrayType)
|
||||
m_errorReporter.fatalTypeError(_tuple.location(), "Unable to deduce common type for array elements.");
|
||||
else if (!inlineArrayType->canLiveOutsideStorage())
|
||||
m_errorReporter.fatalTypeError(_tuple.location(), "Type " + inlineArrayType->toString() + " is only valid in storage.");
|
||||
m_errorReporter.fatalTypeError(_tuple.location(), "Type" + quoteSpace(inlineArrayType->toString()) + "is only valid in storage.");
|
||||
|
||||
_tuple.annotation().type = TypeProvider::array(DataLocation::Memory, inlineArrayType, types.size());
|
||||
}
|
||||
@ -1496,10 +1497,11 @@ bool TypeChecker::visit(UnaryOperation const& _operation)
|
||||
{
|
||||
m_errorReporter.typeError(
|
||||
_operation.location(),
|
||||
"Unary operator " +
|
||||
string(TokenTraits::toString(op)) +
|
||||
" cannot be applied to type " +
|
||||
subExprType->toString()
|
||||
"Unary operator" +
|
||||
quoteSpace(string(TokenTraits::toString(op))) +
|
||||
"cannot be applied to type " +
|
||||
quote(subExprType->toString()) +
|
||||
"."
|
||||
);
|
||||
t = subExprType;
|
||||
}
|
||||
@ -1518,13 +1520,14 @@ void TypeChecker::endVisit(BinaryOperation const& _operation)
|
||||
{
|
||||
m_errorReporter.typeError(
|
||||
_operation.location(),
|
||||
"Operator " +
|
||||
string(TokenTraits::toString(_operation.getOperator())) +
|
||||
" not compatible with types " +
|
||||
leftType->toString() +
|
||||
" and " +
|
||||
rightType->toString() +
|
||||
(!result.message().empty() ? ". " + result.message() : "")
|
||||
"Operator" +
|
||||
quoteSpace(string(TokenTraits::toString(_operation.getOperator()))) +
|
||||
"not compatible with types" +
|
||||
quoteSpace(leftType->toString()) +
|
||||
"and " +
|
||||
quote(rightType->toString()) +
|
||||
"." +
|
||||
(!result.message().empty() ? " " + result.message() : "")
|
||||
);
|
||||
commonType = leftType;
|
||||
}
|
||||
@ -1553,7 +1556,7 @@ void TypeChecker::endVisit(BinaryOperation const& _operation)
|
||||
))
|
||||
m_errorReporter.warning(
|
||||
_operation.location(),
|
||||
"Result of " + operation + " has type " + commonType->toString() + " and thus "
|
||||
"Result of " + operation + " has type" + quoteSpace(commonType->toString()) + "and thus "
|
||||
"might overflow. Silence this warning by converting the literal to the "
|
||||
"expected type."
|
||||
);
|
||||
@ -1567,10 +1570,10 @@ void TypeChecker::endVisit(BinaryOperation const& _operation)
|
||||
_operation.location(),
|
||||
"The result type of the " +
|
||||
operation +
|
||||
" operation is equal to the type of the first operand (" +
|
||||
commonType->toString() +
|
||||
"operation is equal to the type of the first operand (" +
|
||||
quote(commonType->toString()) +
|
||||
") ignoring the (larger) type of the second operand (" +
|
||||
rightType->toString() +
|
||||
quote(rightType->toString()) +
|
||||
") which might be unexpected. Silence this warning by either converting "
|
||||
"the first or the second operand to the type of the other."
|
||||
);
|
||||
@ -1651,15 +1654,15 @@ TypePointer TypeChecker::typeCheckTypeConversionAndRetrieveReturnType(
|
||||
)
|
||||
)
|
||||
ssl.append(
|
||||
"Did you mean to declare this variable as \"address payable\"?",
|
||||
"Did you mean to declare this variable as " + quote("address payable") + "?",
|
||||
variableDeclaration->location()
|
||||
);
|
||||
m_errorReporter.typeError(
|
||||
_functionCall.location(),
|
||||
ssl,
|
||||
"Explicit type conversion not allowed from non-payable \"address\" to \"" +
|
||||
resultType->toString() +
|
||||
"\", which has a payable fallback function."
|
||||
"Explicit type conversion not allowed from non-payable" + quoteSpace("address") + "to " +
|
||||
quote(resultType->toString()) +
|
||||
", which has a payable fallback function."
|
||||
);
|
||||
}
|
||||
else if (
|
||||
@ -1670,21 +1673,19 @@ TypePointer TypeChecker::typeCheckTypeConversionAndRetrieveReturnType(
|
||||
)
|
||||
m_errorReporter.typeError(
|
||||
_functionCall.location(),
|
||||
"Explicit type conversion not allowed from \"" +
|
||||
argType->toString() +
|
||||
"\" to \"" +
|
||||
resultType->toString() +
|
||||
"\". To obtain the address of the contract of the function, " +
|
||||
"you can use the .address member of the function."
|
||||
"Explicit type conversion not allowed from" + quoteSpace(argType->toString()) + "to " +
|
||||
quote(resultType->toString()) +
|
||||
". To obtain the address of the contract of the function, " +
|
||||
"you can use the" + quoteSpace(".address") + "member of the function."
|
||||
);
|
||||
else
|
||||
m_errorReporter.typeError(
|
||||
_functionCall.location(),
|
||||
"Explicit type conversion not allowed from \"" +
|
||||
argType->toString() +
|
||||
"\" to \"" +
|
||||
resultType->toString() +
|
||||
"\"."
|
||||
"Explicit type conversion not allowed from" +
|
||||
quoteSpace(argType->toString()) +
|
||||
"to " +
|
||||
quote(resultType->toString()) +
|
||||
"."
|
||||
);
|
||||
}
|
||||
if (auto addressType = dynamic_cast<AddressType const*>(resultType))
|
||||
@ -1716,14 +1717,14 @@ void TypeChecker::typeCheckFunctionCall(
|
||||
)
|
||||
m_errorReporter.typeError(
|
||||
_functionCall.location(),
|
||||
"\"staticcall\" is not supported by the VM version."
|
||||
quote("staticcall") + " is not supported by the VM version."
|
||||
);
|
||||
|
||||
// Check for event outside of emit statement
|
||||
if (!m_insideEmitStatement && _functionType->kind() == FunctionType::Kind::Event)
|
||||
m_errorReporter.typeError(
|
||||
_functionCall.location(),
|
||||
"Event invocations have to be prefixed by \"emit\"."
|
||||
"Event invocations have to be prefixed by " + quote("emit") + "."
|
||||
);
|
||||
|
||||
// Perform standard function call type checking
|
||||
@ -1739,16 +1740,16 @@ void TypeChecker::typeCheckFallbackFunction(FunctionDefinition const& _function)
|
||||
if (_function.stateMutability() != StateMutability::NonPayable && _function.stateMutability() != StateMutability::Payable)
|
||||
m_errorReporter.typeError(
|
||||
_function.location(),
|
||||
"Fallback function must be payable or non-payable, but is \"" +
|
||||
stateMutabilityToString(_function.stateMutability()) +
|
||||
"\"."
|
||||
"Fallback function must be payable or non-payable, but is " +
|
||||
quote(stateMutabilityToString(_function.stateMutability())) +
|
||||
"."
|
||||
);
|
||||
if (_function.visibility() != Visibility::External)
|
||||
m_errorReporter.typeError(_function.location(), "Fallback function must be defined as \"external\".");
|
||||
m_errorReporter.typeError(_function.location(), "Fallback function must be defined as " + quote("external") + ".");
|
||||
if (!_function.returnParameters().empty())
|
||||
{
|
||||
if (_function.returnParameters().size() > 1 || *type(*_function.returnParameters().front()) != *TypeProvider::bytesMemory())
|
||||
m_errorReporter.typeError(_function.returnParameterList()->location(), "Fallback function can only have a single \"bytes memory\" return value.");
|
||||
m_errorReporter.typeError(_function.returnParameterList()->location(), "Fallback function can only have a single" + quoteSpace("bytes memory") + "return value.");
|
||||
else
|
||||
m_errorReporter.typeError(_function.returnParameterList()->location(), "Return values for fallback functions are not yet implemented.");
|
||||
}
|
||||
@ -1766,12 +1767,12 @@ void TypeChecker::typeCheckReceiveFunction(FunctionDefinition const& _function)
|
||||
if (_function.stateMutability() != StateMutability::Payable)
|
||||
m_errorReporter.typeError(
|
||||
_function.location(),
|
||||
"Receive ether function must be payable, but is \"" +
|
||||
stateMutabilityToString(_function.stateMutability()) +
|
||||
"\"."
|
||||
"Receive ether function must be" + quoteSpace("payable") + "but is " +
|
||||
quote(stateMutabilityToString(_function.stateMutability())) +
|
||||
"."
|
||||
);
|
||||
if (_function.visibility() != Visibility::External)
|
||||
m_errorReporter.typeError(_function.location(), "Receive ether function must be defined as \"external\".");
|
||||
m_errorReporter.typeError(_function.location(), "Receive ether function must be defined as " + quote("external") + ".");
|
||||
if (!_function.returnParameters().empty())
|
||||
m_errorReporter.typeError(_function.returnParameterList()->location(), "Receive ether function cannot return values.");
|
||||
if (!_function.parameters().empty())
|
||||
@ -1783,13 +1784,13 @@ void TypeChecker::typeCheckConstructor(FunctionDefinition const& _function)
|
||||
{
|
||||
solAssert(_function.isConstructor(), "");
|
||||
if (!_function.returnParameters().empty())
|
||||
m_errorReporter.typeError(_function.returnParameterList()->location(), "Non-empty \"returns\" directive for constructor.");
|
||||
m_errorReporter.typeError(_function.returnParameterList()->location(), "Non-empty" + quoteSpace("returns") + "directive for constructor.");
|
||||
if (_function.stateMutability() != StateMutability::NonPayable && _function.stateMutability() != StateMutability::Payable)
|
||||
m_errorReporter.typeError(
|
||||
_function.location(),
|
||||
"Constructor must be payable or non-payable, but is \"" +
|
||||
stateMutabilityToString(_function.stateMutability()) +
|
||||
"\"."
|
||||
"Constructor must be payable or non-payable, but is " +
|
||||
quote(stateMutabilityToString(_function.stateMutability())) +
|
||||
"."
|
||||
);
|
||||
if (_function.visibility() != Visibility::Public && _function.visibility() != Visibility::Internal)
|
||||
m_errorReporter.typeError(_function.location(), "Constructor must be public or internal.");
|
||||
@ -1949,7 +1950,8 @@ void TypeChecker::typeCheckFunctionGeneralChecks(
|
||||
{
|
||||
msg += " Members that have to be skipped in memory:";
|
||||
for (auto const& member: membersRemovedForStructConstructor)
|
||||
msg += " " + member;
|
||||
msg += " " + quote(member);
|
||||
msg += ".";
|
||||
}
|
||||
}
|
||||
else if (
|
||||
@ -1966,8 +1968,8 @@ void TypeChecker::typeCheckFunctionGeneralChecks(
|
||||
else
|
||||
msg +=
|
||||
" This function requires a single bytes argument."
|
||||
" If all your arguments are value types, you can use"
|
||||
" abi.encode(...) to properly generate it.";
|
||||
" If all your arguments are value types, you can use" +
|
||||
quoteSpace("abi.encode(...)") + "to properly generate it.";
|
||||
}
|
||||
else if (
|
||||
_functionType->kind() == FunctionType::Kind::KECCAK256 ||
|
||||
@ -1977,7 +1979,7 @@ void TypeChecker::typeCheckFunctionGeneralChecks(
|
||||
msg +=
|
||||
" This function requires a single bytes argument."
|
||||
" Use abi.encodePacked(...) to obtain the pre-0.5.0"
|
||||
" behaviour or abi.encode(...) to use ABI encoding.";
|
||||
" behaviour or" + quoteSpace("abi.encode(...)") + "to use ABI encoding.";
|
||||
m_errorReporter.typeError(_functionCall.location(), msg);
|
||||
return;
|
||||
}
|
||||
@ -2008,7 +2010,7 @@ void TypeChecker::typeCheckFunctionGeneralChecks(
|
||||
duplication = true;
|
||||
m_errorReporter.typeError(
|
||||
arguments[i]->location(),
|
||||
"Duplicate named argument \"" + *argumentNames[i] + "\"."
|
||||
"Duplicate named argument " + quote(*argumentNames[i]) + "."
|
||||
);
|
||||
}
|
||||
if (duplication)
|
||||
@ -2034,9 +2036,9 @@ void TypeChecker::typeCheckFunctionGeneralChecks(
|
||||
not_all_mapped = true;
|
||||
m_errorReporter.typeError(
|
||||
_functionCall.location(),
|
||||
"Named argument \"" +
|
||||
*argumentNames[i] +
|
||||
"\" does not match function declaration."
|
||||
"Named argument" +
|
||||
quoteSpace(*argumentNames[i]) +
|
||||
"does not match function declaration."
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -2054,10 +2056,10 @@ void TypeChecker::typeCheckFunctionGeneralChecks(
|
||||
{
|
||||
string msg =
|
||||
"Invalid type for argument in function call. "
|
||||
"Invalid implicit conversion from " +
|
||||
type(*paramArgMap[i])->toString() +
|
||||
" to " +
|
||||
parameterTypes[i]->toString() +
|
||||
"Invalid implicit conversion from" +
|
||||
quoteSpace(type(*paramArgMap[i])->toString()) +
|
||||
"to " +
|
||||
quote(parameterTypes[i]->toString()) +
|
||||
" requested.";
|
||||
if (
|
||||
_functionType->kind() == FunctionType::Kind::BareCall ||
|
||||
@ -2066,18 +2068,18 @@ void TypeChecker::typeCheckFunctionGeneralChecks(
|
||||
_functionType->kind() == FunctionType::Kind::BareStaticCall
|
||||
)
|
||||
msg +=
|
||||
" This function requires a single bytes argument."
|
||||
" This function requires a single" + quoteSpace("bytes") + "argument."
|
||||
" If all your arguments are value types, you can"
|
||||
" use abi.encode(...) to properly generate it.";
|
||||
" use" + quoteSpace("abi.encode(...)") + "to properly generate it.";
|
||||
else if (
|
||||
_functionType->kind() == FunctionType::Kind::KECCAK256 ||
|
||||
_functionType->kind() == FunctionType::Kind::SHA256 ||
|
||||
_functionType->kind() == FunctionType::Kind::RIPEMD160
|
||||
)
|
||||
msg +=
|
||||
" This function requires a single bytes argument."
|
||||
" Use abi.encodePacked(...) to obtain the pre-0.5.0"
|
||||
" behaviour or abi.encode(...) to use ABI encoding.";
|
||||
" This function requires a single" + quoteSpace("bytes") + "argument."
|
||||
" Use" + quoteSpace("abi.encodePacked(...)") + "to obtain the pre-0.5.0"
|
||||
" behaviour or" + quoteSpace("abi.encode(...)") + "to use ABI encoding.";
|
||||
m_errorReporter.typeError(paramArgMap[i]->location(), msg);
|
||||
}
|
||||
}
|
||||
@ -2327,13 +2329,13 @@ bool TypeChecker::visit(MemberAccess const& _memberAccess)
|
||||
if (!storageType->members(m_scope).membersByName(memberName).empty())
|
||||
m_errorReporter.fatalTypeError(
|
||||
_memberAccess.location(),
|
||||
"Member \"" + memberName + "\" is not available in " +
|
||||
exprType->toString() +
|
||||
" outside of storage."
|
||||
"Member" + quoteSpace(memberName) + "is not available in" +
|
||||
quoteSpace(exprType->toString()) +
|
||||
"outside of storage."
|
||||
);
|
||||
}
|
||||
string errorMsg = "Member \"" + memberName + "\" not found or not visible "
|
||||
"after argument-dependent lookup in " + exprType->toString() + ".";
|
||||
string errorMsg = "Member" + quoteSpace(memberName) + "not found or not visible "
|
||||
"after argument-dependent lookup in " + quote(exprType->toString()) + ".";
|
||||
|
||||
if (auto const& funType = dynamic_cast<FunctionType const*>(exprType))
|
||||
{
|
||||
@ -2342,14 +2344,14 @@ bool TypeChecker::visit(MemberAccess const& _memberAccess)
|
||||
if (memberName == "value")
|
||||
{
|
||||
if (funType->kind() == FunctionType::Kind::Creation)
|
||||
errorMsg = "Constructor for " + t.front()->toString() + " must be payable for member \"value\" to be available.";
|
||||
errorMsg = "Constructor for" + quoteSpace(t.front()->toString()) + "must be payable for member" + quoteSpace("value") + "to be available.";
|
||||
else if (
|
||||
funType->kind() == FunctionType::Kind::DelegateCall ||
|
||||
funType->kind() == FunctionType::Kind::BareDelegateCall
|
||||
)
|
||||
errorMsg = "Member \"value\" is not allowed in delegated calls due to \"msg.value\" persisting.";
|
||||
errorMsg = "Member" + quoteSpace("value") + "is not allowed in delegated calls due to" + quoteSpace("msg.value") + "persisting.";
|
||||
else
|
||||
errorMsg = "Member \"value\" is only available for payable functions.";
|
||||
errorMsg = "Member" + quoteSpace("value") + "is only available for payable functions.";
|
||||
}
|
||||
else if (
|
||||
t.size() == 1 &&
|
||||
@ -2365,7 +2367,7 @@ bool TypeChecker::visit(MemberAccess const& _memberAccess)
|
||||
{
|
||||
Identifier const* var = dynamic_cast<Identifier const*>(&_memberAccess.expression());
|
||||
string varName = var ? var->name() : "...";
|
||||
errorMsg += " Use \"address(" + varName + ")." + memberName + "\" to access this address member.";
|
||||
errorMsg += " Use" + quoteSpace("address(" + varName + ")." + memberName) + "to access this address member.";
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -2379,7 +2381,7 @@ bool TypeChecker::visit(MemberAccess const& _memberAccess)
|
||||
"Expected address not-payable as members were not found"
|
||||
);
|
||||
|
||||
errorMsg = "\"send\" and \"transfer\" are only available for objects of type \"address payable\", not \"" + exprType->toString() + "\".";
|
||||
errorMsg = quote("send") + " and" + quoteSpace("transfer") + "are only available for objects of type " + quote("address payable") + ", not " + quote(exprType->toString()) + ".";
|
||||
}
|
||||
}
|
||||
|
||||
@ -2391,9 +2393,9 @@ bool TypeChecker::visit(MemberAccess const& _memberAccess)
|
||||
else if (possibleMembers.size() > 1)
|
||||
m_errorReporter.fatalTypeError(
|
||||
_memberAccess.location(),
|
||||
"Member \"" + memberName + "\" not unique "
|
||||
"after argument-dependent lookup in " + exprType->toString() +
|
||||
(memberName == "value" ? " - did you forget the \"payable\" modifier?" : ".")
|
||||
"Member" + quoteSpace(memberName) + "not unique "
|
||||
"after argument-dependent lookup in " + quote(exprType->toString()) +
|
||||
(memberName == "value" ? " - did you forget the" + quoteSpace("payable") + "modifier?" : ".")
|
||||
);
|
||||
|
||||
annotation.referencedDeclaration = possibleMembers.front().declaration;
|
||||
@ -2550,7 +2552,7 @@ bool TypeChecker::visit(IndexAccess const& _access)
|
||||
default:
|
||||
m_errorReporter.fatalTypeError(
|
||||
_access.baseExpression().location(),
|
||||
"Indexed expression has to be a type, mapping or array (is " + baseType->toString() + ")"
|
||||
"Indexed expression has to be a type, mapping or array (is " + quote(baseType->toString()) + ")."
|
||||
);
|
||||
}
|
||||
_access.annotation().type = resultType;
|
||||
@ -2695,12 +2697,12 @@ bool TypeChecker::visit(Identifier const& _identifier)
|
||||
if (_identifier.name() == "sha3" && fType->kind() == FunctionType::Kind::KECCAK256)
|
||||
m_errorReporter.typeError(
|
||||
_identifier.location(),
|
||||
"\"sha3\" has been deprecated in favour of \"keccak256\"."
|
||||
quote("sha3") + " has been deprecated in favour of " + quote("keccak256") + "."
|
||||
);
|
||||
else if (_identifier.name() == "suicide" && fType->kind() == FunctionType::Kind::Selfdestruct)
|
||||
m_errorReporter.typeError(
|
||||
_identifier.location(),
|
||||
"\"suicide\" has been deprecated in favour of \"selfdestruct\"."
|
||||
quote("suicide") + " has been deprecated in favour of " + quote("selfdestruct") + "."
|
||||
);
|
||||
}
|
||||
|
||||
@ -2740,14 +2742,14 @@ void TypeChecker::endVisit(Literal const& _literal)
|
||||
{
|
||||
msg = "This looks like an address but has an invalid checksum.";
|
||||
if (!_literal.getChecksummedAddress().empty())
|
||||
msg += " Correct checksummed address: \"" + _literal.getChecksummedAddress() + "\".";
|
||||
msg += " Correct checksummed address: " + quote(_literal.getChecksummedAddress()) + ".";
|
||||
}
|
||||
|
||||
if (!msg.empty())
|
||||
m_errorReporter.syntaxError(
|
||||
_literal.location(),
|
||||
msg +
|
||||
" If this is not used as an address, please prepend '00'. " +
|
||||
" If this is not used as an address, please prepend " + quote("00") + ". " +
|
||||
"For more information please see https://solidity.readthedocs.io/en/develop/types.html#address-literals"
|
||||
);
|
||||
}
|
||||
@ -2756,13 +2758,13 @@ void TypeChecker::endVisit(Literal const& _literal)
|
||||
m_errorReporter.fatalTypeError(
|
||||
_literal.location(),
|
||||
"Hexadecimal numbers cannot be used with unit denominations. "
|
||||
"You can use an expression of the form \"0x1234 * 1 day\" instead."
|
||||
"You can use an expression of the form" + quoteSpace("0x1234 * 1 day") + "instead."
|
||||
);
|
||||
|
||||
if (_literal.subDenomination() == Literal::SubDenomination::Year)
|
||||
m_errorReporter.typeError(
|
||||
_literal.location(),
|
||||
"Using \"years\" as a unit denomination is deprecated."
|
||||
"Using" + quoteSpace("years") + "as a unit denomination is deprecated."
|
||||
);
|
||||
|
||||
if (!_literal.annotation().type)
|
||||
@ -2807,10 +2809,10 @@ bool TypeChecker::expectType(Expression const& _expression, Type const& _expecte
|
||||
_expression.accept(*this);
|
||||
if (!type(_expression)->isImplicitlyConvertibleTo(_expectedType))
|
||||
{
|
||||
auto errorMsg = "Type " +
|
||||
type(_expression)->toString() +
|
||||
" is not implicitly convertible to expected type " +
|
||||
_expectedType.toString();
|
||||
auto errorMsg = "Type" +
|
||||
quoteSpace(type(_expression)->toString()) +
|
||||
"is not implicitly convertible to expected type " +
|
||||
quote(_expectedType.toString());
|
||||
if (
|
||||
type(_expression)->category() == Type::Category::RationalNumber &&
|
||||
dynamic_cast<RationalNumberType const*>(type(_expression))->isFractional() &&
|
||||
@ -2826,9 +2828,9 @@ bool TypeChecker::expectType(Expression const& _expression, Type const& _expecte
|
||||
m_errorReporter.typeError(
|
||||
_expression.location(),
|
||||
errorMsg +
|
||||
". Try converting to type " +
|
||||
type(_expression)->mobileType()->toString() +
|
||||
" or use an explicit conversion."
|
||||
". Try converting to type" +
|
||||
quoteSpace(type(_expression)->mobileType()->toString()) +
|
||||
"or use an explicit conversion."
|
||||
);
|
||||
}
|
||||
else
|
||||
@ -2846,6 +2848,8 @@ void TypeChecker::requireLValue(Expression const& _expression)
|
||||
if (_expression.annotation().isLValue)
|
||||
return;
|
||||
|
||||
string errMsg;
|
||||
|
||||
return m_errorReporter.typeError(_expression.location(), [&]() {
|
||||
if (_expression.annotation().isConstant)
|
||||
return "Cannot assign to a constant variable.";
|
||||
@ -2868,7 +2872,7 @@ void TypeChecker::requireLValue(Expression const& _expression)
|
||||
}
|
||||
else if (dynamic_cast<ArrayType const*>(type(memberAccess->expression())))
|
||||
if (memberAccess->memberName() == "length")
|
||||
return "Member \"length\" is read-only and cannot be used to resize arrays.";
|
||||
return (errMsg = string("Member") + quoteSpace("length") + string("is read-only and cannot be used to resize arrays.")).c_str();
|
||||
}
|
||||
|
||||
if (auto identifier = dynamic_cast<Identifier const*>(&_expression))
|
||||
|
@ -171,7 +171,8 @@ void ViewPureChecker::endVisit(FunctionDefinition const& _funDef)
|
||||
)
|
||||
m_errorReporter.warning(
|
||||
_funDef.location(),
|
||||
"Function state mutability can be restricted to " + stateMutabilityToString(m_bestMutabilityAndLocation.mutability)
|
||||
"Function state mutability can be restricted to " + quote(stateMutabilityToString(m_bestMutabilityAndLocation.mutability)) +
|
||||
"."
|
||||
);
|
||||
m_currentFunction = nullptr;
|
||||
}
|
||||
@ -252,8 +253,8 @@ void ViewPureChecker::reportMutability(
|
||||
{
|
||||
m_errorReporter.typeError(
|
||||
_location,
|
||||
"Function declared as pure, but this expression (potentially) reads from the "
|
||||
"environment or state and thus requires \"view\"."
|
||||
"Function declared as " + quote("pure") + ", but this expression (potentially) reads from the "
|
||||
"environment or state and thus requires " + quote("view") + "."
|
||||
);
|
||||
m_errors = true;
|
||||
}
|
||||
@ -262,9 +263,9 @@ void ViewPureChecker::reportMutability(
|
||||
m_errorReporter.typeError(
|
||||
_location,
|
||||
"Function declared as " +
|
||||
stateMutabilityToString(m_currentFunction->stateMutability()) +
|
||||
quote(stateMutabilityToString(m_currentFunction->stateMutability())) +
|
||||
", but this expression (potentially) modifies the state and thus "
|
||||
"requires non-payable (the default) or payable."
|
||||
"requires non-payable (the default) or " + quote("payable") + "."
|
||||
);
|
||||
m_errors = true;
|
||||
}
|
||||
@ -277,14 +278,14 @@ void ViewPureChecker::reportMutability(
|
||||
if (_nestedLocation)
|
||||
m_errorReporter.typeError(
|
||||
_location,
|
||||
SecondarySourceLocation().append("\"msg.value\" or \"callvalue()\" appear here inside the modifier.", *_nestedLocation),
|
||||
"This modifier uses \"msg.value\" or \"callvalue()\" and thus the function has to be payable or internal."
|
||||
SecondarySourceLocation().append(quote("msg.value") + " or" + quoteSpace("callvalue()") + "appear here inside the modifier.", *_nestedLocation),
|
||||
"This modifier uses" + quoteSpace("msg.value") + "or" + quoteSpace("callvalue()") + "and thus the function has to be" + quoteSpace("payable") + "or " + quote("internal") + "."
|
||||
);
|
||||
else
|
||||
m_errorReporter.typeError(
|
||||
_location,
|
||||
"\"msg.value\" and \"callvalue()\" can only be used in payable public functions. Make the function "
|
||||
"\"payable\" or use an internal function to avoid this error."
|
||||
quote("msg.value") + " and" + quoteSpace("callvalue()") + "can only be used in payable public functions. Make the function" +
|
||||
quoteSpace("payable") + "or use an internal function to avoid this error."
|
||||
);
|
||||
m_errors = true;
|
||||
}
|
||||
|
@ -31,6 +31,8 @@
|
||||
#include <libsolutil/Keccak256.h>
|
||||
#include <libsolutil/UTF8.h>
|
||||
|
||||
#include <liblangutil/ErrorReporter.h>
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/algorithm/string/classification.hpp>
|
||||
#include <boost/algorithm/string/join.hpp>
|
||||
@ -116,7 +118,7 @@ BoolResult fitsIntegerType(bigint const& _value, IntegerType const& _type)
|
||||
return BoolResult::err("Cannot implicitly convert signed literal to unsigned type.");
|
||||
|
||||
if (_type.minValue() > _value || _value > _type.maxValue())
|
||||
return BoolResult::err("Literal is too large to fit in " + _type.toString(false) + ".");
|
||||
return BoolResult::err("Literal is too large to fit in " + langutil::quote(_type.toString(false)) + ".");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -504,7 +504,7 @@ void SMTEncoder::endVisit(UnaryOperation const& _op)
|
||||
else
|
||||
m_errorReporter.warning(
|
||||
_op.location(),
|
||||
"Assertion checker does not yet implement \"delete\" for this expression."
|
||||
"Assertion checker does not yet implement" + quoteSpace("delete") + "for this expression."
|
||||
);
|
||||
}
|
||||
break;
|
||||
@ -785,7 +785,7 @@ void SMTEncoder::endVisit(Literal const& _literal)
|
||||
m_errorReporter.warning(
|
||||
_literal.location(),
|
||||
"Assertion checker does not yet support the type of this literal (" +
|
||||
_literal.annotation().type->toString() +
|
||||
quote(_literal.annotation().type->toString()) +
|
||||
")."
|
||||
);
|
||||
}
|
||||
@ -1076,7 +1076,7 @@ void SMTEncoder::arithmeticOperation(BinaryOperation const& _op)
|
||||
else
|
||||
m_errorReporter.warning(
|
||||
_op.location(),
|
||||
"Assertion checker does not yet implement this operator for type " + type->richIdentifier() + "."
|
||||
"Assertion checker does not yet implement this operator for type " + quote(type->richIdentifier()) + "."
|
||||
);
|
||||
}
|
||||
|
||||
@ -1167,7 +1167,7 @@ void SMTEncoder::compareOperation(BinaryOperation const& _op)
|
||||
else
|
||||
m_errorReporter.warning(
|
||||
_op.location(),
|
||||
"Assertion checker does not yet implement the type " + _op.annotation().commonType->toString() + " for comparisons"
|
||||
"Assertion checker does not yet implement the type" + quoteSpace(_op.annotation().commonType->toString()) + "for comparisons."
|
||||
);
|
||||
}
|
||||
|
||||
@ -1195,7 +1195,7 @@ void SMTEncoder::booleanOperation(BinaryOperation const& _op)
|
||||
else
|
||||
m_errorReporter.warning(
|
||||
_op.location(),
|
||||
"Assertion checker does not yet implement the type " + _op.annotation().commonType->toString() + " for boolean operations"
|
||||
"Assertion checker does not yet implement the type" + quoteSpace(_op.annotation().commonType->toString()) + "for boolean operations."
|
||||
);
|
||||
}
|
||||
|
||||
@ -1227,7 +1227,7 @@ void SMTEncoder::assignment(
|
||||
|
||||
m_errorReporter.warning(
|
||||
_location,
|
||||
"Assertion checker does not yet implement type " + _type->toString()
|
||||
"Assertion checker does not yet implement type " + quote(_type->toString()) + "."
|
||||
);
|
||||
}
|
||||
else if (auto varDecl = identifierToVariable(_left))
|
||||
@ -1488,7 +1488,7 @@ void SMTEncoder::createExpr(Expression const& _e)
|
||||
if (abstract)
|
||||
m_errorReporter.warning(
|
||||
_e.location(),
|
||||
"Assertion checker does not yet implement type " + _e.annotation().type->toString()
|
||||
"Assertion checker does not yet implement type " + quote(_e.annotation().type->toString()) + "."
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -901,7 +901,7 @@ StringMap CompilerStack::loadMissingSources(SourceUnit const& _ast, std::string
|
||||
{
|
||||
m_errorReporter.parserError(
|
||||
import->location(),
|
||||
string("Source \"" + importPath + "\" not found: " + result.responseOrErrorMessage)
|
||||
string("Source" + quoteSpace(importPath) + "not found: " + result.responseOrErrorMessage)
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
@ -322,11 +322,11 @@ Json::Value collectEVMObject(evmasm::LinkerObject const& _object, string const*
|
||||
std::optional<Json::Value> checkKeys(Json::Value const& _input, set<string> const& _keys, string const& _name)
|
||||
{
|
||||
if (!!_input && !_input.isObject())
|
||||
return formatFatalError("JSONError", "\"" + _name + "\" must be an object");
|
||||
return formatFatalError("JSONError", quote(_name) + " must be an object");
|
||||
|
||||
for (auto const& member: _input.getMemberNames())
|
||||
if (!_keys.count(member))
|
||||
return formatFatalError("JSONError", "Unknown key \"" + member + "\"");
|
||||
return formatFatalError("JSONError", "Unknown key " + quote(member));
|
||||
|
||||
return std::nullopt;
|
||||
}
|
||||
@ -372,7 +372,7 @@ std::optional<Json::Value> checkOptimizerDetail(Json::Value const& _details, std
|
||||
if (_details.isMember(_name))
|
||||
{
|
||||
if (!_details[_name].isBool())
|
||||
return formatFatalError("JSONError", "\"settings.optimizer.details." + _name + "\" must be Boolean");
|
||||
return formatFatalError("JSONError", quote("settings.optimizer.details." + _name) + " must be Boolean");
|
||||
_setting = _details[_name].asBool();
|
||||
}
|
||||
return {};
|
||||
@ -383,11 +383,11 @@ std::optional<Json::Value> checkMetadataKeys(Json::Value const& _input)
|
||||
if (_input.isObject())
|
||||
{
|
||||
if (_input.isMember("useLiteralContent") && !_input["useLiteralContent"].isBool())
|
||||
return formatFatalError("JSONError", "\"settings.metadata.useLiteralContent\" must be Boolean");
|
||||
return formatFatalError("JSONError", quote("settings.metadata.useLiteralContent") + " must be Boolean");
|
||||
|
||||
static set<string> hashes{"ipfs", "bzzr1", "none"};
|
||||
if (_input.isMember("bytecodeHash") && !hashes.count(_input["bytecodeHash"].asString()))
|
||||
return formatFatalError("JSONError", "\"settings.metadata.bytecodeHash\" must be \"ipfs\", \"bzzr1\" or \"none\"");
|
||||
return formatFatalError("JSONError", quote("settings.metadata.bytecodeHash") + " must be " + quoteSpace("ipfs") + "," + quoteSpace("bzzr1") + "or " + quote("none"));
|
||||
}
|
||||
static set<string> keys{"useLiteralContent", "bytecodeHash"};
|
||||
return checkKeys(_input, keys, "settings.metadata");
|
||||
@ -396,7 +396,7 @@ std::optional<Json::Value> checkMetadataKeys(Json::Value const& _input)
|
||||
std::optional<Json::Value> checkOutputSelection(Json::Value const& _outputSelection)
|
||||
{
|
||||
if (!!_outputSelection && !_outputSelection.isObject())
|
||||
return formatFatalError("JSONError", "\"settings.outputSelection\" must be an object");
|
||||
return formatFatalError("JSONError", quote("settings.outputSelection") + " must be an object");
|
||||
|
||||
for (auto const& sourceName: _outputSelection.getMemberNames())
|
||||
{
|
||||
@ -405,7 +405,7 @@ std::optional<Json::Value> checkOutputSelection(Json::Value const& _outputSelect
|
||||
if (!sourceVal.isObject())
|
||||
return formatFatalError(
|
||||
"JSONError",
|
||||
"\"settings.outputSelection." + sourceName + "\" must be an object"
|
||||
quote("settings.outputSelection." + sourceName) + " must be an object"
|
||||
);
|
||||
|
||||
for (auto const& contractName: sourceVal.getMemberNames())
|
||||
@ -415,22 +415,26 @@ std::optional<Json::Value> checkOutputSelection(Json::Value const& _outputSelect
|
||||
if (!contractVal.isArray())
|
||||
return formatFatalError(
|
||||
"JSONError",
|
||||
"\"settings.outputSelection." +
|
||||
sourceName +
|
||||
"." +
|
||||
contractName +
|
||||
"\" must be a string array"
|
||||
quote(
|
||||
"settings.outputSelection." +
|
||||
sourceName +
|
||||
"." +
|
||||
contractName
|
||||
) +
|
||||
" must be a string array"
|
||||
);
|
||||
|
||||
for (auto const& output: contractVal)
|
||||
if (!output.isString())
|
||||
return formatFatalError(
|
||||
"JSONError",
|
||||
"\"settings.outputSelection." +
|
||||
sourceName +
|
||||
"." +
|
||||
contractName +
|
||||
"\" must be a string array"
|
||||
quote(
|
||||
"settings.outputSelection." +
|
||||
sourceName +
|
||||
"." +
|
||||
contractName
|
||||
) +
|
||||
" must be a string array"
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -449,7 +453,7 @@ boost::variant<OptimiserSettings, Json::Value> parseOptimizerSettings(Json::Valu
|
||||
if (_jsonInput.isMember("enabled"))
|
||||
{
|
||||
if (!_jsonInput["enabled"].isBool())
|
||||
return formatFatalError("JSONError", "The \"enabled\" setting must be a Boolean.");
|
||||
return formatFatalError("JSONError", "The" + quoteSpace("enabled") + "setting must be a Boolean.");
|
||||
|
||||
settings = _jsonInput["enabled"].asBool() ? OptimiserSettings::standard() : OptimiserSettings::minimal();
|
||||
}
|
||||
@ -457,7 +461,7 @@ boost::variant<OptimiserSettings, Json::Value> parseOptimizerSettings(Json::Valu
|
||||
if (_jsonInput.isMember("runs"))
|
||||
{
|
||||
if (!_jsonInput["runs"].isUInt())
|
||||
return formatFatalError("JSONError", "The \"runs\" setting must be an unsigned number.");
|
||||
return formatFatalError("JSONError", "The" + quoteSpace("runs") + "setting must be an unsigned number.");
|
||||
settings.expectedExecutionsPerDeployment = _jsonInput["runs"].asUInt();
|
||||
}
|
||||
|
||||
@ -485,7 +489,7 @@ boost::variant<OptimiserSettings, Json::Value> parseOptimizerSettings(Json::Valu
|
||||
if (details.isMember("yulDetails"))
|
||||
{
|
||||
if (!settings.runYulOptimiser)
|
||||
return formatFatalError("JSONError", "\"Providing yulDetails requires Yul optimizer to be enabled.");
|
||||
return formatFatalError("JSONError", "Providing" + quoteSpace("yulDetails") + "requires Yul optimizer to be enabled.");
|
||||
|
||||
if (auto result = checkKeys(details["yulDetails"], {"stackAllocation"}, "settings.optimizer.details.yulDetails"))
|
||||
return *result;
|
||||
@ -513,7 +517,7 @@ boost::variant<StandardCompiler::InputsAndSettings, Json::Value> StandardCompile
|
||||
Json::Value const& sources = _input["sources"];
|
||||
|
||||
if (!sources.isObject() && !sources.isNull())
|
||||
return formatFatalError("JSONError", "\"sources\" is not a JSON object.");
|
||||
return formatFatalError("JSONError", quote("sources") + " is not a JSON object.");
|
||||
|
||||
if (sources.empty())
|
||||
return formatFatalError("JSONError", "No input sources specified.");
|
||||
@ -538,7 +542,7 @@ boost::variant<StandardCompiler::InputsAndSettings, Json::Value> StandardCompile
|
||||
false,
|
||||
"IOError",
|
||||
"general",
|
||||
"Mismatch between content and supplied hash for \"" + sourceName + "\""
|
||||
"Mismatch between content and supplied hash for " + quote(sourceName)
|
||||
));
|
||||
else
|
||||
ret.sources[sourceName] = content;
|
||||
@ -563,7 +567,7 @@ boost::variant<StandardCompiler::InputsAndSettings, Json::Value> StandardCompile
|
||||
false,
|
||||
"IOError",
|
||||
"general",
|
||||
"Mismatch between content and supplied hash for \"" + sourceName + "\" at \"" + url.asString() + "\""
|
||||
"Mismatch between content and supplied hash for" + quoteSpace(sourceName) + "at " + quote(url.asString())
|
||||
));
|
||||
else
|
||||
{
|
||||
@ -573,7 +577,7 @@ boost::variant<StandardCompiler::InputsAndSettings, Json::Value> StandardCompile
|
||||
}
|
||||
}
|
||||
else
|
||||
failures.push_back("Cannot import url (\"" + url.asString() + "\"): " + result.responseOrErrorMessage);
|
||||
failures.push_back("Cannot import url (" + quote(url.asString()) + "): " + result.responseOrErrorMessage + ".");
|
||||
}
|
||||
|
||||
for (auto const& failure: failures)
|
||||
@ -602,7 +606,7 @@ boost::variant<StandardCompiler::InputsAndSettings, Json::Value> StandardCompile
|
||||
if (!!smtlib2Responses)
|
||||
{
|
||||
if (!smtlib2Responses.isObject())
|
||||
return formatFatalError("JSONError", "\"auxiliaryInput.smtlib2responses\" must be an object.");
|
||||
return formatFatalError("JSONError", quote("auxiliaryInput.smtlib2responses") + " must be an object.");
|
||||
|
||||
for (auto const& hashString: smtlib2Responses.getMemberNames())
|
||||
{
|
||||
@ -619,7 +623,7 @@ boost::variant<StandardCompiler::InputsAndSettings, Json::Value> StandardCompile
|
||||
if (!smtlib2Responses[hashString].isString())
|
||||
return formatFatalError(
|
||||
"JSONError",
|
||||
"\"smtlib2Responses." + hashString + "\" must be a string."
|
||||
quote("smtlib2Responses." + hashString) + " must be a string."
|
||||
);
|
||||
|
||||
ret.smtLib2Responses[hash] = smtlib2Responses[hashString].asString();
|
||||
@ -635,14 +639,14 @@ boost::variant<StandardCompiler::InputsAndSettings, Json::Value> StandardCompile
|
||||
if (settings.isMember("parserErrorRecovery"))
|
||||
{
|
||||
if (!settings["parserErrorRecovery"].isBool())
|
||||
return formatFatalError("JSONError", "\"settings.parserErrorRecovery\" must be a Boolean.");
|
||||
return formatFatalError("JSONError", quote("settings.parserErrorRecovery") + " must be a Boolean.");
|
||||
ret.parserErrorRecovery = settings["parserErrorRecovery"].asBool();
|
||||
}
|
||||
|
||||
if (settings.isMember("evmVersion"))
|
||||
{
|
||||
if (!settings["evmVersion"].isString())
|
||||
return formatFatalError("JSONError", "evmVersion must be a string.");
|
||||
return formatFatalError("JSONError", quote("evmVersion") + " must be a string.");
|
||||
std::optional<langutil::EVMVersion> version = langutil::EVMVersion::fromString(settings["evmVersion"].asString());
|
||||
if (!version)
|
||||
return formatFatalError("JSONError", "Invalid EVM version requested.");
|
||||
@ -657,30 +661,30 @@ boost::variant<StandardCompiler::InputsAndSettings, Json::Value> StandardCompile
|
||||
if (settings["debug"].isMember("revertStrings"))
|
||||
{
|
||||
if (!settings["debug"]["revertStrings"].isString())
|
||||
return formatFatalError("JSONError", "settings.debug.revertStrings must be a string.");
|
||||
return formatFatalError("JSONError", quote("settings.debug.revertStrings") + " must be a string.");
|
||||
std::optional<RevertStrings> revertStrings = revertStringsFromString(settings["debug"]["revertStrings"].asString());
|
||||
if (!revertStrings)
|
||||
return formatFatalError("JSONError", "Invalid value for settings.debug.revertStrings.");
|
||||
return formatFatalError("JSONError", "Invalid value for " + quote("settings.debug.revertStrings") + ".");
|
||||
if (*revertStrings != RevertStrings::Default && *revertStrings != RevertStrings::Strip)
|
||||
return formatFatalError(
|
||||
"UnimplementedFeatureError",
|
||||
"Only \"default\" and \"strip\" are implemented for settings.debug.revertStrings for now."
|
||||
"Only" + quoteSpace("default") + "and" + quoteSpace("strip") + "are implemented for" + quoteSpace("settings.debug.revertStrings") + "for now."
|
||||
);
|
||||
ret.revertStrings = *revertStrings;
|
||||
}
|
||||
}
|
||||
|
||||
if (settings.isMember("remappings") && !settings["remappings"].isArray())
|
||||
return formatFatalError("JSONError", "\"settings.remappings\" must be an array of strings.");
|
||||
return formatFatalError("JSONError", quote("settings.remappings") + " must be an array of strings.");
|
||||
|
||||
for (auto const& remapping: settings.get("remappings", Json::Value()))
|
||||
{
|
||||
if (!remapping.isString())
|
||||
return formatFatalError("JSONError", "\"settings.remappings\" must be an array of strings");
|
||||
return formatFatalError("JSONError", quote("settings.remappings") + " must be an array of strings");
|
||||
if (auto r = CompilerStack::parseRemapping(remapping.asString()))
|
||||
ret.remappings.emplace_back(std::move(*r));
|
||||
else
|
||||
return formatFatalError("JSONError", "Invalid remapping: \"" + remapping.asString() + "\"");
|
||||
return formatFatalError("JSONError", "Invalid remapping: " + quote(remapping.asString()));
|
||||
}
|
||||
|
||||
if (settings.isMember("optimizer"))
|
||||
@ -694,7 +698,7 @@ boost::variant<StandardCompiler::InputsAndSettings, Json::Value> StandardCompile
|
||||
|
||||
Json::Value jsonLibraries = settings.get("libraries", Json::Value(Json::objectValue));
|
||||
if (!jsonLibraries.isObject())
|
||||
return formatFatalError("JSONError", "\"libraries\" is not a JSON object.");
|
||||
return formatFatalError("JSONError", quote("libraries") + " is not a JSON object.");
|
||||
for (auto const& sourceName: jsonLibraries.getMemberNames())
|
||||
{
|
||||
auto const& jsonSourceName = jsonLibraries[sourceName];
|
||||
@ -709,7 +713,7 @@ boost::variant<StandardCompiler::InputsAndSettings, Json::Value> StandardCompile
|
||||
if (!boost::starts_with(address, "0x"))
|
||||
return formatFatalError(
|
||||
"JSONError",
|
||||
"Library address is not prefixed with \"0x\"."
|
||||
"Library address is not prefixed with " + quote("0x") + "."
|
||||
);
|
||||
|
||||
if (address.length() != 42)
|
||||
@ -727,7 +731,7 @@ boost::variant<StandardCompiler::InputsAndSettings, Json::Value> StandardCompile
|
||||
{
|
||||
return formatFatalError(
|
||||
"JSONError",
|
||||
"Invalid library address (\"" + address + "\") supplied."
|
||||
"Invalid library address (" + quote(address) + ") supplied."
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1021,11 +1025,11 @@ Json::Value StandardCompiler::compileYul(InputsAndSettings _inputsAndSettings)
|
||||
if (!_inputsAndSettings.smtLib2Responses.empty())
|
||||
return formatFatalError("JSONError", "Yul mode does not support smtlib2responses.");
|
||||
if (!_inputsAndSettings.remappings.empty())
|
||||
return formatFatalError("JSONError", "Field \"settings.remappings\" cannot be used for Yul.");
|
||||
return formatFatalError("JSONError", "Field" + quoteSpace("settings.remappings") + "cannot be used for Yul.");
|
||||
if (!_inputsAndSettings.libraries.empty())
|
||||
return formatFatalError("JSONError", "Field \"settings.libraries\" cannot be used for Yul.");
|
||||
return formatFatalError("JSONError", "Field" + quoteSpace("settings.libraries") + "cannot be used for Yul.");
|
||||
if (_inputsAndSettings.revertStrings != RevertStrings::Default)
|
||||
return formatFatalError("JSONError", "Field \"settings.debug.revertStrings\" cannot be used for Yul.");
|
||||
return formatFatalError("JSONError", "Field" + quoteSpace("settings.debug.revertStrings") + "cannot be used for Yul.");
|
||||
|
||||
Json::Value output = Json::objectValue;
|
||||
|
||||
@ -1107,7 +1111,7 @@ Json::Value StandardCompiler::compile(Json::Value const& _input) noexcept
|
||||
else if (settings.language == "Yul")
|
||||
return compileYul(std::move(settings));
|
||||
else
|
||||
return formatFatalError("JSONError", "Only \"Solidity\" or \"Yul\" is supported as a language.");
|
||||
return formatFatalError("JSONError", "Only" + quoteSpace("Solidity") + "or" + quoteSpace("Yul") + "is supported as a language.");
|
||||
}
|
||||
catch (Json::LogicError const& _exception)
|
||||
{
|
||||
|
@ -97,7 +97,7 @@ bool DocStringParser::parse(string const& _docString, ErrorReporter& _errorRepor
|
||||
auto tagNameEndPos = firstWhitespaceOrNewline(tagPos, end);
|
||||
if (tagNameEndPos == end)
|
||||
{
|
||||
appendError("End of tag " + string(tagPos, tagNameEndPos) + " not found");
|
||||
appendError("End of tag" + quoteSpace(string(tagPos, tagNameEndPos)) + "not found.");
|
||||
break;
|
||||
}
|
||||
|
||||
@ -151,7 +151,7 @@ DocStringParser::iter DocStringParser::parseDocTagParam(iter _pos, iter _end)
|
||||
|
||||
if (descStartPos == nlPos)
|
||||
{
|
||||
appendError("No description given for param " + paramName);
|
||||
appendError("No description given for param " + quote(paramName) + ".");
|
||||
return _end;
|
||||
}
|
||||
|
||||
|
@ -226,11 +226,11 @@ ASTPointer<ImportDirective> Parser::parseImportDirective()
|
||||
unitAlias = expectIdentifierToken();
|
||||
}
|
||||
else
|
||||
fatalParserError("Expected string literal (path), \"*\" or alias list.");
|
||||
fatalParserError("Expected string literal (path)," + quoteSpace("*") + "or alias list.");
|
||||
// "from" is not a keyword but parsed as an identifier because of backwards
|
||||
// compatibility and because it is a really common word.
|
||||
if (m_scanner->currentToken() != Token::Identifier || m_scanner->currentLiteral() != "from")
|
||||
fatalParserError("Expected \"from\".");
|
||||
fatalParserError("Expected " + quote("from") + ".");
|
||||
m_scanner->next();
|
||||
if (m_scanner->currentToken() != Token::StringLiteral)
|
||||
fatalParserError("Expected import path.");
|
||||
@ -448,8 +448,8 @@ StateMutability Parser::parseStateMutability()
|
||||
case Token::Constant:
|
||||
stateMutability = StateMutability::View;
|
||||
parserError(
|
||||
"The state mutability modifier \"constant\" was removed in version 0.5.0. "
|
||||
"Use \"view\" or \"pure\" instead."
|
||||
"The state mutability modifier" + quoteSpace("constant") + "was removed in version 0.5.0. "
|
||||
"Use" + quoteSpace("view") + "or" + quoteSpace("pure") + "instead."
|
||||
);
|
||||
break;
|
||||
default:
|
||||
@ -481,9 +481,9 @@ Parser::FunctionHeaderParserResult Parser::parseFunctionHeader(bool _isStateVari
|
||||
if (_isStateVariable && (result.visibility == Visibility::External || result.visibility == Visibility::Internal))
|
||||
break;
|
||||
parserError(string(
|
||||
"Visibility already specified as \"" +
|
||||
Declaration::visibilityToString(result.visibility) +
|
||||
"\"."
|
||||
"Visibility already specified as " +
|
||||
quote(Declaration::visibilityToString(result.visibility)) +
|
||||
"."
|
||||
));
|
||||
m_scanner->next();
|
||||
}
|
||||
@ -495,9 +495,9 @@ Parser::FunctionHeaderParserResult Parser::parseFunctionHeader(bool _isStateVari
|
||||
if (result.stateMutability != StateMutability::NonPayable)
|
||||
{
|
||||
parserError(string(
|
||||
"State mutability already specified as \"" +
|
||||
stateMutabilityToString(result.stateMutability) +
|
||||
"\"."
|
||||
"State mutability already specified as " +
|
||||
quote(stateMutabilityToString(result.stateMutability)) +
|
||||
"."
|
||||
));
|
||||
m_scanner->next();
|
||||
}
|
||||
@ -559,9 +559,9 @@ ASTPointer<ASTNode> Parser::parseFunctionDefinition()
|
||||
}.at(m_scanner->currentToken());
|
||||
name = make_shared<ASTString>(TokenTraits::toString(m_scanner->currentToken()));
|
||||
string message{
|
||||
"This function is named \"" + *name + "\" but is not the " + expected + " of the contract. "
|
||||
"If you intend this to be a " + expected + ", use \"" + *name + "(...) { ... }\" without "
|
||||
"the \"function\" keyword to define it."
|
||||
"This function is named" + quoteSpace(*name) + "but is not the " + expected + " of the contract. "
|
||||
"If you intend this to be a " + expected + ", use" + quoteSpace(*name + "(...) { ... }") + "without " +
|
||||
"the" + quoteSpace("function") + "keyword to define it."
|
||||
};
|
||||
if (m_scanner->currentToken() == Token::Constructor)
|
||||
parserError(message);
|
||||
@ -647,10 +647,10 @@ ASTPointer<EnumDefinition> Parser::parseEnumDefinition()
|
||||
break;
|
||||
expectToken(Token::Comma);
|
||||
if (m_scanner->currentToken() != Token::Identifier)
|
||||
fatalParserError(string("Expected identifier after ','"));
|
||||
fatalParserError(string("Expected identifier after " + quote(",") + "."));
|
||||
}
|
||||
if (members.empty())
|
||||
parserError({"enum with no members is not allowed."});
|
||||
parserError({quote("enum") + " with no members is not allowed."});
|
||||
|
||||
nodeFactory.markEndPosition();
|
||||
expectToken(Token::RBrace);
|
||||
@ -678,8 +678,8 @@ ASTPointer<VariableDeclaration> Parser::parseVariableDeclaration(
|
||||
if (dynamic_cast<FunctionTypeName*>(type.get()) && _options.isStateVariable && m_scanner->currentToken() == Token::LBrace)
|
||||
fatalParserError(
|
||||
"Expected a state variable declaration. If you intended this as a fallback function "
|
||||
"or a function to handle plain ether transactions, use the \"fallback\" keyword "
|
||||
"or the \"ether\" keyword instead."
|
||||
"or a function to handle plain ether transactions, use the" + quoteSpace("fallback") + "keyword "
|
||||
"or the" + quoteSpace("ether") + "keyword instead."
|
||||
);
|
||||
|
||||
bool isIndexed = false;
|
||||
@ -698,9 +698,9 @@ ASTPointer<VariableDeclaration> Parser::parseVariableDeclaration(
|
||||
if (visibility != Visibility::Default)
|
||||
{
|
||||
parserError(string(
|
||||
"Visibility already specified as \"" +
|
||||
Declaration::visibilityToString(visibility) +
|
||||
"\"."
|
||||
"Visibility already specified as " +
|
||||
quote(Declaration::visibilityToString(visibility)) +
|
||||
"."
|
||||
));
|
||||
m_scanner->next();
|
||||
}
|
||||
@ -1182,7 +1182,7 @@ ASTPointer<InlineAssembly> Parser::parseInlineAssembly(ASTPointer<ASTString> con
|
||||
if (m_scanner->currentToken() == Token::StringLiteral)
|
||||
{
|
||||
if (m_scanner->currentLiteral() != "evmasm")
|
||||
fatalParserError("Only \"evmasm\" supported.");
|
||||
fatalParserError("Only" + quoteSpace("evmasm") + "supported.");
|
||||
// This can be used in the future to set the dialect.
|
||||
m_scanner->next();
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ bool AsmAnalyzer::operator()(Identifier const& _identifier)
|
||||
{
|
||||
m_errorReporter.declarationError(
|
||||
_identifier.location,
|
||||
"Variable " + _identifier.name.str() + " used before it was declared."
|
||||
"Variable" + quoteSpace(_identifier.name.str()) + "used before it was declared."
|
||||
);
|
||||
success = false;
|
||||
}
|
||||
@ -141,7 +141,7 @@ bool AsmAnalyzer::operator()(Identifier const& _identifier)
|
||||
{
|
||||
m_errorReporter.typeError(
|
||||
_identifier.location,
|
||||
"Function " + _identifier.name.str() + " used without being called."
|
||||
"Function" + quoteSpace(_identifier.name.str()) + "used without being called."
|
||||
);
|
||||
success = false;
|
||||
}
|
||||
@ -180,7 +180,7 @@ bool AsmAnalyzer::operator()(ExpressionStatement const& _statement)
|
||||
to_string(m_stackHeight - initialStackHeight) +
|
||||
" value" +
|
||||
(m_stackHeight - initialStackHeight == 1 ? "" : "s") +
|
||||
"). Use ``pop()`` or assign them.";
|
||||
"). Use" + quoteSpace("pop()") + "or assign them.";
|
||||
m_errorReporter.error(Error::Type::TypeError, _statement.location, msg);
|
||||
success = false;
|
||||
}
|
||||
@ -350,7 +350,7 @@ bool AsmAnalyzer::operator()(FunctionCall const& _funCall)
|
||||
else if (!m_dataNames.count(std::get<Literal>(arg).value))
|
||||
m_errorReporter.typeError(
|
||||
_funCall.functionName.location,
|
||||
"Unknown data object \"" + std::get<Literal>(arg).value.str() + "\"."
|
||||
"Unknown data object " + quote(std::get<Literal>(arg).value.str()) + "."
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -558,7 +558,7 @@ bool AsmAnalyzer::expectDeposit(int _deposit, int _oldHeight, SourceLocation con
|
||||
{
|
||||
m_errorReporter.typeError(
|
||||
_location,
|
||||
"Expected expression to return one item to the stack, but did return " +
|
||||
"Expected expression to return one item to the stack, but it returned " +
|
||||
to_string(m_stackHeight - _oldHeight) +
|
||||
" items."
|
||||
);
|
||||
@ -585,7 +585,7 @@ bool AsmAnalyzer::checkAssignment(Identifier const& _variable, size_t _valueSize
|
||||
{
|
||||
m_errorReporter.declarationError(
|
||||
_variable.location,
|
||||
"Variable " + _variable.name.str() + " used before it was declared."
|
||||
"Variable" + quoteSpace(_variable.name.str()) + "used before it was declared."
|
||||
);
|
||||
success = false;
|
||||
}
|
||||
@ -638,7 +638,7 @@ void AsmAnalyzer::expectValidType(string const& type, SourceLocation const& _loc
|
||||
if (!builtinTypes.count(type))
|
||||
m_errorReporter.typeError(
|
||||
_location,
|
||||
"\"" + type + "\" is not a valid type (user defined types are not yet supported)."
|
||||
quote(type) + " is not a valid type (user defined types are not yet supported)."
|
||||
);
|
||||
}
|
||||
|
||||
@ -663,14 +663,14 @@ bool AsmAnalyzer::warnOnInstructions(evmasm::Instruction _instr, SourceLocation
|
||||
auto errorForVM = [=](string const& vmKindMessage) {
|
||||
m_errorReporter.typeError(
|
||||
_location,
|
||||
"The \"" +
|
||||
boost::to_lower_copy(instructionInfo(_instr).name)
|
||||
+ "\" instruction is " +
|
||||
"The" +
|
||||
quoteSpace(boost::to_lower_copy(instructionInfo(_instr).name))
|
||||
+ "instruction is " +
|
||||
vmKindMessage +
|
||||
" VMs " +
|
||||
" (you are currently compiling for \"" +
|
||||
m_evmVersion.name() +
|
||||
"\")."
|
||||
" (you are currently compiling for " +
|
||||
quote(m_evmVersion.name()) +
|
||||
")."
|
||||
);
|
||||
};
|
||||
|
||||
@ -720,7 +720,7 @@ bool AsmAnalyzer::warnOnInstructions(evmasm::Instruction _instr, SourceLocation
|
||||
_location,
|
||||
"Jump instructions and labels are low-level EVM features that can lead to "
|
||||
"incorrect stack access. Because of that they are disallowed in strict assembly. "
|
||||
"Use functions, \"switch\", \"if\" or \"for\" statements instead."
|
||||
"Use functions, " + quote("switch") + "," + quoteSpace("if") + "or" + quoteSpace("for") + "statements instead."
|
||||
);
|
||||
}
|
||||
else
|
||||
|
@ -151,7 +151,7 @@ Statement Parser::parseStatement()
|
||||
{
|
||||
Statement stmt{createWithLocation<Leave>()};
|
||||
if (!m_insideFunction)
|
||||
m_errorReporter.syntaxError(location(), "Keyword \"leave\" can only be used inside a function.");
|
||||
m_errorReporter.syntaxError(location(), "Keyword" + quoteSpace("leave") + "can only be used inside a function.");
|
||||
m_scanner->next();
|
||||
return stmt;
|
||||
}
|
||||
@ -184,17 +184,16 @@ Statement Parser::parseStatement()
|
||||
auto const token = currentToken() == Token::Comma ? "," : ":=";
|
||||
|
||||
fatalParserError(
|
||||
std::string("Variable name must precede \"") +
|
||||
token +
|
||||
"\"" +
|
||||
(currentToken() == Token::Comma ? " in multiple assignment." : " in assignment.")
|
||||
std::string("Variable name must precede") +
|
||||
quoteSpace(token) +
|
||||
(currentToken() == Token::Comma ? "in multiple assignment." : "in assignment.")
|
||||
);
|
||||
}
|
||||
|
||||
auto const& identifier = std::get<Identifier>(elementary);
|
||||
|
||||
if (m_dialect.builtin(identifier.name))
|
||||
fatalParserError("Cannot assign to builtin function \"" + identifier.name.str() + "\".");
|
||||
fatalParserError("Cannot assign to builtin function " + quoteSpace(identifier.name.str()) + ".");
|
||||
|
||||
variableNames.emplace_back(identifier);
|
||||
|
||||
@ -477,7 +476,7 @@ Expression Parser::parseCall(Parser::ElementaryOperation&& _initialOp)
|
||||
fatalParserError(
|
||||
m_dialect.flavour == AsmFlavour::Yul ?
|
||||
"Function name expected." :
|
||||
"Assembly instruction or function name required in front of \"(\")"
|
||||
"Assembly instruction or function name required in front of " + quoteSpace("()") + "."
|
||||
);
|
||||
|
||||
expectToken(Token::LParen);
|
||||
@ -526,7 +525,7 @@ YulString Parser::expectAsmIdentifier()
|
||||
}
|
||||
|
||||
if (m_dialect.builtin(name))
|
||||
fatalParserError("Cannot use builtin function name \"" + name.str() + "\" as identifier name.");
|
||||
fatalParserError("Cannot use builtin function name" + quoteSpace(name.str()) + "as identifier name.");
|
||||
advance();
|
||||
return name;
|
||||
}
|
||||
@ -536,13 +535,13 @@ void Parser::checkBreakContinuePosition(string const& _which)
|
||||
switch (m_currentForLoopComponent)
|
||||
{
|
||||
case ForLoopComponent::None:
|
||||
m_errorReporter.syntaxError(location(), "Keyword \"" + _which + "\" needs to be inside a for-loop body.");
|
||||
m_errorReporter.syntaxError(location(), "Keyword" + quoteSpace(_which) + "needs to be inside a for-loop body.");
|
||||
break;
|
||||
case ForLoopComponent::ForLoopPre:
|
||||
m_errorReporter.syntaxError(location(), "Keyword \"" + _which + "\" in for-loop init block is not allowed.");
|
||||
m_errorReporter.syntaxError(location(), "Keyword" + quoteSpace(_which) + "in for-loop init block is not allowed.");
|
||||
break;
|
||||
case ForLoopComponent::ForLoopPost:
|
||||
m_errorReporter.syntaxError(location(), "Keyword \"" + _which + "\" in for-loop post block is not allowed.");
|
||||
m_errorReporter.syntaxError(location(), "Keyword" + quoteSpace(_which) + "in for-loop post block is not allowed.");
|
||||
break;
|
||||
case ForLoopComponent::ForLoopBody:
|
||||
break;
|
||||
|
@ -142,7 +142,7 @@ bool ScopeFiller::registerVariable(TypedName const& _name, SourceLocation const&
|
||||
//@TODO secondary location
|
||||
m_errorReporter.declarationError(
|
||||
_location,
|
||||
"Variable name " + _name.name.str() + " already taken in this scope."
|
||||
"Variable name" + quoteSpace(_name.name.str()) + "already taken in this scope."
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -162,7 +162,7 @@ bool ScopeFiller::registerFunction(FunctionDefinition const& _funDef)
|
||||
//@TODO secondary location
|
||||
m_errorReporter.declarationError(
|
||||
_funDef.location,
|
||||
"Function name " + _funDef.name.str() + " already taken in this scope."
|
||||
"Function name" + quoteSpace(_funDef.name.str()) + "already taken in this scope."
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ contract A1 { function a(uint x) public pure { assert(x > 0); } } contract A2 {
|
||||
","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":131,"file":"a.sol","start":0},"type":"Warning"},{"component":"general","formattedMessage":"b.sol:1:1: Warning: Source file does not specify required compiler version!
|
||||
contract A1 { function b(uint x) public { assert(x > 0); } } contract B2 { function b(uint x) public pure { assert(x > 0); } }
|
||||
^----------------------------------------------------------------------------------------------------------------------------^
|
||||
","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":126,"file":"b.sol","start":0},"type":"Warning"},{"component":"general","formattedMessage":"b.sol:1:15: Warning: Function state mutability can be restricted to pure
|
||||
","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":126,"file":"b.sol","start":0},"type":"Warning"},{"component":"general","formattedMessage":"b.sol:1:15: Warning: Function state mutability can be restricted to \"pure\".
|
||||
contract A1 { function b(uint x) public { assert(x > 0); } } contract B2 { function b(uint x) public pure { assert(x > 0); } }
|
||||
^------------------------------------------^
|
||||
","message":"Function state mutability can be restricted to pure","severity":"warning","sourceLocation":{"end":58,"file":"b.sol","start":14},"type":"Warning"}],"sources":{"a.sol":{"id":0},"b.sol":{"id":1}}}
|
||||
","message":"Function state mutability can be restricted to \"pure\".","severity":"warning","sourceLocation":{"end":58,"file":"b.sol","start":14},"type":"Warning"}],"sources":{"a.sol":{"id":0},"b.sol":{"id":1}}}
|
||||
|
@ -4,7 +4,7 @@ contract A1 { function a(uint x) public pure { assert(x > 0); } } contract A2 {
|
||||
","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":131,"file":"a.sol","start":0},"type":"Warning"},{"component":"general","formattedMessage":"b.sol:1:1: Warning: Source file does not specify required compiler version!
|
||||
contract A1 { function b(uint x) public { assert(x > 0); } } contract B2 { function b(uint x) public pure { assert(x > 0); } }
|
||||
^----------------------------------------------------------------------------------------------------------------------------^
|
||||
","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":126,"file":"b.sol","start":0},"type":"Warning"},{"component":"general","formattedMessage":"b.sol:1:15: Warning: Function state mutability can be restricted to pure
|
||||
","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":126,"file":"b.sol","start":0},"type":"Warning"},{"component":"general","formattedMessage":"b.sol:1:15: Warning: Function state mutability can be restricted to \"pure\".
|
||||
contract A1 { function b(uint x) public { assert(x > 0); } } contract B2 { function b(uint x) public pure { assert(x > 0); } }
|
||||
^------------------------------------------^
|
||||
","message":"Function state mutability can be restricted to pure","severity":"warning","sourceLocation":{"end":58,"file":"b.sol","start":14},"type":"Warning"}],"sources":{"a.sol":{"id":0},"b.sol":{"id":1}}}
|
||||
","message":"Function state mutability can be restricted to \"pure\".","severity":"warning","sourceLocation":{"end":58,"file":"b.sol","start":14},"type":"Warning"}],"sources":{"a.sol":{"id":0},"b.sol":{"id":1}}}
|
||||
|
@ -4,7 +4,7 @@ contract A1 { function a(uint x) public pure { assert(x > 0); } } contract A2 {
|
||||
","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":131,"file":"a.sol","start":0},"type":"Warning"},{"component":"general","formattedMessage":"b.sol:1:1: Warning: Source file does not specify required compiler version!
|
||||
contract A1 { function b(uint x) public { assert(x > 0); } } contract B2 { function b(uint x) public pure { assert(x > 0); } }
|
||||
^----------------------------------------------------------------------------------------------------------------------------^
|
||||
","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":126,"file":"b.sol","start":0},"type":"Warning"},{"component":"general","formattedMessage":"b.sol:1:15: Warning: Function state mutability can be restricted to pure
|
||||
","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":126,"file":"b.sol","start":0},"type":"Warning"},{"component":"general","formattedMessage":"b.sol:1:15: Warning: Function state mutability can be restricted to \"pure\".
|
||||
contract A1 { function b(uint x) public { assert(x > 0); } } contract B2 { function b(uint x) public pure { assert(x > 0); } }
|
||||
^------------------------------------------^
|
||||
","message":"Function state mutability can be restricted to pure","severity":"warning","sourceLocation":{"end":58,"file":"b.sol","start":14},"type":"Warning"}],"sources":{"a.sol":{"id":0},"b.sol":{"id":1}}}
|
||||
","message":"Function state mutability can be restricted to \"pure\".","severity":"warning","sourceLocation":{"end":58,"file":"b.sol","start":14},"type":"Warning"}],"sources":{"a.sol":{"id":0},"b.sol":{"id":1}}}
|
||||
|
@ -4,7 +4,7 @@ contract A1 { function a(uint x) public pure { assert(x > 0); } } contract A2 {
|
||||
","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":131,"file":"a.sol","start":0},"type":"Warning"},{"component":"general","formattedMessage":"b.sol:1:1: Warning: Source file does not specify required compiler version!
|
||||
contract A1 { function b(uint x) public { assert(x > 0); } } contract B2 { function b(uint x) public pure { assert(x > 0); } }
|
||||
^----------------------------------------------------------------------------------------------------------------------------^
|
||||
","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":126,"file":"b.sol","start":0},"type":"Warning"},{"component":"general","formattedMessage":"b.sol:1:15: Warning: Function state mutability can be restricted to pure
|
||||
","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":126,"file":"b.sol","start":0},"type":"Warning"},{"component":"general","formattedMessage":"b.sol:1:15: Warning: Function state mutability can be restricted to \"pure\".
|
||||
contract A1 { function b(uint x) public { assert(x > 0); } } contract B2 { function b(uint x) public pure { assert(x > 0); } }
|
||||
^------------------------------------------^
|
||||
","message":"Function state mutability can be restricted to pure","severity":"warning","sourceLocation":{"end":58,"file":"b.sol","start":14},"type":"Warning"}],"sources":{"a.sol":{"id":0},"b.sol":{"id":1}}}
|
||||
","message":"Function state mutability can be restricted to \"pure\".","severity":"warning","sourceLocation":{"end":58,"file":"b.sol","start":14},"type":"Warning"}],"sources":{"a.sol":{"id":0},"b.sol":{"id":1}}}
|
||||
|
@ -1,7 +1,7 @@
|
||||
{"contracts":{"b.sol":{"B2":{"evm":{"bytecode":{"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}}}}},"errors":[{"component":"general","formattedMessage":"b.sol:1:1: Warning: Source file does not specify required compiler version!
|
||||
contract A1 { function b(uint x) public { assert(x > 0); } } contract B2 { function b(uint x) public pure { assert(x > 0); } }
|
||||
^----------------------------------------------------------------------------------------------------------------------------^
|
||||
","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":126,"file":"b.sol","start":0},"type":"Warning"},{"component":"general","formattedMessage":"b.sol:1:15: Warning: Function state mutability can be restricted to pure
|
||||
","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":126,"file":"b.sol","start":0},"type":"Warning"},{"component":"general","formattedMessage":"b.sol:1:15: Warning: Function state mutability can be restricted to \"pure\".
|
||||
contract A1 { function b(uint x) public { assert(x > 0); } } contract B2 { function b(uint x) public pure { assert(x > 0); } }
|
||||
^------------------------------------------^
|
||||
","message":"Function state mutability can be restricted to pure","severity":"warning","sourceLocation":{"end":58,"file":"b.sol","start":14},"type":"Warning"}],"sources":{"a.sol":{"id":0},"b.sol":{"id":1}}}
|
||||
","message":"Function state mutability can be restricted to \"pure\".","severity":"warning","sourceLocation":{"end":58,"file":"b.sol","start":14},"type":"Warning"}],"sources":{"a.sol":{"id":0},"b.sol":{"id":1}}}
|
||||
|
@ -4,7 +4,7 @@ Error: Expected primary expression.
|
||||
5 | balances[tx.origin] = ; // missing RHS.
|
||||
| ^
|
||||
|
||||
Warning: Recovered in Statement at ';'.
|
||||
Warning: Recovered in Statement at ";".
|
||||
--> recovery_ast_constructor/input.sol:5:27:
|
||||
|
|
||||
5 | balances[tx.origin] = ; // missing RHS.
|
||||
|
@ -1,7 +1,7 @@
|
||||
{"errors":[{"component":"general","formattedMessage":"A:1:58: ParserError: Expected type name
|
||||
pragma solidity >=0.0; contract Errort6 { using foo for ; /* missing type name */ }
|
||||
^
|
||||
","message":"Expected type name","severity":"error","sourceLocation":{"end":58,"file":"A","start":57},"type":"ParserError"},{"component":"general","formattedMessage":"A:1:84: Warning: Recovered in ContractDefinition at '}'.
|
||||
","message":"Expected type name","severity":"error","sourceLocation":{"end":58,"file":"A","start":57},"type":"ParserError"},{"component":"general","formattedMessage":"A:1:84: Warning: Recovered in ContractDefinition at \"}\".
|
||||
pragma solidity >=0.0; contract Errort6 { using foo for ; /* missing type name */ }
|
||||
^
|
||||
","message":"Recovered in ContractDefinition at '}'.","severity":"warning","sourceLocation":{"end":84,"file":"A","start":83},"type":"Warning"}],"sources":{"A":{"ast":{"absolutePath":"A","exportedSymbols":{"Errort6":[3]},"id":4,"nodeType":"SourceUnit","nodes":[{"id":1,"literals":["solidity",">=","0.0"],"nodeType":"PragmaDirective","src":"0:22:0"},{"abstract":false,"baseContracts":[],"contractDependencies":[],"contractKind":"contract","documentation":null,"fullyImplemented":true,"id":3,"linearizedBaseContracts":[3],"name":"Errort6","nodeType":"ContractDefinition","nodes":[],"scope":4,"src":"23:35:0"}],"src":"0:84:0"},"id":0}}}
|
||||
","message":"Recovered in ContractDefinition at \"}\".","severity":"warning","sourceLocation":{"end":84,"file":"A","start":83},"type":"Warning"}],"sources":{"A":{"ast":{"absolutePath":"A","exportedSymbols":{"Errort6":[3]},"id":4,"nodeType":"SourceUnit","nodes":[{"id":1,"literals":["solidity",">=","0.0"],"nodeType":"PragmaDirective","src":"0:22:0"},{"abstract":false,"baseContracts":[],"contractDependencies":[],"contractKind":"contract","documentation":null,"fullyImplemented":true,"id":3,"linearizedBaseContracts":[3],"name":"Errort6","nodeType":"ContractDefinition","nodes":[],"scope":4,"src":"23:35:0"}],"src":"0:84:0"},"id":0}}}
|
||||
|
@ -1 +1 @@
|
||||
{"errors":[{"component":"general","formattedMessage":"\"Providing yulDetails requires Yul optimizer to be enabled.","message":"\"Providing yulDetails requires Yul optimizer to be enabled.","severity":"error","type":"JSONError"}]}
|
||||
{"errors":[{"component":"general","formattedMessage":"Providing \"yulDetails\" requires Yul optimizer to be enabled.","message":"Providing \"yulDetails\" requires Yul optimizer to be enabled.","severity":"error","type":"JSONError"}]}
|
||||
|
@ -179,7 +179,7 @@ BOOST_AUTO_TEST_CASE(smoke_test)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(surplus_input)
|
||||
{
|
||||
CHECK_PARSE_ERROR("{ } { }", ParserError, "Expected end of source but got '{'");
|
||||
CHECK_PARSE_ERROR("{ } { }", ParserError, "Expected end of source but got " + quote("{"));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(simple_instructions)
|
||||
@ -209,7 +209,7 @@ BOOST_AUTO_TEST_CASE(vardecl)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(vardecl_name_clashes)
|
||||
{
|
||||
CHECK_PARSE_ERROR("{ let x := 1 let x := 2 }", DeclarationError, "Variable name x already taken in this scope.");
|
||||
CHECK_PARSE_ERROR("{ let x := 1 let x := 2 }", DeclarationError, "Variable name" + quoteSpace("x") + "already taken in this scope.");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(vardecl_multi)
|
||||
@ -219,7 +219,7 @@ BOOST_AUTO_TEST_CASE(vardecl_multi)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(vardecl_multi_conflict)
|
||||
{
|
||||
CHECK_PARSE_ERROR("{ function f() -> x, y {} let x, x := f() }", DeclarationError, "Variable name x already taken in this scope.");
|
||||
CHECK_PARSE_ERROR("{ function f() -> x, y {} let x, x := f() }", DeclarationError, "Variable name" + quoteSpace("x") + "already taken in this scope.");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(vardecl_bool)
|
||||
@ -240,7 +240,7 @@ BOOST_AUTO_TEST_CASE(functional)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(functional_partial)
|
||||
{
|
||||
CHECK_PARSE_ERROR("{ let x := byte }", ParserError, "Expected '(' but got '}'");
|
||||
CHECK_PARSE_ERROR("{ let x := byte }", ParserError, "Expected" + quoteSpace("(") + "but got " + quote("}"));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(functional_partial_success)
|
||||
@ -265,8 +265,8 @@ BOOST_AUTO_TEST_CASE(vardecl_complex)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(variable_use_before_decl)
|
||||
{
|
||||
CHECK_PARSE_ERROR("{ x := 2 let x := 3 }", DeclarationError, "Variable x used before it was declared.");
|
||||
CHECK_PARSE_ERROR("{ let x := mul(2, x) }", DeclarationError, "Variable x used before it was declared.");
|
||||
CHECK_PARSE_ERROR("{ x := 2 let x := 3 }", DeclarationError, "Variable" + quoteSpace("x") + "used before it was declared.");
|
||||
CHECK_PARSE_ERROR("{ let x := mul(2, x) }", DeclarationError, "Variable" + quoteSpace("x") + "used before it was declared.");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(if_statement)
|
||||
@ -284,10 +284,10 @@ BOOST_AUTO_TEST_CASE(if_statement_scope)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(if_statement_invalid)
|
||||
{
|
||||
CHECK_PARSE_ERROR("{ if mload {} }", ParserError, "Expected '(' but got '{'");
|
||||
CHECK_PARSE_ERROR("{ if mload {} }", ParserError, "Expected" + quoteSpace("(") + "but got " + quote("{"));
|
||||
BOOST_CHECK("{ if calldatasize() {}");
|
||||
CHECK_PARSE_ERROR("{ if mstore(1, 1) {} }", TypeError, "Expected expression to return one item to the stack, but did return 0 items");
|
||||
CHECK_PARSE_ERROR("{ if 32 let x := 3 }", ParserError, "Expected '{' but got reserved keyword 'let'");
|
||||
CHECK_PARSE_ERROR("{ if mstore(1, 1) {} }", TypeError, "Expected expression to return one item to the stack, but it returned 0 items.");
|
||||
CHECK_PARSE_ERROR("{ if 32 let x := 3 }", ParserError, "Expected" + quoteSpace("{") + "but got reserved keyword " + quote("let"));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(switch_statement)
|
||||
@ -314,8 +314,8 @@ BOOST_AUTO_TEST_CASE(switch_duplicate_case)
|
||||
BOOST_AUTO_TEST_CASE(switch_invalid_expression)
|
||||
{
|
||||
CHECK_PARSE_ERROR("{ switch {} default {} }", ParserError, "Literal, identifier or instruction expected.");
|
||||
CHECK_PARSE_ERROR("{ switch mload default {} }", ParserError, "Expected '(' but got reserved keyword 'default'");
|
||||
CHECK_PARSE_ERROR("{ switch mstore(1, 1) default {} }", TypeError, "Expected expression to return one item to the stack, but did return 0 items");
|
||||
CHECK_PARSE_ERROR("{ switch mload default {} }", ParserError, "Expected" + quoteSpace("(") + "but got reserved keyword " + quote("default"));
|
||||
CHECK_PARSE_ERROR("{ switch mstore(1, 1) default {} }", TypeError, "Expected expression to return one item to the stack, but it returned 0 items.");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(switch_default_before_case)
|
||||
@ -335,7 +335,7 @@ BOOST_AUTO_TEST_CASE(switch_invalid_case)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(switch_invalid_body)
|
||||
{
|
||||
CHECK_PARSE_ERROR("{ switch 42 case 1 mul case 2 {} default {} }", ParserError, "Expected '{' but got identifier");
|
||||
CHECK_PARSE_ERROR("{ switch 42 case 1 mul case 2 {} default {} }", ParserError, "Expected" + quoteSpace("{") + "but got identifier");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(for_statement)
|
||||
@ -347,11 +347,11 @@ BOOST_AUTO_TEST_CASE(for_statement)
|
||||
BOOST_AUTO_TEST_CASE(for_invalid_expression)
|
||||
{
|
||||
CHECK_PARSE_ERROR("{ for {} {} {} {} }", ParserError, "Literal, identifier or instruction expected.");
|
||||
CHECK_PARSE_ERROR("{ for 1 1 {} {} }", ParserError, "Expected '{' but got 'Number'");
|
||||
CHECK_PARSE_ERROR("{ for {} 1 1 {} }", ParserError, "Expected '{' but got 'Number'");
|
||||
CHECK_PARSE_ERROR("{ for {} 1 {} 1 }", ParserError, "Expected '{' but got 'Number'");
|
||||
CHECK_PARSE_ERROR("{ for {} mload {} {} }", ParserError, "Expected '(' but got '{'");
|
||||
CHECK_PARSE_ERROR("{ for {} mstore(1, 1) {} {} }", TypeError, "Expected expression to return one item to the stack, but did return 0 items");
|
||||
CHECK_PARSE_ERROR("{ for 1 1 {} {} }", ParserError, "Expected" + quoteSpace("{") + "but got " + quote("Number"));
|
||||
CHECK_PARSE_ERROR("{ for {} 1 1 {} }", ParserError, "Expected" + quoteSpace("{") + "but got " + quote("Number"));
|
||||
CHECK_PARSE_ERROR("{ for {} 1 {} 1 }", ParserError, "Expected" + quoteSpace("{") + "but got " + quote("Number"));
|
||||
CHECK_PARSE_ERROR("{ for {} mload {} {} }", ParserError, "Expected" + quoteSpace("(") + "but got " + quote("{"));
|
||||
CHECK_PARSE_ERROR("{ for {} mstore(1, 1) {} {} }", TypeError, "Expected expression to return one item to the stack, but it returned 0 items.");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(for_visibility)
|
||||
@ -364,11 +364,11 @@ BOOST_AUTO_TEST_CASE(for_visibility)
|
||||
CHECK_PARSE_ERROR("{ for { pop(i) } 1 { } { let i := 1 } }", DeclarationError, "Identifier not found");
|
||||
CHECK_PARSE_ERROR("{ for {} i {} { let i := 1 } }", DeclarationError, "Identifier not found");
|
||||
CHECK_PARSE_ERROR("{ for {} 1 { pop(i) } { let i := 1 } }", DeclarationError, "Identifier not found");
|
||||
CHECK_PARSE_ERROR("{ for { let x := 1 } 1 { let x := 1 } {} }", DeclarationError, "Variable name x already taken in this scope");
|
||||
CHECK_PARSE_ERROR("{ for { let x := 1 } 1 {} { let x := 1 } }", DeclarationError, "Variable name x already taken in this scope");
|
||||
CHECK_PARSE_ERROR("{ let x := 1 for { let x := 1 } 1 {} {} }", DeclarationError, "Variable name x already taken in this scope");
|
||||
CHECK_PARSE_ERROR("{ let x := 1 for {} 1 { let x := 1 } {} }", DeclarationError, "Variable name x already taken in this scope");
|
||||
CHECK_PARSE_ERROR("{ let x := 1 for {} 1 {} { let x := 1 } }", DeclarationError, "Variable name x already taken in this scope");
|
||||
CHECK_PARSE_ERROR("{ for { let x := 1 } 1 { let x := 1 } {} }", DeclarationError, "Variable name" + quoteSpace("x") + "already taken in this scope");
|
||||
CHECK_PARSE_ERROR("{ for { let x := 1 } 1 {} { let x := 1 } }", DeclarationError, "Variable name" + quoteSpace("x") + "already taken in this scope");
|
||||
CHECK_PARSE_ERROR("{ let x := 1 for { let x := 1 } 1 {} {} }", DeclarationError, "Variable name" + quoteSpace("x") + "already taken in this scope");
|
||||
CHECK_PARSE_ERROR("{ let x := 1 for {} 1 { let x := 1 } {} }", DeclarationError, "Variable name" + quoteSpace("x") + "already taken in this scope");
|
||||
CHECK_PARSE_ERROR("{ let x := 1 for {} 1 {} { let x := 1 } }", DeclarationError, "Variable name" + quoteSpace("x") + "already taken in this scope");
|
||||
// Check that body and post are not sub-scopes of each other.
|
||||
BOOST_CHECK(successParse("{ for {} 1 { let x := 1 } { let x := 1 } }"));
|
||||
}
|
||||
@ -415,27 +415,27 @@ BOOST_AUTO_TEST_CASE(opcode_for_function_args)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(name_clashes)
|
||||
{
|
||||
CHECK_PARSE_ERROR("{ let g := 2 function g() { } }", DeclarationError, "Variable name g already taken in this scope");
|
||||
CHECK_PARSE_ERROR("{ let g := 2 function g() { } }", DeclarationError, "Variable name" + quoteSpace("g") + "already taken in this scope");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(name_clashes_function_subscope)
|
||||
{
|
||||
CHECK_PARSE_ERROR("{ function g() { function g() {} } }", DeclarationError, "Function name g already taken in this scope");
|
||||
CHECK_PARSE_ERROR("{ function g() { function g() {} } }", DeclarationError, "Function name" + quoteSpace("g") + "already taken in this scope");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(name_clashes_function_subscope_reverse)
|
||||
{
|
||||
CHECK_PARSE_ERROR("{ { function g() {} } function g() { } }", DeclarationError, "Function name g already taken in this scope");
|
||||
CHECK_PARSE_ERROR("{ { function g() {} } function g() { } }", DeclarationError, "Function name" + quoteSpace("g") + "already taken in this scope");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(name_clashes_function_variable_subscope)
|
||||
{
|
||||
CHECK_PARSE_ERROR("{ function g() { let g := 0 } }", DeclarationError, "Variable name g already taken in this scope");
|
||||
CHECK_PARSE_ERROR("{ function g() { let g := 0 } }", DeclarationError, "Variable name" + quoteSpace("g") + "already taken in this scope");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(name_clashes_function_variable_subscope_reverse)
|
||||
{
|
||||
CHECK_PARSE_ERROR("{ { let g := 0 } function g() { } }", DeclarationError, "Variable name g already taken in this scope");
|
||||
CHECK_PARSE_ERROR("{ { let g := 0 } function g() { } }", DeclarationError, "Variable name" + quoteSpace("g") + "already taken in this scope");
|
||||
}
|
||||
BOOST_AUTO_TEST_CASE(functions_in_parallel_scopes)
|
||||
{
|
||||
@ -477,8 +477,8 @@ BOOST_AUTO_TEST_CASE(recursion_depth)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(multiple_assignment)
|
||||
{
|
||||
CHECK_PARSE_ERROR("{ let x function f() -> a, b {} 123, x := f() }", ParserError, "Variable name must precede \",\" in multiple assignment.");
|
||||
CHECK_PARSE_ERROR("{ let x function f() -> a, b {} x, 123 := f() }", ParserError, "Variable name must precede \":=\" in assignment.");
|
||||
CHECK_PARSE_ERROR("{ let x function f() -> a, b {} 123, x := f() }", ParserError, "Variable name must precede" + quoteSpace(",") + "in multiple assignment.");
|
||||
CHECK_PARSE_ERROR("{ let x function f() -> a, b {} x, 123 := f() }", ParserError, "Variable name must precede" + quoteSpace(":=") + "in assignment.");
|
||||
|
||||
/// NOTE: Travis hiccups if not having a variable
|
||||
char const* text = R"(
|
||||
@ -731,9 +731,9 @@ BOOST_AUTO_TEST_CASE(shift_constantinople_warning)
|
||||
{
|
||||
if (solidity::test::Options::get().evmVersion().hasBitwiseShifting())
|
||||
return;
|
||||
CHECK_PARSE_WARNING("{ pop(shl(10, 32)) }", TypeError, "The \"shl\" instruction is only available for Constantinople-compatible VMs");
|
||||
CHECK_PARSE_WARNING("{ pop(shr(10, 32)) }", TypeError, "The \"shr\" instruction is only available for Constantinople-compatible VMs");
|
||||
CHECK_PARSE_WARNING("{ pop(sar(10, 32)) }", TypeError, "The \"sar\" instruction is only available for Constantinople-compatible VMs");
|
||||
CHECK_PARSE_WARNING("{ pop(shl(10, 32)) }", TypeError, "The" + quoteSpace("shl") + "instruction is only available for Constantinople-compatible VMs");
|
||||
CHECK_PARSE_WARNING("{ pop(shr(10, 32)) }", TypeError, "The" + quoteSpace("shr") + "instruction is only available for Constantinople-compatible VMs");
|
||||
CHECK_PARSE_WARNING("{ pop(sar(10, 32)) }", TypeError, "The" + quoteSpace("sar") + "instruction is only available for Constantinople-compatible VMs");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(jump_error)
|
||||
|
@ -362,7 +362,7 @@ BOOST_AUTO_TEST_CASE(dynamic_return_types_not_possible)
|
||||
}
|
||||
)";
|
||||
if (solidity::test::Options::get().evmVersion() == EVMVersion::homestead())
|
||||
CHECK_ERROR(sourceCode, TypeError, "Type inaccessible dynamic type is not implicitly convertible to expected type string memory.");
|
||||
CHECK_ERROR(sourceCode, TypeError, "Type" + quoteSpace("inaccessible dynamic type") + "is not implicitly convertible to expected type " + quote("string memory") + ".");
|
||||
else
|
||||
CHECK_SUCCESS_NO_WARNINGS(sourceCode);
|
||||
}
|
||||
@ -387,7 +387,7 @@ BOOST_AUTO_TEST_CASE(returndatasize_as_variable)
|
||||
{Error::Type::Warning, "Variable is shadowed in inline assembly by an instruction of the same name"}
|
||||
});
|
||||
if (!solidity::test::Options::get().evmVersion().supportsReturndata())
|
||||
expectations.emplace_back(make_pair(Error::Type::TypeError, std::string("\"returndatasize\" instruction is only available for Byzantium-compatible VMs")));
|
||||
expectations.emplace_back(make_pair(Error::Type::TypeError, quote("returndatasize") + " instruction is only available for Byzantium-compatible VMs"));
|
||||
CHECK_ALLOW_MULTI(text, expectations);
|
||||
}
|
||||
|
||||
@ -402,7 +402,7 @@ BOOST_AUTO_TEST_CASE(create2_as_variable)
|
||||
{Error::Type::Warning, "Variable is shadowed in inline assembly by an instruction of the same name"}
|
||||
});
|
||||
if (!solidity::test::Options::get().evmVersion().hasCreate2())
|
||||
expectations.emplace_back(make_pair(Error::Type::TypeError, std::string("\"create2\" instruction is only available for Constantinople-compatible VMs")));
|
||||
expectations.emplace_back(make_pair(Error::Type::TypeError, quote("create2") + " instruction is only available for Constantinople-compatible VMs"));
|
||||
CHECK_ALLOW_MULTI(text, expectations);
|
||||
}
|
||||
|
||||
@ -417,7 +417,7 @@ BOOST_AUTO_TEST_CASE(extcodehash_as_variable)
|
||||
{Error::Type::Warning, "Variable is shadowed in inline assembly by an instruction of the same name"}
|
||||
});
|
||||
if (!solidity::test::Options::get().evmVersion().hasExtCodeHash())
|
||||
expectations.emplace_back(make_pair(Error::Type::TypeError, std::string("\"extcodehash\" instruction is only available for Constantinople-compatible VMs")));
|
||||
expectations.emplace_back(make_pair(Error::Type::TypeError, quote("extcodehash") + " instruction is only available for Constantinople-compatible VMs"));
|
||||
CHECK_ALLOW_MULTI(text, expectations);
|
||||
}
|
||||
|
||||
@ -455,7 +455,7 @@ BOOST_AUTO_TEST_CASE(address_staticcall)
|
||||
if (solidity::test::Options::get().evmVersion().hasStaticCall())
|
||||
CHECK_SUCCESS_NO_WARNINGS(sourceCode);
|
||||
else
|
||||
CHECK_ERROR(sourceCode, TypeError, "\"staticcall\" is not supported by the VM version.");
|
||||
CHECK_ERROR(sourceCode, TypeError, quote("staticcall") + " is not supported by the VM version.");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(address_staticcall_value)
|
||||
@ -469,7 +469,7 @@ BOOST_AUTO_TEST_CASE(address_staticcall_value)
|
||||
}
|
||||
}
|
||||
)";
|
||||
CHECK_ERROR(sourceCode, TypeError, "Member \"value\" is only available for payable functions.");
|
||||
CHECK_ERROR(sourceCode, TypeError, "Member" + quoteSpace("value") + "is only available for payable functions.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -487,7 +487,7 @@ BOOST_AUTO_TEST_CASE(address_call_full_return_type)
|
||||
if (solidity::test::Options::get().evmVersion().supportsReturndata())
|
||||
CHECK_SUCCESS_NO_WARNINGS(sourceCode);
|
||||
else
|
||||
CHECK_ERROR(sourceCode, TypeError, "Type inaccessible dynamic type is not implicitly convertible to expected type bytes memory.");
|
||||
CHECK_ERROR(sourceCode, TypeError, "Type" + quoteSpace("inaccessible dynamic type") + "is not implicitly convertible to expected type " + quote("bytes memory") + ".");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(address_delegatecall_full_return_type)
|
||||
@ -504,7 +504,7 @@ BOOST_AUTO_TEST_CASE(address_delegatecall_full_return_type)
|
||||
if (solidity::test::Options::get().evmVersion().supportsReturndata())
|
||||
CHECK_SUCCESS_NO_WARNINGS(sourceCode);
|
||||
else
|
||||
CHECK_ERROR(sourceCode, TypeError, "Type inaccessible dynamic type is not implicitly convertible to expected type bytes memory.");
|
||||
CHECK_ERROR(sourceCode, TypeError, "Type" + quoteSpace("inaccessible dynamic type") + "is not implicitly convertible to expected type " + quote("bytes memory") + ".");
|
||||
}
|
||||
|
||||
|
||||
|
@ -148,7 +148,7 @@ BOOST_AUTO_TEST_CASE(unsatisfied_version_with_recovery)
|
||||
}
|
||||
)";
|
||||
Error err = getError(text, true);
|
||||
BOOST_CHECK(searchErrorMessage(err, "Expected identifier but got ';'"));
|
||||
BOOST_CHECK(searchErrorMessage(err, "Expected identifier but got " + quote(";")));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(function_natspec_documentation)
|
||||
@ -516,13 +516,13 @@ BOOST_AUTO_TEST_CASE(multiple_visibility_specifiers)
|
||||
uint private internal a;
|
||||
}
|
||||
)";
|
||||
CHECK_PARSE_ERROR(text, "Visibility already specified as \"private\".");
|
||||
CHECK_PARSE_ERROR(text, "Visibility already specified as " + quote("private"));
|
||||
text = R"(
|
||||
contract c {
|
||||
function f() private external {}
|
||||
}
|
||||
)";
|
||||
CHECK_PARSE_ERROR(text, "Visibility already specified as \"private\".");
|
||||
CHECK_PARSE_ERROR(text, "Visibility already specified as " + quote("private"));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(keyword_is_reserved)
|
||||
@ -568,7 +568,7 @@ BOOST_AUTO_TEST_CASE(keyword_is_reserved)
|
||||
for (auto const& keyword: keywords)
|
||||
{
|
||||
auto text = std::string("contract ") + keyword + " {}";
|
||||
CHECK_PARSE_ERROR(text.c_str(), string("Expected identifier but got reserved keyword '") + keyword + "'");
|
||||
CHECK_PARSE_ERROR(text.c_str(), string("Expected identifier but got reserved keyword ") + quote(keyword));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -24,10 +24,12 @@
|
||||
#include <libsolidity/interface/StandardCompiler.h>
|
||||
#include <libsolidity/interface/Version.h>
|
||||
#include <libsolutil/JSON.h>
|
||||
#include <liblangutil/ErrorReporter.h>
|
||||
#include <test/Metadata.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace solidity::evmasm;
|
||||
using namespace solidity::langutil;
|
||||
|
||||
namespace solidity::frontend::test
|
||||
{
|
||||
@ -126,7 +128,7 @@ BOOST_AUTO_TEST_CASE(invalid_language)
|
||||
}
|
||||
)";
|
||||
Json::Value result = compile(input);
|
||||
BOOST_CHECK(containsError(result, "JSONError", "Only \"Solidity\" or \"Yul\" is supported as a language."));
|
||||
BOOST_CHECK(containsError(result, "JSONError", "Only" + quoteSpace("Solidity") + "or" + quoteSpace("Yul") + "is supported as a language."));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(valid_language)
|
||||
@ -137,7 +139,7 @@ BOOST_AUTO_TEST_CASE(valid_language)
|
||||
}
|
||||
)";
|
||||
Json::Value result = compile(input);
|
||||
BOOST_CHECK(!containsError(result, "JSONError", "Only \"Solidity\" or \"Yul\" is supported as a language."));
|
||||
BOOST_CHECK(!containsError(result, "JSONError", "Only" + quoteSpace("Solidity") + "or" + quoteSpace("Yul") + "is supported as a language."));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(no_sources)
|
||||
@ -172,7 +174,7 @@ BOOST_AUTO_TEST_CASE(no_sources_empty_array)
|
||||
}
|
||||
)";
|
||||
Json::Value result = compile(input);
|
||||
BOOST_CHECK(containsError(result, "JSONError", "\"sources\" is not a JSON object."));
|
||||
BOOST_CHECK(containsError(result, "JSONError", quote("sources") + " is not a JSON object."));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(sources_is_array)
|
||||
@ -184,7 +186,7 @@ BOOST_AUTO_TEST_CASE(sources_is_array)
|
||||
}
|
||||
)";
|
||||
Json::Value result = compile(input);
|
||||
BOOST_CHECK(containsError(result, "JSONError", "\"sources\" is not a JSON object."));
|
||||
BOOST_CHECK(containsError(result, "JSONError", quote("sources") + " is not a JSON object."));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(unexpected_trailing_test)
|
||||
@ -238,7 +240,7 @@ BOOST_AUTO_TEST_CASE(error_recovery_field)
|
||||
)";
|
||||
|
||||
Json::Value result = compile(input);
|
||||
BOOST_CHECK(containsError(result, "JSONError", "\"settings.parserErrorRecovery\" must be a Boolean."));
|
||||
BOOST_CHECK(containsError(result, "JSONError", quote("settings.parserErrorRecovery") + " must be a Boolean."));
|
||||
|
||||
input = R"(
|
||||
{
|
||||
@ -276,7 +278,7 @@ BOOST_AUTO_TEST_CASE(optimizer_enabled_not_boolean)
|
||||
}
|
||||
)";
|
||||
Json::Value result = compile(input);
|
||||
BOOST_CHECK(containsError(result, "JSONError", "The \"enabled\" setting must be a Boolean."));
|
||||
BOOST_CHECK(containsError(result, "JSONError", "The" + quoteSpace("enabled") + "setting must be a Boolean."));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(optimizer_runs_not_a_number)
|
||||
@ -298,7 +300,7 @@ BOOST_AUTO_TEST_CASE(optimizer_runs_not_a_number)
|
||||
}
|
||||
)";
|
||||
Json::Value result = compile(input);
|
||||
BOOST_CHECK(containsError(result, "JSONError", "The \"runs\" setting must be an unsigned number."));
|
||||
BOOST_CHECK(containsError(result, "JSONError", "The" + quoteSpace("runs") + "setting must be an unsigned number."));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(optimizer_runs_not_an_unsigned_number)
|
||||
@ -320,7 +322,7 @@ BOOST_AUTO_TEST_CASE(optimizer_runs_not_an_unsigned_number)
|
||||
}
|
||||
)";
|
||||
Json::Value result = compile(input);
|
||||
BOOST_CHECK(containsError(result, "JSONError", "The \"runs\" setting must be an unsigned number."));
|
||||
BOOST_CHECK(containsError(result, "JSONError", "The" + quoteSpace("runs") + "setting must be an unsigned number."));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(basic_compilation)
|
||||
@ -461,8 +463,8 @@ BOOST_AUTO_TEST_CASE(compilation_error)
|
||||
{
|
||||
BOOST_CHECK_EQUAL(
|
||||
util::jsonCompactPrint(error),
|
||||
"{\"component\":\"general\",\"formattedMessage\":\"fileA:1:23: ParserError: Expected identifier but got '}'\\n"
|
||||
"contract A { function }\\n ^\\n\",\"message\":\"Expected identifier but got '}'\","
|
||||
"{\"component\":\"general\",\"formattedMessage\":\"fileA:1:23: ParserError: Expected identifier but got \\\"}\\\"\\n"
|
||||
"contract A { function }\\n ^\\n\",\"message\":\"Expected identifier but got \\\"}\\\"\","
|
||||
"\"severity\":\"error\",\"sourceLocation\":{\"end\":23,\"file\":\"fileA\",\"start\":22},\"type\":\"ParserError\"}"
|
||||
);
|
||||
}
|
||||
@ -726,7 +728,7 @@ BOOST_AUTO_TEST_CASE(libraries_invalid_top_level)
|
||||
}
|
||||
)";
|
||||
Json::Value result = compile(input);
|
||||
BOOST_CHECK(containsError(result, "JSONError", "\"libraries\" is not a JSON object."));
|
||||
BOOST_CHECK(containsError(result, "JSONError", quote("libraries") + " is not a JSON object."));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(libraries_invalid_entry)
|
||||
@ -770,7 +772,7 @@ BOOST_AUTO_TEST_CASE(libraries_invalid_hex)
|
||||
}
|
||||
)";
|
||||
Json::Value result = compile(input);
|
||||
BOOST_CHECK(containsError(result, "JSONError", "Invalid library address (\"0x4200000000000000000000000000000000000xx1\") supplied."));
|
||||
BOOST_CHECK(containsError(result, "JSONError", "Invalid library address (" + quote("0x4200000000000000000000000000000000000xx1") + ") supplied."));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(libraries_invalid_length)
|
||||
@ -817,7 +819,7 @@ BOOST_AUTO_TEST_CASE(libraries_missing_hex_prefix)
|
||||
}
|
||||
)";
|
||||
Json::Value result = compile(input);
|
||||
BOOST_CHECK(containsError(result, "JSONError", "Library address is not prefixed with \"0x\"."));
|
||||
BOOST_CHECK(containsError(result, "JSONError", "Library address is not prefixed with " + quote("0x") + "."));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(library_linking)
|
||||
|
@ -70,28 +70,28 @@ BOOST_AUTO_TEST_CASE(environment_access)
|
||||
CHECK_ERROR(
|
||||
"contract C { function f() pure public { " + x + "; } }",
|
||||
TypeError,
|
||||
"Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires \"view\""
|
||||
"Function declared as " + quote("pure") + ", but this expression (potentially) reads from the environment or state and thus requires " + quote("view") + "."
|
||||
);
|
||||
}
|
||||
for (string const& x: pure)
|
||||
{
|
||||
CHECK_WARNING(
|
||||
"contract C { function f() view public { " + x + "; } }",
|
||||
"Function state mutability can be restricted to pure"
|
||||
"Function state mutability can be restricted to " + quote("pure") + "."
|
||||
);
|
||||
}
|
||||
|
||||
CHECK_WARNING_ALLOW_MULTI(
|
||||
"contract C { function f() view public { blockhash; } }",
|
||||
(std::vector<std::string>{
|
||||
"Function state mutability can be restricted to pure",
|
||||
"Function state mutability can be restricted to " + quote("pure") + ".",
|
||||
"Statement has no effect."
|
||||
}));
|
||||
|
||||
CHECK_ERROR(
|
||||
"contract C { function f() view public { block.blockhash; } }",
|
||||
TypeError,
|
||||
"\"block.blockhash()\" has been deprecated in favor of \"blockhash()\""
|
||||
quote("block.blockhash()") + " has been deprecated in favor of " + quote("blockhash()") + "."
|
||||
);
|
||||
}
|
||||
|
||||
@ -106,7 +106,7 @@ BOOST_AUTO_TEST_CASE(address_staticcall)
|
||||
}
|
||||
)";
|
||||
if (!solidity::test::Options::get().evmVersion().hasStaticCall())
|
||||
CHECK_ERROR(text, TypeError, "\"staticcall\" is not supported by the VM version.");
|
||||
CHECK_ERROR(text, TypeError, quote("staticcall") + " is not supported by the VM version.");
|
||||
else
|
||||
CHECK_SUCCESS_NO_WARNINGS(text);
|
||||
}
|
||||
@ -122,7 +122,7 @@ BOOST_AUTO_TEST_CASE(assembly_staticcall)
|
||||
}
|
||||
)";
|
||||
if (!solidity::test::Options::get().evmVersion().hasStaticCall())
|
||||
CHECK_ERROR(text, TypeError, "\"staticcall\" instruction is only available for Byzantium-compatible");
|
||||
CHECK_ERROR(text, TypeError, quote("staticcall") + " instruction is only available for Byzantium-compatible");
|
||||
else
|
||||
CHECK_SUCCESS_NO_WARNINGS(text);
|
||||
}
|
||||
|
@ -17,4 +17,4 @@ contract Error1 {
|
||||
}
|
||||
// ----
|
||||
// ParserError: (95-96): Expected primary expression.
|
||||
// Warning: (95-96): Recovered in Statement at ';'.
|
||||
// Warning: (95-96): Recovered in Statement at ";".
|
||||
|
@ -4,4 +4,4 @@ contract Errort6 {
|
||||
|
||||
// ----
|
||||
// ParserError: (36-37): Expected type name
|
||||
// Warning: (59-60): Recovered in ContractDefinition at '}'.
|
||||
// Warning: (59-60): Recovered in ContractDefinition at "}".
|
||||
|
@ -10,4 +10,4 @@ contract Error2 {
|
||||
mapping (address => uint balances; // missing ) before "balances"
|
||||
}
|
||||
// ----
|
||||
// ParserError: (417-425): Expected ')' but got identifier
|
||||
// ParserError: (417-425): Expected ")" but got identifier
|
||||
|
@ -17,7 +17,7 @@ contract SendCoin {
|
||||
}
|
||||
|
||||
// ----
|
||||
// ParserError: (212-220): Expected ')' but got identifier
|
||||
// ParserError: (220-221): Expected ';' but got ')'
|
||||
// ParserError: (212-220): Expected ")" but got identifier
|
||||
// ParserError: (220-221): Expected ";" but got ")"
|
||||
// ParserError: (220-221): Function, variable, struct or modifier declaration expected.
|
||||
// Warning: (235-236): Recovered in ContractDefinition at '}'.
|
||||
// Warning: (235-236): Recovered in ContractDefinition at "}".
|
||||
|
@ -8,4 +8,4 @@ contract Error3 {
|
||||
}
|
||||
// ----
|
||||
// ParserError: (95-96): Expected primary expression.
|
||||
// Warning: (95-96): Recovered in Statement at ';'.
|
||||
// Warning: (95-96): Recovered in Statement at ";".
|
||||
|
@ -21,9 +21,9 @@ contract Error4 {
|
||||
|
||||
}
|
||||
// ----
|
||||
// ParserError: (249-250): Expected ';' but got 'Number'
|
||||
// ParserError: (471-479): Expected ';' but got identifier
|
||||
// ParserError: (529-533): Expected ';' but got 'emit'
|
||||
// ParserError: (577-583): Expected ',' but got 'return'
|
||||
// ParserError: (249-250): Expected ";" but got "Number"
|
||||
// ParserError: (471-479): Expected ";" but got identifier
|
||||
// ParserError: (529-533): Expected ";" but got "emit"
|
||||
// ParserError: (577-583): Expected "," but got "return"
|
||||
// ParserError: (577-583): Expected primary expression.
|
||||
// Warning: (588-589): Recovered in Statement at ';'.
|
||||
// Warning: (588-589): Recovered in Statement at ";".
|
||||
|
@ -35,8 +35,8 @@ library MerkleProof {
|
||||
|
||||
// ----
|
||||
// Warning: (755-767): Assertion checker does not yet support this expression.
|
||||
// Warning: (988-991): Assertion checker does not yet implement type abi
|
||||
// Warning: (988-991): Assertion checker does not yet implement type "abi".
|
||||
// Warning: (988-1032): Assertion checker does not yet implement this type of function call.
|
||||
// Warning: (1175-1178): Assertion checker does not yet implement type abi
|
||||
// Warning: (1175-1178): Assertion checker does not yet implement type "abi".
|
||||
// Warning: (1175-1219): Assertion checker does not yet implement this type of function call.
|
||||
// Warning: (755-767): Assertion checker does not yet support this expression.
|
||||
|
@ -52,6 +52,6 @@ contract MyConc{
|
||||
}
|
||||
// ----
|
||||
// Warning: (773-792): This declaration shadows an existing declaration.
|
||||
// Warning: (1009-1086): Function state mutability can be restricted to view
|
||||
// Warning: (1009-1086): Function state mutability can be restricted to "view".
|
||||
// Warning: (985-1002): Underflow (resulting value less than 0) happens here.
|
||||
// Warning: (985-1002): Overflow (resulting value larger than 2**256 - 1) happens here.
|
||||
|
@ -117,23 +117,23 @@ contract PropagateThroughReturnValue {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (1886-1954): Function state mutability can be restricted to view
|
||||
// Warning: (1886-1954): Function state mutability can be restricted to "view".
|
||||
// Warning: (318-332): Assertion checker does not yet support the type of this variable.
|
||||
// Warning: (338-347): Assertion checker does not yet support the type of this variable.
|
||||
// Warning: (353-378): Assertion checker does not yet support the type of this variable.
|
||||
// Warning: (384-409): Assertion checker does not yet support the type of this variable.
|
||||
// Warning: (464-479): Assertion checker does not yet support this expression.
|
||||
// Warning: (464-475): Assertion checker does not yet implement type struct Reference.St storage ref
|
||||
// Warning: (464-475): Assertion checker does not yet implement type "struct Reference.St storage ref".
|
||||
// Warning: (464-494): Assertion checker does not yet implement such assignments.
|
||||
// Warning: (539-554): Assertion checker does not yet support this expression.
|
||||
// Warning: (539-550): Assertion checker does not yet implement type struct Reference.St storage ref
|
||||
// Warning: (539-550): Assertion checker does not yet implement type "struct Reference.St storage ref".
|
||||
// Warning: (557-567): Assertion checker does not yet support this expression.
|
||||
// Warning: (557-563): Assertion checker does not yet implement type struct Reference.St storage ref
|
||||
// Warning: (557-563): Assertion checker does not yet implement type "struct Reference.St storage ref".
|
||||
// Warning: (539-567): Assertion checker does not yet implement such assignments.
|
||||
// Warning: (629-643): Assertion checker does not yet support the type of this variable.
|
||||
// Warning: (646-668): Assertion checker does not yet implement type struct Reference.St storage ref
|
||||
// Warning: (706-728): Assertion checker does not yet implement type struct Reference.St storage ref
|
||||
// Warning: (700-728): Assertion checker does not yet implement type struct Reference.St storage pointer
|
||||
// Warning: (646-668): Assertion checker does not yet implement type "struct Reference.St storage ref".
|
||||
// Warning: (706-728): Assertion checker does not yet implement type "struct Reference.St storage ref".
|
||||
// Warning: (700-728): Assertion checker does not yet implement type "struct Reference.St storage pointer".
|
||||
// Warning: (748-755): Assertion checker does not yet support this expression.
|
||||
// Warning: (748-751): Assertion checker does not yet implement type struct Reference.St storage pointer
|
||||
// Warning: (748-751): Assertion checker does not yet implement type "struct Reference.St storage pointer".
|
||||
// Warning: (748-770): Assertion checker does not yet implement such assignments.
|
||||
|
@ -77,13 +77,13 @@ contract InternalCall {
|
||||
// Warning: (117-126): Unused local variable.
|
||||
// Warning: (260-269): Unused local variable.
|
||||
// Warning: (667-676): Unused local variable.
|
||||
// Warning: (75-137): Function state mutability can be restricted to pure
|
||||
// Warning: (218-280): Function state mutability can be restricted to pure
|
||||
// Warning: (470-539): Function state mutability can be restricted to pure
|
||||
// Warning: (1144-1206): Function state mutability can be restricted to pure
|
||||
// Warning: (1212-1274): Function state mutability can be restricted to pure
|
||||
// Warning: (1280-1342): Function state mutability can be restricted to pure
|
||||
// Warning: (771-774): Assertion checker does not yet implement type abi
|
||||
// Warning: (75-137): Function state mutability can be restricted to "pure".
|
||||
// Warning: (218-280): Function state mutability can be restricted to "pure".
|
||||
// Warning: (470-539): Function state mutability can be restricted to "pure".
|
||||
// Warning: (1144-1206): Function state mutability can be restricted to "pure".
|
||||
// Warning: (1212-1274): Function state mutability can be restricted to "pure".
|
||||
// Warning: (1280-1342): Function state mutability can be restricted to "pure".
|
||||
// Warning: (771-774): Assertion checker does not yet implement type "abi".
|
||||
// Warning: (782-813): Type conversion is not yet fully supported and might yield false positives.
|
||||
// Warning: (771-814): Assertion checker does not yet implement this type of function call.
|
||||
// Warning: (1403-1408): Assertion checker does not yet implement this type of function call.
|
||||
|
@ -9,6 +9,6 @@ contract C {
|
||||
// ----
|
||||
// Warning: (133-143): Unused local variable.
|
||||
// Warning: (133-143): Assertion checker does not yet support the type of this variable.
|
||||
// Warning: (146-147): Assertion checker does not yet implement type type(struct C.A storage pointer)
|
||||
// Warning: (146-163): Assertion checker does not yet implement type struct C.A memory
|
||||
// Warning: (146-147): Assertion checker does not yet implement type "type(struct C.A storage pointer)".
|
||||
// Warning: (146-163): Assertion checker does not yet implement type "struct C.A memory".
|
||||
// Warning: (146-163): Assertion checker does not yet implement this expression.
|
||||
|
@ -5,7 +5,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (162-165): Assertion checker does not yet implement type abi
|
||||
// Warning: (162-165): Assertion checker does not yet implement type "abi".
|
||||
// Warning: (162-176): Assertion checker does not yet implement this type of function call.
|
||||
// Warning: (178-181): Assertion checker does not yet implement type abi
|
||||
// Warning: (178-181): Assertion checker does not yet implement type "abi".
|
||||
// Warning: (178-203): Assertion checker does not yet implement this type of function call.
|
||||
|
@ -17,4 +17,4 @@ contract C
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (228-229): Assertion checker does not yet implement type type(library L)
|
||||
// Warning: (228-229): Assertion checker does not yet implement type "type(library L)".
|
||||
|
@ -17,5 +17,5 @@ contract C
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (228-229): Assertion checker does not yet implement type type(library L)
|
||||
// Warning: (228-229): Assertion checker does not yet implement type "type(library L)".
|
||||
// Warning: (245-261): Assertion violation happens here
|
||||
|
@ -17,14 +17,14 @@ contract C
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (73-192): Function state mutability can be restricted to pure
|
||||
// Warning: (73-192): Function state mutability can be restricted to "pure".
|
||||
// Warning: (103-113): Assertion checker does not yet support the type of this variable.
|
||||
// Warning: (117-120): Assertion checker does not yet support this expression.
|
||||
// Warning: (117-118): Assertion checker does not yet implement type struct C.S memory
|
||||
// Warning: (117-118): Assertion checker does not yet implement type "struct C.S memory".
|
||||
// Warning: (117-124): Assertion checker does not yet implement such assignments.
|
||||
// Warning: (165-168): Assertion checker does not yet support this expression.
|
||||
// Warning: (165-166): Assertion checker does not yet implement type struct C.S memory
|
||||
// Warning: (165-166): Assertion checker does not yet implement type "struct C.S memory".
|
||||
// Warning: (158-168): Assertion checker does not yet implement "delete" for this expression.
|
||||
// Warning: (179-182): Assertion checker does not yet support this expression.
|
||||
// Warning: (179-180): Assertion checker does not yet implement type struct C.S memory
|
||||
// Warning: (179-180): Assertion checker does not yet implement type "struct C.S memory".
|
||||
// Warning: (172-188): Assertion violation happens here
|
||||
|
@ -9,8 +9,8 @@ contract C {
|
||||
}
|
||||
// ----
|
||||
// Warning: (151-159): Assertion checker does not yet support the type of this variable.
|
||||
// Warning: (206-209): Assertion checker does not yet implement type abi
|
||||
// Warning: (225-226): Assertion checker does not yet implement type type(struct C.S storage pointer)
|
||||
// Warning: (235-241): Assertion checker does not yet implement type type(uint256[] memory)
|
||||
// Warning: (235-244): Assertion checker does not yet implement type type(uint256[] memory[2] memory)
|
||||
// Warning: (206-209): Assertion checker does not yet implement type "abi".
|
||||
// Warning: (225-226): Assertion checker does not yet implement type "type(struct C.S storage pointer)".
|
||||
// Warning: (235-241): Assertion checker does not yet implement type "type(uint256[] memory)".
|
||||
// Warning: (235-244): Assertion checker does not yet implement type "type(uint256[] memory[2] memory)".
|
||||
// Warning: (206-246): Assertion checker does not yet implement this type of function call.
|
||||
|
@ -12,8 +12,8 @@ contract C {
|
||||
// ----
|
||||
// Warning: (125-132): Unused local variable.
|
||||
// Warning: (183-190): Unused local variable.
|
||||
// Warning: (136-139): Assertion checker does not yet implement type abi
|
||||
// Warning: (136-139): Assertion checker does not yet implement type "abi".
|
||||
// Warning: (136-167): Assertion checker does not yet implement this type of function call.
|
||||
// Warning: (194-197): Assertion checker does not yet implement type abi
|
||||
// Warning: (194-197): Assertion checker does not yet implement type "abi".
|
||||
// Warning: (194-225): Assertion checker does not yet implement this type of function call.
|
||||
// Warning: (303-319): Assertion violation happens here
|
||||
|
@ -14,11 +14,11 @@ contract C {
|
||||
// Warning: (100-104): Unused local variable.
|
||||
// Warning: (161-171): Unused local variable.
|
||||
// Warning: (173-177): Unused local variable.
|
||||
// Warning: (108-111): Assertion checker does not yet implement type abi
|
||||
// Warning: (142-143): Assertion checker does not yet implement type type(contract C)
|
||||
// Warning: (108-111): Assertion checker does not yet implement type "abi".
|
||||
// Warning: (142-143): Assertion checker does not yet implement type "type(contract C)".
|
||||
// Warning: (108-145): Assertion checker does not yet implement this type of function call.
|
||||
// Warning: (181-184): Assertion checker does not yet implement type abi
|
||||
// Warning: (215-216): Assertion checker does not yet implement type type(contract C)
|
||||
// Warning: (181-184): Assertion checker does not yet implement type "abi".
|
||||
// Warning: (215-216): Assertion checker does not yet implement type "type(contract C)".
|
||||
// Warning: (181-218): Assertion checker does not yet implement this type of function call.
|
||||
// Warning: (296-312): Assertion violation happens here
|
||||
// Warning: (315-331): Assertion violation happens here
|
||||
|
@ -10,6 +10,6 @@ contract C
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (132-133): Assertion checker does not yet implement type type(enum C.D)
|
||||
// Warning: (132-133): Assertion checker does not yet implement type "type(enum C.D)".
|
||||
// Warning: (132-136): Type conversion is not yet fully supported and might yield false positives.
|
||||
// Warning: (140-160): Assertion violation happens here
|
||||
|
@ -8,6 +8,6 @@ contract C {
|
||||
// ----
|
||||
// Warning: (146-150): Assertion checker does not yet implement this type of function call.
|
||||
// Warning: (154-158): Assertion checker does not yet implement this type of function call.
|
||||
// Warning: (170-176): Assertion checker does not yet implement the type function (uint256) returns (uint256) for comparisons
|
||||
// Warning: (170-176): Assertion checker does not yet implement the type "function (uint256) returns (uint256)" for comparisons.
|
||||
// Warning: (139-159): Assertion violation happens here
|
||||
// Warning: (163-177): Assertion violation happens here
|
||||
|
@ -10,5 +10,5 @@ contract C
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (47-148): Function state mutability can be restricted to pure
|
||||
// Warning: (47-148): Function state mutability can be restricted to "pure".
|
||||
// Warning: (128-144): Assertion violation happens here
|
||||
|
@ -12,4 +12,4 @@ contract C
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (47-168): Function state mutability can be restricted to pure
|
||||
// Warning: (47-168): Function state mutability can be restricted to "pure".
|
||||
|
@ -15,18 +15,18 @@ contract C
|
||||
}
|
||||
// ----
|
||||
// Warning: (124-130): Assertion checker does not yet support this expression.
|
||||
// Warning: (124-128): Assertion checker does not yet implement type struct C.S memory
|
||||
// Warning: (124-128): Assertion checker does not yet implement type "struct C.S memory".
|
||||
// Warning: (124-133): Assertion checker does not yet implement this expression.
|
||||
// Warning: (124-136): Assertion checker does not yet implement this expression.
|
||||
// Warning: (154-160): Assertion checker does not yet support this expression.
|
||||
// Warning: (154-158): Assertion checker does not yet implement type struct C.S memory
|
||||
// Warning: (154-158): Assertion checker does not yet implement type "struct C.S memory".
|
||||
// Warning: (154-163): Assertion checker does not yet implement this expression.
|
||||
// Warning: (154-166): Assertion checker does not yet implement this expression.
|
||||
// Warning: (182-188): Assertion checker does not yet support this expression.
|
||||
// Warning: (182-186): Assertion checker does not yet implement type struct C.S memory
|
||||
// Warning: (182-186): Assertion checker does not yet implement type "struct C.S memory".
|
||||
// Warning: (182-191): Assertion checker does not yet implement this expression.
|
||||
// Warning: (182-194): Assertion checker does not yet implement this expression.
|
||||
// Warning: (209-215): Assertion checker does not yet support this expression.
|
||||
// Warning: (209-213): Assertion checker does not yet implement type struct C.S memory
|
||||
// Warning: (209-213): Assertion checker does not yet implement type "struct C.S memory".
|
||||
// Warning: (209-218): Assertion checker does not yet implement this expression.
|
||||
// Warning: (202-226): Assertion violation happens here
|
||||
|
@ -12,8 +12,8 @@ contract C
|
||||
// ----
|
||||
// Warning: (109-119): Assertion checker does not yet support the type of this variable.
|
||||
// Warning: (139-142): Assertion checker does not yet support this expression.
|
||||
// Warning: (139-140): Assertion checker does not yet implement type struct C.S memory
|
||||
// Warning: (139-140): Assertion checker does not yet implement type "struct C.S memory".
|
||||
// Warning: (139-151): Assertion checker does not yet implement such assignments.
|
||||
// Warning: (162-165): Assertion checker does not yet support this expression.
|
||||
// Warning: (162-163): Assertion checker does not yet implement type struct C.S memory
|
||||
// Warning: (162-163): Assertion checker does not yet implement type "struct C.S memory".
|
||||
// Warning: (155-176): Assertion violation happens here
|
||||
|
@ -14,9 +14,9 @@ contract C {
|
||||
// ----
|
||||
// Warning: (123-128): Assertion checker does not yet implement this type of function call.
|
||||
// Warning: (152-197): Assertion checker does not yet support the type of this variable.
|
||||
// Warning: (212-214): Assertion checker does not yet implement type function (function (uint256))
|
||||
// Warning: (212-214): Assertion checker does not yet implement type "function (function (uint256))".
|
||||
// Warning: (212-219): Assertion checker does not yet implement this type of function call.
|
||||
// Warning: (255-257): Internal error: Expression undefined for SMT solver.
|
||||
// Warning: (255-257): Assertion checker does not yet implement type function (function (uint256))
|
||||
// Warning: (212-214): Assertion checker does not yet implement type function (function (uint256))
|
||||
// Warning: (255-257): Assertion checker does not yet implement type "function (function (uint256))".
|
||||
// Warning: (212-214): Assertion checker does not yet implement type "function (function (uint256))".
|
||||
// Warning: (212-219): Assertion checker does not yet implement this type of function call.
|
||||
|
@ -17,11 +17,11 @@ contract C {
|
||||
// ----
|
||||
// Warning: (195-200): Assertion checker does not yet implement this type of function call.
|
||||
// Warning: (224-269): Assertion checker does not yet support the type of this variable.
|
||||
// Warning: (284-286): Assertion checker does not yet implement type function (function (uint256))
|
||||
// Warning: (284-286): Assertion checker does not yet implement type "function (function (uint256))".
|
||||
// Warning: (287-288): Assertion checker does not yet support this global variable.
|
||||
// Warning: (284-291): Assertion checker does not yet implement this type of function call.
|
||||
// Warning: (327-329): Internal error: Expression undefined for SMT solver.
|
||||
// Warning: (327-329): Assertion checker does not yet implement type function (function (uint256))
|
||||
// Warning: (284-286): Assertion checker does not yet implement type function (function (uint256))
|
||||
// Warning: (327-329): Assertion checker does not yet implement type "function (function (uint256))".
|
||||
// Warning: (284-286): Assertion checker does not yet implement type "function (function (uint256))".
|
||||
// Warning: (287-288): Assertion checker does not yet support this global variable.
|
||||
// Warning: (284-291): Assertion checker does not yet implement this type of function call.
|
||||
|
@ -15,10 +15,10 @@ contract test {
|
||||
// Warning: (140-144): Statement has no effect.
|
||||
// Warning: (148-152): Statement has no effect.
|
||||
// Warning: (156-163): Statement has no effect.
|
||||
// Warning: (125-126): Assertion checker does not yet implement type type(struct test.s storage pointer)
|
||||
// Warning: (130-131): Assertion checker does not yet implement type type(struct test.s storage pointer)
|
||||
// Warning: (130-136): Assertion checker does not yet implement type struct test.s memory
|
||||
// Warning: (125-126): Assertion checker does not yet implement type "type(struct test.s storage pointer)".
|
||||
// Warning: (130-131): Assertion checker does not yet implement type "type(struct test.s storage pointer)".
|
||||
// Warning: (130-136): Assertion checker does not yet implement type "struct test.s memory".
|
||||
// Warning: (130-136): Assertion checker does not yet implement this expression.
|
||||
// Warning: (140-141): Assertion checker does not yet implement type type(struct test.s storage pointer)
|
||||
// Warning: (140-144): Assertion checker does not yet implement type type(struct test.s memory[7] memory)
|
||||
// Warning: (156-163): Assertion checker does not yet implement type type(uint256[7] memory)
|
||||
// Warning: (140-141): Assertion checker does not yet implement type "type(struct test.s storage pointer)".
|
||||
// Warning: (140-144): Assertion checker does not yet implement type "type(struct test.s memory[7] memory)".
|
||||
// Warning: (156-163): Assertion checker does not yet implement type "type(uint256[7] memory)".
|
||||
|
@ -16,11 +16,11 @@ contract C
|
||||
// ----
|
||||
// Warning: (157-170): Unused local variable.
|
||||
// Warning: (157-170): Assertion checker does not yet support the type of this variable.
|
||||
// Warning: (139-146): Assertion checker does not yet implement type struct C.S storage ref
|
||||
// Warning: (149-150): Assertion checker does not yet implement type type(struct C.S storage pointer)
|
||||
// Warning: (149-153): Assertion checker does not yet implement type struct C.S memory
|
||||
// Warning: (139-146): Assertion checker does not yet implement type "struct C.S storage ref".
|
||||
// Warning: (149-150): Assertion checker does not yet implement type "type(struct C.S storage pointer)".
|
||||
// Warning: (149-153): Assertion checker does not yet implement type "struct C.S memory".
|
||||
// Warning: (149-153): Assertion checker does not yet implement this expression.
|
||||
// Warning: (139-153): Assertion checker does not yet implement type struct C.S storage ref
|
||||
// Warning: (173-174): Assertion checker does not yet implement type type(struct C.S storage pointer)
|
||||
// Warning: (173-177): Assertion checker does not yet implement type struct C.S memory
|
||||
// Warning: (139-153): Assertion checker does not yet implement type "struct C.S storage ref".
|
||||
// Warning: (173-174): Assertion checker does not yet implement type "type(struct C.S storage pointer)".
|
||||
// Warning: (173-177): Assertion checker does not yet implement type "struct C.S memory".
|
||||
// Warning: (173-177): Assertion checker does not yet implement this expression.
|
||||
|
@ -14,21 +14,21 @@ contract C
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (71-197): Function state mutability can be restricted to pure
|
||||
// Warning: (71-197): Function state mutability can be restricted to "pure".
|
||||
// Warning: (101-111): Assertion checker does not yet support the type of this variable.
|
||||
// Warning: (115-118): Assertion checker does not yet support this expression.
|
||||
// Warning: (115-116): Assertion checker does not yet implement type struct C.S memory
|
||||
// Warning: (115-116): Assertion checker does not yet implement type "struct C.S memory".
|
||||
// Warning: (115-121): Assertion checker does not yet implement this expression.
|
||||
// Warning: (115-121): Assertion checker does not yet implement this expression.
|
||||
// Warning: (139-142): Assertion checker does not yet support this expression.
|
||||
// Warning: (139-140): Assertion checker does not yet implement type struct C.S memory
|
||||
// Warning: (139-140): Assertion checker does not yet implement type "struct C.S memory".
|
||||
// Warning: (139-145): Assertion checker does not yet implement this expression.
|
||||
// Warning: (139-145): Assertion checker does not yet implement this expression.
|
||||
// Warning: (161-164): Assertion checker does not yet support this expression.
|
||||
// Warning: (161-162): Assertion checker does not yet implement type struct C.S memory
|
||||
// Warning: (161-162): Assertion checker does not yet implement type "struct C.S memory".
|
||||
// Warning: (161-167): Assertion checker does not yet implement this expression.
|
||||
// Warning: (161-167): Assertion checker does not yet implement this expression.
|
||||
// Warning: (182-185): Assertion checker does not yet support this expression.
|
||||
// Warning: (182-183): Assertion checker does not yet implement type struct C.S memory
|
||||
// Warning: (182-183): Assertion checker does not yet implement type "struct C.S memory".
|
||||
// Warning: (182-188): Assertion checker does not yet implement this expression.
|
||||
// Warning: (175-193): Assertion violation happens here
|
||||
|
@ -14,21 +14,21 @@ contract C
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (73-211): Function state mutability can be restricted to pure
|
||||
// Warning: (73-211): Function state mutability can be restricted to "pure".
|
||||
// Warning: (103-113): Assertion checker does not yet support the type of this variable.
|
||||
// Warning: (117-120): Assertion checker does not yet support this expression.
|
||||
// Warning: (117-118): Assertion checker does not yet implement type struct C.S memory
|
||||
// Warning: (117-118): Assertion checker does not yet implement type "struct C.S memory".
|
||||
// Warning: (117-123): Assertion checker does not yet implement this expression.
|
||||
// Warning: (117-126): Assertion checker does not yet implement this expression.
|
||||
// Warning: (144-147): Assertion checker does not yet support this expression.
|
||||
// Warning: (144-145): Assertion checker does not yet implement type struct C.S memory
|
||||
// Warning: (144-145): Assertion checker does not yet implement type "struct C.S memory".
|
||||
// Warning: (144-150): Assertion checker does not yet implement this expression.
|
||||
// Warning: (144-153): Assertion checker does not yet implement this expression.
|
||||
// Warning: (169-172): Assertion checker does not yet support this expression.
|
||||
// Warning: (169-170): Assertion checker does not yet implement type struct C.S memory
|
||||
// Warning: (169-170): Assertion checker does not yet implement type "struct C.S memory".
|
||||
// Warning: (169-175): Assertion checker does not yet implement this expression.
|
||||
// Warning: (169-178): Assertion checker does not yet implement this expression.
|
||||
// Warning: (193-196): Assertion checker does not yet support this expression.
|
||||
// Warning: (193-194): Assertion checker does not yet implement type struct C.S memory
|
||||
// Warning: (193-194): Assertion checker does not yet implement type "struct C.S memory".
|
||||
// Warning: (193-199): Assertion checker does not yet implement this expression.
|
||||
// Warning: (186-207): Assertion violation happens here
|
||||
|
@ -16,18 +16,18 @@ contract C
|
||||
// ----
|
||||
// Warning: (110-120): Assertion checker does not yet support the type of this variable.
|
||||
// Warning: (124-127): Assertion checker does not yet support this expression.
|
||||
// Warning: (124-125): Assertion checker does not yet implement type struct C.S memory
|
||||
// Warning: (124-125): Assertion checker does not yet implement type "struct C.S memory".
|
||||
// Warning: (124-130): Assertion checker does not yet implement this expression.
|
||||
// Warning: (124-136): Assertion checker does not yet implement this expression.
|
||||
// Warning: (154-157): Assertion checker does not yet support this expression.
|
||||
// Warning: (154-155): Assertion checker does not yet implement type struct C.S memory
|
||||
// Warning: (154-155): Assertion checker does not yet implement type "struct C.S memory".
|
||||
// Warning: (154-160): Assertion checker does not yet implement this expression.
|
||||
// Warning: (154-166): Assertion checker does not yet implement this expression.
|
||||
// Warning: (182-185): Assertion checker does not yet support this expression.
|
||||
// Warning: (182-183): Assertion checker does not yet implement type struct C.S memory
|
||||
// Warning: (182-183): Assertion checker does not yet implement type "struct C.S memory".
|
||||
// Warning: (182-188): Assertion checker does not yet implement this expression.
|
||||
// Warning: (182-194): Assertion checker does not yet implement this expression.
|
||||
// Warning: (209-212): Assertion checker does not yet support this expression.
|
||||
// Warning: (209-210): Assertion checker does not yet implement type struct C.S memory
|
||||
// Warning: (209-210): Assertion checker does not yet implement type "struct C.S memory".
|
||||
// Warning: (209-215): Assertion checker does not yet implement this expression.
|
||||
// Warning: (202-226): Assertion violation happens here
|
||||
|
@ -15,11 +15,11 @@ contract C {
|
||||
}
|
||||
// ----
|
||||
// Warning: (112-120): Assertion checker does not yet support the type of this variable.
|
||||
// Warning: (137-138): Assertion checker does not yet implement type type(struct C.S storage pointer)
|
||||
// Warning: (137-141): Assertion checker does not yet implement type struct C.S memory
|
||||
// Warning: (137-138): Assertion checker does not yet implement type "type(struct C.S storage pointer)".
|
||||
// Warning: (137-141): Assertion checker does not yet implement type "struct C.S memory".
|
||||
// Warning: (137-141): Assertion checker does not yet implement this expression.
|
||||
// Warning: (193-203): Assertion checker does not yet support the type of this variable.
|
||||
// Warning: (137-138): Assertion checker does not yet implement type type(struct C.S storage pointer)
|
||||
// Warning: (137-141): Assertion checker does not yet implement type struct C.S memory
|
||||
// Warning: (137-138): Assertion checker does not yet implement type "type(struct C.S storage pointer)".
|
||||
// Warning: (137-141): Assertion checker does not yet implement type "struct C.S memory".
|
||||
// Warning: (137-141): Assertion checker does not yet implement this expression.
|
||||
// Warning: (227-228): Assertion checker does not yet implement type struct C.S memory
|
||||
// Warning: (227-228): Assertion checker does not yet implement type "struct C.S memory".
|
||||
|
@ -6,5 +6,5 @@ function f() public pure { int[][]; }
|
||||
}
|
||||
// ----
|
||||
// Warning: (73-80): Statement has no effect.
|
||||
// Warning: (73-78): Assertion checker does not yet implement type type(int256[] memory)
|
||||
// Warning: (73-80): Assertion checker does not yet implement type type(int256[] memory[] memory)
|
||||
// Warning: (73-78): Assertion checker does not yet implement type "type(int256[] memory)".
|
||||
// Warning: (73-80): Assertion checker does not yet implement type "type(int256[] memory[] memory)".
|
||||
|
@ -6,6 +6,6 @@ function f() public pure { int[][][]; }
|
||||
}
|
||||
// ----
|
||||
// Warning: (73-82): Statement has no effect.
|
||||
// Warning: (73-78): Assertion checker does not yet implement type type(int256[] memory)
|
||||
// Warning: (73-80): Assertion checker does not yet implement type type(int256[] memory[] memory)
|
||||
// Warning: (73-82): Assertion checker does not yet implement type type(int256[] memory[] memory[] memory)
|
||||
// Warning: (73-78): Assertion checker does not yet implement type "type(int256[] memory)".
|
||||
// Warning: (73-80): Assertion checker does not yet implement type "type(int256[] memory[] memory)".
|
||||
// Warning: (73-82): Assertion checker does not yet implement type "type(int256[] memory[] memory[] memory)".
|
||||
|
@ -6,6 +6,6 @@ function f() public pure { (int[][]); }
|
||||
}
|
||||
// ----
|
||||
// Warning: (73-82): Statement has no effect.
|
||||
// Warning: (74-79): Assertion checker does not yet implement type type(int256[] memory)
|
||||
// Warning: (74-81): Assertion checker does not yet implement type type(int256[] memory[] memory)
|
||||
// Warning: (73-82): Assertion checker does not yet implement type type(int256[] memory[] memory)
|
||||
// Warning: (74-79): Assertion checker does not yet implement type "type(int256[] memory)".
|
||||
// Warning: (74-81): Assertion checker does not yet implement type "type(int256[] memory[] memory)".
|
||||
// Warning: (73-82): Assertion checker does not yet implement type "type(int256[] memory[] memory)".
|
||||
|
@ -6,7 +6,7 @@ function f() public pure { (int[][][]); }
|
||||
}
|
||||
// ----
|
||||
// Warning: (73-84): Statement has no effect.
|
||||
// Warning: (74-79): Assertion checker does not yet implement type type(int256[] memory)
|
||||
// Warning: (74-81): Assertion checker does not yet implement type type(int256[] memory[] memory)
|
||||
// Warning: (74-83): Assertion checker does not yet implement type type(int256[] memory[] memory[] memory)
|
||||
// Warning: (73-84): Assertion checker does not yet implement type type(int256[] memory[] memory[] memory)
|
||||
// Warning: (74-79): Assertion checker does not yet implement type "type(int256[] memory)".
|
||||
// Warning: (74-81): Assertion checker does not yet implement type "type(int256[] memory[] memory)".
|
||||
// Warning: (74-83): Assertion checker does not yet implement type "type(int256[] memory[] memory[] memory)".
|
||||
// Warning: (73-84): Assertion checker does not yet implement type "type(int256[] memory[] memory[] memory)".
|
||||
|
@ -5,4 +5,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (74-82): Member "pop" is not available in uint256[] memory outside of storage.
|
||||
// TypeError: (74-82): Member "pop" is not available in "uint256[] memory" outside of storage.
|
||||
|
@ -2,4 +2,4 @@ contract C {
|
||||
uint[3/0] ids;
|
||||
}
|
||||
// ----
|
||||
// TypeError: (22-25): Operator / not compatible with types int_const 3 and int_const 0
|
||||
// TypeError: (22-25): Operator "/" not compatible with types "int_const 3" and "int_const 0".
|
||||
|
@ -5,4 +5,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (63-71): Member "pop" not found or not visible after argument-dependent lookup in uint256.
|
||||
// TypeError: (63-71): Member "pop" not found or not visible after argument-dependent lookup in "uint256".
|
||||
|
@ -4,4 +4,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (66-71): Member "pop" is not available in uint256[] calldata outside of storage.
|
||||
// TypeError: (66-71): Member "pop" is not available in "uint256[] calldata" outside of storage.
|
||||
|
@ -5,4 +5,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (72-77): Member "pop" is not available in uint256[] memory outside of storage.
|
||||
// TypeError: (72-77): Member "pop" is not available in "uint256[] memory" outside of storage.
|
||||
|
@ -4,4 +4,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (66-72): Member "push" is not available in uint256[] calldata outside of storage.
|
||||
// TypeError: (66-72): Member "push" is not available in "uint256[] calldata" outside of storage.
|
||||
|
@ -5,4 +5,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (72-78): Member "push" is not available in uint256[] memory outside of storage.
|
||||
// TypeError: (72-78): Member "push" is not available in "uint256[] memory" outside of storage.
|
||||
|
@ -4,4 +4,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (65-88): Type bytes calldata slice is not implicitly convertible to expected type bytes memory.
|
||||
// TypeError: (65-88): Type "bytes calldata slice" is not implicitly convertible to expected type "bytes memory".
|
||||
|
@ -4,4 +4,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (79-85): Invalid type for argument in function call. Invalid implicit conversion from bytes calldata slice to bytes memory requested.
|
||||
// TypeError: (79-85): Invalid type for argument in function call. Invalid implicit conversion from "bytes calldata slice" to "bytes memory" requested.
|
||||
|
@ -5,4 +5,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (66-74): Member "pop" not found or not visible after argument-dependent lookup in uint256[3] storage ref.
|
||||
// TypeError: (66-74): Member "pop" not found or not visible after argument-dependent lookup in "uint256[3] storage ref".
|
||||
|
@ -5,4 +5,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (65-73): Member "pop" not found or not visible after argument-dependent lookup in string storage ref.
|
||||
// TypeError: (65-73): Member "pop" not found or not visible after argument-dependent lookup in "string storage ref".
|
||||
|
@ -3,5 +3,5 @@ contract C {
|
||||
uint constant b = mulmod(3, 4, 0.1);
|
||||
}
|
||||
// ----
|
||||
// TypeError: (48-51): Invalid type for argument in function call. Invalid implicit conversion from rational_const 1 / 10 to uint256 requested.
|
||||
// TypeError: (89-92): Invalid type for argument in function call. Invalid implicit conversion from rational_const 1 / 10 to uint256 requested.
|
||||
// TypeError: (48-51): Invalid type for argument in function call. Invalid implicit conversion from "rational_const 1 / 10" to "uint256" requested.
|
||||
// TypeError: (89-92): Invalid type for argument in function call. Invalid implicit conversion from "rational_const 1 / 10" to "uint256" requested.
|
||||
|
@ -2,4 +2,4 @@ contract C {
|
||||
uint constant a = a;
|
||||
}
|
||||
// ----
|
||||
// TypeError: (17-36): The value of the constant a has a cyclic dependency via a.
|
||||
// TypeError: (17-36): The value of the constant "a" has a cyclic dependency via "a".
|
||||
|
@ -5,6 +5,6 @@ contract C {
|
||||
uint constant d = 2 + a;
|
||||
}
|
||||
// ----
|
||||
// TypeError: (17-40): The value of the constant a has a cyclic dependency via c.
|
||||
// TypeError: (71-129): The value of the constant c has a cyclic dependency via d.
|
||||
// TypeError: (135-158): The value of the constant d has a cyclic dependency via a.
|
||||
// TypeError: (17-40): The value of the constant "a" has a cyclic dependency via "c".
|
||||
// TypeError: (71-129): The value of the constant "c" has a cyclic dependency via "d".
|
||||
// TypeError: (135-158): The value of the constant "d" has a cyclic dependency via "a".
|
||||
|
@ -5,7 +5,7 @@ contract C {
|
||||
uint constant c = b;
|
||||
}
|
||||
// ----
|
||||
// TypeError: (17-36): The value of the constant x has a cyclic dependency via a.
|
||||
// TypeError: (42-65): The value of the constant a has a cyclic dependency via b.
|
||||
// TypeError: (71-90): The value of the constant b has a cyclic dependency via c.
|
||||
// TypeError: (96-115): The value of the constant c has a cyclic dependency via b.
|
||||
// TypeError: (17-36): The value of the constant "x" has a cyclic dependency via "a".
|
||||
// TypeError: (42-65): The value of the constant "a" has a cyclic dependency via "b".
|
||||
// TypeError: (71-90): The value of the constant "b" has a cyclic dependency via "c".
|
||||
// TypeError: (96-115): The value of the constant "c" has a cyclic dependency via "b".
|
||||
|
@ -7,4 +7,4 @@ contract B is A {
|
||||
}
|
||||
// ----
|
||||
// Warning: (58-101): This declaration shadows an existing declaration.
|
||||
// TypeError: (130-133): Member "f" not found or not visible after argument-dependent lookup in function () pure returns (uint8).
|
||||
// TypeError: (130-133): Member "f" not found or not visible after argument-dependent lookup in "function () pure returns (uint8)".
|
||||
|
@ -8,4 +8,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (169-171): Invalid type for argument in function call. Invalid implicit conversion from address to address payable requested.
|
||||
// TypeError: (169-171): Invalid type for argument in function call. Invalid implicit conversion from "address" to "address payable" requested.
|
||||
|
@ -7,4 +7,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (105-144): Type function () external is not implicitly convertible to expected type function () payable external.
|
||||
// TypeError: (105-144): Type "function () external" is not implicitly convertible to expected type "function () payable external".
|
||||
|
@ -7,4 +7,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (105-141): Type function () external is not implicitly convertible to expected type function () pure external.
|
||||
// TypeError: (105-141): Type "function () external" is not implicitly convertible to expected type "function () pure external".
|
||||
|
@ -7,4 +7,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (105-141): Type function () external is not implicitly convertible to expected type function () view external.
|
||||
// TypeError: (105-141): Type "function () external" is not implicitly convertible to expected type "function () view external".
|
||||
|
@ -7,4 +7,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (113-149): Type function () payable external is not implicitly convertible to expected type function () pure external.
|
||||
// TypeError: (113-149): Type "function () payable external" is not implicitly convertible to expected type "function () pure external".
|
||||
|
@ -7,4 +7,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (113-149): Type function () payable external is not implicitly convertible to expected type function () view external.
|
||||
// TypeError: (113-149): Type "function () payable external" is not implicitly convertible to expected type "function () view external".
|
||||
|
@ -7,4 +7,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (110-149): Type function () pure external is not implicitly convertible to expected type function () payable external.
|
||||
// TypeError: (110-149): Type "function () pure external" is not implicitly convertible to expected type "function () payable external".
|
||||
|
@ -7,4 +7,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (110-149): Type function () view external is not implicitly convertible to expected type function () payable external.
|
||||
// TypeError: (110-149): Type "function () view external" is not implicitly convertible to expected type "function () payable external".
|
||||
|
@ -7,4 +7,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (110-146): Type function () view external is not implicitly convertible to expected type function () pure external.
|
||||
// TypeError: (110-146): Type "function () view external" is not implicitly convertible to expected type "function () pure external".
|
||||
|
@ -8,5 +8,5 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (93-94): Type int256[] memory is not implicitly convertible to expected type int256[] storage pointer.
|
||||
// TypeError: (102-110): Type int256[] memory is not implicitly convertible to expected type int256[] storage pointer.
|
||||
// TypeError: (93-94): Type "int256[] memory" is not implicitly convertible to expected type "int256[] storage pointer".
|
||||
// TypeError: (102-110): Type "int256[] memory" is not implicitly convertible to expected type "int256[] storage pointer".
|
||||
|
@ -3,4 +3,4 @@ contract C {
|
||||
ufixed constant b = ufixed(4 ether / 3 hours);
|
||||
}
|
||||
// ----
|
||||
// TypeError: (32-49): Type rational_const 10000000000000000 / 27 is not implicitly convertible to expected type uint256. Try converting to type ufixed256x62 or use an explicit conversion.
|
||||
// TypeError: (32-49): Type "rational_const 10000000000000000 / 27" is not implicitly convertible to expected type "uint256". Try converting to type "ufixed256x62" or use an explicit conversion.
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user