src/internal/types/testdata/fixedbugs/issue66878.go
raw| 1 | // Copyright 2024 The Go Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
| 5 | package p |
| 6 | |
| 7 | func _[T bool](ch chan T) { |
| 8 | var _, _ T = <-ch |
| 9 | } |
| 10 | |
| 11 | // offending code snippets from issue |
| 12 | |
| 13 | func _[T ~bool](ch <-chan T) { |
| 14 | var x, ok T = <-ch |
| 15 | println(x, ok) |
| 16 | } |
| 17 | |
| 18 | func _[T ~bool](m map[int]T) { |
| 19 | var x, ok T = m[0] |
| 20 | println(x, ok) |
| 21 | } |