Source file test/typeparam/issue51233.go

     1  // errorcheck
     2  
     3  // Copyright 2022 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  package p
     7  
     8  // As of issue #51527, type-type inference has been disabled.
     9  
    10  type RC[RG any] interface {
    11  	~[]RG
    12  }
    13  
    14  type Fn[RCT RC[RG], RG any] func(RCT)
    15  
    16  type FFn[RCT RC[RG], RG any] func() Fn[RCT] // ERROR "not enough type arguments for type Fn: have 1, want 2"
    17  
    18  type F[RCT RC[RG], RG any] interface {
    19  	Fn() Fn[RCT] // ERROR "not enough type arguments for type Fn: have 1, want 2"
    20  }
    21  
    22  type concreteF[RCT RC[RG], RG any] struct {
    23  	makeFn FFn[RCT] // ERROR "not enough type arguments for type FFn: have 1, want 2"
    24  }
    25  
    26  func (c *concreteF[RCT, RG]) Fn() Fn[RCT] { // ERROR "not enough type arguments for type Fn: have 1, want 2"
    27  	return c.makeFn()
    28  }
    29  

View as plain text