mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #10993 from ethereum/fixModuleMemberNames
Fix module member names for importing with renaming.
This commit is contained in:
commit
3dcba53595
@ -112,7 +112,11 @@ util::Result<TypePointers> transformParametersToExternal(TypePointers const& _pa
|
|||||||
}
|
}
|
||||||
|
|
||||||
MemberList::Member::Member(Declaration const* _declaration, Type const* _type):
|
MemberList::Member::Member(Declaration const* _declaration, Type const* _type):
|
||||||
name(_declaration->name()),
|
Member(_declaration, _type, _declaration->name())
|
||||||
|
{}
|
||||||
|
|
||||||
|
MemberList::Member::Member(Declaration const* _declaration, Type const* _type, string _name):
|
||||||
|
name(move(_name)),
|
||||||
type(_type),
|
type(_type),
|
||||||
declaration(_declaration)
|
declaration(_declaration)
|
||||||
{
|
{
|
||||||
@ -3810,10 +3814,7 @@ MemberList::MemberMap ModuleType::nativeMembers(ASTNode const*) const
|
|||||||
MemberList::MemberMap symbols;
|
MemberList::MemberMap symbols;
|
||||||
for (auto const& [name, declarations]: *m_sourceUnit.annotation().exportedSymbols)
|
for (auto const& [name, declarations]: *m_sourceUnit.annotation().exportedSymbols)
|
||||||
for (Declaration const* symbol: declarations)
|
for (Declaration const* symbol: declarations)
|
||||||
{
|
symbols.emplace_back(symbol, symbol->type(), name);
|
||||||
solAssert(name == symbol->name(), "");
|
|
||||||
symbols.emplace_back(symbol, symbol->type());
|
|
||||||
}
|
|
||||||
return symbols;
|
return symbols;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,6 +110,7 @@ public:
|
|||||||
|
|
||||||
/// Constructs a Member with the name extracted from @p _declaration's name.
|
/// Constructs a Member with the name extracted from @p _declaration's name.
|
||||||
Member(Declaration const* _declaration, Type const* _type);
|
Member(Declaration const* _declaration, Type const* _type);
|
||||||
|
Member(Declaration const* _declaration, Type const* _type, std::string _name);
|
||||||
|
|
||||||
std::string name;
|
std::string name;
|
||||||
Type const* type = nullptr;
|
Type const* type = nullptr;
|
||||||
|
@ -0,0 +1,8 @@
|
|||||||
|
==== Source: s1.sol ====
|
||||||
|
int constant a = 2;
|
||||||
|
==== Source: s2.sol ====
|
||||||
|
import {a as e} from "s1.sol";
|
||||||
|
import "s2.sol" as M;
|
||||||
|
contract C {
|
||||||
|
function f() public pure returns (int) { return M.e; }
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
==== Source: s1.sol ====
|
||||||
|
int constant a = 2;
|
||||||
|
==== Source: s2.sol ====
|
||||||
|
import {a as e} from "s1.sol";
|
||||||
|
import "s2.sol" as M;
|
||||||
|
contract C {
|
||||||
|
function f() public pure returns (int) { return M.a; }
|
||||||
|
}
|
||||||
|
// ----
|
||||||
|
// TypeError 9582: (s2.sol:116-119): Member "a" not found or not visible after argument-dependent lookup in module "s2.sol".
|
Loading…
Reference in New Issue
Block a user