refactor(slang): replace mlir_function_name with compute_canonical_signature()#356
Draft
hedgar2017 wants to merge 1 commit into
Draft
refactor(slang): replace mlir_function_name with compute_canonical_signature()#356hedgar2017 wants to merge 1 commit into
mlir_function_name with compute_canonical_signature()#356hedgar2017 wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
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 withFunctionDefinition::compute_canonical_signature(). - Remove local AST/ABI-based type-to-text helpers previously used to build MLIR symbol names.
- Bump the
slang_soliditygit revision and updateCargo.lockdependency 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"); |
…gnature Delete mlir_function_name, type_name_text, and elementary_type_text. Use slang's compute_canonical_signature() directly at all call sites.
e0def49 to
7f36bd9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Delete
mlir_function_name,type_name_text, andelementary_type_text(~60 lines). Use slang'scompute_canonical_signature()directly at all call sites.Blocked on upstream: slang's
compute_canonical_signature()currently returnsNonefor 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)