Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

poc: match block/macro pragma args from tail end with flexibleOptionalParams #24555

Draft
wants to merge 3 commits into
base: devel
Choose a base branch
from

Conversation

metagn
Copy link
Collaborator

@metagn metagn commented Dec 20, 2024

Not referencing any issues, just wanted to see if this works

Generalizes the logic from #18631 to all post expr blocks and definitions that support macro pragmas, which considers them "tail args", i.e. matched to the end of the overload params rather than the start, as long as the argument at that position has to be provided (no varargs, void, or params with default values).

Then it's checked that every argument before them is provided or doesn't need to be provided (i.e. varargs, default value) and the match fails if they aren't. This prevents post expr blocks and macro pragmas from needlessly getting typechecked when enough arguments aren't given for their overload. Restricting to post expr blocks and macro pragmas here is because they have a void type at syntax level, so it's not important that they get typechecked early

This solves the issues referenced in #21673 but only for post-expr blocks and macro pragmas.

@metagn metagn changed the title tail args experiment poc: match block/macro pragma args from tail end with flexibleOptionalParams Feb 15, 2025
@metagn
Copy link
Collaborator Author

metagn commented Feb 15, 2025

Need to make RFC as this is an extension to flexibleOptionalParams if we ever want to make it the default (name is misleading), the key difference is that the match fails early if the params up to the tail arg are not provided which stops the untyped params from compiling

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