Skip to content

[Bug]: Copy-paste bugs in DataflowAnalyzer equality check #44571

@marzi3

Description

@marzi3

Description

Found two copy-paste errors in DataflowAnalyzer.java where nodeA is incorrectly used instead of nodeB:

XML_QNAME (Line 1270): BLangXMLQName xmlqNameB = (BLangXMLQName) nodeA;

GROUP_EXPR (Line 1393): BLangGroupExpr groupExprB = (BLangGroupExpr) nodeA;

These cause equality checks for these nodes to erroneously return true. Needs to be updated to use nodeB.

Steps to Reproduce

Open compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/semantics/analyzer/DataflowAnalyzer.java.

Inspect the equality(Node nodeA, Node nodeB) method.

Observe lines 1270 and 1393.

In both the XML_QNAME and GROUP_EXPR cases, the code incorrectly assigns nodeA to the second comparison variable (xmlqNameB and groupExprB), causing the check to always return true regardless of the content of nodeB.

Affected Version(s)

Master branch (latest commit).

OS, DB, other environment details and versions

No response

Related area

-> Compilation

Related issue(s) (optional)

No response

Suggested label(s) (optional)

No response

Suggested assignee(s) (optional)

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions