Text file src/go/types/testdata/fixedbugs/issue49296.go2

     1  // Copyright 2021 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  func _[
     8          T0 any,
     9          T1 []int,
    10          T2 ~float64 | ~complex128 | chan int,
    11  ]() {
    12  	// TODO(rfindley): the types2 error here is clearer.
    13          _ = T0(nil /* ERROR cannot convert nil to T0 */ )
    14          _ = T1(1 /* ERROR cannot convert 1 .* to T1 */ )
    15          _ = T2(2 /* ERROR cannot convert 2 .* to T2 */ )
    16  }
    17  
    18  // test case from issue
    19  func f[T interface{[]int}]() {
    20  	_ = T(1 /* ERROR cannot convert */ )
    21  }
    22  

View as plain text