mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
TypeChecker: Minor simplifications for operators and using for
This commit is contained in:
parent
1dd05e2978
commit
27df07c4ce
@ -1751,7 +1751,9 @@ bool TypeChecker::visit(UnaryOperation const& _operation)
|
||||
else
|
||||
_operation.annotation().type = result.get();
|
||||
_operation.annotation().isConstant = false;
|
||||
_operation.annotation().isPure = !modifying && *_operation.subExpression().annotation().isPure;
|
||||
_operation.annotation().isPure =
|
||||
!modifying &&
|
||||
*_operation.subExpression().annotation().isPure;
|
||||
_operation.annotation().isLValue = false;
|
||||
|
||||
return false;
|
||||
@ -3750,8 +3752,9 @@ void TypeChecker::endVisit(UsingForDirective const& _usingFor)
|
||||
solAssert(m_errorReporter.hasErrors());
|
||||
return;
|
||||
}
|
||||
solAssert(_usingFor.typeName()->annotation().type);
|
||||
if (Declaration const* typeDefinition = _usingFor.typeName()->annotation().type->typeDefinition())
|
||||
Type const* usingForType = _usingFor.typeName()->annotation().type;
|
||||
solAssert(usingForType);
|
||||
if (Declaration const* typeDefinition = usingForType->typeDefinition())
|
||||
{
|
||||
if (typeDefinition->scope() != m_currentSourceUnit)
|
||||
m_errorReporter.typeError(
|
||||
@ -3785,10 +3788,12 @@ void TypeChecker::endVisit(UsingForDirective const& _usingFor)
|
||||
return;
|
||||
}
|
||||
|
||||
solAssert(_usingFor.typeName()->annotation().type);
|
||||
Type const* usingForType = _usingFor.typeName()->annotation().type;
|
||||
solAssert(usingForType);
|
||||
|
||||
Type const* normalizedType = TypeProvider::withLocationIfReference(
|
||||
DataLocation::Storage,
|
||||
_usingFor.typeName()->annotation().type
|
||||
usingForType
|
||||
);
|
||||
solAssert(normalizedType);
|
||||
|
||||
@ -3824,7 +3829,7 @@ void TypeChecker::endVisit(UsingForDirective const& _usingFor)
|
||||
"The function \"{}\" cannot be bound to the type \"{}\" because the type cannot "
|
||||
"be implicitly converted to the first argument of the function (\"{}\"){}",
|
||||
joinHumanReadable(path->path(), "."),
|
||||
_usingFor.typeName()->annotation().type->toString(true /* withoutDataLocation */),
|
||||
usingForType->toString(true /* withoutDataLocation */),
|
||||
functionType->selfType()->humanReadableName(),
|
||||
result.message().empty() ? "." : ": " + result.message()
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user