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

Bugfix: Do not mangle overridden non-overloaded virtual function names #1624

Merged
merged 4 commits into from
Feb 28, 2024

Conversation

xermicus
Copy link
Contributor

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.

…idden

Signed-off-by: xermicus <cyrill@parity.io>
@xermicus xermicus changed the title Bugfix: Do not mangle overridden virtual function names Bugfix: Do not mangle overridden non-overloaded virtual function names Feb 27, 2024
Signed-off-by: xermicus <cyrill@parity.io>
src/sema/contracts.rs Outdated Show resolved Hide resolved
xermicus and others added 2 commits February 28, 2024 15:03
Co-authored-by: Lucas Steuernagel <38472950+LucasSte@users.noreply.github.com>
Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
Signed-off-by: xermicus <cyrill@parity.io>
Copy link

codecov bot commented Feb 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.57%. Comparing base (5cab937) to head (a9b7e02).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1624      +/-   ##
==========================================
- Coverage   88.58%   88.57%   -0.01%     
==========================================
  Files         150      150              
  Lines       69330    69330              
==========================================
- Hits        61415    61412       -3     
- Misses       7915     7918       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@xermicus
Copy link
Contributor Author

Codecov says -0.01% coverage on the project however the diff hit 100%. I'm gonna merge

@xermicus xermicus merged commit b4728a4 into hyperledger-solang:main Feb 28, 2024
19 of 20 checks passed
@xermicus xermicus deleted the issue-1623 branch February 28, 2024 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect metadata for overridden functions.
3 participants