mirror of
https://github.com/golang/go
synced 2024-11-22 16:54:48 -07:00
25 lines
391 B
Go
25 lines
391 B
Go
|
// run
|
||
|
|
||
|
// 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 main
|
||
|
|
||
|
func main() {
|
||
|
ch1 := make(chan struct{})
|
||
|
var ch2 <-chan struct{} = ch1
|
||
|
|
||
|
switch ch1 {
|
||
|
case ch2:
|
||
|
default:
|
||
|
panic("bad narrow case")
|
||
|
}
|
||
|
|
||
|
switch ch2 {
|
||
|
case ch1:
|
||
|
default:
|
||
|
panic("bad narrow switch")
|
||
|
}
|
||
|
}
|