Skip to content
This repository was archived by the owner on Dec 29, 2022. It is now read-only.
This repository was archived by the owner on Dec 29, 2022. It is now read-only.

compiler: crash in f(*args, k=v, **kwargs) #135

@alandonovan

Description

@alandonovan
$ cat a.sky

def b(*args, **kwargs):
	print(args, kwargs)

def a(*args, **kwargs):
	b(*args, k = "foo", **kwargs)

a(1, 2, x=3)

Both Python and Skylark-in-Java print this result:

((1, 2), {'x': 3, 'k': 'foo'})

But the Go implementation crashes in the compiler:

$ skylark a.sky 
panic: interface conversion: syntax.Expr is *syntax.UnaryExpr, not *syntax.BinaryExpr

goroutine 1 [running]:
google3/third_party/golang/skylark/internal/compile/compile.(*fcomp).args(0xc0000ef7b0, 0xc00009a1e0, 0xc000069900)
	third_party/golang/skylark/internal/compile/compile.go:1512 +0x5a6
google3/third_party/golang/skylark/internal/compile/compile.(*fcomp).call(0xc0000ef7b0, 0xc00009a1e0)
	third_party/golang/skylark/internal/compile/compile.go:1470 +0x5e
google3/third_party/golang/skylark/internal/compile/compile.(*fcomp).expr(0xc0000ef7b0, 0x5edc00, 0xc00009a1e0)
	third_party/golang/skylark/internal/compile/compile.go:1270 +0x26c
google3/third_party/golang/skylark/internal/compile/compile.(*fcomp).stmt(0xc0000ef7b0, 0x5eddc0, 0xc00000c960)
	third_party/golang/skylark/internal/compile/compile.go:910 +0x102a
google3/third_party/golang/skylark/internal/compile/compile.(*fcomp).stmts(0xc0000ef7b0, 0xc000057530, 0x1, 0x1)
	third_party/golang/skylark/internal/compile/compile.go:899 +0x68
google3/third_party/golang/skylark/internal/compile/compile.(*pcomp).function(0xc00000ca20, 0x700161, 0x1, 0xc0000574b0, 0x100000005, 0xc000057530, 0x1, 0x1, 0xc0000575b0, 0x2, ...)
	third_party/golang/skylark/internal/compile/compile.go:440 +0x292
google3/third_party/golang/skylark/internal/compile/compile.(*fcomp).function(0xc0000efbc8, 0xc0000574b0, 0x100000005, 0x700161, 0x1, 0xc0000b2160)
	third_party/golang/skylark/internal/compile/compile.go:1627 +0x201
google3/third_party/golang/skylark/internal/compile/compile.(*fcomp).stmt(0xc0000efbc8, 0x5edcc0, 0xc0000b2140)
	third_party/golang/skylark/internal/compile/compile.go:1013 +0xf7d
google3/third_party/golang/skylark/internal/compile/compile.(*fcomp).stmts(0xc0000efbc8, 0xc000069c80, 0x3, 0x4)
	third_party/golang/skylark/internal/compile/compile.go:899 +0x68
google3/third_party/golang/skylark/internal/compile/compile.(*pcomp).function(0xc00000ca20, 0x5c1ca2, 0xa, 0xc0000574b0, 0x100000002, 0xc000069c80, 0x3, 0x4, 0x0, 0x0, ...)
	third_party/golang/skylark/internal/compile/compile.go:440 +0x292
google3/third_party/golang/skylark/internal/compile/compile.File(0xc000069c80, 0x3, 0x4, 0x0, 0x0, 0x0, 0xc000057580, 0x2, 0x2, 0x593640)
...
`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions