...

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

Documentation: internal/types/testdata/fixedbugs

     1  // Copyright 2020 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 Optional[T any] struct {}
     8  
     9  func (_ Optional[T]) Val() (T, bool)
    10  
    11  type Box[T any] interface {
    12  	Val() (T, bool)
    13  }
    14  
    15  func f[V interface{}, A, B Box[V]]() {}
    16  
    17  func _() {
    18  	f[int, Optional[int], Optional[int]]()
    19  	_ = f[int, Optional[int], Optional /* ERROR "does not satisfy Box" */ [string]]
    20  	_ = f[int, Optional[int], Optional /* ERRORx "Optional.* does not satisfy Box.*" */ [string]]
    21  }
    22  

View as plain text