Skip to content

cmd/compile: compiler accepts range over int for any language version #64704

@griesemer

Description

@griesemer

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.

Metadata

Metadata

Assignees

Labels

FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.compiler/runtimeIssues related to the Go compiler and/or runtime.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions