ceylon / ceylon.ast

Apache License 2.0
18 stars 3 forks source link

Equality broken #127

Closed sadmac7000 closed 7 years ago

sadmac7000 commented 7 years ago

These two nodes test as equal when they are different.

import ceylon.ast.core { ... }
BooleanCondition a = BooleanCondition(WithinOperation { 
    operand = BaseExpression(MemberNameWithTypeArguments(LIdentifier("i"))); // LOOK HERE
    lowerBound = ClosedBound(IntegerLiteral("0"));
    upperBound = OpenBound(BaseExpression(MemberNameWithTypeArguments(LIdentifier("length"))));
    });
BooleanCondition b = BooleanCondition(WithinOperation { 
    operand = BaseExpression(MemberNameWithTypeArguments(LIdentifier("j"))); // AND HERE
    lowerBound = ClosedBound(IntegerLiteral("0"));
    upperBound = OpenBound(BaseExpression(MemberNameWithTypeArguments(LIdentifier("length"))));
    });

shared void run() {
    print(a == b);
}
lucaswerkmeister commented 7 years ago

Thanks, fixed. I have no idea how that happened – WithinOperation.equals hasn’t been touched since the node was added in ea64dbbd, which I’m pretty sure was auto-generated code.