| 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 |
type String string |
| 8 |
|
| 9 |
func g[P any](P, string) {} |
| 10 |
|
| 11 |
// String and string are not identical and thus must not unify |
| 12 |
// (they are element types of the func type and therefore must |
| 13 |
// be identical to match). |
| 14 |
// The result is an error from type inference, rather than an |
| 15 |
// error from an assignment mismatch. |
| 16 |
var f func(int, String) = g // ERROR "inferred type func(int, string) for func(P, string) does not match type func(int, String) of f" |