aboutsummaryrefslogtreecommitdiff
path: root/src/internal
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2024-04-18 08:51:27 -0700
committerGopher Robot <gobot@golang.org>2024-04-18 17:42:47 +0000
commitad87d4404782d816f7a4497113b6b983b45aa442 (patch)
tree9b9985f0b52ae0823ee1064f7c16e7a7309c4d7e /src/internal
parenta0205e650a2a802b82e7f924e43d4a9adfb3ac36 (diff)
downloadgo-ad87d4404782d816f7a4497113b6b983b45aa442.tar.gz
go-ad87d4404782d816f7a4497113b6b983b45aa442.zip
go/types, types2: use correct predicate when asserting comma-ok types
While at it and unrelated, up-date testdata/manual.go sample file so we can just copy its contents into a test file after debugging, without fixing the date. Fixes #66878. Change-Id: Ie49a341b78d99bdc0f1a0ba1ca42fa2d3a807bd6 Reviewed-on: https://go-review.googlesource.com/c/go/+/580075 Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Robert Findley <rfindley@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/internal')
-rw-r--r--src/internal/types/testdata/fixedbugs/issue66878.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/internal/types/testdata/fixedbugs/issue66878.go b/src/internal/types/testdata/fixedbugs/issue66878.go
new file mode 100644
index 0000000000..bd6315f9c3
--- /dev/null
+++ b/src/internal/types/testdata/fixedbugs/issue66878.go
@@ -0,0 +1,21 @@
+// Copyright 2024 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package p
+
+func _[T bool](ch chan T) {
+ var _, _ T = <-ch
+}
+
+// offending code snippets from issue
+
+func _[T ~bool](ch <-chan T) {
+ var x, ok T = <-ch
+ println(x, ok)
+}
+
+func _[T ~bool](m map[int]T) {
+ var x, ok T = m[0]
+ println(x, ok)
+}