diff --git a/src/org/rascalmpl/library/analysis/diff/edits/HiFiTreeDiff.rsc b/src/org/rascalmpl/library/analysis/diff/edits/HiFiTreeDiff.rsc index 742326421e..3697180ef0 100644 --- a/src/org/rascalmpl/library/analysis/diff/edits/HiFiTreeDiff.rsc +++ b/src/org/rascalmpl/library/analysis/diff/edits/HiFiTreeDiff.rsc @@ -224,7 +224,7 @@ list[TextEdit] treeDiff( default list[TextEdit] treeDiff( t:appl(Production p:prod(_,_,_), list[Tree] _), r:appl(Production q:!p , list[Tree] _)) - = [replace(t@\loc, learnIndentation(t@\loc, "", ""))]; + = [replace(t@\loc, learnIndentation(t@\loc, "", ""))] when bprintln(t); // If list production are the same, then the element lists can still be of different length // and we switch to listDiff which has different heuristics than normal trees. @@ -235,7 +235,7 @@ list[TextEdit] treeDiff( // When the productions are equal, but the children may be different, we dig deeper for differences default list[TextEdit] treeDiff(appl(Production p, list[Tree] argsA), appl(p, list[Tree] argsB)) - = [*treeDiff(a, b) | <- zip2(argsA, argsB)]; + = [*treeDiff(a, b) | <- zip2(argsA, argsB)] when bprintln("into

on both sides"); @synopsis{decide how many separators we have} int seps(\iter-seps(_,list[Symbol] s)) = size(s); diff --git a/src/org/rascalmpl/library/lang/rascal/tests/library/analysis/diff/edits/HiFiTreeDiffTests.rsc b/src/org/rascalmpl/library/lang/rascal/tests/library/analysis/diff/edits/HiFiTreeDiffTests.rsc index 07475915d7..0c7dd7c826 100644 --- a/src/org/rascalmpl/library/lang/rascal/tests/library/analysis/diff/edits/HiFiTreeDiffTests.rsc +++ b/src/org/rascalmpl/library/lang/rascal/tests/library/analysis/diff/edits/HiFiTreeDiffTests.rsc @@ -72,6 +72,10 @@ start[Program] swapAB(start[Program] p) = visit(p) { case (Id) `b` => (Id) `a` }; +start[Program] naturalToString(start[Program] p) = visit(p) { + case (Type) `natural` => (Type) `string` +}; + start[Program] addDeclarationToEnd(start[Program] p) = visit(p) { case (Program) `begin declare <{IdType ","}* decls>; <{Statement ";"}* body> end` => (Program) `begin @@ -116,3 +120,6 @@ test bool addDeclarationToStartAndSwapABTest() test bool addDeclarationToStartAndEndAndSwapABTest() = editsAreSyntacticallyCorrect(#start[Program], simpleExample, addDeclarationToStart o addDeclarationToEnd o swapAB); + +test bool naturalToStringTest() + = editsAreSyntacticallyCorrect(#start[Program], simpleExample, naturalToString);