Open ergl opened 4 years ago
Info for whomever wants to look at this: this kind of assertion error means there's a mismatch between one part of the code that thinks the expression value is used, and another part of the code that thinks the expression value is not used.
Further comments, this happens during the ir
pass of the compiler, and a minimal example:
class Foo
new create() => None
actor Main
new create(env: Env) =>
Foo~create()
Debug backtrace:
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
* frame #0: 0x00007fff726e42c2 libsystem_kernel.dylib`__pthread_kill + 10
frame #1: 0x00007fff7279fbf1 libsystem_pthread.dylib`pthread_kill + 284
frame #2: 0x00007fff7264e6a6 libsystem_c.dylib`abort + 127
frame #3: 0x0000000100114e0d ponyc`ponyint_assert_fail(expr="r_value != GEN_NOTNEEDED", file="/Users/ryan/dev/ponyc/src/libponyc/codegen/genexpr.c", line=310, func="gen_assign_cast") at ponyassert.c:65:3
frame #4: 0x000000010004bfa7 ponyc`gen_assign_cast(c=0x00007ffeefbfeff8, l_type=0x0000000104004500, r_value=0x0000000000000002, type=0x000000010626e780) at genexpr.c:310:3
frame #5: 0x0000000100041e1b ponyc`gen_call(c=0x00007ffeefbfeff8, ast=0x000000010b56a040) at gencall.c:877:17
frame #6: 0x000000010004b885 ponyc`gen_expr(c=0x00007ffeefbfeff8, ast=0x000000010b56a040) at genexpr.c:92:13
frame #7: 0x0000000100045864 ponyc`gen_seq(c=0x00007ffeefbfeff8, ast=0x000000010bee5dc0) at gencontrol.c:22:13
frame #8: 0x000000010004b759 ponyc`gen_expr(c=0x00007ffeefbfeff8, ast=0x000000010bee5dc0) at genexpr.c:26:13
frame #9: 0x000000010004e577 ponyc`genfun_newbe(c=0x00007ffeefbfeff8, t=0x000000010c213d00, m=0x000000010c05e900) at genfun.c:589:24
frame #10: 0x000000010004d70f ponyc`genfun_method(c=0x00007ffeefbfeff8, t=0x000000010c213d00, n=0x000000010c05e880, m=0x000000010c05e900) at genfun.c:784:15
frame #11: 0x000000010004d542 ponyc`genfun_method_bodies(c=0x00007ffeefbfeff8, t=0x000000010c213d00) at genfun.c:946:11
frame #12: 0x000000010006a096 ponyc`gentypes(c=0x00007ffeefbfeff8) at gentype.c:861:9
frame #13: 0x000000010004b07c ponyc`genexe(c=0x00007ffeefbfeff8, program=0x000000010c7bfd00) at genexe.c:561:7
frame #14: 0x000000010003ca7a ponyc`codegen(program=0x000000010c7bfd00, opt=0x00007ffeefbff4c8) at codegen.c:923:10
frame #15: 0x00000001000b78b3 ponyc`generate_passes(program=0x000000010c7bfd00, options=0x00007ffeefbff4c8) at pass.c:360:10
frame #16: 0x0000000100001fa1 ponyc`compile_package(path="examples/crash/", opt=0x00007ffeefbff4c8, print_program_ast=false, print_package_ast=false) at main.c:67:13
frame #17: 0x0000000100001e3f ponyc`main(argc=2, argv=0x00007ffeefbff5d0) at main.c:112:15
frame #18: 0x00007fff725a93d5 libdyld.dylib`start + 1
The following code causes a compiler error on ponyc 0.35.1-57947572
Pony version:
Can reproduce on the playground: https://playground.ponylang.io/?gist=04897bac813bf7fed2f2639eccb4a88d
I don't have a debug version of ponyc right now, but this is the backtrace with lldb: