File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -674,7 +674,7 @@ private class Pattern {
674674
675675 // Successful regex match.
676676 guard let fullMatch = matchInfo. first else {
677- fatalError ( " Didn't get any matches! " )
677+ return nil
678678 }
679679
680680 // If this defines any variables, remember their values.
@@ -1014,7 +1014,13 @@ private struct CheckString {
10141014 // Match itself from the last position after matching CHECK-DAG.
10151015 let matchBuffer = buffer. substring ( from: buffer. index ( buffer. startIndex, offsetBy: lastPos) )
10161016 guard let ( matchPos, matchLen) = self . pattern. match ( matchBuffer, variableTable) else {
1017- diagnose ( . error, self . loc, self . prefix + " : could not find ' \( self . pattern. fixedString) ' in input " )
1017+ if self . pattern. fixedString. isEmpty {
1018+ diagnose ( . error, self . loc, self . prefix + " : could not find a match for regex ' \( self . pattern. regExPattern) ' in input " )
1019+ } else if self . pattern. regExPattern. isEmpty {
1020+ diagnose ( . error, self . loc, self . prefix + " : could not find ' \( self . pattern. fixedString) ' in input " )
1021+ } else {
1022+ diagnose ( . error, self . loc, self . prefix + " : could not find ' \( self . pattern. fixedString) ' (with regex ' \( self . pattern. regExPattern) ') in input " )
1023+ }
10181024 return nil
10191025 }
10201026
You can’t perform that action at this time.
0 commit comments