Merge pull request #10506 from ethereum/superInLibs

Make super unavailable in libraries.
This commit is contained in:
chriseth
2020-12-07 14:36:42 +01:00
committed by GitHub
4 changed files with 17 additions and 1 deletions
+1
View File
@@ -17,6 +17,7 @@ Bugfixes:
* SMTChecker: Fix internal compiler error when doing bitwise compound assignment with string literals.
* SMTChecker: Fix internal error when trying to generate counterexamples with old z3.
* SMTChecker: Fix segmentation fault that could occur on certain SMT-enabled sources when no SMT solver was available.
* Type Checker: ``super`` is not available in libraries.
* Yul Optimizer: Fix a bug in NameSimplifier where a new name created by NameSimplifier could also be created by NameDispenser.
* Yul Optimizer: Removed NameSimplifier from optimization steps available to users.
@@ -285,6 +285,7 @@ bool NameAndTypeResolver::resolveNamesAndTypesInternal(ASTNode& _node, bool _res
solAssert(_resolveInsideCode, "");
m_globalContext.setCurrentContract(*contract);
if (!contract->isLibrary())
updateDeclaration(*m_globalContext.currentSuper());
updateDeclaration(*m_globalContext.currentThis());
@@ -0,0 +1,7 @@
contract C {
}
function f() pure {
super;
}
// ----
// DeclarationError 7576: (39-44): Undeclared identifier. "super" is not (or not yet) visible at this point.
@@ -0,0 +1,7 @@
library L {
function f() public {
(super);
}
}
// ----
// DeclarationError 7576: (41-46): Undeclared identifier. "super" is not (or not yet) visible at this point.