Source file test/typeparam/issue47901.go

     1  // run
     2  
     3  // Copyright 2021 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  package main
     8  
     9  type Chan[T any] chan Chan[T]
    10  
    11  func (ch Chan[T]) recv() Chan[T] {
    12  	return <-ch
    13  }
    14  
    15  func main() {
    16  	ch := Chan[int](make(chan Chan[int]))
    17  	go func() {
    18  		ch <- make(Chan[int])
    19  	}()
    20  	ch.recv()
    21  }
    22  

View as plain text