Skip to content

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

Open
hedgar2017 wants to merge 1 commit into
az-slang-immutablesfrom
az-slang-modules
Open

feat(slang): complete modules and free functions#654
hedgar2017 wants to merge 1 commit into
az-slang-immutablesfrom
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
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 3 times, most recently from 7d0acd3 to 06af1a7 Compare August 16, 2026 20:28

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 on lines +315 to 323
if let Some(Type::UserMetaType(meta)) = access.operand().get_type()
&& let Definition::Contract(_) | Definition::Import(_) = meta.definition()
&& let Some(Type::Function(function_type)) = access.get_type()
{
return Self::FunctionPointer(
Expression::MemberAccessExpression(access),
function_type,
);
}
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.

2 participants