Skip to content

cmd/compile: <autogenerated>:1: cannot use .this (type *Map[int,struct{}]) as type Map[.shape.int,.shape.struct {}] in argument to Map[.shape.int,.shape.struct {}].Get #47877

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dominikh opened this issue Aug 21, 2021 · 3 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@dominikh
Copy link
Member

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

$ go version
go version devel go1.18-6e50991d2a Sat Aug 21 18:23:58 2021 +0000 linux/amd64

What did you do?

package main

type Map[K comparable, V any] struct {
	m map[K]V
}

func NewMap[K comparable, V any]() Map[K, V] {
	return Map[K, V]{m: map[K]V{}}
}

func (m Map[K, V]) Get(key K) V {
	return m.m[key]
}

func main() {
	_ = NewMap[int, struct{}]()
}

What did you see instead?

$ go build
# sandbox/sand2
<autogenerated>:1: cannot use .this (type *Map[int,struct{}]) as type Map[.shape.int,.shape.struct {}] in argument to Map[.shape.int,.shape.struct {}].Get
@dominikh dominikh added this to the Go1.18 milestone Aug 21, 2021
@dominikh dominikh added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Aug 21, 2021
@danscales danscales self-assigned this Aug 23, 2021
@danscales
Copy link
Contributor

This is related to #47713 (similarly related to a discrepancy in the naming of types, which leads to problems with wrapper generation). I'll have a fix for both in the next day or so.

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/344510 mentions this issue: cmd/compile: chnage types2 typename format to be like types1

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/344613 mentions this issue: cmd/compile: fix naming of types inside instantiations

@golang golang locked and limited conversation to collaborators Jun 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

3 participants