github.com/go-asm/go@v1.21.1-0.20240213172139-40c5ead50c48/types/testdata/fixedbugs/issue51339.go (about)

     1  // Copyright 2022 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  // This file is tested when running "go test -run Manual"
     6  // without source arguments. Use for one-off debugging.
     7  
     8  package p
     9  
    10  type T[P any, B *P] struct{}
    11  
    12  func (T /* ERROR "cannot use generic type" */) m0() {}
    13  
    14  // TODO(rfindley): eliminate the duplicate errors here.
    15  func ( /* ERROR "got 1 type parameter, but receiver base type declares 2" */ T /* ERROR "not enough type arguments for type" */ [_]) m1() {
    16  }
    17  func (T[_, _]) m2() {}
    18  
    19  // TODO(gri) this error is unfortunate (issue #51343)
    20  func (T /* ERROR "too many type arguments for type" */ [_, _, _]) m3() {}