Source file test/typeparam/mdempsky/18.go
1 // run 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 // Test that implicit conversions to interface type in a select/case 8 // clause are compiled correctly. 9 10 package main 11 12 import "fmt" 13 14 func main() { f[int]() } 15 16 func f[T any]() { 17 ch := make(chan T) 18 close(ch) 19 20 var i, ok any 21 select { 22 case i, ok = <-ch: 23 } 24 25 fmt.Printf("%T %T\n", i, ok) 26 } 27