program main
  enum Signal
    variant Red
    variant Yellow
    variant Green
  fn red() -> Signal
    enum-variant Signal.Red
  fn yellow() -> Signal
    enum-variant Signal.Yellow
  fn echo(signal: Signal) -> Signal
    var signal
  fn local_signal() -> Signal
    local let signal: Signal
      enum-variant Signal.Green
    var signal
  fn same_signal(left: Signal, right: Signal) -> bool
    binary =
      var left
      var right
  fn signal_code(signal: Signal) -> i32
    match
      subject
        var signal
      arm Signal.Red
        int 1
      arm Signal.Yellow
        local let code: i32
          int 2
        var code
      arm Signal.Green
        int 3
  fn call_flow() -> Signal
    call echo
      call local_signal
  fn main() -> i32
    call signal_code
      call call_flow
  test "enum constructor equality"
    binary =
      enum-variant Signal.Red
      call red
  test "enum local return call flow"
    binary =
      call call_flow
      enum-variant Signal.Green
  test "enum parameter equality"
    call same_signal
      call yellow
      enum-variant Signal.Yellow
  test "enum match red"
    binary =
      call signal_code
        enum-variant Signal.Red
      int 1
  test "enum match multi expression arm"
    binary =
      call signal_code
        enum-variant Signal.Yellow
      int 2
  test "enum match green"
    binary =
      call signal_code
        call call_flow
      int 3
