;;; TOOL: wat2wasm
;;; ERROR: 1
;;; ARGS: --enable-exceptions
(module
  (tag $e)
  (func
    try $l1
      nop
    catch $e
      block $l2
        try $l3
          nop
        catch $e
          try $l4
            rethrow $l4
            rethrow 0
            rethrow $l2
            rethrow 2
          catch $e
            rethrow $l2
            rethrow 2
          end
        end
      end
    end)
  )
(;; STDERR ;;;
out/test/typecheck/bad-rethrow-depth.txt:15:13: error: invalid rethrow depth: 0 (catches: 1, 3)
            rethrow $l4
            ^^^^^^^
out/test/typecheck/bad-rethrow-depth.txt:16:13: error: invalid rethrow depth: 0 (catches: 1, 3)
            rethrow 0
            ^^^^^^^
out/test/typecheck/bad-rethrow-depth.txt:17:13: error: invalid rethrow depth: 2 (catches: 1, 3)
            rethrow $l2
            ^^^^^^^
out/test/typecheck/bad-rethrow-depth.txt:18:13: error: invalid rethrow depth: 2 (catches: 1, 3)
            rethrow 2
            ^^^^^^^
out/test/typecheck/bad-rethrow-depth.txt:20:13: error: invalid rethrow depth: 2 (catches: 0, 1, 3)
            rethrow $l2
            ^^^^^^^
out/test/typecheck/bad-rethrow-depth.txt:21:13: error: invalid rethrow depth: 2 (catches: 0, 1, 3)
            rethrow 2
            ^^^^^^^
;;; STDERR ;;)
