Skip to content

x/tools/go/ssa: panic: variadic parameter must be of unnamed slice type #54946

@visualfc

Description

@visualfc

What version of Go are you using (go version)?

$ go version
go version go1.18.4 darwin/amd64

Does this issue reproduce with the latest release?

What operating system and processor architecture are you using (go env)?

go env Output
$ go env

What did you do?

Input program: $GOROOT/test/typeparam/issue376214.go

package main

func add[S ~string | ~[]byte](buf *[]byte, s S) {
	*buf = append(*buf, s...)
}

func main() {
	var buf []byte
	add(&buf, "foo")
	add(&buf, []byte("bar"))
	if string(buf) != "foobar" {
		panic("got " + string(buf))
	}
}

I run it with ssadump -build=G issue376214.go

What did you expect to see?

I expect it pass.

What did you see instead?

panic: variadic parameter must be of unnamed slice type

goroutine 1 [running]:
go/types.NewSignatureType(0x0, {0x0, 0x0, 0x0}, {0x0, 0x0, 0x0}, 0xc00000d908, 0xc00000d758, 0x1)
	$home/myproj/go/src/go/types/signature.go:53 +0x29e
golang.org/x/tools/internal/typeparams.NewSignatureType(...)
	$home/myproj/tools/internal/typeparams/typeparams_go118.go:55
golang.org/x/tools/go/ssa.(*subster).signature(0x1286b00?, 0xc0002de200)
	$home/myproj/tools/go/ssa/subst.go:372 +0xd2
....

Metadata

Metadata

Assignees

No one assigned

    Labels

    AnalysisIssues related to static analysis (vet, x/tools/go/analysis)FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.ToolsThis label describes issues relating to any tools in the x/tools repository.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions