src/internal/types/testdata/fixedbugs/issue61903.go
raw| 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 | type T[P any] interface{} |
| 10 | |
| 11 | func f1[P any](T[P]) {} |
| 12 | func f2[P any](T[P], P) {} |
| 13 | |
| 14 | func _() { |
| 15 | var t T[int] |
| 16 | f1(t) |
| 17 | |
| 18 | var s string |
| 19 | f2(t, s /* ERROR "type string of s does not match inferred type int for P" */) |
| 20 | } |