Skip to content

Commit 4700c2b

Browse files
committed
Properly export symbols from aliased imports.
1 parent 31fd97b commit 4700c2b

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Compiler Features:
1313

1414

1515
Bugfixes:
16+
* Name Resolver: Fix that when importing an aliased symbol using ``import {AliasedName} from "a.sol"`` it would use the original name of the symbol and not the aliased one.
1617
* SMTChecker: Fix false negative caused by ``push`` on storage array references returned by internal functions.
1718
* SMTChecker: Fix false positive in external calls from constructors.
1819
* SMTChecker: Fix internal error on some multi-source uses of ``abi.*``, cryptographic functions and constants.

libsolidity/analysis/NameAndTypeResolver.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,12 @@ bool NameAndTypeResolver::performImports(SourceUnit& _sourceUnit, map<string, So
102102
else
103103
for (Declaration const* declaration: declarations)
104104
if (!DeclarationRegistrationHelper::registerDeclaration(
105-
target, *declaration, alias.alias.get(), &alias.location, false, m_errorReporter
105+
target,
106+
*declaration,
107+
alias.alias ? alias.alias.get() : &alias.symbol->name(),
108+
&alias.location,
109+
false,
110+
m_errorReporter
106111
))
107112
error = true;
108113
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
==== Source: dummy ====
2+
contract Dummy { string public constant FOO = "FOO"; }
3+
==== Source: hasAlias ====
4+
import {Dummy as AliasedDummy} from "dummy";
5+
==== Source: Main ====
6+
import {AliasedDummy} from "hasAlias";
7+
contract TestAlias is AliasedDummy {}
8+
// ----

0 commit comments

Comments
 (0)