From d1f98705b4610adcccbcca82014a620128a39735 Mon Sep 17 00:00:00 2001 From: Jukka Lehtosalo Date: Thu, 29 Jan 2026 15:51:46 +0000 Subject: [PATCH] [mypyc] Internal: use emojis to highlight IR errors in tests --- mypyc/ir/pprint.py | 7 +++++-- mypyc/test/test_ircheck.py | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/mypyc/ir/pprint.py b/mypyc/ir/pprint.py index e0a9e9d63208b..67a71d961f8d5 100644 --- a/mypyc/ir/pprint.py +++ b/mypyc/ir/pprint.py @@ -414,7 +414,7 @@ def format_blocks( lines.append("L%d:%s" % (block.label, handler_msg)) if block in source_to_error: for error in source_to_error[block]: - lines.append(f" ERR: {error}") + lines.append(f" ERROR: {error}") ops = block.ops if ( isinstance(ops[-1], Goto) @@ -429,8 +429,11 @@ def format_blocks( line = " " + op.accept(visitor) lines.append(line) if op in source_to_error: + first = len(lines) - 1 + # Use emojis to highlight the error for error in source_to_error[op]: - lines.append(f" ERR: {error}") + lines.append(f" \U0001f446 ERROR: {error}") + lines[first] = " \U0000274c " + lines[first][4:] if not isinstance(block.ops[-1], (Goto, Branch, Return, Unreachable)): # Each basic block needs to exit somewhere. diff --git a/mypyc/test/test_ircheck.py b/mypyc/test/test_ircheck.py index 7f7063cdc5e60..ac2aab5917824 100644 --- a/mypyc/test/test_ircheck.py +++ b/mypyc/test/test_ircheck.py @@ -178,8 +178,8 @@ def test_pprint(self) -> None: assert formatted == [ "def func_1():", "L0:", - " goto L1", - " ERR: Invalid control operation target: 1", + " \U0000274c goto L1", + " \U0001f446 ERROR: Invalid control operation target: 1", ] def test_load_address_declares_register(self) -> None: