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

go/types, types2: duplicate key not detected for map composite literals with certain generic key types #51610

Open
griesemer opened this issue Mar 11, 2022 · 2 comments
Assignees
Labels
NeedsFix
Milestone

Comments

@griesemer
Copy link
Contributor

@griesemer griesemer commented Mar 11, 2022

func f[P int | float64]() {
	m := map[P]int{0: 1, 0.0: 2}
	fmt.Println(m)
}

should report a duplicate key: both 0 and 0.0 will be mapped to the same entry at run time

cc: findleyr

@griesemer griesemer added the NeedsFix label Mar 11, 2022
@griesemer griesemer added this to the Go1.19 milestone Mar 11, 2022
@griesemer griesemer self-assigned this Mar 11, 2022
@thepudds
Copy link

@thepudds thepudds commented Mar 11, 2022

@gopherbot
Copy link

@gopherbot gopherbot commented May 17, 2022

Change https://go.dev/cl/406555 mentions this issue: types2: detect dupl. map keys in comp. literals with generic key type

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsFix
Projects
None yet
Development

No branches or pull requests

3 participants