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: compiler accepts range over int for any language version #64704

Closed
griesemer opened this issue Dec 13, 2023 · 1 comment
Closed
Assignees
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@griesemer
Copy link
Contributor

Go version

go version devel go1.22-27f02a1d25 Tue Dec 12 21:19:47 2023 -0800 darwin/amd64

What operating system and processor architecture are you using (go env)?

Not relevant. This is just a bug in the typechecker.

What did you do?

Compiled the following program (x.go) with: go tool compile -lang=go1.21.

package main

func main() {
	for range 10 {
	}
}

What did you expect to see?

An error: range over integers is only permitted with go1.22 and up.

What did you see instead?

No error.

@griesemer griesemer added the NeedsFix The path to resolution is known, but the work has not been done. label Dec 13, 2023
@griesemer griesemer added this to the Go1.22 milestone Dec 13, 2023
@griesemer griesemer self-assigned this Dec 13, 2023
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Dec 13, 2023
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/549459 mentions this issue: go/types, types2: report error for range over int if Go version < 1.22

ezz-no pushed a commit to ezz-no/go-ezzno that referenced this issue Feb 18, 2024
Fixes golang#64704.

Change-Id: Ied3af46ab534343cdafba5ee27680b9c6ef3d37a
Reviewed-on: https://go-review.googlesource.com/c/go/+/549459
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

2 participants