github.com/go-asm/go@v1.21.1-0.20240213172139-40c5ead50c48/types/testdata/fixedbugs/issue44799.go (about)

     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 main
     6  
     7  func Map[F, T any](s []F, f func(F) T) []T { return nil }
     8  
     9  func Reduce[Elem1, Elem2 any](s []Elem1, initializer Elem2, f func(Elem2, Elem1) Elem2) Elem2 { var x Elem2; return x }
    10  
    11  func main() {
    12  	var s []int
    13  	var f1 func(int) float64
    14  	var f2 func(float64, int) float64
    15  	_ = Map[int](s, f1)
    16  	_ = Map(s, f1)
    17  	_ = Reduce[int](s, 0, f2)
    18  	_ = Reduce(s, 0, f2)
    19  }