mirror of
https://github.com/github/semantic.git
synced 2024-12-25 16:02:43 +03:00
Correct the equality test over terms.
This commit is contained in:
parent
95596ba60c
commit
128132ac26
@ -156,7 +156,7 @@ func refineLeafReplacement(aString: String, _ bString: String)(_ patch: Patch<Te
|
|||||||
case let .Replace(.Unroll(aExtract, .Leaf), .Unroll(bExtract, .Leaf)):
|
case let .Replace(.Unroll(aExtract, .Leaf), .Unroll(bExtract, .Leaf)):
|
||||||
let a = aString.utf16[aExtract.range].enumerate().map { Term(Info(range: (aExtract.range.startIndex + $0).range, categories: aExtract.categories), .Leaf(String($1))) }
|
let a = aString.utf16[aExtract.range].enumerate().map { Term(Info(range: (aExtract.range.startIndex + $0).range, categories: aExtract.categories), .Leaf(String($1))) }
|
||||||
let b = bString.utf16[bExtract.range].enumerate().map { Term(Info(range: (bExtract.range.startIndex + $0).range, categories: bExtract.categories), .Leaf(String($1))) }
|
let b = bString.utf16[bExtract.range].enumerate().map { Term(Info(range: (bExtract.range.startIndex + $0).range, categories: bExtract.categories), .Leaf(String($1))) }
|
||||||
return .Roll((aExtract, bExtract), .Indexed(SES(a, b, cost: Diff.sum(Patch.sum), recur: { $0 == $1 ? Term.zip($0, $1).map(Diff.init) : Diff.Replace($0, $1) })))
|
return .Roll((aExtract, bExtract), .Indexed(SES(a, b, cost: Diff.sum(Patch.sum), recur: { Term.equals(annotation: const(true), leaf: ==)($0, $1) ? Term.zip($0, $1).map(Diff.init) : Diff.Replace($0, $1) })))
|
||||||
default:
|
default:
|
||||||
return .Pure(patch)
|
return .Pure(patch)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user