diff --git a/compiler/mono/src/ir.rs b/compiler/mono/src/ir.rs index d937033115..3addb67f74 100644 --- a/compiler/mono/src/ir.rs +++ b/compiler/mono/src/ir.rs @@ -1351,7 +1351,7 @@ impl<'a> Expr<'a> { RuntimeErrorFunction(s) => alloc.text(format!("ErrorFunction {}", s)), GetTagId { structure, .. } => alloc - .text("GetTagId") + .text("GetTagId ") .append(symbol_to_doc(alloc, *structure)), } } @@ -7755,7 +7755,7 @@ fn match_on_lambda_set<'a>( hole: &'a Stmt<'a>, ) -> Stmt<'a> { match lambda_set.runtime_representation() { - Layout::Union(_) => { + Layout::Union(union_layout) => { let closure_tag_id_symbol = env.unique_symbol(); let result = union_lambda_set_to_switch( @@ -7773,11 +7773,9 @@ fn match_on_lambda_set<'a>( ); // extract & assign the closure_tag_id_symbol - let expr = Expr::AccessAtIndex { - index: 0, - field_layouts: env.arena.alloc([Layout::Builtin(Builtin::Int64)]), + let expr = Expr::GetTagId { structure: closure_data_symbol, - wrapped: Wrapped::MultiTagUnion, + union_layout, }; Stmt::Let( diff --git a/compiler/test_mono/generated/specialize_lowlevel.txt b/compiler/test_mono/generated/specialize_lowlevel.txt index 8b7fd1f420..6f36920266 100644 --- a/compiler/test_mono/generated/specialize_lowlevel.txt +++ b/compiler/test_mono/generated/specialize_lowlevel.txt @@ -21,7 +21,7 @@ procedure Test.0 (): let Test.5 = 2i64; let Test.12 = 42i64; joinpoint Test.19 Test.13: - let Test.14 = Index 0 Test.13; + let Test.14 = GetTagId Test.13; joinpoint Test.15 Test.11: ret Test.11; in