Skip to content

Api version limit for complex template expressions#5520

Merged
jhefferman-sfdc merged 13 commits intomasterfrom
jhefferman/cte-api-versioning
Sep 29, 2025
Merged

Api version limit for complex template expressions#5520
jhefferman-sfdc merged 13 commits intomasterfrom
jhefferman/cte-api-versioning

Conversation

@jhefferman-sfdc
Copy link
Contributor

Details

Complex template expressions should only be allowed for components that have an API version greater than 260 (60).
If CTEs are used on components with a prior version, a suitable error message should be displayed.

Does this pull request introduce a breaking change?

  • 😮‍💨 No, it does not introduce a breaking change.

Does this pull request introduce an observable change?

  • 🤞 No, it does not introduce an observable change.

GUS work item

W-17386900

@jhefferman-sfdc jhefferman-sfdc requested a review from a team as a code owner September 29, 2025 15:16
const sourceLocation = ast.sourceLocation(location);

return ctx.config.experimentalComplexExpressions
return isComplexTemplateExpressionEnabled(ctx)
Copy link
Contributor Author

@jhefferman-sfdc jhefferman-sfdc Sep 29, 2025

Choose a reason for hiding this comment

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

In contrast to the ctx.config.experimentalComplexExpressions property, isComplexTemplateExpressionEnabled additionally checks that the context api version is sufficient for complex template expressions.

(directive) => directive.name === 'PreserveComments'
)?.value?.value;
const experimentalComplexExpressions = Boolean(options.experimentalComplexExpressions);
const apiVersion = Number(options.apiVersion);
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it not already a number? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It can be undefined (goes to NaN)

Comment on lines 60 to +64
experimentalComplexExpressions,
}: {
entry: string;
dirname: string;
experimentalComplexExpressions: boolean;
experimentalComplexExpressions: boolean | undefined;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
experimentalComplexExpressions: boolean | undefined;
experimentalComplexExpressions = false,
}: {
entry: string;
dirname: string;
experimentalComplexExpressions: boolean;

just cuz

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A default value isn't enough, still considered boolean | undefined and results in a type error. Gonna keep it as-is

if (!isEscaped && isExpression(value)) {
if (isQuoted && !isComplexTemplateExpressionEnabled(ctx)) {
// Don't test for the API version here, just check if CTE is enabled.
// We can provide more specific errors WRT API versions after the expression has been parsed and we know what it is.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// We can provide more specific errors WRT API versions after the expression has been parsed and we know what it is.
// We can provide more specific errors w.r.t API versions after the expression has been parsed and we know what it is.

Otherwise I might think that MRT fell over.

@jhefferman-sfdc jhefferman-sfdc merged commit e9cf8c7 into master Sep 29, 2025
7 checks passed
@jhefferman-sfdc jhefferman-sfdc deleted the jhefferman/cte-api-versioning branch September 29, 2025 19:51
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