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

No matching continuation if a type filter failed #160

Open
quasilyte opened this issue Dec 26, 2020 · 0 comments
Open

No matching continuation if a type filter failed #160

quasilyte opened this issue Dec 26, 2020 · 0 comments

Comments

@quasilyte
Copy link
Owner

quasilyte commented Dec 26, 2020

This rule might look like it finds all f() calls that contain at least 1 error-typed argument.

m.Match(`f($*_, $err, $*_)`).
	Where(m["err"].Type.Is(`error`)).
	Report(`f() has error arg`)

It doesn't behave this way as gogrep may bind $err to something that is not error, especially if there is more than 1 argument in f() call.

It's not obvious how to fix this, but it should be fixed.

How it could be solved (in theory):

  • If filters were a part of the gogrep matcher, it could use them to reject matches that do not satisfy the filters.
  • TODO: any other ideas?
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

No branches or pull requests

1 participant