Source file src/internal/types/testdata/fixedbugs/issue80042.go
1 // Copyright 2026 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 f[P any](_ P) {} 8 9 func _(x map[func /* ERROR "invalid map key type func(int)" */ (int)]bool) { 10 // While functions are not valid map keys, the intended type for P 11 // is still unambiguous here. Avoid "cannot use generic function f 12 // without instantiation". 13 x[f] = true 14 } 15 16 // same thinking applies through a type parameter 17 func _[P map[func /* ERROR "invalid map key type func(int)" */ (int)]bool](x P) { 18 x[f] = true 19 } 20