reject_chan_recv_role.mx raw

   1  // D19 rule 5, the reader's side: a send-only end cannot be read. This is the
   2  // statement that turns "I have a capability to send" into "I can drain the
   3  // peer's messages", which is exactly the authority confusion A2 forbids.
   4  //
   5  // expected: cannot receive from send-only channel
   6  package main
   7  
   8  func bad(c chan<- int32) (v int32) {
   9  	v = <-c
  10  	return
  11  }
  12  
  13  func main() {
  14  	select {
  15  	case <-shutdown:
  16  		return
  17  	default:
  18  	}
  19  }
  20