neugram / ng

scripting language integrated with Go
https://neugram.io
BSD 2-Clause "Simplified" License
916 stars 43 forks source link

Passing variadic parameter with expansion fails. #240

Closed daved closed 5 years ago

daved commented 6 years ago
ng> import "fmt"
ng> func print(format string, a ...interface{}) { fmt.Printf(format, a...) }
ng eval panic: interface conversion: tipe.Type is *tipe.Slice, not *tipe.Ellipsis
goroutine 1 [running]:
runtime/debug.Stack(0x52, 0x0, 0x0)
        /usr/local/go/src/runtime/debug/stack.go:24 +0xa7
runtime/debug.PrintStack()
        /usr/local/go/src/runtime/debug/stack.go:16 +0x22
neugram.io/ng/eval.(*Program).Eval.func1(0xc420174100, 0xc4201957c8, 0xc4201957b0)
        /home/daved/gocode/src/neugram.io/ng/eval/eval.go:478 +0x1ea
panic(0xb400c0, 0xc420238100)
        /usr/local/go/src/runtime/panic.go:505 +0x229
neugram.io/ng/typecheck.(*Checker).exprPartialCall(0xc4201ac1b0, 0xc42023a190, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
        /home/daved/gocode/src/neugram.io/ng/typecheck/typecheck.go:1977 +0x127b
neugram.io/ng/typecheck.(*Checker).exprPartial(0xc4201ac1b0, 0xc5fd20, 0xc42023a190, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc5fd20, ...)
        /home/daved/gocode/src/neugram.io/ng/typecheck/typecheck.go:2527 +0x52dc
neugram.io/ng/typecheck.(*Checker).exprNoElide(0xc4201ac1b0, 0xc5fd20, 0xc42023a190, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
        /home/daved/gocode/src/neugram.io/ng/typecheck/typecheck.go:1364 +0x79
neugram.io/ng/typecheck.(*Checker).stmt(0xc4201ac1b0, 0xc606e0, 0xc420240420, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
        /home/daved/gocode/src/neugram.io/ng/typecheck/typecheck.go:252 +0x3dc4
neugram.io/ng/typecheck.(*Checker).stmt(0xc4201ac1b0, 0xc602e0, 0xc420240450, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
        /home/daved/gocode/src/neugram.io/ng/typecheck/typecheck.go:280 +0x2068
neugram.io/ng/typecheck.(*Checker).exprPartial(0xc4201ac1b0, 0xc5fda0, 0xc420416000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc5fda0, ...)
        /home/daved/gocode/src/neugram.io/ng/typecheck/typecheck.go:2145 +0x4e35
neugram.io/ng/typecheck.(*Checker).exprNoElide(0xc4201ac1b0, 0xc5fda0, 0xc420416000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
        /home/daved/gocode/src/neugram.io/ng/typecheck/typecheck.go:1364 +0x79
neugram.io/ng/typecheck.(*Checker).stmt(0xc4201ac1b0, 0xc606e0, 0xc420240480, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
        /home/daved/gocode/src/neugram.io/ng/typecheck/typecheck.go:252 +0x3dc4
neugram.io/ng/typecheck.(*Checker).Add(0xc4201ac1b0, 0xc606e0, 0xc420240480, 0x0, 0x0)
        /home/daved/gocode/src/neugram.io/ng/typecheck/typecheck.go:3594 +0x94
neugram.io/ng/eval.(*Program).Eval(0xc420174100, 0xc606e0, 0xc420240480, 0x0, 0x0, 0x0, 0x0, 0xc5b5a0, 0xc420236270)
        /home/daved/gocode/src/neugram.io/ng/eval/eval.go:483 +0xe2
neugram.io/ng/ngcore.(*Session).Exec(0xc4200cc090, 0xc42026a0a0, 0x48, 0x50, 0x48, 0x50, 0x0, 0x0, 0x0)
        /home/daved/gocode/src/neugram.io/ng/ngcore/ngcore.go:211 +0x2d1
neugram.io/ng/ngcore.(*Session).Run(0xc4200cc090, 0xc659a0, 0xc420024170, 0xc4201ce000, 0xc4201c4060, 0xc42019f080, 0x52)
        /home/daved/gocode/src/neugram.io/ng/ngcore/ngcore.go:370 +0x3c8
main.loop(0xc659a0, 0xc420024170, 0x0)
        /home/daved/gocode/src/neugram.io/ng/ng.go:216 +0x1e4
main.main()
        /home/daved/gocode/src/neugram.io/ng/ng.go:130 +0x774
ng: eval: ng eval panic: interface conversion: tipe.Type is *tipe.Slice, not *tipe.Ellipsis
daved commented 5 years ago

As far as I know, this has not been resolved; I'm pruning what appears to be neglected issues that I created.