Skip to content
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

Fixed bug where cycles where always considered unequal #2096

Merged
merged 1 commit into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,15 @@
return bool(true, ctx);
}

if (TreeAdapter.isCycle(left) && TreeAdapter.isCycle(right)) {
IConstructor type1 = TreeAdapter.getCycleType(left);
IConstructor type2 = TreeAdapter.getCycleType(right);
int length1 = TreeAdapter.getCycleLength(left);
int length2 = TreeAdapter.getCycleLength(right);

Check warning on line 254 in src/org/rascalmpl/interpreter/result/ConcreteSyntaxResult.java

View check run for this annotation

Codecov / codecov/patch

src/org/rascalmpl/interpreter/result/ConcreteSyntaxResult.java#L251-L254

Added lines #L251 - L254 were not covered by tests

return bool(type1.equals(type2) && length1 == length2, ctx);
}

return bool(false, ctx);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module lang::rascal::tests::concrete::ParseTreeEquality

import ParseTree;

bool testCycleEquality() {
Tree cycle1 = cycle(sort("X"), 3);
Tree cycle2 = cycle(sort("X"), 3);

return cycle1 == cycle2;
}
Loading