Skip to content

Avoid variable collisions when inlining @InlineMe expressions. - #6325

Open
copybara-service[bot] wants to merge 1 commit into
masterfrom
test_1016825728
Open

copybara-service[bot] wants to merge 1 commit into
masterfrom
test_1016825728

Conversation

@copybara-service

Copy link
Copy Markdown
Contributor

Avoid variable collisions when inlining @InlineMe expressions.

Inlining an @InlineMe replacement containing a lambda expression fails to compile (or shadows caller fields) when a lambda parameter has the same name as a variable already in scope at the call site, and flow-scoped pattern variables in replacement expressions can escape into surrounding caller code.

Reject @InlineMe methods whose replacement expressions introduce named pattern variables (NO_PATTERN_VARIABLES), and decline to inline at call sites (Description.NO_MATCH) when a replacement introduces named pattern variables or declares lambda parameters that collide with variables in scope via SuggestedFixes.variableNamer.

Inlining an `@InlineMe` replacement containing a lambda expression fails to compile (or shadows caller fields) when a lambda parameter has the same name as a variable already in scope at the call site, and flow-scoped pattern variables in replacement expressions can escape into surrounding caller code.

Reject `@InlineMe` methods whose replacement expressions introduce named pattern variables (`NO_PATTERN_VARIABLES`), and decline to inline at call sites (`Description.NO_MATCH`) when a replacement introduces named pattern variables or declares lambda parameters that collide with variables in scope via `SuggestedFixes.variableNamer`.

PiperOrigin-RevId: 1016825728

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant