diff options
author | Anurag Dashputre <anurag4u80@gmail.com> | 2018-12-02 01:20:56 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2018-12-03 19:25:31 +0800 |
commit | 82f5763e7afa498f891e9d41b30278c4482ddb8b (patch) | |
tree | ffe9d7a020cf8e5bb475d0a283d26d73569fc3e5 | |
parent | 4b98946e5a6cbc477ca5c61ca0a0dc8c2d1b27ca (diff) | |
download | dexon-solidity-82f5763e7afa498f891e9d41b30278c4482ddb8b.tar.gz dexon-solidity-82f5763e7afa498f891e9d41b30278c4482ddb8b.tar.zst dexon-solidity-82f5763e7afa498f891e9d41b30278c4482ddb8b.zip |
Fix internal compiler error for unimplemented base contract function.
-rw-r--r-- | Changelog.md | 1 | ||||
-rw-r--r-- | libsolidity/ast/Types.cpp | 3 | ||||
-rw-r--r-- | test/libsolidity/syntaxTests/unimplemented_super_function.sol | 8 | ||||
-rw-r--r-- | test/libsolidity/syntaxTests/unimplemented_super_function_derived.sol | 12 |
4 files changed, 23 insertions, 1 deletions
diff --git a/Changelog.md b/Changelog.md index 72d51bff..5df412ca 100644 --- a/Changelog.md +++ b/Changelog.md @@ -25,6 +25,7 @@ Bugfixes: * Type Checker: Disallow struct return types for getters of public state variables unless the new ABI encoder is active. * Type Checker: Fix internal compiler error when a field of a struct used as a parameter in a function type has a non-existent type. * Type Checker: Disallow functions ``sha3`` and ``suicide`` also without a function call. + * Type Checker: Fix internal compiler error with ``super`` when base contract function is not implemented. * Type Checker: Fixed internal error when trying to create abstract contract in some cases. * Type Checker: Fixed internal error related to double declaration of events. * Type Checker: Disallow inline arrays of mapping type. diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index 16e9cf89..6cadb5f3 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -1943,8 +1943,9 @@ MemberList::MemberMap ContractType::nativeMembers(ContractDefinition const* _con for (ContractDefinition const* base: bases | boost::adaptors::sliced(1, bases.size())) for (FunctionDefinition const* function: base->definedFunctions()) { - if (!function->isVisibleInDerivedContracts()) + if (!function->isVisibleInDerivedContracts() || !function->isImplemented()) continue; + auto functionType = make_shared<FunctionType>(*function, true); bool functionWithEqualArgumentsFound = false; for (auto const& member: members) diff --git a/test/libsolidity/syntaxTests/unimplemented_super_function.sol b/test/libsolidity/syntaxTests/unimplemented_super_function.sol new file mode 100644 index 00000000..356727ae --- /dev/null +++ b/test/libsolidity/syntaxTests/unimplemented_super_function.sol @@ -0,0 +1,8 @@ +contract a { + function f() public; +} +contract b is a { + function f() public { super.f(); } +} +// ---- +// TypeError: (84-91): Member "f" not found or not visible after argument-dependent lookup in contract super b. diff --git a/test/libsolidity/syntaxTests/unimplemented_super_function_derived.sol b/test/libsolidity/syntaxTests/unimplemented_super_function_derived.sol new file mode 100644 index 00000000..88acbdf0 --- /dev/null +++ b/test/libsolidity/syntaxTests/unimplemented_super_function_derived.sol @@ -0,0 +1,12 @@ +contract a { + function f() public; +} +contract b is a { + function f() public { super.f(); } +} +contract c is a,b { + // No error here. + function f() public { super.f(); } +} +// ---- +// TypeError: (84-91): Member "f" not found or not visible after argument-dependent lookup in contract super b. |