diff --git a/compiler/mono/src/ir.rs b/compiler/mono/src/ir.rs index 49d080b7b4..2d4bfc607c 100644 --- a/compiler/mono/src/ir.rs +++ b/compiler/mono/src/ir.rs @@ -5928,6 +5928,13 @@ pub fn from_can<'a>( let _res = roc_unify::unify::unify(env.subs, var, def.expr_var, Mode::EQ); + resolve_abilities_in_specialized_body( + env, + procs, + &def.loc_expr.value, + def.expr_var, + ); + return with_hole( env, def.loc_expr.value, @@ -5959,6 +5966,13 @@ pub fn from_can<'a>( Mode::EQ, ); + resolve_abilities_in_specialized_body( + env, + procs, + &def.loc_expr.value, + def.expr_var, + ); + stmt = with_hole( env, specialized_expr, @@ -6017,6 +6031,13 @@ pub fn from_can<'a>( let outer_symbol = env.unique_symbol(); stmt = store_pattern(env, procs, layout_cache, &mono_pattern, outer_symbol, stmt); + resolve_abilities_in_specialized_body( + env, + procs, + &def.loc_expr.value, + def.expr_var, + ); + // convert the def body, store in outer_symbol with_hole( env, diff --git a/compiler/test_gen/src/gen_abilities.rs b/compiler/test_gen/src/gen_abilities.rs index 5974ddcf04..bd2fa3e852 100644 --- a/compiler/test_gen/src/gen_abilities.rs +++ b/compiler/test_gen/src/gen_abilities.rs @@ -292,9 +292,10 @@ fn decode() { fromBytes = \lst, fmt -> when decodeWith lst decoder fmt is { result, rest } -> - when result is - Ok val -> if List.isEmpty rest then Ok val else Err (Leftover rest) - Err e -> Err e + Result.after result \val -> + if List.isEmpty rest + then Ok val + else Err (Leftover rest) Linear := {} @@ -309,9 +310,8 @@ fn decode() { # impl Decoding for MyU8 decoder = @Decoder \lst, fmt -> - when decodeWith lst u8 fmt is - { result, rest } -> - { result: Result.map result (\n -> @MyU8 n), rest } + { result, rest } = decodeWith lst u8 fmt + { result: Result.map result (\n -> @MyU8 n), rest } myU8 = when fromBytes [ 15 ] (@Linear {}) is