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

     1  // errorcheck
     2  
     3  // Copyright 2010 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  // This is a test case for issue 804.
     8  
     9  package main
    10  
    11  func f() [10]int {
    12  	return [10]int{}
    13  }
    14  
    15  var m map[int][10]int
    16  
    17  func main() {
    18  	f()[1] = 2	// ERROR "cannot|invalid"
    19  	f()[2:3][0] = 4	// ERROR "cannot|addressable"
    20  	var x = "abc"
    21  	x[2] = 3	// ERROR "cannot|invalid"
    22  	m[0][5] = 6  // ERROR "cannot|invalid"
    23  }