...

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

Documentation: internal/types/testdata/fixedbugs

     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  package p
     6  
     7  type RC[RG any] interface {
     8  	~[]RG
     9  }
    10  
    11  type Fn[RCT RC[RG], RG any] func(RCT)
    12  
    13  type F[RCT RC[RG], RG any] interface {
    14  	Fn() Fn /* ERROR "not enough type arguments for type Fn: have 1, want 2" */ [RCT]
    15  }
    16  
    17  type concreteF[RCT RC[RG], RG any] struct {
    18  	makeFn func() Fn /* ERROR "not enough type arguments for type Fn: have 1, want 2" */ [RCT]
    19  }
    20  
    21  func (c *concreteF[RCT, RG]) Fn() Fn /* ERROR "not enough type arguments for type Fn: have 1, want 2" */ [RCT] {
    22  	return c.makeFn()
    23  }
    24  
    25  func NewConcrete[RCT RC[RG], RG any](Rc RCT) F /* ERROR "not enough type arguments for type F: have 1, want 2" */ [RCT] {
    26  	// TODO(rfindley): eliminate the duplicate error below.
    27  	return & /* ERRORx `cannot use .* as F\[RCT\]` */ concreteF /* ERROR "not enough type arguments for type concreteF: have 1, want 2" */ [RCT]{
    28  		makeFn: nil,
    29  	}
    30  }
    31  

View as plain text