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

Open
griesemer opened this issue Dec 4, 2020 · 0 comments
Open

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

griesemer opened this issue Dec 4, 2020 · 0 comments
Assignees
Milestone

Comments

@griesemer
Copy link
Contributor

@griesemer griesemer commented Dec 4, 2020

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 this to the Go1.17 milestone Dec 4, 2020
@griesemer griesemer self-assigned this Dec 4, 2020
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
1 participant
You can’t perform that action at this time.