mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #9689 from ethereum/using-for-interface
Disallow ``using for`` directive for interfaces.
This commit is contained in:
commit
e872b1b51e
@ -24,6 +24,7 @@ Bugfixes:
|
||||
* Type Checker: Disallow signed literals as exponent in exponentiation operator.
|
||||
* Allow `type(Contract).name` for abstract contracts and interfaces.
|
||||
* Type Checker: Disallow structs containing nested mapping in memory as parameters for library functions.
|
||||
* Type Checker: Disallow ``using for`` directive inside interfaces.
|
||||
|
||||
|
||||
### 0.7.0 (2020-07-28)
|
||||
|
@ -3148,6 +3148,16 @@ void TypeChecker::endVisit(Literal const& _literal)
|
||||
_literal.annotation().isPure = true;
|
||||
}
|
||||
|
||||
void TypeChecker::endVisit(UsingForDirective const& _usingFor)
|
||||
{
|
||||
if (m_currentContract->isInterface())
|
||||
m_errorReporter.typeError(
|
||||
9088_error,
|
||||
_usingFor.location(),
|
||||
"The \"using for\" directive is not allowed inside interfaces."
|
||||
);
|
||||
}
|
||||
|
||||
bool TypeChecker::contractDependenciesAreCyclic(
|
||||
ContractDefinition const& _contract,
|
||||
std::set<ContractDefinition const*> const& _seenContracts
|
||||
|
@ -143,6 +143,7 @@ private:
|
||||
bool visit(Identifier const& _identifier) override;
|
||||
void endVisit(ElementaryTypeNameExpression const& _expr) override;
|
||||
void endVisit(Literal const& _literal) override;
|
||||
void endVisit(UsingForDirective const& _usingForDirective) override;
|
||||
|
||||
bool contractDependenciesAreCyclic(
|
||||
ContractDefinition const& _contract,
|
||||
|
10
test/libsolidity/syntaxTests/bound/interface_using_for.sol
Normal file
10
test/libsolidity/syntaxTests/bound/interface_using_for.sol
Normal file
@ -0,0 +1,10 @@
|
||||
library L {
|
||||
function f() public {}
|
||||
}
|
||||
|
||||
interface I {
|
||||
using L for int;
|
||||
function g() external;
|
||||
}
|
||||
// ----
|
||||
// TypeError 9088: (60-76): The "using for" directive is not allowed inside interfaces.
|
Loading…
Reference in New Issue
Block a user