reject_chan_send_role.mx raw

   1  // D19 rule 5: a receive-only end cannot be written to. The role is a property
   2  // of the OPERATION, not only of the type. Legacy gets this from go/types;
   3  // stage4 accepted it and emitted a send on the receive ring, which is the
   4  // silent corruption this fixture exists to prevent.
   5  //
   6  // expected: cannot send to receive-only channel
   7  package main
   8  
   9  func bad(c <-chan int32) {
  10  	c <- 1
  11  }
  12  
  13  func main() {
  14  	select {
  15  	case <-shutdown:
  16  		return
  17  	default:
  18  	}
  19  }
  20