Skip to content

feat(slang): inheritance - #697

Merged
hedgar2017 merged 6 commits into
mainfrom
az-slang-inheritance
Sep 23, 2026
Merged

hedgar2017 merged 6 commits into
mainfrom
az-slang-inheritance

Conversation

@hedgar2017

@hedgar2017 hedgar2017 commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Lowers contracts with contract bases in the Slang frontend: inherited state and getters, virtual dispatch to the most-derived override, super and contract-qualified calls, and the base-constructor chain with each argument list evaluated at the call to its target. The tester's Slang view follows the compilation API of the revision this pins.

cargo run-tester-slang: 20182 passed, 85 failed, 35 invalid.

@hedgar2017
hedgar2017 force-pushed the az-slang-inheritance branch 2 times, most recently from 7cbb0fa to 586eea6 Compare September 8, 2026 07:23
@github-actions

github-actions Bot commented Sep 8, 2026 •

Copy link
Copy Markdown

Coverage Summary

Crate Line Coverage Function Coverage
solx 🟢 83.6% 🔴 20.0%
solx-benchmark-converter 🔴 0.0% 🔴 0.0%
solx-codegen-evm 🔴 24.7% 🔴 11.5%
solx-compiler-downloader 🔴 0.0% 🔴 0.0%
solx-core 🔴 39.2% 🔴 46.9%
solx-dev 🔴 2.4% 🔴 3.0%
solx-evm-assembly 🔴 0.0% 🔴 0.0%
solx-mlir 🟡 50.3% 🔴 46.3%
solx-slang 🔴 22.6% 🔴 31.0%
solx-solc-test-adapter 🔴 1.7% 🔴 2.1%
solx-standard-json 🔴 42.6% 🔴 47.7%
solx-tester 🔴 36.1% 🔴 34.3%
solx-utils 🔴 32.3% 🔴 35.1%
solx-yul 🔴 0.0% 🔴 0.0%
Total 🔴 10.9% 🔴 13.1%

Codecov Report | HTML Report | Workflow Run

@hedgar2017
hedgar2017 force-pushed the az-slang-inheritance branch 6 times, most recently from 28da541 to 7fb3184 Compare September 9, 2026 22:15
@abinavpp
abinavpp force-pushed the app-slang-inline-assembly branch 2 times, most recently from c237244 to 6d41503 Compare September 16, 2026 13:18
@hedgar2017
hedgar2017 force-pushed the app-slang-inline-assembly branch from 6d41503 to 96cebda Compare September 16, 2026 16:03
@abinavpp
abinavpp force-pushed the app-slang-inline-assembly branch 3 times, most recently from ed6c4df to 31ee803 Compare September 17, 2026 12:29
Base automatically changed from app-slang-inline-assembly to main September 17, 2026 19:59
@hedgar2017
hedgar2017 force-pushed the az-slang-inheritance branch 9 times, most recently from 2629bb2 to 88459fe Compare September 19, 2026 13:46
@hedgar2017 hedgar2017 self-assigned this Sep 19, 2026
@hedgar2017
hedgar2017 marked this pull request as ready for review September 19, 2026 13:47
@hedgar2017
hedgar2017 requested review from a team and a balanced review from Copilot September 19, 2026 13:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Constructor-chain construction introduces a prohibited hierarchy pre-pass and threaded cache.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 1 Medium severity · 1 Low severity

Open (2)

Comment thread solx-slang/src/contract/mod.rs Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Selector dispatch is still precomputed before emission, contrary to the frontend’s required on-demand model.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 1 Medium severity · 1 Low severity

Open (2)
Resolved since last review (2)

Comment thread solx-slang/src/scope/contract.rs Outdated
Comment thread solx-slang/src/contract/constructor.rs Outdated
@hedgar2017
hedgar2017 force-pushed the az-slang-inheritance branch 2 times, most recently from 95dcff6 to 434b7d6 Compare September 21, 2026 08:32
Comment thread solx-slang/src/contract/object.rs Outdated
@abinavpp

Copy link
Copy Markdown
Contributor

thank you for working on this!

This is pre-existing, but what does the Object enum in solx-slang/src/contract/object.rs buy us over slang's own definitions? Object::functions(), state_variables() and storage_layout() are now thin wrappers over linearised_functions(), linearised_state_variables() and compute_abi(), and the library cases are the plain node.functions() / node.state_variables(). If I read functions() right, the extra walk over contracts() is only there to emit in linearisation/declaration order rather than slang's name order

Comment thread solx-slang/src/contract/function/mod.rs Outdated

@abinavpp abinavpp left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you! lgmt! mostly nits/questions. i don't see any major concerns with the lowering..

Comment thread solx-slang/src/contract/function/expression/call/mod.rs Outdated
Comment thread solx-slang/src/contract/constructor.rs

@ggiraldez ggiraldez left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left some minor suggestions and questions, but looks good to me! Can't really evaluate the MLIR part, but I can see Abinav already approved as well.

Comment thread solx-slang/src/contract/function/expression/call/mod.rs
Comment thread solx-slang/src/contract/function/mod.rs Outdated
Comment thread solx-slang/src/contract/constructor.rs
Comment thread solx-slang/src/contract/object.rs
Comment thread solx-slang/src/contract/constructor.rs
Comment thread solx-slang/src/contract/constructor.rs Outdated
Comment thread solx-slang/src/contract/constructor.rs Outdated
@hedgar2017

hedgar2017 commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor Author

This is pre-existing, but what does the Object enum in solx-slang/src/contract/object.rs buy us over slang's own definitions? Object::functions(), state_variables() and storage_layout() are now thin wrappers over linearised_functions(), linearised_state_variables() and compute_abi(), and the library cases are the plain node.functions() / node.state_variables(). If I read functions() right, the extra walk over contracts() is only there to emit in linearisation/declaration order rather than slang's name order

@abinavpp I'd keep Object, it provides a nice abstraction over matches that would have to be inlined otherwise, since ContractDefinition and LibraryDefinition are different types.
On the order, however, it makes sense to emit in Slang order and I've confirmed it doesn't affect behavior. We've just had a lot of LIT pinned against solc that would have to be changed.

Let me create an issue for a follow-up. I'd address it after solc removal: #726

@hedgar2017
hedgar2017 added this pull request to the merge queue Sep 23, 2026
Merged via the queue into main with commit b2465c8 Sep 23, 2026
44 checks passed
@hedgar2017
hedgar2017 deleted the az-slang-inheritance branch September 23, 2026 21:05
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.

4 participants