---
source: compiler-core/src/erlang/tests.rs
expression: "\npub fn main() {\n  let code = <<\"hello world\":utf8>>\n  let pre = 1\n  case code {\n    <<pre:bytes-size(pre), _:bytes>> -> pre\n    _ -> panic\n  }\n}        "
---
----- SOURCE CODE

pub fn main() {
  let code = <<"hello world":utf8>>
  let pre = 1
  case code {
    <<pre:bytes-size(pre), _:bytes>> -> pre
    _ -> panic
  }
}        

----- COMPILED ERLANG
-module(my@mod).
-compile([no_auto_import, nowarn_ignored, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-export([main/0]).

-file("project/test/my/mod.gleam", 2).
-spec main() -> bitstring().
main() ->
    Code = <<"hello world"/utf8>>,
    Pre = 1,
    case Code of
        <<Pre@1:Pre/binary, _/binary>> ->
            Pre@1;

        _ ->
            erlang:error(#{
                gleam_error => panic,
                message => ~"`panic` expression evaluated.",
                file => ~"project/test/my/mod.gleam",
                module => ~"my/mod",
                function => ~"main",
                line => 7
            })
    end.
