From 6c951376b433e2ea1631027632b2a2b734ae18a0 Mon Sep 17 00:00:00 2001 From: Robert Widmann Date: Mon, 20 Nov 2017 13:05:41 -0500 Subject: [PATCH 1/2] Improve error message for damaged CHECK line --- Sources/FileCheck/CheckString.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/FileCheck/CheckString.swift b/Sources/FileCheck/CheckString.swift index 2c57eb4..ebe19f5 100644 --- a/Sources/FileCheck/CheckString.swift +++ b/Sources/FileCheck/CheckString.swift @@ -329,7 +329,7 @@ private func diagnoseFailedCheck( } else { diagnose(.error, at: loc, - with: prefix + ": could not find '\(pattern.fixedString)' in input", + with: prefix + ": could not find match for CHECK line", options: options ) } From 5ed1849fe22f6c1a8cd2553b80d2a9bb03b42f4f Mon Sep 17 00:00:00 2001 From: Robert Widmann Date: Mon, 20 Nov 2017 13:05:49 -0500 Subject: [PATCH 2/2] Remove dead parameters from edit distance --- Sources/FileCheck/EditDistance.swift | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/Sources/FileCheck/EditDistance.swift b/Sources/FileCheck/EditDistance.swift index c62232e..5fcf0f3 100644 --- a/Sources/FileCheck/EditDistance.swift +++ b/Sources/FileCheck/EditDistance.swift @@ -2,17 +2,11 @@ /// /// - parameter fa: The first sequence to compare. /// - parameter ta: The second sequence to compare. -/// - parameter allowReplacements: Whether to allow element replacements (change one -/// element into another) as a single operation, rather than as two operations -/// (an insertion and a removal). -/// - parameter maxEditDistance: If non-zero, the maximum edit distance that this -/// routine is allowed to compute. If the edit distance will exceed that -/// maximum, returns \c MaxEditDistance+1. /// -/// - returns: the minimum number of element insertions, removals, or (if -/// `allowReplacements` is `true`) replacements needed to transform one of -/// the given sequences into the other. If zero, the sequences are identical. -func editDistance(from fa : Substring, to ta : Substring, allowReplacements : Bool = true, maxEditDistance : Int = 0) -> Int { +/// - returns: the minimum number of element insertions, removals, or +/// replacements needed to transform one of the given sequences into the +/// other. If zero, the sequences are identical. +func editDistance(from fa : Substring, to ta : Substring) -> Int { guard !fa.isEmpty else { return ta.count }