Merge remote-tracking branch 'origin/develop' into breaking

This commit is contained in:
chriseth
2022-02-17 09:42:15 +01:00
99 changed files with 2494 additions and 230 deletions
+4 -3
View File
@@ -897,10 +897,11 @@ OverrideChecker::OverrideProxyBySignatureMultiSet const& OverrideChecker::inheri
if (var->isPublic())
functionsInBase.emplace(OverrideProxy{var});
for (OverrideProxy const& func: inheritedFunctions(*base))
functionsInBase.insert(func);
result += functionsInBase;
for (OverrideProxy const& func: inheritedFunctions(*base))
if (!functionsInBase.count(func))
result.insert(func);
}
m_inheritedFunctions[&_contract] = result;
+37 -3
View File
@@ -2207,14 +2207,42 @@ void TypeChecker::typeCheckABIEncodeCallFunction(FunctionCall const& _functionCa
}
}
void TypeChecker::typeCheckStringConcatFunction(
FunctionCall const& _functionCall,
FunctionType const* _functionType
)
{
solAssert(_functionType);
solAssert(_functionType->kind() == FunctionType::Kind::StringConcat);
solAssert(_functionCall.names().empty());
typeCheckFunctionGeneralChecks(_functionCall, _functionType);
for (shared_ptr<Expression const> const& argument: _functionCall.arguments())
{
Type const* argumentType = type(*argument);
bool notConvertibleToString = !argumentType->isImplicitlyConvertibleTo(*TypeProvider::stringMemory());
if (notConvertibleToString)
m_errorReporter.typeError(
9977_error,
argument->location(),
"Invalid type for argument in the string.concat function call. "
"string type is required, but " +
argumentType->identifier() + " provided."
);
}
}
void TypeChecker::typeCheckBytesConcatFunction(
FunctionCall const& _functionCall,
FunctionType const* _functionType
)
{
solAssert(_functionType, "");
solAssert(_functionType->kind() == FunctionType::Kind::BytesConcat, "");
solAssert(_functionCall.names().empty(), "");
solAssert(_functionType);
solAssert(_functionType->kind() == FunctionType::Kind::BytesConcat);
solAssert(_functionCall.names().empty());
typeCheckFunctionGeneralChecks(_functionCall, _functionType);
@@ -2651,6 +2679,12 @@ bool TypeChecker::visit(FunctionCall const& _functionCall)
returnTypes = functionType->returnParameterTypes();
break;
}
case FunctionType::Kind::StringConcat:
{
typeCheckStringConcatFunction(_functionCall, functionType);
returnTypes = functionType->returnParameterTypes();
break;
}
case FunctionType::Kind::Wrap:
case FunctionType::Kind::Unwrap:
{
+6
View File
@@ -113,6 +113,12 @@ private:
/// Performs checks specific to the ABI encode functions of type ABIEncodeCall
void typeCheckABIEncodeCallFunction(FunctionCall const& _functionCall);
/// Performs general checks and checks specific to string concat function call
void typeCheckStringConcatFunction(
FunctionCall const& _functionCall,
FunctionType const* _functionType
);
/// Performs general checks and checks specific to bytes concat function call
void typeCheckBytesConcatFunction(
FunctionCall const& _functionCall,