...

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

Documentation: internal/types/testdata/fixedbugs

     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          _ = T0(nil /* ERROR "cannot convert nil to type T0" */ )
    13          _ = T1(1 /* ERRORx `cannot convert 1 .* to type T1` */ )
    14          _ = T2(2 /* ERRORx `cannot convert 2 .* to type T2` */ )
    15  }
    16  
    17  // test case from issue
    18  func f[T interface{[]int}]() {
    19  	_ = T(1 /* ERROR "cannot convert" */ )
    20  }
    21  

View as plain text