Repository: gleam-lang/gleam (rust)

Issue:
Invalid Erlang generated for pipe expression in bit array size segment
This Gleam code that uses a pipe in a `size` bit array segment:

```gleam
pub fn main() {
  <<<<0xAE>>:bits-size(5 |> identity)>>
}

fn identity(x) {
  x
}
```

Produces this error output from `gleam build` on Gleam 1.6.2:

```
  Compiling bit_array_test
/Users/richardviney/Code/bit_array_test/src/bit_array_test.gleam:8:39: syntax error before: ','
/Users/richardviney/Code/bit_array_test/build/dev/erlang/bit_array_test/_gleam_artefacts/bit_array_test.erl:4:2: function main/0 undefined
%    4| -export([main/0]).
%     |  ^

/Users/richardviney/Code/bit_array_test/src/bit_array_test.gleam:6:2: spec for undefined function main/0
%    6|   <<<<0xAE>>:bits-size(5 |> identity)>>
%     |  ^

error: Shell command failure

There was a problem when running the shell command `escript`.
```

The generated Erlang code is here: [bit_array_test.erl.txt](https://github.com/user-attachments/files/17985959/bit_array_test.erl.txt)

---

I'm uncertain whether pipes in bit array segments are meant to work, but blocks and case expressions work so pipes probably should too.

Pull request:
Fix pipe in size option on erlang
Fixes #3944

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3434122f3..4e8f60f14 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -164,7 +164,7 @@
 
   This expression computes a value without any side effects, but then the
   value isn't used at all. You might way to assign it to a variable, or
-  delete the expression entirely if it not needed.
+  delete the expression entirely if it's not needed.
   ```
 
   ([Surya Rose](https://github.com/GearsDatapacks))
@@ -365,3 +365,7 @@
 - Fixed a bug where the compiler would crash when type-checking code containing
   an assignment pattern inside a bit-array pattern.
   ([Surya Rose](https://github.com/GearsDatapacks))
+
+- Fixed a bug where a using the pipe operator in the `size` option of a bit array
+  segment would generate invalid code on the Erlang target.
+  ([Surya Rose](https://github.com/GearsDatapacks))
diff --git a/compiler-core/src/erlang.rs b/compiler-core/src/erlang.rs
index 8f11f38ed..5cd76d1e6 100644
--- a/compiler-core/src/erlang.rs
+++ b/compiler-core/src/erlang.rs
@@ -933,7 +933,7 @@ fn expr_segment<'a>(
         }
 
         _ => {
-            let inner_expr = expr(expression, env).surround("(", ")");
+            let inner_expr = maybe_block_expr(expression, env).surround("(", ")");
             // The value of size must be a non-negative integer, we use lists:max here to ensure
             // it is at least 0;
             let value_guard = ":(lists:max(["
diff --git a/compiler-core/src/warning.rs b/compiler-core/src/warning.rs
index 2e35744b5..51e73094f 100644
--- a/compiler-core/src/warning.rs
+++ b/compiler-core/src/warning.rs
@@ -909,7 +909,7 @@ can already tell which branch is going to match with this value.",
                     text: wrap(
                         "This expression computes a value without any side \
 effects, but then the value isn't used at all. You might way to assign it to a \
-variable, or delete the expression entirely if it not needed.",
+variable, or delete the expression entirely if it's not needed.",
                     ),
                     hint: None,
                     level: diagnostic::Level::Warning,


Test patch:
diff --git a/compiler-core/src/erlang/tests/bit_arrays.rs b/compiler-core/src/erlang/tests/bit_arrays.rs
index 048a8d5a0..12eee7847 100644
--- a/compiler-core/src/erlang/tests/bit_arrays.rs
+++ b/compiler-core/src/erlang/tests/bit_arrays.rs
@@ -204,3 +204,19 @@ pub fn main() {
 }"#
     );
 }
+
+// https://github.com/gleam-lang/gleam/issues/3944
+#[test]
+fn pipe_size_segment() {
+    assert_erl!(
+        "
+pub fn main() {
+  <<0xAE:size(5 |> identity)>>
+}
+
+fn identity(x) {
+  x
+}
+"
+    );
+}
diff --git a/compiler-core/src/erlang/tests/snapshots/gleam_core__erlang__tests__bit_arrays__pipe_size_segment.snap b/compiler-core/src/erlang/tests/snapshots/gleam_core__erlang__tests__bit_arrays__pipe_size_segment.snap
new file mode 100644
index 000000000..3e0c48b72
--- /dev/null
+++ b/compiler-core/src/erlang/tests/snapshots/gleam_core__erlang__tests__bit_arrays__pipe_size_segment.snap
@@ -0,0 +1,33 @@
+---
+source: compiler-core/src/erlang/tests/bit_arrays.rs
+expression: "\npub fn main() {\n  <<0xAE:size(5 |> identity)>>\n}\n\nfn identity(x) {\n  x\n}\n"
+---
+----- SOURCE CODE
+
+pub fn main() {
+  <<0xAE:size(5 |> identity)>>
+}
+
+fn identity(x) {
+  x
+}
+
+
+----- COMPILED ERLANG
+-module(my@mod).
+-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
+
+-export([main/0]).
+
+-file("project/test/my/mod.gleam", 6).
+-spec identity(J) -> J.
+identity(X) ->
+    X.
+
+-file("project/test/my/mod.gleam", 2).
+-spec main() -> bitstring().
+main() ->
+    <<16#AE:(lists:max([(begin
+            _pipe = 5,
+            identity(_pipe)
+        end), 0]))>>.
diff --git a/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__constructing_anonymous_function_is_pure.snap b/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__constructing_anonymous_function_is_pure.snap
index ff429e040..2d288e256 100644
--- a/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__constructing_anonymous_function_is_pure.snap
+++ b/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__constructing_anonymous_function_is_pure.snap
@@ -23,4 +23,4 @@ warning: Unused value
 
 This expression computes a value without any side effects, but then the
 value isn't used at all. You might way to assign it to a variable, or
-delete the expression entirely if it not needed.
+delete the expression entirely if it's not needed.
diff --git a/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__function_is_pure_on_erlang_if_external_on_js.snap b/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__function_is_pure_on_erlang_if_external_on_js.snap
index 3799549fe..8c67b1498 100644
--- a/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__function_is_pure_on_erlang_if_external_on_js.snap
+++ b/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__function_is_pure_on_erlang_if_external_on_js.snap
@@ -22,4 +22,4 @@ warning: Unused value
 
 This expression computes a value without any side effects, but then the
 value isn't used at all. You might way to assign it to a variable, or
-delete the expression entirely if it not needed.
+delete the expression entirely if it's not needed.
diff --git a/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__function_is_pure_on_js_if_external_on_erlang.snap b/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__function_is_pure_on_js_if_external_on_erlang.snap
index 52532aeb7..e042e9e4c 100644
--- a/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__function_is_pure_on_js_if_external_on_erlang.snap
+++ b/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__function_is_pure_on_js_if_external_on_erlang.snap
@@ -22,4 +22,4 @@ warning: Unused value
 
 This expression computes a value without any side effects, but then the
 value isn't used at all. You might way to assign it to a variable, or
-delete the expression entirely if it not needed.
+delete the expression entirely if it's not needed.
diff --git a/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__pure_pipeline_raises_warning.snap b/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__pure_pipeline_raises_warning.snap
index 783dec578..16904a672 100644
--- a/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__pure_pipeline_raises_warning.snap
+++ b/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__pure_pipeline_raises_warning.snap
@@ -21,4 +21,4 @@ warning: Unused value
 
 This expression computes a value without any side effects, but then the
 value isn't used at all. You might way to assign it to a variable, or
-delete the expression entirely if it not needed.
+delete the expression entirely if it's not needed.
diff --git a/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__pure_pipeline_with_many_steps_raises_warning.snap b/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__pure_pipeline_with_many_steps_raises_warning.snap
index 79a7f058f..604eceafe 100644
--- a/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__pure_pipeline_with_many_steps_raises_warning.snap
+++ b/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__pure_pipeline_with_many_steps_raises_warning.snap
@@ -21,4 +21,4 @@ warning: Unused value
 
 This expression computes a value without any side effects, but then the
 value isn't used at all. You might way to assign it to a variable, or
-delete the expression entirely if it not needed.
+delete the expression entirely if it's not needed.
diff --git a/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__pure_standard_library_function.snap b/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__pure_standard_library_function.snap
index ad8ba10ac..615c23bed 100644
--- a/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__pure_standard_library_function.snap
+++ b/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__pure_standard_library_function.snap
@@ -33,4 +33,4 @@ warning: Unused value
 
 This expression computes a value without any side effects, but then the
 value isn't used at all. You might way to assign it to a variable, or
-delete the expression entirely if it not needed.
+delete the expression entirely if it's not needed.
diff --git a/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_binary_operation_raises_a_warning.snap b/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_binary_operation_raises_a_warning.snap
index e8e75f2af..8b821d74a 100644
--- a/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_binary_operation_raises_a_warning.snap
+++ b/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_binary_operation_raises_a_warning.snap
@@ -19,4 +19,4 @@ warning: Unused value
 
 This expression computes a value without any side effects, but then the
 value isn't used at all. You might way to assign it to a variable, or
-delete the expression entirely if it not needed.
+delete the expression entirely if it's not needed.
diff --git a/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_block_wrapping_pure_expression.snap b/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_block_wrapping_pure_expression.snap
index 996ac105e..b3466dae3 100644
--- a/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_block_wrapping_pure_expression.snap
+++ b/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_block_wrapping_pure_expression.snap
@@ -19,4 +19,4 @@ warning: Unused value
 
 This expression computes a value without any side effects, but then the
 value isn't used at all. You might way to assign it to a variable, or
-delete the expression entirely if it not needed.
+delete the expression entirely if it's not needed.
diff --git a/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_block_wrapping_pure_expressions.snap b/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_block_wrapping_pure_expressions.snap
index ed506ce2a..2e807d033 100644
--- a/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_block_wrapping_pure_expressions.snap
+++ b/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_block_wrapping_pure_expressions.snap
@@ -25,7 +25,7 @@ warning: Unused value
 
 This expression computes a value without any side effects, but then the
 value isn't used at all. You might way to assign it to a variable, or
-delete the expression entirely if it not needed.
+delete the expression entirely if it's not needed.
 
 warning: Unused literal
   ┌─ /src/warning/wrn.gleam:4:5
diff --git a/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_bool_negation_raises_a_warning.snap b/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_bool_negation_raises_a_warning.snap
index f38216e39..7d2991cfc 100644
--- a/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_bool_negation_raises_a_warning.snap
+++ b/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_bool_negation_raises_a_warning.snap
@@ -19,4 +19,4 @@ warning: Unused value
 
 This expression computes a value without any side effects, but then the
 value isn't used at all. You might way to assign it to a variable, or
-delete the expression entirely if it not needed.
+delete the expression entirely if it's not needed.
diff --git a/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_case_expression.snap b/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_case_expression.snap
index b382bf11b..2992cd050 100644
--- a/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_case_expression.snap
+++ b/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_case_expression.snap
@@ -26,4 +26,4 @@ warning: Unused value
 
 This expression computes a value without any side effects, but then the
 value isn't used at all. You might way to assign it to a variable, or
-delete the expression entirely if it not needed.
+delete the expression entirely if it's not needed.
diff --git a/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_fn_function_call.snap b/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_fn_function_call.snap
index fda8c42ea..e31fdf69a 100644
--- a/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_fn_function_call.snap
+++ b/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_fn_function_call.snap
@@ -19,4 +19,4 @@ warning: Unused value
 
 This expression computes a value without any side effects, but then the
 value isn't used at all. You might way to assign it to a variable, or
-delete the expression entirely if it not needed.
+delete the expression entirely if it's not needed.
diff --git a/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_function_literal_raises_a_warning.snap b/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_function_literal_raises_a_warning.snap
index 79068df38..687b07bc8 100644
--- a/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_function_literal_raises_a_warning.snap
+++ b/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_function_literal_raises_a_warning.snap
@@ -19,4 +19,4 @@ warning: Unused value
 
 This expression computes a value without any side effects, but then the
 value isn't used at all. You might way to assign it to a variable, or
-delete the expression entirely if it not needed.
+delete the expression entirely if it's not needed.
diff --git a/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_module_select_const.snap b/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_module_select_const.snap
index 0caaed705..9c1709263 100644
--- a/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_module_select_const.snap
+++ b/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_module_select_const.snap
@@ -25,4 +25,4 @@ warning: Unused value
 
 This expression computes a value without any side effects, but then the
 value isn't used at all. You might way to assign it to a variable, or
-delete the expression entirely if it not needed.
+delete the expression entirely if it's not needed.
diff --git a/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_module_select_constructor.snap b/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_module_select_constructor.snap
index 0d48dfb0c..f4da0d6fe 100644
--- a/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_module_select_constructor.snap
+++ b/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_module_select_constructor.snap
@@ -25,4 +25,4 @@ warning: Unused value
 
 This expression computes a value without any side effects, but then the
 value isn't used at all. You might way to assign it to a variable, or
-delete the expression entirely if it not needed.
+delete the expression entirely if it's not needed.
diff --git a/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_module_select_constructor_call.snap b/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_module_select_constructor_call.snap
index 710681212..318552830 100644
--- a/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_module_select_constructor_call.snap
+++ b/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_module_select_constructor_call.snap
@@ -25,4 +25,4 @@ warning: Unused value
 
 This expression computes a value without any side effects, but then the
 value isn't used at all. You might way to assign it to a variable, or
-delete the expression entirely if it not needed.
+delete the expression entirely if it's not needed.
diff --git a/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_module_select_function.snap b/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_module_select_function.snap
index ea7dcb9ab..ee05d9c2f 100644
--- a/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_module_select_function.snap
+++ b/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_module_select_function.snap
@@ -25,4 +25,4 @@ warning: Unused value
 
 This expression computes a value without any side effects, but then the
 value isn't used at all. You might way to assign it to a variable, or
-delete the expression entirely if it not needed.
+delete the expression entirely if it's not needed.
diff --git a/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_pipeline_ending_with_pure_fn.snap b/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_pipeline_ending_with_pure_fn.snap
index 992e34cf4..8883d6de3 100644
--- a/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_pipeline_ending_with_pure_fn.snap
+++ b/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_pipeline_ending_with_pure_fn.snap
@@ -22,4 +22,4 @@ warning: Unused value
 
 This expression computes a value without any side effects, but then the
 value isn't used at all. You might way to assign it to a variable, or
-delete the expression entirely if it not needed.
+delete the expression entirely if it's not needed.
diff --git a/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_pipeline_ending_with_variant_raises_a_warning.snap b/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_pipeline_ending_with_variant_raises_a_warning.snap
index 767514092..31fe58820 100644
--- a/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_pipeline_ending_with_variant_raises_a_warning.snap
+++ b/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_pipeline_ending_with_variant_raises_a_warning.snap
@@ -22,4 +22,4 @@ warning: Unused value
 
 This expression computes a value without any side effects, but then the
 value isn't used at all. You might way to assign it to a variable, or
-delete the expression entirely if it not needed.
+delete the expression entirely if it's not needed.
diff --git a/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_pipeline_ending_with_variant_raises_a_warning_2.snap b/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_pipeline_ending_with_variant_raises_a_warning_2.snap
index 4623de212..adc348a99 100644
--- a/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_pipeline_ending_with_variant_raises_a_warning_2.snap
+++ b/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_pipeline_ending_with_variant_raises_a_warning_2.snap
@@ -27,4 +27,4 @@ warning: Unused value
 
 This expression computes a value without any side effects, but then the
 value isn't used at all. You might way to assign it to a variable, or
-delete the expression entirely if it not needed.
+delete the expression entirely if it's not needed.
diff --git a/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_pure_function.snap b/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_pure_function.snap
index 362d21f1f..18e38235f 100644
--- a/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_pure_function.snap
+++ b/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_pure_function.snap
@@ -21,4 +21,4 @@ warning: Unused value
 
 This expression computes a value without any side effects, but then the
 value isn't used at all. You might way to assign it to a variable, or
-delete the expression entirely if it not needed.
+delete the expression entirely if it's not needed.
diff --git a/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_pure_function_that_calls_other_pure_function.snap b/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_pure_function_that_calls_other_pure_function.snap
index 88aa2de63..546fb7eae 100644
--- a/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_pure_function_that_calls_other_pure_function.snap
+++ b/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_pure_function_that_calls_other_pure_function.snap
@@ -23,4 +23,4 @@ warning: Unused value
 
 This expression computes a value without any side effects, but then the
 value isn't used at all. You might way to assign it to a variable, or
-delete the expression entirely if it not needed.
+delete the expression entirely if it's not needed.
diff --git a/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_record_access_raises_a_warning.snap b/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_record_access_raises_a_warning.snap
index 03aa4cb60..d54aa2eea 100644
--- a/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_record_access_raises_a_warning.snap
+++ b/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_record_access_raises_a_warning.snap
@@ -24,4 +24,4 @@ warning: Unused value
 
 This expression computes a value without any side effects, but then the
 value isn't used at all. You might way to assign it to a variable, or
-delete the expression entirely if it not needed.
+delete the expression entirely if it's not needed.
diff --git a/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_record_update_raises_a_warning.snap b/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_record_update_raises_a_warning.snap
index 30738f20a..2f0da6d19 100644
--- a/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_record_update_raises_a_warning.snap
+++ b/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_record_update_raises_a_warning.snap
@@ -24,4 +24,4 @@ warning: Unused value
 
 This expression computes a value without any side effects, but then the
 value isn't used at all. You might way to assign it to a variable, or
-delete the expression entirely if it not needed.
+delete the expression entirely if it's not needed.
diff --git a/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_tuple_index_raises_a_warning.snap b/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_tuple_index_raises_a_warning.snap
index b24b85ec7..4e38182db 100644
--- a/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_tuple_index_raises_a_warning.snap
+++ b/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_tuple_index_raises_a_warning.snap
@@ -19,4 +19,4 @@ warning: Unused value
 
 This expression computes a value without any side effects, but then the
 value isn't used at all. You might way to assign it to a variable, or
-delete the expression entirely if it not needed.
+delete the expression entirely if it's not needed.
diff --git a/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_variable_raises_a_warning.snap b/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_variable_raises_a_warning.snap
index 6e7cc01b5..083b8bdb6 100644
--- a/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_variable_raises_a_warning.snap
+++ b/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_variable_raises_a_warning.snap
@@ -20,4 +20,4 @@ warning: Unused value
 
 This expression computes a value without any side effects, but then the
 value isn't used at all. You might way to assign it to a variable, or
-delete the expression entirely if it not needed.
+delete the expression entirely if it's not needed.
diff --git a/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__use_with_pure_fn_expression_is_marked_as_unused.snap b/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__use_with_pure_fn_expression_is_marked_as_unused.snap
index 2108e6575..c33d918e8 100644
--- a/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__use_with_pure_fn_expression_is_marked_as_unused.snap
+++ b/compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__use_with_pure_fn_expression_is_marked_as_unused.snap
@@ -26,4 +26,4 @@ warning: Unused value
 
 This expression computes a value without any side effects, but then the
 value isn't used at all. You might way to assign it to a variable, or
-delete the expression entirely if it not needed.
+delete the expression entirely if it's not needed.