Merge pull request #9325 from ethereum/develop

Merge develop into breaking.
This commit is contained in:
chriseth
2020-07-06 19:11:02 +02:00
committed by GitHub
23 changed files with 84 additions and 54 deletions
+4 -2
View File
@@ -163,7 +163,8 @@ bool StaticAnalyzer::visit(VariableDeclaration const& _variable)
m_errorReporter.warning(
3408_error,
_variable.location(),
"Variable covers a large part of storage and thus makes collisions likely. "
"Variable " + util::escapeAndQuoteString(_variable.name()) +
" covers a large part of storage and thus makes collisions likely. "
"Either use mappings or dynamic arrays and allow their size to be increased only "
"in small quantities per transaction."
);
@@ -171,7 +172,8 @@ bool StaticAnalyzer::visit(VariableDeclaration const& _variable)
m_errorReporter.warning(
7325_error,
_variable.location(),
"Type " + type->canonicalName() + " has large size and thus makes collisions likely. "
"Type " + util::escapeAndQuoteString(type->canonicalName()) +
" has large size and thus makes collisions likely. "
"Either use mappings or dynamic arrays and allow their size to be increased only "
"in small quantities per transaction."
);
+1 -1
View File
@@ -1343,7 +1343,7 @@ bool TypeChecker::visit(Conditional const& _conditional)
_conditional.location(),
"True expression's type " +
trueType->toString() +
" doesn't match false expression's type " +
" does not match false expression's type " +
falseType->toString() +
"."
);
+10 -1
View File
@@ -588,6 +588,15 @@ bool VariableDeclaration::isInternalCallableParameter() const
return false;
}
bool VariableDeclaration::isConstructorParameter() const
{
if (!isCallableOrCatchParameter())
return false;
if (auto const* function = dynamic_cast<FunctionDefinition const*>(scope()))
return function->isConstructor();
return false;
}
bool VariableDeclaration::isLibraryFunctionParameter() const
{
if (!isCallableOrCatchParameter())
@@ -622,7 +631,7 @@ set<VariableDeclaration::Location> VariableDeclaration::allowedDataLocations() c
set<Location> locations{ Location::Memory };
if (isInternalCallableParameter() || isLibraryFunctionParameter() || isTryCatchParameter())
locations.insert(Location::Storage);
if (!isTryCatchParameter())
if (!isTryCatchParameter() && !isConstructorParameter())
locations.insert(Location::CallData);
return locations;
+1
View File
@@ -928,6 +928,7 @@ public:
/// @returns true if this variable is a parameter or return parameter of an internal function
/// or a function type of internal visibility.
bool isInternalCallableParameter() const;
bool isConstructorParameter() const;
/// @returns true iff this variable is a parameter(or return parameter of a library function
bool isLibraryFunctionParameter() const;
/// @returns true if the type of the variable does not need to be specified, i.e. it is declared