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