diff --git a/slither/core/variables/variable.py b/slither/core/variables/variable.py index 2b777e6723..1afcc47575 100644 --- a/slither/core/variables/variable.py +++ b/slither/core/variables/variable.py @@ -179,5 +179,4 @@ def solidity_signature(self) -> str: return f'{name}({",".join(parameters)})' def __str__(self) -> str: - assert self._name return self._name diff --git a/tests/e2e/compilation/test_data/test_contract_data/test_contract_data.sol b/tests/e2e/compilation/test_data/test_contract_data/test_contract_data.sol new file mode 100644 index 0000000000..a99001da34 --- /dev/null +++ b/tests/e2e/compilation/test_data/test_contract_data/test_contract_data.sol @@ -0,0 +1,5 @@ +contract TestSlither { + function testFunction(uint256 param1, uint256, address param3) public { + + } +} \ No newline at end of file diff --git a/tests/e2e/compilation/test_resolution.py b/tests/e2e/compilation/test_resolution.py index 71edaa143f..af7cbe2c77 100644 --- a/tests/e2e/compilation/test_resolution.py +++ b/tests/e2e/compilation/test_resolution.py @@ -43,3 +43,20 @@ def test_cycle(solc_binary_path) -> None: solc_path = solc_binary_path("0.8.0") slither = Slither(Path(TEST_DATA_DIR, "test_cyclic_import", "a.sol").as_posix(), solc=solc_path) _run_all_detectors(slither) + + +def test_contract_function_parameter(solc_binary_path) -> None: + solc_path = solc_binary_path("0.8.0") + standard_json = SolcStandardJson() + standard_json.add_source_file( + Path(TEST_DATA_DIR, "test_contract_data", "test_contract_data.sol").as_posix() + ) + compilation = CryticCompile(standard_json, solc=solc_path) + slither = Slither(compilation) + contract = slither.contracts[0] + function = contract.functions[0] + parameters = function.parameters + + assert (parameters[0].name == 'param1') + assert (parameters[1].name == '') + assert (parameters[2].name == 'param3')