Skip to content

cmd/compile: type parameter strings are reported inconsistently #49547

@rogpeppe

Description

@rogpeppe
go version devel go1.18-1ec51087e5 Thu Nov 11 07:03:15 2021 +0000 linux/amd64

I ran the following code: https://gotipplay.golang.org/p/zJqSyWEKLMD

package main

import "fmt"

type foo int

func main() {
	fmt.Printf("%T\n", foo(0))
	f := F[foo]{}
	fmt.Printf("%T\n", f)
}

type F[T any] struct {
}

It prints:

main.foo
main.F["".foo]

I'd expect it to print:

main.foo
main.F[main.foo]

i.e. it should report the type parameter string in the same way that it's reported when the type isn't a parameter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.genericsIssue is related to generics

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions