Skip to content
Snippets Groups Projects
Commit 033c0b03 authored by hansen's avatar hansen
Browse files

Fixed type restriction bug

parent 2a4bbd9d
No related branches found
No related tags found
No related merge requests found
...@@ -196,6 +196,7 @@ public class TypeRestrictor extends DepthFirstAdapter { ...@@ -196,6 +196,7 @@ public class TypeRestrictor extends DepthFirstAdapter {
private void analysePredicate(Node n, HashSet<Node> list, private void analysePredicate(Node n, HashSet<Node> list,
HashSet<Node> ignoreList) { HashSet<Node> ignoreList) {
if (removedNodes.contains(n)) if (removedNodes.contains(n))
return; return;
...@@ -227,23 +228,23 @@ public class TypeRestrictor extends DepthFirstAdapter { ...@@ -227,23 +228,23 @@ public class TypeRestrictor extends DepthFirstAdapter {
putRestrictedType(r_right, new ASetExtensionExpression(element)); putRestrictedType(r_right, new ASetExtensionExpression(element));
removedNodes.add(n); removedNodes.add(n);
} }
if (left instanceof ACoupleExpression) { // detecting couples, e.g. (a,b) = (1,3)
ACoupleExpression couple = (ACoupleExpression) left; // if (left instanceof ACoupleExpression) {
PExpression first = couple.getList().get(0); // ACoupleExpression couple = (ACoupleExpression) left;
Node r_first = machineContext.getReferenceNode(first); // PExpression first = couple.getList().get(0);
PExpression second = couple.getList().get(0); // Node r_first = machineContext.getReferenceNode(first);
Node r_second = machineContext.getReferenceNode(second); // PExpression second = couple.getList().get(0);
// Node r_second = machineContext.getReferenceNode(second);
if (list.contains(r_first) && list.contains(r_second) //
&& isAConstantExpression(right, list, ignoreList)) { // if (list.contains(r_first) && list.contains(r_second)
ArrayList<PExpression> element = new ArrayList<PExpression>(); // && isAConstantExpression(right, list, ignoreList)) {
element.add(right); // ArrayList<PExpression> element = new ArrayList<PExpression>();
putRestrictedTypeOfTuple(r_right, // element.add(right);
new ASetExtensionExpression(element)); // putRestrictedTypeOfTuple(r_right,
removedNodes.add(n); // new ASetExtensionExpression(element));
} // removedNodes.add(n);
// }
} // }
return; return;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment