Skip to content

Expand Aliases#184

Merged
rcosta358 merged 3 commits intomainfrom
expand-aliases
Mar 28, 2026
Merged

Expand Aliases#184
rcosta358 merged 3 commits intomainfrom
expand-aliases

Conversation

@rcosta358
Copy link
Copy Markdown
Collaborator

@rcosta358 rcosta358 commented Mar 19, 2026

Closes #160. Adds a new alias expansion pass in the simplification that adds the alias body as an origin of an alias invocation, substituting its parameters with the provided arguments. Works by extracting the aliases from the context and passing them to the simplification logic and reusing the ValDerivationNode to represent alias expansions, which is enough for this purpose and avoids requiring changes to the VS Code extension.

Example

When we invoke the alias Byte(int b) { b >= -128 && b <= 127 }") with Byte(#v_8), we get:

{
  "value": "Byte(#v_8)",
  "origin": {
    "value": "#v_8 >= -128 && #v_8 <= 127"
  }
}

@rcosta358 rcosta358 self-assigned this Mar 19, 2026
@rcosta358 rcosta358 added enhancement New feature or request simplification Related to the simplification of expressions labels Mar 19, 2026
Copy link
Copy Markdown
Collaborator

@CatarinaGamboa CatarinaGamboa left a comment

Choose a reason for hiding this comment

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

Great! As we discussed passing the context can be kinda weird. We can see if we can change the codebase to always use the ctx as a singleton (since it actually is a singleton) instead of as an argument in so many methods

@rcosta358 rcosta358 merged commit 2eb9510 into main Mar 28, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request simplification Related to the simplification of expressions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Alias Expansion

2 participants