Black Lives Matter. Support the Equal Justice Initiative.

Text file src/go/types/testdata/fixedbugs/issue45635.go2

Documentation: go/types/testdata/fixedbugs

     1  // Copyright 2021 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package main
     6  
     7  func main() {
     8  	some /* ERROR "undeclared name" */ [int, int]()
     9  }
    10  
    11  type N[T any] struct{}
    12  
    13  var _ N /* ERROR "0 arguments but 1 type parameters" */ []
    14  
    15  type I interface {
    16  	type map[int]int, []int
    17  }
    18  
    19  func _[T I](i, j int) {
    20  	var m map[int]int
    21  	_ = m[i, j /* ERROR "more than one index" */ ]
    22  
    23  	var a [3]int
    24  	_ = a[i, j /* ERROR "more than one index" */ ]
    25  
    26  	var s []int
    27  	_ = s[i, j /* ERROR "more than one index" */ ]
    28  
    29  	var t T
    30  	// TODO(rFindley) Fix the duplicate error below.
    31  	_ = t[i, j /* ERROR "more than one index" */ /* ERROR "more than one index" */ ]
    32  }
    33  

View as plain text