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

     1  // -lang=go1.20
     2  
     3  // Copyright 2023 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 p
     8  
     9  func g[P any](P)      {}
    10  func h[P, Q any](P) Q { panic(0) }
    11  
    12  var _ func(int) = g /* ERROR "implicitly instantiated function in assignment requires go1.21 or later" */
    13  var _ func(int) string = h[ /* ERROR "partially instantiated function in assignment requires go1.21 or later" */ int]
    14  
    15  func f1(func(int))      {}
    16  func f2(int, func(int)) {}
    17  
    18  func _() {
    19  	f1(g /* ERROR "implicitly instantiated function as argument requires go1.21 or later" */)
    20  	f2(0, g /* ERROR "implicitly instantiated function as argument requires go1.21 or later" */)
    21  }
    22  

View as plain text