Skip to content

transpile: Allow macro conversion to succeed only for some expansions#1806

Open
Rua wants to merge 7 commits into
immunant:masterfrom
Rua:macro-call-per-expr
Open

transpile: Allow macro conversion to succeed only for some expansions#1806
Rua wants to merge 7 commits into
immunant:masterfrom
Rua:macro-call-per-expr

Conversation

@Rua
Copy link
Copy Markdown
Contributor

@Rua Rua commented May 14, 2026

If there is ever a failure to convert one of the expansion sites of a macro, or it fails to fold into a single common type, then the entire macro is discarded and left in its expanded form. This PR adds a fallback mechanism: if the conversion succeeds for some of the expansion sites, then those will be converted to use the macro, and only the ones that failed will be left expanded.

The expr_results value stores all the errors of the conversion attempts for each expansion site. Currently, the Ok variant is just empty, but this is planned to hold information about functional macro arguments in the future.

@Rua Rua force-pushed the macro-call-per-expr branch from 7ad929f to 7abe5ab Compare May 15, 2026 09:29
@Rua Rua force-pushed the macro-call-per-expr branch from 7abe5ab to ec60c42 Compare May 15, 2026 09:34
@Rua Rua force-pushed the macro-call-per-expr branch from ec60c42 to fe546cc Compare May 15, 2026 11:45
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