...

Source file src/internal/types/testdata/fixedbugs/issue43056.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  // simplified example
     8  func f[T ~func(T)](a, b T) {}
     9  
    10  type F func(F)
    11  
    12  func _() {
    13  	var i F
    14  	var j func(F)
    15  
    16  	f(i, j)
    17  	f(j, i)
    18  }
    19  
    20  // example from issue
    21  func g[T interface{ Equal(T) bool }](a, b T) {}
    22  
    23  type I interface{ Equal(I) bool }
    24  
    25  func _() {
    26  	var i I
    27  	var j interface{ Equal(I) bool }
    28  
    29  	g(i, j)
    30  	g(j, i)
    31  }
    32  

View as plain text