I think we can make this question more general.
The error message shows that the Crystal compiler tried to check the code’s types during the code generation stage, but it failed. The line “ret ptr %14, !dbg !42” looks like LLVM IR (Intermediate Representation). If we could produce LLVM IR—for example, by using the --emit llvm-ir
option—it would make our investigation easier. However, since the compiler fails at this point, it cannot output the IR. So, how can we debug this problem if we can’t see the generated IR directly?
At a quick glance, it seems that the omission of the block/ploc type specification may be causing some problems. Also, referencing self
outside initialize
often leads to trouble.