Skip to content

refactor(slang): replace mlir_function_name with compute_canonical_signature()#356

Draft
hedgar2017 wants to merge 1 commit into
mainfrom
feat-slang-use-type-internal-name
Draft

refactor(slang): replace mlir_function_name with compute_canonical_signature()#356
hedgar2017 wants to merge 1 commit into
mainfrom
feat-slang-use-type-internal-name

Conversation

@hedgar2017
Copy link
Copy Markdown
Contributor

@hedgar2017 hedgar2017 commented Apr 21, 2026

Delete mlir_function_name, type_name_text, and elementary_type_text (~60 lines). Use slang's compute_canonical_signature() directly at all call sites.

Blocked on upstream: slang's compute_canonical_signature() currently returns None for constructors, fallback, and receive functions (they have no name in the AST). NomicFoundation/slang#1712 needs to be updated to derive the name from the function kind for these cases. Until then, the .expect() calls will panic on those function kinds.

Depends on NomicFoundation/slang#1712, in particular NomicFoundation/slang#1712 (comment)

@hedgar2017 hedgar2017 added the ci:slang Trigger slang unit tests on PR label Apr 21, 2026
@hedgar2017 hedgar2017 requested a review from Copilot April 21, 2026 09:28
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors function symbol name generation in the solx-slang lowering pipeline to rely on slang’s compute_canonical_signature() rather than local helpers, and updates the pinned slang revision accordingly.

Changes:

  • Replace FunctionEmitter::mlir_function_name(...) call sites with FunctionDefinition::compute_canonical_signature().
  • Remove local AST/ABI-based type-to-text helpers previously used to build MLIR symbol names.
  • Bump the slang_solidity git revision and update Cargo.lock dependency resolutions.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 3 comments.

File Description
solx-slang/src/ast/contract/mod.rs Switches pre-registration to use slang canonical signatures for MLIR symbol names.
solx-slang/src/ast/contract/function/mod.rs Switches emitted sol.func naming (and abstract/interface handling) to slang canonical signatures; removes old naming helpers.
solx-slang/Cargo.toml Updates pinned slang_solidity git revision.
Cargo.lock Reflects transitive dependency changes from the slang revision bump.

Comment on lines +109 to +111
let mlir_name = function
.compute_canonical_signature()
.expect("canonical signature available for all emitted functions");
Comment on lines +67 to +69
return Ok(function
.compute_canonical_signature()
.expect("canonical signature available for all emitted functions"));
Comment on lines +73 to +75
let mlir_name = function
.compute_canonical_signature()
.expect("canonical signature available for all emitted functions");
Base automatically changed from replace-type-cache-with-fields to main April 21, 2026 18:53
…gnature

Delete mlir_function_name, type_name_text, and elementary_type_text.
Use slang's compute_canonical_signature() directly at all call sites.
@hedgar2017 hedgar2017 force-pushed the feat-slang-use-type-internal-name branch from e0def49 to 7f36bd9 Compare April 26, 2026 03:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:slang Trigger slang unit tests on PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants