(module test_mono_recursive_fn_bug (class Foo (param a) (method foo (type (fn-type (params (own a)) (ret (own (con Int))))))) (instance (class Foo) (type (con Int)) (method foo (body (lam (params (typed x a)) (ret (con Int)) (body x))))) (fn loop (type (fn-type (params (own (con Int)) (own (con Int))) (ret (own (con Int))))) (params acc i) (body (if (app eq i 0) acc (tail-app loop (app + acc i) (app - i 1))))) (fn main (type (fn-type (params) (ret (own (con Unit))) (effects IO))) (params) (body (app print (app loop 0 5)))))