Open sbinet opened 6 years ago
the following fails in ng:
ng
ng> type T struct { Name string } ng> ts := []T{{Name:"name"}} neugram: parser: panic: TODO parseStmt } (off 54) goroutine 20 [running]: runtime/debug.Stack(0x32, 0x0, 0x0) /home/binet/sdk/go/src/runtime/debug/stack.go:24 +0xa7 runtime/debug.PrintStack() /home/binet/sdk/go/src/runtime/debug/stack.go:16 +0x22 neugram.io/ng/parser.(*Parser).work.func1(0xc42013a070) /home/binet/work/gonum/src/neugram.io/ng/parser/parser.go:145 +0x116 panic(0xaf4b00, 0xc42001e720) /home/binet/sdk/go/src/runtime/panic.go:502 +0x229 neugram.io/ng/parser.(*Parser).parseStmt(0xc42013a070, 0xc42001e6e0, 0x1) /home/binet/work/gonum/src/neugram.io/ng/parser/parser.go:1233 +0x1836 neugram.io/ng/parser.(*Parser).work(0xc42013a070) /home/binet/work/gonum/src/neugram.io/ng/parser/parser.go:188 +0x1f4 created by neugram.io/ng/parser.New /home/binet/work/gonum/src/neugram.io/ng/parser/parser.go:30 +0x114 ng eval panic: expr TODO: &expr.Bad{ Position: src.Pos{ Filename: "/home/binet/work/gonum/src/neugram.io/ng/ng-interactive", Line: int32(2), Column: int16(11), }, Error: parser.Error{ Pos: src.Pos{ Filename: "/home/binet/work/gonum/src/neugram.io/ng/ng-interactive", Line: int32(2), Column: int16(12), }, Offset: int(45), Msg: "expected operand, got ident", }, } goroutine 1 [running]: runtime/debug.Stack(0x186, 0x0, 0x0) /home/binet/sdk/go/src/runtime/debug/stack.go:24 +0xa7 runtime/debug.PrintStack() /home/binet/sdk/go/src/runtime/debug/stack.go:16 +0x22 neugram.io/ng/eval.(*Program).Eval.func1(0xc42012c180, 0xc420137630, 0xc420137618) /home/binet/work/gonum/src/neugram.io/ng/eval/eval.go:476 +0x1ea panic(0xaf4b00, 0xc42001e890) /home/binet/sdk/go/src/runtime/panic.go:502 +0x229 neugram.io/ng/typecheck.(*Checker).exprPartial(0xc42014e1b0, 0xc442c0, 0xc420099080, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc442c0, ...) /home/binet/work/gonum/src/neugram.io/ng/typecheck/typecheck.go:2679 +0x59aa neugram.io/ng/typecheck.(*Checker).expr(0xc42014e1b0, 0xc442c0, 0xc420099080, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0) /home/binet/work/gonum/src/neugram.io/ng/typecheck/typecheck.go:1350 +0x79 neugram.io/ng/typecheck.(*Checker).checkSliceLiteral(0xc42014e1b0, 0xc44780, 0xc42009f860, 0x0, 0x0, 0x0, 0xc42001e6c0, 0x1, 0x1, 0xc42001e6a0, ...) /home/binet/work/gonum/src/neugram.io/ng/typecheck/typecheck.go:2811 +0x24a neugram.io/ng/typecheck.(*Checker).exprPartial(0xc42014e1b0, 0xc44780, 0xc42009f860, 0x0, 0x3, 0xc40a00, 0xc42001e6a0, 0x0, 0x0, 0xc44780, ...) /home/binet/work/gonum/src/neugram.io/ng/typecheck/typecheck.go:2218 +0x4fa0 neugram.io/ng/typecheck.(*Checker).exprNoElide(0xc42014e1b0, 0xc44780, 0xc42009f860, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0) /home/binet/work/gonum/src/neugram.io/ng/typecheck/typecheck.go:1359 +0x79 neugram.io/ng/typecheck.(*Checker).stmt(0xc42014e1b0, 0xc448c0, 0xc42009f8b0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0) /home/binet/work/gonum/src/neugram.io/ng/typecheck/typecheck.go:166 +0x378 neugram.io/ng/typecheck.(*Checker).Add(0xc42014e1b0, 0xc448c0, 0xc42009f8b0, 0x0, 0x0) /home/binet/work/gonum/src/neugram.io/ng/typecheck/typecheck.go:3490 +0x94 neugram.io/ng/eval.(*Program).Eval(0xc42012c180, 0xc448c0, 0xc42009f8b0, 0xc4201680c0, 0x0, 0x0, 0x0, 0xc3fc00, 0xc42001e8a0) /home/binet/work/gonum/src/neugram.io/ng/eval/eval.go:481 +0xe2 main.handleResult(0x2, 0xc42000c4e0, 0x2, 0x2, 0x0, 0x0, 0x0, 0xc4200c4180, 0x4, 0x4) /home/binet/work/gonum/src/neugram.io/ng/ng.go:393 +0x72b main.loop(0xc400000000) /home/binet/work/gonum/src/neugram.io/ng/ng.go:385 +0x5d2 main.main() /home/binet/work/gonum/src/neugram.io/ng/ng.go:147 +0x5be ng: ng eval panic: expr TODO: &expr.Bad{ Position: src.Pos{ Filename: "/home/binet/work/gonum/src/neugram.io/ng/ng-interactive", Line: int32(2), Column: int16(11), }, Error: parser.Error{ Pos: src.Pos{ Filename: "/home/binet/work/gonum/src/neugram.io/ng/ng-interactive", Line: int32(2), Column: int16(12), }, Offset: int(45), Msg: "expected operand, got ident", }, } name neugram: parser: expected operand, got ident (off 45) neugram: parser: expected "}", found "ident" (off 45) neugram: parser: expected ";", found ":" (off 46) neugram: parser: panic: TODO parseStmt } (off 54)
of course, this works, though:
ng> type T struct { Name string } ng> ts := []T{T{Name:"name"}} ng> ts []struct { Name string }{ struct { Name string }{ Name: "name", }, }
the following fails in
ng
:of course, this works, though: