Source file test/typeparam/issue48030.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 Src[T any] func() Src[T]
    10  
    11  func Seq[T any]() Src[T] {
    12  	return nil
    13  }
    14  
    15  func Seq2[T1 any, T2 any](v1 T1, v2 T2) Src[T2] {
    16  	return nil
    17  }
    18  
    19  func main() {
    20  	// Type args fully supplied
    21  	Seq[int]()
    22  	// Partial inference of type args
    23  	Seq2[int](5, "abc")
    24  	// Full inference of type args
    25  	Seq2(5, "abc")
    26  }
    27  

View as plain text