(module test_mono_ctor_main
  (import test_mono_ctor_listmod)
  (class Trivial
    (param a)
    (method trivial
      (type (fn-type (params (own a)) (ret (own (con Int)))))))
  (instance
    (class Trivial)
    (type (con Int))
    (method trivial
      (body (lam (params (typed x (con Int))) (ret (con Int)) (body x)))))
  (fn head_or_zero
    (doc "Pattern-matches Cons from an imported module's List<Int>. Bug repro: with a class+instance present in the workspace, the mono pass walks this body and synth's local-flat ctor_index resolves Cons to bare \"List\", which mismatches the qualified scrutinee type \"test_mono_ctor_listmod.List<Int>\".")
    (type (fn-type (params (own (con test_mono_ctor_listmod.List (con Int)))) (ret (own (con Int)))))
    (params xs)
    (body (match xs
      (case (pat-ctor Cons h _) h)
      (case (pat-ctor Nil) 0))))
  (fn main
    (type (fn-type (params) (ret (own (con Unit))) (effects IO)))
    (params)
    (body (app print (app head_or_zero (term-ctor test_mono_ctor_listmod.List Cons 7 (term-ctor test_mono_ctor_listmod.List Nil)))))))
