mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Fix member lookup for constructor in library.
This commit is contained in:
parent
d31f05fcc0
commit
c96e997a3c
@ -8,6 +8,7 @@ Compiler Features:
|
|||||||
|
|
||||||
Bugfixes:
|
Bugfixes:
|
||||||
* SMTChecker: Fix internal error on fixed bytes index access.
|
* SMTChecker: Fix internal error on fixed bytes index access.
|
||||||
|
* References Resolver: Fix internal bug when using constructor for library.
|
||||||
|
|
||||||
|
|
||||||
### 0.7.0 (2020-07-28)
|
### 0.7.0 (2020-07-28)
|
||||||
|
@ -792,6 +792,7 @@ public:
|
|||||||
m_body(_body)
|
m_body(_body)
|
||||||
{
|
{
|
||||||
solAssert(_kind == Token::Constructor || _kind == Token::Function || _kind == Token::Fallback || _kind == Token::Receive, "");
|
solAssert(_kind == Token::Constructor || _kind == Token::Function || _kind == Token::Fallback || _kind == Token::Receive, "");
|
||||||
|
solAssert(isOrdinary() == !name().empty(), "");
|
||||||
}
|
}
|
||||||
|
|
||||||
void accept(ASTVisitor& _visitor) override;
|
void accept(ASTVisitor& _visitor) override;
|
||||||
|
@ -451,7 +451,7 @@ MemberList::MemberMap Type::boundFunctions(Type const& _type, ASTNode const& _sc
|
|||||||
);
|
);
|
||||||
for (FunctionDefinition const* function: library.definedFunctions())
|
for (FunctionDefinition const* function: library.definedFunctions())
|
||||||
{
|
{
|
||||||
if (!function->isVisibleAsLibraryMember() || seenFunctions.count(function))
|
if (!function->isOrdinary() || !function->isVisibleAsLibraryMember() || seenFunctions.count(function))
|
||||||
continue;
|
continue;
|
||||||
seenFunctions.insert(function);
|
seenFunctions.insert(function);
|
||||||
if (function->parameters().empty())
|
if (function->parameters().empty())
|
||||||
@ -3838,6 +3838,8 @@ MemberList::MemberMap TypeType::nativeMembers(ASTNode const* _currentScope) cons
|
|||||||
{
|
{
|
||||||
if (dynamic_cast<ModifierDefinition const*>(declaration))
|
if (dynamic_cast<ModifierDefinition const*>(declaration))
|
||||||
continue;
|
continue;
|
||||||
|
if (declaration->name().empty())
|
||||||
|
continue;
|
||||||
|
|
||||||
if (!contract.isLibrary() && inDerivingScope && declaration->isVisibleInDerivedContracts())
|
if (!contract.isLibrary() && inDerivingScope && declaration->isVisibleInDerivedContracts())
|
||||||
{
|
{
|
||||||
|
@ -0,0 +1,4 @@
|
|||||||
|
library L{ constructor() { L.x; } }
|
||||||
|
// ----
|
||||||
|
// TypeError 7634: (11-33): Constructor cannot be defined in libraries.
|
||||||
|
// TypeError 9582: (27-30): Member "x" not found or not visible after argument-dependent lookup in type(library L).
|
Loading…
Reference in New Issue
Block a user