Skip to content

Detected template "X && X". Logical operator has equal expressions #1742

@VladimirPlyashkun

Description

@VladimirPlyashkun

Hi, there is a bug in the ast.cpp:796 file. Conditional block has logical and operator with same operands.

if (lhs_tail->head() && !rhs_tail->head()) return false;
if (!lhs_tail->head() && rhs_tail->head()) return false;
if (lhs_tail->head() && lhs_tail->head()) {   // <--- here:  lhs_tail->head()
    if (!lhs_tail->head()->is_superselector_of(rhs_tail->head())) return false;
}

I suppose, that correct code should look like this:

if (lhs_tail->head() && !rhs_tail->head()) return false;
if (!lhs_tail->head() && rhs_tail->head()) return false;
if (lhs_tail->head() && rhs_tail->head()) {
    if (!lhs_tail->head()->is_superselector_of(rhs_tail->head())) return false;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions