1// run 2 3// Copyright 2024 The Go Authors. All rights reserved. 4// Use of this source code is governed by a BSD-style 5// license that can be found in the LICENSE file. 6 7package main 8 9func main() { 10 ch1 := make(chan struct{}) 11 var ch2 <-chan struct{} = ch1 12 13 switch ch1 { 14 case ch2: 15 default: 16 panic("bad narrow case") 17 } 18 19 switch ch2 { 20 case ch1: 21 default: 22 panic("bad narrow switch") 23 } 24} 25