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/internal/types2: valid shifts are not accepted #42989

Closed
griesemer opened this issue Dec 4, 2020 · 2 comments
Closed

cmd/compile/internal/types2: valid shifts are not accepted #42989

griesemer opened this issue Dec 4, 2020 · 2 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@griesemer
Copy link
Contributor

For the code

package p
func _(s uint) {
	var m map[int]string
	delete(m, 1<<s)
	delete(m, 1.<<s)
}

the type checker reports

x.go:4:12: invalid argument: 1 << s (untyped int value) is not assignable to int
x.go:5:12: invalid argument: 1. << s (untyped float value) is not assignable to int

go/types and the compiler accept this.

@griesemer griesemer added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Dec 4, 2020
@griesemer griesemer added this to the Go1.17 milestone Dec 4, 2020
@griesemer griesemer self-assigned this Dec 4, 2020
@gopherbot
Copy link

Change https://golang.org/cl/303090 mentions this issue: go/types, types2: add a test case for shifts that used to fail

@griesemer
Copy link
Contributor Author

This appears to work now. Closing.

Will add test cases (https://golang.org/cl/303090).

gopherbot pushed a commit that referenced this issue Mar 23, 2021
For #42989.

Change-Id: Ic354edde23ed7bfb4cb3eec2794f7213ed862b47
Reviewed-on: https://go-review.googlesource.com/c/go/+/303090
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
@golang golang locked and limited conversation to collaborators Mar 18, 2022
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

2 participants