Source file test/typeparam/issue54537.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  package main
     8  
     9  func main() {
    10  	_ = F[bool]
    11  
    12  	var x string
    13  	_ = G(x == "foo")
    14  }
    15  
    16  func F[T ~bool](x string) {
    17  	var _ T = x == "foo"
    18  }
    19  
    20  func G[T any](t T) *T {
    21  	return &t
    22  }
    23  

View as plain text