Skip to content

type parameter can not infer the shared underlying type (unsure if bug or feature request) #52260

@dans-stuff

Description

@dans-stuff

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

$ go version
go version go1.18 darwin/arm64

Does this issue reproduce with the latest release?

Yes

What did you do?

https://go.dev/play/p/TR_hVFrldXH

What did you expect to see?

I expect the compiler to infer that A and B have the same underlying type.

This expectation comes from being able to pass an A{}, and a map[string]int{} and having the underlying type correctly inferred, and from being able to specify the underlying type manually to overcome the failed inference.

What did you see instead?

I get a compile error type B of B{} does not match inferred type A for M

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions