modernc.org/gc@v1.0.1-0.20240304020402-f0dba7c97c2b/testdata/errchk/test/fixedbugs/bug249.go (about)

     1  // errorcheck
     2  
     3  // Copyright 2009 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  
     7  package main
     8  
     9  var c1 chan <- chan int = (chan<- (chan int))(nil)
    10  var c2 chan <- chan int = (chan (<-chan int))(nil)  // ERROR "chan|incompatible"
    11  var c3 <- chan chan int = (<-chan (chan int))(nil)
    12  var c4 chan chan <- int = (chan (chan<- int))(nil)
    13  
    14  var c5 <- chan <- chan int = (<-chan (<-chan int))(nil)
    15  var c6 chan <- <- chan int = (chan<- (<-chan int))(nil)
    16  var c7 chan <- chan <- int = (chan<- (chan<- int))(nil)
    17  
    18  var c8 <- chan <- chan chan int = (<-chan (<-chan (chan int)))(nil)
    19  var c9 <- chan chan <- chan int = (<-chan (chan<- (chan int)))(nil)
    20  var c10 chan <- <- chan chan int = (chan<- (<-chan (chan int)))(nil)
    21  var c11 chan <- chan <- chan int = (chan<- (chan<- (chan int)))(nil)
    22  var c12 chan chan <- <- chan int = (chan (chan<- (<-chan int)))(nil)
    23  var c13 chan chan <- chan <- int = (chan (chan<- (chan<- int)))(nil)
    24  
    25  var r1 chan<- (chan int) = (chan <- chan int)(nil)
    26  var r2 chan (<-chan int) = (chan <- chan int)(nil)  // ERROR "chan|incompatible"
    27  var r3 <-chan (chan int) = (<- chan chan int)(nil)
    28  var r4 chan (chan<- int) = (chan chan <- int)(nil)
    29  
    30  var r5 <-chan (<-chan int) = (<- chan <- chan int)(nil)
    31  var r6 chan<- (<-chan int) = (chan <- <- chan int)(nil)
    32  var r7 chan<- (chan<- int) = (chan <- chan <- int)(nil)
    33  
    34  var r8 <-chan (<-chan (chan int)) = (<- chan <- chan chan int)(nil)
    35  var r9 <-chan (chan<- (chan int)) = (<- chan chan <- chan int)(nil)
    36  var r10 chan<- (<-chan (chan int)) = (chan <- <- chan chan int)(nil)
    37  var r11 chan<- (chan<- (chan int)) = (chan <- chan <- chan int)(nil)
    38  var r12 chan (chan<- (<-chan int)) = (chan chan <- <- chan int)(nil)
    39  var r13 chan (chan<- (chan<- int)) = (chan chan <- chan <- int)(nil)