Skip to content

Empty structs aren't decoded correctly in function arguments. #59

@dallbee

Description

@dallbee

This is a pretty minor thing, but it confused me enough to make me want to fix it, unless its a harder problem than I'm realizing.

Empty structs are decoded as ..., `` or sometimes as unknown.

I'd be happy to take a stab at this tonight if this is indeed a bug.

Examples:

//go:noinline
func Foo(x struct{}) {
	panic("test")
}

func TestFoo(t *testing.T) {
	Foo(struct{}{})
}

Results in:

1: running [Created by testing.(*T).Run @ testing.go:1238]
    testing testing.go:1143    tRunner.func1.2(*T(#1), func(#2))
    testing testing.go:1146    tRunner.func1(*T(#3))
            panic.go:965       panic(interface{}(#1))
    pp ppl_test.go:16 Foo()
    pp pp_test.go:20 TestFoo(*T(#3))
    testing testing.go:1193    tRunner(*T(#3), func(0x8952b8))
exit status 2

And

//go:noinline
func Foo(x chan struct{}) {
	panic("test")
}

func TestFoo(t *testing.T) {
	Foo(nil)
}

Results in:

1: running [Created by testing.(*T).Run @ testing.go:1238]
    testing testing.go:1143    tRunner.func1.2(*T(#1), func(#2))
    testing testing.go:1146    tRunner.func1(*T(#3))
            panic.go:965       panic(interface{}(#1))
    pp ppl_test.go:16 Foo(chan <unknown>(0x0))
    pp pp_test.go:20 TestFoo(*T(#3))
    testing testing.go:1193    tRunner(*T(#3), func(0x8952b8))
exit status 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions