Skip to content

Bug: multiple assignment from implicit array causes panic #524

Closed
@hachi8833

Description

The following works:

» a, b, c = [1, 2, 3]
#» 3
» a
#» 1
» b
#» 2
» c
#» 3

The following causes panic:

» a, b, c = 1, 2, 3
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0x40f1455]

goroutine 1 [running]:
github.com/goby-lang/goby/compiler/ast.(*BaseNode).MarkAsExp(0x0)
	/Users/hachi8833/deve/golang/gopath/sys/src/github.com/goby-lang/goby/compiler/ast/ast.go:36 +0x5
github.com/goby-lang/goby/compiler/parser.(*Parser).parseStatement(0xc420138240, 0x486f768, 0x1)
	/Users/hachi8833/deve/golang/gopath/sys/src/github.com/goby-lang/goby/compiler/parser/statement_parsing.go:34 +0xbd
github.com/goby-lang/goby/compiler/parser.(*Parser).ParseProgram(0xc420138240, 0x11, 0xc42011e040)
	/Users/hachi8833/deve/golang/gopath/sys/src/github.com/goby-lang/goby/compiler/parser/parser.go:193 +0xe8
github.com/goby-lang/goby/igb.StartIgb(0x456d9c0, 0x5)
	/Users/hachi8833/deve/golang/gopath/sys/src/github.com/goby-lang/goby/igb/repl.go:160 +0x4d1
main.main()
	/Users/hachi8833/deve/golang/gopath/sys/src/github.com/goby-lang/goby/goby.go:29 +0x954

FYI: works in Ruby:

#ruby
i, j, k = 1, 2, 3
=> [1, 2, 3]

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions