The following function in Muon's extended language causes the analyzer to assert:
However, if I restructure the function to be as follows, then the assertion does not fail:
#0 __pthread_kill_implementation (threadid=549621233440, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
#1 0x0000007ff7ca0a64 in __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
#2 0x0000007ff7c5a76c in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3 0x0000007ff7c474bc in __GI_abort () at ./stdlib/abort.c:79
#4 0x0000007ff7c541e4 in __assert_fail_base (fmt=0x7ff7d6f2c8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x55555e93d0 "t - 1 < tc_type_count", file=file@entry=0x55555e93b8 "../src/lang/typecheck.c", line=line@entry=19,
function=function@entry=0x55555e94d0 <__PRETTY_FUNCTION__.2> "obj_type_to_tc_type") at ./assert/assert.c:92
#5 0x0000007ff7c5424c in __GI___assert_fail (assertion=0x55555e93d0 "t - 1 < tc_type_count", file=0x55555e93b8 "../src/lang/typecheck.c", line=19, function=0x55555e94d0 <__PRETTY_FUNCTION__.2> "obj_type_to_tc_type") at ./assert/assert.c:101
#6 0x00000055555aed54 in obj_type_to_tc_type (t=obj_typeinfo) at ../src/lang/typecheck.c:19
#7 0x00000055555af4f0 in typecheck_nested_type_arr_iter (wk=0x7fffffd728, _ctx=0x7fffffbe60, v=7248) at ../src/lang/typecheck.c:239
#8 0x00000055555a1c90 in obj_array_foreach (wk=0x7fffffd728, arr=7816, ctx=0x7fffffbe60, cb=0x55555af4c4 <typecheck_nested_type_arr_iter>) at ../src/lang/object.c:507
#9 0x00000055555af864 in typecheck_complex_type (wk=0x7fffffd728, got_obj=7816, got_type=9223372036854776064, type=10376575016438333726) at ../src/lang/typecheck.c:304
#10 0x00000055555af960 in typecheck_custom (wk=0x7fffffd728, n_id=871, got_obj=7816, type=10376575016438333726, fmt=0x55555e67f0 "function returned invalid type, expected %s, got %s") at ../src/lang/typecheck.c:332
#11 0x00000055555949e8 in analyze_node (wk=0x7fffffd728, n_id=871, res=0x7fffffbf7c) at ../src/lang/analyze.c:1632
#12 0x000000555559dda0 in interp_node (wk=0x7fffffd728, n_id=870, res=0x7fffffc034) at ../src/lang/interpreter.c:1220
#13 0x0000005555594888 in analyze_node (wk=0x7fffffd728, n_id=256, res=0x7fffffc034) at ../src/lang/analyze.c:1603
#14 0x0000005555567aa0 in func_obj_call (wk=0x7fffffd728, f=0x5555686400, args=3171, res=0x7fffffc0c4) at ../src/functions/common.c:762
#15 0x0000005555591c98 in analyze_func_obj_immediate (wk=0x7fffffd728, n_id=233, func_obj=3161) at ../src/lang/analyze.c:695
#16 0x0000005555594870 in analyze_node (wk=0x7fffffd728, n_id=233, res=0x7fffffc1ac) at ../src/lang/analyze.c:1597
#17 0x000000555559dda0 in interp_node (wk=0x7fffffd728, n_id=232, res=0x7fffffc35c) at ../src/lang/interpreter.c:1220
#18 0x0000005555594888 in analyze_node (wk=0x7fffffd728, n_id=1, res=0x7fffffc35c) at ../src/lang/analyze.c:1603
#19 0x0000005555596420 in eval (wk=0x7fffffd728, src=0x7fffffc360, mode=eval_mode_default, res=0x7fffffc35c) at ../src/lang/eval.c:166
#20 0x0000005555587480 in module_import (wk=0x7fffffd728, name=0x55556b61e3 "i18n", encapsulate=true, res=0x7fffffc954) at ../src/functions/modules.c:97
#21 0x0000005555576c84 in func_import (wk=0x7fffffd728, _=0, args_node=14, res=0x7fffffc954) at ../src/functions/kernel.c:1599
#22 0x0000005555568900 in analyze_function (wk=0x7fffffd728, fi=0x555561f6a8 <impl_tbl_kernel+1080>, args_node=14, rcvr=0, res=0x7fffffc954, was_pure=0x7fffffc953) at ../src/functions/common.c:1111
#23 0x0000005555591fdc in analyze_function_call (wk=0x7fffffd728, n_id=13, args_node=14, fi=0x555561f6a8 <impl_tbl_kernel+1080>, rcvr=0, res=0x7fffffc9a4) at ../src/lang/analyze.c:763
#24 0x00000055555927c8 in analyze_func (wk=0x7fffffd728, n_id=13, chained=false, l_id=0, res=0x7fffffca58) at ../src/lang/analyze.c:925
#25 0x0000005555594a38 in analyze_node (wk=0x7fffffd728, n_id=13, res=0x7fffffca58) at ../src/lang/analyze.c:1645
#26 0x0000005555594600 in analyze_assign (wk=0x7fffffd728, n=0x55556ea408) at ../src/lang/analyze.c:1540
#27 0x0000005555594ad8 in analyze_node (wk=0x7fffffd728, n_id=11, res=0x7fffffcb0c) at ../src/lang/analyze.c:1663
#28 0x000000555559dda0 in interp_node (wk=0x7fffffd728, n_id=9, res=0x7fffffcc94) at ../src/lang/interpreter.c:1220
#29 0x0000005555594888 in analyze_node (wk=0x7fffffd728, n_id=1, res=0x7fffffcc94) at ../src/lang/analyze.c:1603
#30 0x0000005555596420 in eval (wk=0x7fffffd728, src=0x7fffffcc98, mode=eval_mode_first, res=0x7fffffcc94) at ../src/lang/eval.c:166
#31 0x000000555559656c in eval_project_file (wk=0x7fffffd728, path=0x7fffffce70 "/home/andrew/github/muon/build/welp/meson.build", first=true) at ../src/lang/eval.c:199
#32 0x00000055555951a0 in analyze_eval_project_file (wk=0x7fffffd728, path=0x7fffffce70 "/home/andrew/github/muon/build/welp/meson.build", first=true) at ../src/lang/analyze.c:1853
#33 0x0000005555596008 in eval_project (wk=0x7fffffd728, subproject_name=0x0, cwd=0x5555669980 "/home/andrew/github/muon/build/welp", build_dir=0x55555e9550 "dummy", proj_id=0x7fffffd6f4) at ../src/lang/eval.c:63
#34 0x0000005555595920 in do_analyze (opts=0x7fffffe480) at ../src/lang/analyze.c:2046
#35 0x00000055555bcf68 in cmd_analyze (argc=2, argi=2, argv=0x7ffffff058) at ../src/main.c:340
#36 0x00000055555bfea0 in cmd_main (argc=2, argi=1, argv=0x7ffffff058) at ../src/main.c:1075
#37 0x00000055555bffbc in main (argc=2, argv=0x7ffffff058) at ../src/main.c:1107