Closed MovingtoMars closed 8 years ago
In tests/option.ark, try:
debugDumpOption<int>(Option::Some<int>(5));
ark: /home/sachiel/gocode/src/github.com/ark-lang/go-llvm/workdir/src/lib/IR/Instructions.cpp:239: void llvm::CallInst::init(llvm::FunctionType *, llvm::Value *, ArrayRef<llvm::Value *>, const llvm::Twine &): Assertion `(i >= FTy->getNumParams() || FTy->getParamType(i) == Args[i]->getType()) && "Calling a function with a bad signature!"' failed. SIGABRT: abort PC=0x7fa81c93e5f8 m=0 signal arrived during cgo execution goroutine 1 [syscall, locked to thread]: runtime.cgocall(0x5621ab87b9e0, 0xc8201d4958, 0x562100000000) /usr/lib/go/src/runtime/cgocall.go:120 +0x11b fp=0xc8201d4910 sp=0xc8201d48e0 github.com/ark-lang/go-llvm/llvm._Cfunc_LLVMBuildCall(0x5621afdea690, 0x5621afdea408, 0xc820033248, 0xc800000001, 0x5621afdeb3a0, 0x0) ??:0 +0x3a fp=0xc8201d4958 sp=0xc8201d4910 github.com/ark-lang/go-llvm/llvm.Builder.CreateCall(0x5621afdea690, 0x5621afdea408, 0xc820033248, 0x1, 0x1, 0x0, 0x0, 0x0) /home/sachiel/gocode/src/github.com/ark-lang/go-llvm/llvm/ir.go:1661 +0xd0 fp=0xc8201d49b0 sp=0xc8201d4958 github.com/ark-lang/ark/src/codegen/LLVMCodegen.(*Codegen).genCallExprWithArgs(0xc82018b100, 0xc8201738c0, 0xc820033248, 0x1, 0x1, 0x0) /home/sachiel/gocode/src/github.com/ark-lang/ark/src/codegen/LLVMCodegen/codegen.go:1630 +0xdf fp=0xc8201d4ac0 sp=0xc8201d49b0 github.com/ark-lang/ark/src/codegen/LLVMCodegen.(*Codegen).genCallExpr(0xc82018b100, 0xc8201738c0, 0x0) /home/sachiel/gocode/src/github.com/ark-lang/ark/src/codegen/LLVMCodegen/codegen.go:1658 +0x37a fp=0xc8201d4bc8 sp=0xc8201d4ac0 github.com/ark-lang/ark/src/codegen/LLVMCodegen.(*Codegen).genExpr(0xc82018b100, 0x7fa81c0cff70, 0xc8201738c0, 0x0) /home/sachiel/gocode/src/github.com/ark-lang/ark/src/codegen/LLVMCodegen/codegen.go:912 +0x6c0 fp=0xc8201d4d98 sp=0xc8201d4bc8 github.com/ark-lang/ark/src/codegen/LLVMCodegen.(*Codegen).genCallStat(0xc82018b100, 0xc82011da40) /home/sachiel/gocode/src/github.com/ark-lang/ark/src/codegen/LLVMCodegen/codegen.go:475 +0x79 fp=0xc8201d4de0 sp=0xc8201d4d98 github.com/ark-lang/ark/src/codegen/LLVMCodegen.(*Codegen).genStat(0xc82018b100, 0x7fa81c0d6080, 0xc82011da40) /home/sachiel/gocode/src/github.com/ark-lang/ark/src/codegen/LLVMCodegen/codegen.go:385 +0x6c5 fp=0xc8201d4eb0 sp=0xc8201d4de0 github.com/ark-lang/ark/src/codegen/LLVMCodegen.(*Codegen).genNode(0xc82018b100, 0x7fa81c0cffc8, 0xc82011da40) /home/sachiel/gocode/src/github.com/ark-lang/ark/src/codegen/LLVMCodegen/codegen.go:368 +0x1a2 fp=0xc8201d4f30 sp=0xc8201d4eb0 github.com/ark-lang/ark/src/codegen/LLVMCodegen.(*Codegen).genBlock(0xc82018b100, 0xc82017d600) /home/sachiel/gocode/src/github.com/ark-lang/ark/src/codegen/LLVMCodegen/codegen.go:442 +0xf8 fp=0xc8201d4fb8 sp=0xc8201d4f30 github.com/ark-lang/ark/src/codegen/LLVMCodegen.(*Codegen).genFunctionBody(0xc82018b100, 0xc82011a240, 0x5621afdea568, 0x0) /home/sachiel/gocode/src/github.com/ark-lang/ark/src/codegen/LLVMCodegen/codegen.go:797 +0x63d fp=0xc8201d5170 sp=0xc8201d4fb8 github.com/ark-lang/ark/src/codegen/LLVMCodegen.(*Codegen).genFunctionDecl(0xc82018b100, 0xc820171770, 0x0) /home/sachiel/gocode/src/github.com/ark-lang/ark/src/codegen/LLVMCodegen/codegen.go:768 +0x250 fp=0xc8201d5280 sp=0xc8201d5170 github.com/ark-lang/ark/src/codegen/LLVMCodegen.(*Codegen).genDecl(0xc82018b100, 0x7fa81c0d5d30, 0xc820171770) /home/sachiel/gocode/src/github.com/ark-lang/ark/src/codegen/LLVMCodegen/codegen.go:736 +0x412 fp=0xc8201d53c0 sp=0xc8201d5280 github.com/ark-lang/ark/src/codegen/LLVMCodegen.(*Codegen).genNode(0xc82018b100, 0x7fa81c0cfd08, 0xc820171770) /home/sachiel/gocode/src/github.com/ark-lang/ark/src/codegen/LLVMCodegen/codegen.go:364 +0xbf fp=0xc8201d5440 sp=0xc8201d53c0 github.com/ark-lang/ark/src/codegen/LLVMCodegen.(*Codegen).Generate.func1() /home/sachiel/gocode/src/github.com/ark-lang/ark/src/codegen/LLVMCodegen/codegen.go:208 +0x2e2 fp=0xc8201d55d8 sp=0xc8201d5440 github.com/ark-lang/ark/src/util/log.Timed(0x5621ada96d20, 0xb, 0xc8201d5660, 0x7, 0xc8201d59d0) /home/sachiel/gocode/src/github.com/ark-lang/ark/src/util/log/timed.go:28 +0x2f8 fp=0xc8201d57e0 sp=0xc8201d55d8 github.com/ark-lang/ark/src/codegen/LLVMCodegen.(*Codegen).Generate(0xc82018b100, 0xc820011ea0, 0x3, 0x4) /home/sachiel/gocode/src/github.com/ark-lang/ark/src/codegen/LLVMCodegen/codegen.go:222 +0xae1 fp=0xc8201d59f8 sp=0xc8201d57e0 main.(*Context).Build.func4() /home/sachiel/gocode/src/github.com/ark-lang/ark/src/cmd/ark/main.go:175 +0x78 fp=0xc8201d5a38 sp=0xc8201d59f8 github.com/ark-lang/ark/src/util/log.Timed(0x5621ada96d00, 0xd, 0x0, 0x0, 0xc8201d5d98) /home/sachiel/gocode/src/github.com/ark-lang/ark/src/util/log/timed.go:28 +0x2f8 fp=0xc8201d5c40 sp=0xc8201d5a38 main.(*Context).Build(0xc8200f0700, 0x7ffffb26c8e0, 0x5, 0x1, 0x5621ada8a050, 0x4, 0x0) /home/sachiel/gocode/src/github.com/ark-lang/ark/src/cmd/ark/main.go:176 +0x51a fp=0xc8201d5dc0 sp=0xc8201d5c40 main.main() /home/sachiel/gocode/src/github.com/ark-lang/ark/src/cmd/ark/main.go:56 +0x4f0 fp=0xc8201d5f20 sp=0xc8201d5dc0 runtime.main() /usr/lib/go/src/runtime/proc.go:111 +0x2b0 fp=0xc8201d5f70 sp=0xc8201d5f20 runtime.goexit() /usr/lib/go/src/runtime/asm_amd64.s:1721 +0x1 fp=0xc8201d5f78 sp=0xc8201d5f70 goroutine 17 [syscall, locked to thread]: runtime.goexit() /usr/lib/go/src/runtime/asm_amd64.s:1721 +0x1 rax 0x0 rbx 0x7fa81e200000 rcx 0x7fa81c93e5f8 rdx 0x6 rdi 0x1817 rsi 0x1817 rbp 0x5621ae413ff3 rsp 0x7ffffb26a108 r8 0xfefefefefefefeff r9 0xfefefeff092d6364 r10 0x8 r11 0x206 r12 0xef r13 0x5621ae413efb r14 0x7ffffb26a410 r15 0x5621adad1b30 rip 0x7fa81c93e5f8 rflags 0x206 cs 0x33 fs 0x0 gs 0x0
In tests/option.ark, try: