You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Whenever a method is overriden, Solang appends an underscore _ to the method name in the generated metadata file.
To Reproduce
After compiling the following file:
abstract contract Base {
function test() public pure virtual returns (uint8) {
return 42;
}
}
contract TestA is Base {
}
contract TestB is Base {
function test() public pure override returns (uint8) {
return 42;
}
}
with Solang (latest release 0.3.3), the generated metadata file for TestA correctly calls the method test ("label": "test").
However, in contract TestB it is called test_ ("label": "test_").
Expected behavior
The metadata name is also test in the metadata for contract TestB.
This is also the behavior of the Solidity compiler (where the method is called test in both cases in the generated metadata).
Hyperledger Solang version
0.3.3
The text was updated successfully, but these errors were encountered:
#1624)
Closes#1623
The basic idea of the algorithm checking whether a function name is
eligible for mangling or not is to mangle the name if that function is
publicly callable but the functions name appears multiple time in the
contract. But this doesn't account for virtual functions also appearing
more than one time in the same contract if they are overridden. With
this PR, we bail early if the function we are checking overrides,
marking only the single one non-overriding implementation as eligible
for mangling. Consequently, functions which override but do not overload
are no longer unnecessarily mangled.
Co-authored-by: Lucas Steuernagel <38472950+LucasSte@users.noreply.github.com>
Describe the bug
Whenever a method is overriden, Solang appends an underscore
_
to the method name in the generated metadata file.To Reproduce
After compiling the following file:
with Solang (latest release 0.3.3), the generated metadata file for
TestA
correctly calls the methodtest
("label": "test"
).However, in contract
TestB
it is calledtest_
("label": "test_"
).Expected behavior
The metadata name is also
test
in the metadata for contractTestB
.This is also the behavior of the Solidity compiler (where the method is called
test
in both cases in the generated metadata).Hyperledger Solang version
0.3.3
The text was updated successfully, but these errors were encountered: