From 692309ebd72b4dbc04536f059aa57d75ac397abf Mon Sep 17 00:00:00 2001
From: Micha Reiser <micha@reiser.io>
Date: Tue, 25 Jun 2024 08:34:35 +0200
Subject: [PATCH] [red-knot] Fix tests in release builds (#12022)

---
 crates/red_knot/src/semantic.rs | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/crates/red_knot/src/semantic.rs b/crates/red_knot/src/semantic.rs
index 706d427b1843c..0af2f9beefe10 100644
--- a/crates/red_knot/src/semantic.rs
+++ b/crates/red_knot/src/semantic.rs
@@ -271,17 +271,16 @@ impl SourceOrderVisitor<'_> for SemanticIndexer {
         let node_key = NodeKey::from_node(expr.into());
         let expression_id = self.expressions_by_id.push(node_key);
 
-        debug_assert_eq!(
-            expression_id,
-            self.flow_graph_builder
-                .record_expr(self.current_flow_node())
-        );
+        let flow_expression_id = self
+            .flow_graph_builder
+            .record_expr(self.current_flow_node());
+        debug_assert_eq!(expression_id, flow_expression_id);
 
-        debug_assert_eq!(
-            expression_id,
-            self.symbol_table_builder
-                .record_expression(self.cur_scope())
-        );
+        let symbol_expression_id = self
+            .symbol_table_builder
+            .record_expression(self.cur_scope());
+
+        debug_assert_eq!(expression_id, symbol_expression_id);
 
         self.expressions.insert(node_key, expression_id);
 
