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

improve variadic funcs matching rules #29

Merged
merged 1 commit into from
Mar 20, 2022

Conversation

quasilyte
Copy link
Owner

Introduced a new matcher op: maybeVariadicCallExpr.
Unlike CallExpr, it doesn't unconditionally accept
both variadic and non-variadic calls. Instead, it only
accepts variadic calls if there are more than N arguments.

Take this pattern for example:

f($_, $_, $_, $*_)

Variadic call will be accepted only if there are more than
3 arguments passed to f.

f(a, b, c, 4)     // ok
f(a, b, c, xs...) // ok
f(a, b, xs...)    // NOT ok

Fixes #28

Introduced a new matcher op: maybeVariadicCallExpr.
Unlike CallExpr, it doesn't unconditionally accept
both variadic and non-variadic calls. Instead, it only
accepts variadic calls if there are more than N arguments.

Take this pattern for example:

	f($_, $_, $_, $*_)

Variadic call will be accepted only if there are more than
3 arguments passed to f.

	f(a, b, c, 4)     // ok
	f(a, b, c, xs...) // ok
	f(a, b, xs...)    // NOT ok

Fixes #28
@quasilyte quasilyte merged commit f7f5e21 into master Mar 20, 2022
@quasilyte quasilyte deleted the quasilyte/fix_variadic_func_matching branch March 20, 2022 17:15
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.

Variadic function matching issue
1 participant