Skip to content

fix(compiler): preserve literal variable reference text - #97

Open
BichengWang wants to merge 1 commit into
salesforce:mainfrom
BichengWang:fix-literal-variable-text
Open

BichengWang wants to merge 1 commit into
salesforce:mainfrom
BichengWang:fix-literal-variable-text

Conversation

@BichengWang

Copy link
Copy Markdown
Contributor

What

Preserve literal @variables text when compiling expressions.

Why

Fixes #96. For example, @variables.x == "@variables.x" currently compiles to state.x == "state.x", changing the comparison. Literal text can also trigger an unknown-variable warning.

How

Remove the final regex replacement over serialized expressions. Reference AST nodes already resolve recursively, including inside function arguments. Add five regression cases covering parsed literals, comparisons, mixed literal/reference arguments, escaped quotes, and template text alongside real references.

Test Plan

All five new cases failed before the fix and pass afterward.

  • Existing tests pass (pnpm exec turbo run test --force: 24/24 tasks; compiler: 1,118 passed, 3 skipped)
  • New/updated tests cover the change
  • Linting and type checks pass (pnpm exec turbo run lint --force and pnpm exec turbo run typecheck --force; lint reports 12 existing UI warnings)
  • pnpm format:check, changed-file ESLint, and the server path traversal regression suite pass

Checklist

  • My code follows the project's coding style
  • I have reviewed my own diff
  • I have added/updated documentation as needed (no documentation change needed)
  • This change does not introduce new warnings

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Compiler rewrites literal @variables text in expressions

1 participant