Skip to content

Do not create invalid public types in MergeSimilarFunctions - #9126

Open
tlively wants to merge 1 commit into
mainfrom
merge-similar-functions-open-public-fix
Open

tlively wants to merge 1 commit into
mainfrom
merge-similar-functions-open-public-fix

Conversation

@tlively

@tlively tlively commented Sep 20, 2026

Copy link
Copy Markdown
Member

When similar functions differ only in the targets of their respective Call expressions, MergeSimilarFunctions can merge the functions and pass the correct call target in as a function reference. If the call targets were not previously referenced, they might previously have had private types. In an open world where func is exposed on the boundary, this transformation will make the private types public. Since public types can have stricter validation rules than private types (e.g. public types may not contain exact references when custom descriptors are disallowed), this could previously create invalid public types. Fix the bug by adding a check that the call target has a valid public type before doing the optimization.

When similar functions differ only in the targets of their respective Call expressions, MergeSimilarFunctions can merge the functions and pass the correct call target in as a function reference. If the call targets were not previously referenced, they might previously have had private types. In an open world where `func` is exposed on the boundary, this transformation will make the private types public. Since public types can have stricter validation rules than private types (e.g. public types may not contain exact references when custom descriptors are disallowed), this could previously create invalid public types. Fix the bug by adding a check that the call target has a valid public type before doing the optimization.
@tlively
tlively requested a review from a team as a code owner September 20, 2026 22:21
@tlively
tlively requested review from kripken and removed request for a team September 20, 2026 22:21
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