Source file src/internal/types/testdata/fixedbugs/issue51339.go

     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  func (T /* ERROR "receiver declares 1 type parameter, but receiver base type declares 2" */ [_]) m1() {
    15  }
    16  func (T[_, _]) m2() {}
    17  
    18  // TODO(gri) this error is unfortunate (issue #51343)
    19  func (T /* ERROR "receiver declares 3 type parameters, but receiver base type declares 2" */ [_, _, _]) m3() {
    20  }
    21  

View as plain text