Skip to content

Commit

Permalink
increase score points for equality in needleman-wunsch, fixes scala#8980
Browse files Browse the repository at this point in the history


  * increasing the score fixes a subtle coloring issue where a closing
    square bracket would erroneously classified as deleted instead of
    matching.
  • Loading branch information
rethab committed May 16, 2020
1 parent 80943ee commit 5c75d47
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/util/DiffUtil.scala
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ object DiffUtil {
}

private def needlemanWunsch(x: Array[String], y: Array[String], builder: mutable.ArrayBuilder[Patch]): Unit = {
def similarity(a: String, b: String) = if (a == b) 2 else -1
def similarity(a: String, b: String) = if (a == b) 3 else -1
val d = 1
val score = Array.tabulate(x.length + 1, y.length + 1) { (i, j) =>
if (i == 0) d * j
Expand Down

0 comments on commit 5c75d47

Please sign in to comment.