Skip to content
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

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

Closed
dominikh opened this issue Aug 21, 2021 · 3 comments
Assignees
Milestone

Comments

@dominikh
Copy link
Member

@dominikh dominikh commented Aug 21, 2021

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
@danscales danscales self-assigned this Aug 23, 2021
@danscales
Copy link

@danscales danscales commented Aug 23, 2021

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.

Loading

@gopherbot
Copy link

@gopherbot gopherbot commented Aug 23, 2021

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

Loading

@gopherbot
Copy link

@gopherbot gopherbot commented Aug 24, 2021

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

Loading

@gopherbot gopherbot closed this in 5b64381 Aug 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants