Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: None when requested immediate inheritance #2304

Closed
Tiko7454 opened this issue Feb 13, 2024 · 4 comments
Closed

[Bug]: None when requested immediate inheritance #2304

Tiko7454 opened this issue Feb 13, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@Tiko7454
Copy link
Contributor

Describe the issue:

When I request inheritance for contract A it gives a list consisting of B, but when I request for immediate inheritance, it gives a list with one element, which is None

Code example to reproduce the issue:

// b.sol

contract B{}
// a.sol

import {B as Base} from "b.sol";

contract A is Base {}

Version:

0.10.0

Relevant log output:

>>> slither = Slither("a.sol")
>>> A = slither.contracts[0]
>>> A.name
'A'
>>> A.inheritance
[<slither.core.declarations.contract.Contract object at 0x7f36dea24b10>]
>>> A.inheritance[0].name
'B'
>>> A.immediate_inheritance
[None]
@Tiko7454 Tiko7454 added the bug-candidate Bugs reports that are not yet confirmed label Feb 13, 2024
@0xalpharush
Copy link
Contributor

We probably need to resolve the alias as is done here:

if contract_name in contract_parser.underlying_contract.file_scope.renaming:
contract_name = contract_parser.underlying_contract.file_scope.renaming[
contract_name
]

For base contracts, too:
# Resolve immediate base contracts
for i in contract_parser.baseContracts:
if i in contract_parser.remapping:
fathers.append(
contract_parser.underlying_contract.file_scope.get_contract_from_name(
contract_parser.remapping[i]
)
# self._compilation_unit.get_contract_from_name(contract_parser.remapping[i])
)

@0xalpharush 0xalpharush added bug Something isn't working and removed bug-candidate Bugs reports that are not yet confirmed labels Feb 13, 2024
@0xalpharush 0xalpharush changed the title [Bug-Candidate]: None when requested immediate inheritance [Bug-]: None when requested immediate inheritance Feb 13, 2024
@0xalpharush 0xalpharush changed the title [Bug-]: None when requested immediate inheritance [Bug]: None when requested immediate inheritance Feb 13, 2024
@Tiko7454
Copy link
Contributor Author

I fixed the bug the way you said and opened a pr #2306

@0xalpharush
Copy link
Contributor

Did it fix the issue?

@Tiko7454
Copy link
Contributor Author

Yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants