You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In certain cases, weggli seems to parse the >= operator incorrectly. While I haven't debugged the code to confirm, I suspect weggli is mistakenly parsing template parameter statements where they don't exist, thus swallowing the > and treating the = as a stand-alone assignment operator.
Consider the following query:
weggli --cpp '{ if (_ = _) { }}'$TARGET
This is meant to detect non-declaration assignments in if statements. This query matches the following snippets, as expected:
voidtest_bad_conditional() {
if (x = 1234) {
}
}
voidtest_bad_conditional() {
if (x =! false) {
}
}
And, as expected, it does not match this snippet:
voidtest_bad_conditional() {
if (auto x = 1234) {
}
}
Something I did not expect, however, is for it to match these snippets (it does):
I've run this query against various large code-bases, and the only false matches contain a < preceding the >, hence my suspicion that weggli is mistakenly parsing a template param. This isn't the only prerequisite, however, as this snippet does not match:
booltest_bad_conditional() {
if (b < 4 || a >= 3) {
returnfalse;
}
returntrue;
}
Making me think that, in addition to the preceding <, the presence of the . or -> (and potentially other) operators on either side is important.
The text was updated successfully, but these errors were encountered:
In certain cases, weggli seems to parse the
>=
operator incorrectly. While I haven't debugged the code to confirm, I suspect weggli is mistakenly parsing template parameter statements where they don't exist, thus swallowing the>
and treating the=
as a stand-alone assignment operator.Consider the following query:
This is meant to detect non-declaration assignments in
if
statements. This query matches the following snippets, as expected:And, as expected, it does not match this snippet:
Something I did not expect, however, is for it to match these snippets (it does):
I've run this query against various large code-bases, and the only false matches contain a
<
preceding the>
, hence my suspicion that weggli is mistakenly parsing a template param. This isn't the only prerequisite, however, as this snippet does not match:Making me think that, in addition to the preceding
<
, the presence of the.
or->
(and potentially other) operators on either side is important.The text was updated successfully, but these errors were encountered: