1 // expected: '+=' is not allowed for text concatenation
2 //
3 // The '+=' half of the same rule. Legacy rewrites `+=` into a concat-move for
4 // the stdlib and refuses it in user code (loader's CheckPlusOnText, AssignStmt
5 // case); stage4 had no such check at all and concatenated, so `s += b` on text
6 // compiled here and was rejected there.
7 //
8 // The operand is []byte and the operator is '+=' rather than '+', which is the
9 // only thing that distinguishes this fixture from reject_plus_text.
10 package main
11 12 func main() {
13 // Termination first: a batch program must still be stoppable, and the entry
14 // rule fires before the restriction under test, so without this the fixture
15 // reports the missing shutdown arm instead of the '+' it exists to reject.
16 select {
17 case <-shutdown:
18 return
19 default:
20 }
21 a := []byte("x")
22 b := []byte("y")
23 s := a
24 s += b
25 println(s)
26 }
27