You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Any code explicitly returning a lib struct or a tuple inside a fun results in a codegen error.
Here's an example (also works with empty prelude):
libLibFoostructBar
value : Int32endend
fun foo : LibFoo::BarreturnLibFoo::Bar.new
end
This results in the following compilation error:
Module validation failed: Function return type does not match operand type of return inst!
ret %"struct.LibFoo::Bar" %2, !dbg !668
{ i64 } (Exception)
from /crystal/src/string.cr:5488:31 in 'codegen'
from /crystal/src/compiler/crystal/compiler.cr:195:16 in 'compile:combine_rpath'
from /crystal/src/compiler/crystal/compiler.cr:188:56 in 'compile:combine_rpath'
from /crystal/src/compiler/crystal/command/eval.cr:30:5 in 'eval'
from /crystal/src/compiler/crystal/command.cr:125:12 in 'run'
from /crystal/src/compiler/crystal.cr:11:1 in '__crystal_main'
from /crystal/src/crystal/main.cr:129:5 in 'main'
from src/env/__libc_start_main.c:95:2 in 'libc_start_main_stage2'
Another example:
fun foo : {Int32}
return {0}
end
..which results in this error:
Module validation failed: Function return type does not match operand type of return inst!
ret %"Tuple(Int32)" %2, !dbg !668
{ i64 } (Exception)
from /crystal/src/string.cr:5488:31 in 'codegen'
from /crystal/src/compiler/crystal/compiler.cr:195:16 in 'compile:combine_rpath'
from /crystal/src/compiler/crystal/compiler.cr:188:56 in 'compile:combine_rpath'
from /crystal/src/compiler/crystal/command/eval.cr:30:5 in 'eval'
from /crystal/src/compiler/crystal/command.cr:125:12 in 'run'
from /crystal/src/compiler/crystal.cr:11:1 in '__crystal_main'
from /crystal/src/crystal/main.cr:129:5 in 'main'
from src/env/__libc_start_main.c:95:2 in 'libc_start_main_stage2'
Bug Report
Any code explicitly returning a lib struct or a tuple inside a
fun
results in a codegen error.Here's an example (also works with empty prelude):
This results in the following compilation error:
Another example:
..which results in this error:
System information
The text was updated successfully, but these errors were encountered: