Skip to content

feat(slang): complete modules and free functions - #654

Merged
hedgar2017 merged 4 commits into
main-slangfrom
az-slang-modules
Aug 21, 2026
Merged

feat(slang): complete modules and free functions#654
hedgar2017 merged 4 commits into
main-slangfrom
az-slang-modules

Conversation

@hedgar2017

@hedgar2017 hedgar2017 commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Completes module member access: a parenthesized or conditional form over import aliases is never materialized. It is evaluated for effect, and its members resolve by name. Alias chains, renames, star imports, and free functions in pointer, operator, and using-for positions are pinned by fixtures.

  • A qualifier evaluates for effect only when it denotes a module, when an enum member reads through it, or when an external library call dispatches through it. Contract, interface, library, and value-type names resolve statically and emit nothing, matching legacy in every probed position.
  • An external library callee evaluates its qualifier before the arguments. A module-qualified function callee is a pointer call, so its qualifier evaluates after them, in legacy order.
  • A discarded bare name of a struct, error, or event emits nothing instead of crashing, completing the no-op set over every name-denoting definition kind.
  • The slang dependency bump unifies module meta-types across aliases of one source unit, so a conditional over two aliases of the same module compiles.
  • The qualifier semantics are pinned by executable suites in tests/solidity/complex, with every expected value verified against legacy execution, and lit tests compile the same sources to pin their emission.

cargo run-tester-slang: 10323 → 10375 passed.

@hedgar2017 hedgar2017 changed the title feat(slang): modules feat(slang): complete modules and free functions emission Aug 16, 2026
@hedgar2017
hedgar2017 force-pushed the az-slang-modules branch 4 times, most recently from f327bf5 to 3e06782 Compare August 16, 2026 17:16
@hedgar2017
hedgar2017 requested review from a team, abinavpp and ggiraldez and a balanced review from Copilot and removed request for Copilot and ggiraldez August 16, 2026 17:27

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Extends Slang lowering for module-qualified members and reachable free functions.

Changes:

  • Evaluates namespace qualifiers for side effects while resolving members by name.
  • Supports module-qualified calls, aliases, libraries, and user-defined value types.
  • Adds MLIR fixtures for module access and free-function emission paths.

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
solx-slang/src/contract/function/expression/mod.rs Handles module-typed expression effects.
solx-slang/src/contract/function/expression/member.rs Resolves namespace members after qualifier effects.
solx-slang/src/contract/function/expression/call/mod.rs Classifies and evaluates namespace-qualified callees.
solx-mlir/tests/lit/module_values.sol Tests effectful module-qualified expressions and calls.
solx-mlir/tests/lit/module_members.sol Tests chained, renamed, and star imports.
solx-mlir/tests/lit/free_function_using_for.sol Tests using-for free functions.
solx-mlir/tests/lit/free_function_shadowing.sol Tests free-function shadowing.
solx-mlir/tests/lit/free_function_pointer.sol Tests free-function pointers.
solx-mlir/tests/lit/free_function_operator_reached.sol Tests operator-reachable free functions.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread solx-slang/src/contract/function/expression/member.rs Outdated
Comment thread solx-mlir/tests/lit/free_function_pointer.sol
@hedgar2017 hedgar2017 changed the title feat(slang): complete modules and free functions emission feat(slang): complete modules and free functions Aug 16, 2026
@hedgar2017 hedgar2017 self-assigned this Aug 16, 2026
@hedgar2017
hedgar2017 force-pushed the az-slang-modules branch 4 times, most recently from 06af1a7 to caa1472 Compare August 16, 2026 20:58
@hedgar2017
hedgar2017 requested a balanced review from Copilot August 16, 2026 21:05

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 25 out of 27 changed files in this pull request and generated 1 comment.

Comment thread solx-slang/src/contract/function/expression/call/mod.rs Outdated
@hedgar2017
hedgar2017 force-pushed the az-slang-immutables branch from d2d9603 to d8a94dd Compare August 18, 2026 09:50
@hedgar2017
hedgar2017 force-pushed the az-slang-modules branch 2 times, most recently from 5fba828 to 08c4735 Compare August 18, 2026 10:29
@hedgar2017
hedgar2017 force-pushed the az-slang-immutables branch from d8a94dd to 62bd660 Compare August 18, 2026 11:17
@hedgar2017
hedgar2017 force-pushed the az-slang-immutables branch 2 times, most recently from 89b4598 to 8670e42 Compare August 20, 2026 11:22
Comment thread solx-slang/src/contract/function/expression/call/mod.rs Outdated

@PavelKopyl PavelKopyl 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.

LGTM, thanks!

Base automatically changed from az-slang-immutables to main-slang August 20, 2026 16:24
@github-actions

github-actions Bot commented Aug 20, 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 🔴 25.5% 🔴 13.5%
solx-compiler-downloader 🔴 0.0% 🔴 0.0%
solx-core 🔴 38.6% 🔴 47.4%
solx-dev 🔴 2.4% 🔴 3.0%
solx-evm-assembly 🔴 0.0% 🔴 0.0%
solx-mlir 🟡 59.2% 🟡 55.1%
solx-slang 🔴 23.6% 🔴 34.2%
solx-solc-test-adapter 🔴 1.7% 🔴 2.1%
solx-standard-json 🔴 42.8% 🔴 47.7%
solx-tester 🔴 36.5% 🔴 34.3%
solx-utils 🔴 29.3% 🔴 32.9%
solx-yul 🔴 0.0% 🔴 0.0%
Total 🔴 11.0% 🔴 13.2%

Codecov Report | HTML Report | Workflow Run

@hedgar2017
hedgar2017 enabled auto-merge August 20, 2026 22:23
@hedgar2017
hedgar2017 added this pull request to the merge queue Aug 20, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 21, 2026
@hedgar2017
hedgar2017 added this pull request to the merge queue Aug 21, 2026
Merged via the queue into main-slang with commit 83d1c18 Aug 21, 2026
44 checks passed
@hedgar2017
hedgar2017 deleted the az-slang-modules branch August 21, 2026 09:07
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.

3 participants