summaryrefslogtreecommitdiffstats
path: root/test/typeparam/mdempsky/18.go
blob: f4a4ec73c5eb6e35e84510ec165c58bd9e80e466 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// run

// Copyright 2022 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// Test that implicit conversions to interface type in a select/case
// clause are compiled correctly.

package main

import "fmt"

func main() { f[int]() }

func f[T any]() {
	ch := make(chan T)
	close(ch)

	var i, ok any
	select {
	case i, ok = <-ch:
	}

	fmt.Printf("%T %T\n", i, ok)
}