Skip to content

Commit 73c2430

Browse files
committed
Pass the right variable table to diagnostics
1 parent f106a41 commit 73c2430

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Sources/FileCheck/CheckString.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ struct CheckString {
8080
// Match itself from the last position after matching CHECK-DAG.
8181
let matchBuffer = buffer.substring(from: buffer.index(buffer.startIndex, offsetBy: lastPos))
8282
guard let (range, mutVariableTable) = self.pattern.match(matchBuffer, initialTable) else {
83-
diagnoseFailedCheck(variableTable, options, buffer)
83+
diagnoseFailedCheck(initialTable, options, buffer)
8484
return nil
8585
}
8686
let (matchPos, matchLen) = (range.location, range.length)
@@ -344,7 +344,7 @@ struct CheckString {
344344
)
345345
}
346346
} else {
347-
if let varDef = self.pattern.variableDefs[varName] {
347+
if let varDef = variableTable[varName] {
348348
diagnose(.note,
349349
at: self.loc,
350350
with: "with variable '\(varName)' equal to '\(varDef)'",

Tests/FileCheckTests/DAGSpec.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ class DAGSpec : XCTestCase {
1515
})
1616
}
1717

18-
#if swift(>=4)
1918
func testDAGWithInst() {
2019
XCTAssert(fileCheckOutput(of: .stdout, withPrefixes: ["CHECK-INSTDAG"]) {
2120
// CHECK-INSTDAG-DAG: add [[REG1:r[0-9]+]], r1, r2
@@ -46,6 +45,7 @@ class DAGSpec : XCTestCase {
4645
})
4746
}
4847

48+
#if swift(>=4)
4949
func testDAGXFailWithInst() {
5050
XCTAssertFalse(fileCheckOutput(of: .stdout, withPrefixes: ["INSTDAG-XFAIL1"]) {
5151
// INSTDAG-XFAIL1: __x1

0 commit comments

Comments
 (0)