Source file src/internal/types/testdata/fixedbugs/issue58671.go

     1  // Copyright 2023 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 p
     6  
     7  func g[P any](...P) P { var x P; return x }
     8  
     9  func _() {
    10  	var (
    11  		_ int        = g(1, 2)
    12  		_ rune       = g(1, 'a')
    13  		_ float64    = g(1, 'a', 2.3)
    14  		_ float64    = g('a', 2.3)
    15  		_ complex128 = g(2.3, 'a', 1i)
    16  	)
    17  	g(true, 'a' /* ERROR "mismatched types untyped bool and untyped rune (cannot infer P)" */)
    18  	g(1, "foo" /* ERROR "mismatched types untyped int and untyped string (cannot infer P)" */)
    19  	g(1, 2.3, "bar" /* ERROR "mismatched types untyped float and untyped string (cannot infer P)" */)
    20  }
    21  

View as plain text