Black Lives Matter. Support the Equal Justice Initiative.

Text file src/go/types/testdata/check/builtins.go2

Documentation: go/types/testdata/check

     1  // Copyright 2020 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  // This file tests built-in calls on generic types.
     6  
     7  package builtins
     8  
     9  type Bmc interface {
    10  	type map[rune]string, chan int
    11  }
    12  
    13  type Bms interface {
    14  	type map[string]int, []int
    15  }
    16  
    17  type Bcs interface {
    18  	type chan bool, []float64
    19  }
    20  
    21  type Bss interface {
    22  	type []int, []string
    23  }
    24  
    25  func _[T any] () {
    26  	_ = make(T /* ERROR invalid argument */ )
    27  	_ = make(T /* ERROR invalid argument */ , 10)
    28  	_ = make(T /* ERROR invalid argument */ , 10, 20)
    29  }
    30  
    31  func _[T Bmc] () {
    32  	_ = make(T)
    33  	_ = make(T, 10)
    34  	_ = make /* ERROR expects 1 or 2 arguments */ (T, 10, 20)
    35  }
    36  
    37  func _[T Bms] () {
    38  	_ = make /* ERROR expects 2 arguments */ (T)
    39  	_ = make(T, 10)
    40  	_ = make /* ERROR expects 2 arguments */ (T, 10, 20)
    41  }
    42  
    43  func _[T Bcs] () {
    44  	_ = make /* ERROR expects 2 arguments */ (T)
    45  	_ = make(T, 10)
    46  	_ = make /* ERROR expects 2 arguments */ (T, 10, 20)
    47  }
    48  
    49  func _[T Bss] () {
    50  	_ = make /* ERROR expects 2 or 3 arguments */ (T)
    51  	_ = make(T, 10)
    52  	_ = make(T, 10, 20)
    53  }
    54  

View as plain text