Skip to content

Commit 2b30157

Browse files
authored
Use GlobalReplace for replacing unexpected insts with a regex (#6401)
Replace all unexpected instruction ids in a line, not just the first one. Otherwise you get something like this: ``` // CHECK:STDOUT: impl @<null name>: <unexpected>.inst{{[0-9A-F]+}}.loc20_6 as <unexpected>.inst6000002E.loc20_11; ```
1 parent 6b1ef75 commit 2b30157

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

toolchain/check/testdata/impl/error_recovery.carbon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,5 +288,5 @@ impl C as I {
288288
// CHECK:STDOUT: constants {
289289
// CHECK:STDOUT: }
290290
// CHECK:STDOUT:
291-
// CHECK:STDOUT: impl @<null name>: <unexpected>.inst{{[0-9A-F]+}}.loc9_6 as <unexpected>.inst5800002D.loc9_11;
291+
// CHECK:STDOUT: impl @<null name>: <unexpected>.inst{{[0-9A-F]+}}.loc9_6 as <unexpected>.inst{{[0-9A-F]+}}.loc9_11;
292292
// CHECK:STDOUT:

toolchain/testing/file_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ auto ToolchainFileTest::DoExtraCheckReplacements(std::string& check_line) const
329329
// instruction edits including adding/removing singleton instructions.
330330
static RE2 inst_re(
331331
R"(((?:import_ref [^,]*, |<unexpected>\.)inst)[0-9A-F]+)");
332-
RE2::Replace(&check_line, inst_re, R"(\1{{[0-9A-F]+}})");
332+
RE2::GlobalReplace(&check_line, inst_re, R"(\1{{[0-9A-F]+}})");
333333

334334
// Reduce location sensitivity in imports referring to `Core`; this is
335335
// brittle for small edits, including comment changes.

0 commit comments

Comments
 (0)