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

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

Closed
alandonovan opened this issue Oct 21, 2018 · 0 comments
Closed

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

alandonovan opened this issue Oct 21, 2018 · 0 comments

Comments

@alandonovan
Copy link
Contributor

alandonovan commented Oct 21, 2018

$ 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)
...
`
alandonovan pushed a commit that referenced this issue Oct 21, 2018
Fixes #135

Change-Id: I5a0f2fbccdaae8ab0327e8e74241903ea0e03c53
alandonovan pushed a commit that referenced this issue Oct 22, 2018
Fixes #135

Change-Id: Ic0a58734929262cc2b56305172c6572cb57f4803
alandonovan pushed a commit that referenced this issue Oct 22, 2018
* skylark: fix a crash in call f(*args, named=value)

Fixes #135
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant