-
Notifications
You must be signed in to change notification settings - Fork 570
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
"new" keyword in C# throws error #10205
Comments
Reduced the test. The issue seems to be language-agnostic.
This rule causes the error:
|
The root cause of the error is due to the way we match metavariables inside quotes. Metavariables in quotes are handled differently than those not in quotes. When they are enclosed in strings, you should use The reason why the error is thrown only after you added the |
The error aside, I looked into why the rule without the Based on our current implementation, functions don't match constructors. Without the We have decided that it is better to keep the distinction between functions and constructors whenever we can disambiguate the two, as constructors are hard to deal with when certain languages have numerous ways of constructing objects. It seems like your workaround works fine so I will close this issue with this comment. |
semgrep version
v1.70.0
test code:
Adding the word "new" in the above rule causes the following error:
My workaround is to replace the above metavariable-pattern with an equivalent metavariable-regex.
What is the priority of the bug to you?
Environment
Semgrep playground
The text was updated successfully, but these errors were encountered: