github.com/xushiwei/go@v0.0.0-20130601165731-2b9d83f45bc9/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  }