aboutsummaryrefslogtreecommitdiff
path: root/test/range3.go
AgeCommit message (Collapse)Author
2023-12-01cmd/compile: fix typecheck range over rune literalCuong Manh Le
With range over int, the rune literal in range expression will be left as untyped rune, but idealType is not handling this case, causing ICE. Fixing this by setting the concrete type for untyped rune expresison. Fixes #64471 Change-Id: I07a151c54ea1d9e1b92e4d96cdfb6e73dca13862 Reviewed-on: https://go-review.googlesource.com/c/go/+/546296 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2023-11-02test: run range-over-integer tests without need for -goexperimentRobert Griesemer
Move the range-over-function tests into range4.go. Change-Id: Idccf30a0c7d7e8d2a17fb1c5561cf21e00506135 Reviewed-on: https://go-review.googlesource.com/c/go/+/539095 Reviewed-by: Cherry Mui <cherryyz@google.com> Auto-Submit: Robert Griesemer <gri@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@google.com> Run-TryBot: Robert Griesemer <gri@google.com>
2023-10-09cmd/compile: fix typecheck range over negative integerCuong Manh Le
Before range over integer, types2 leaves constant expression in RHS of non-constant shift untyped, so idealType do the validation to ensure that constant value must be an int >= 0. With range over int, the range expression can also be left untyped, and can be an negative integer, causing the validation false. Fixing this by relaxing the validation in idealType, and moving the check to Unified IR reader. Fixes #63378 Change-Id: I43042536c09afd98d52c5981adff5dbc5e7d882a Reviewed-on: https://go-review.googlesource.com/c/go/+/532835 Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@golang.org>
2023-09-20cmd/compile: implement range over funcRuss Cox
Add compiler support for range over functions. See the large comment at the top of cmd/compile/internal/rangefunc/rewrite.go for details. This is only reachable if GOEXPERIMENT=range is set, because otherwise type checking will fail. For proposal #61405 (but behind a GOEXPERIMENT). For #61717. Change-Id: I05717f94e63089c503acc49b28b47edeb4e011b4 Reviewed-on: https://go-review.googlesource.com/c/go/+/510541 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Auto-Submit: Russ Cox <rsc@golang.org>
2023-09-20cmd/compile: implement range over integerRuss Cox
Add compiler implementation of range over integers. This is only reachable if GOEXPERIMENT=range is set, because otherwise type checking will fail. For proposal #61405 (but behind a GOEXPERIMENT). For #61717. Change-Id: I4e35a73c5df1ac57f61ffb54033a433967e5be51 Reviewed-on: https://go-review.googlesource.com/c/go/+/510538 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Auto-Submit: Russ Cox <rsc@golang.org>