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 {
674
674
675
675
// Successful regex match.
676
676
guard let fullMatch = matchInfo. first else {
677
- fatalError ( " Didn't get any matches! " )
677
+ return nil
678
678
}
679
679
680
680
// If this defines any variables, remember their values.
@@ -1014,7 +1014,13 @@ private struct CheckString {
1014
1014
// Match itself from the last position after matching CHECK-DAG.
1015
1015
let matchBuffer = buffer. substring ( from: buffer. index ( buffer. startIndex, offsetBy: lastPos) )
1016
1016
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
+ }
1018
1024
return nil
1019
1025
}
1020
1026
You can’t perform that action at this time.
0 commit comments