Source file test/fixedbugs/issue56923.go

     1  // compile
     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  
     7  package p
     8  
     9  type Eq[T any] interface {
    10  	Eqv(a T, b T) bool
    11  }
    12  
    13  type EqFunc[T any] func(a, b T) bool
    14  
    15  func (r EqFunc[T]) Eqv(a, b T) bool {
    16  	return r(a, b)
    17  }
    18  
    19  func New[T any](f func(a, b T) bool) Eq[T] {
    20  	return EqFunc[T](f)
    21  }
    22  
    23  func Equal(a, b []byte) bool {
    24  	return string(a) == string(b)
    25  }
    26  
    27  var Bytes Eq[[]byte] = New(Equal)
    28  

View as plain text