package p
-func f1[M1 map[K1]int, K1 comparable](m1 M1) {}
+// The core type of M2 unifies with the type of m1
+// during function argument type inference.
+// M2's constraint is unnamed.
+func f1[K1 comparable, E1 any](m1 map[K1]E1) {}
-func f2[M2 map[K2]int, K2 comparable](m2 M2) {
+func f2[M2 map[string]int](m2 M2) {
f1(m2)
}
+// The core type of M3 unifies with the type of m1
+// during function argument type inference.
+// M3's constraint is named.
+type Map3 map[string]int
+
+func f3[M3 Map3](m3 M3) {
+ f1(m3)
+}
+
+// The core type of M5 unifies with the core type of M4
+// during constraint type inference.
+func f4[M4 map[K4]int, K4 comparable](m4 M4) {}
+
+func f5[M5 map[K5]int, K5 comparable](m5 M5) {
+ f4(m5)
+}
+
// test case from issue
func Copy[MC ~map[KC]VC, KC comparable, VC any](dst, src MC) {
// parameter P ("x" side), but the argument type P must be left alone so
// that unification resolves the type parameter P to P.
//
-// For bidirection unification, both sets are provided. This enables
+// For bidirectional unification, both sets are provided. This enables
// unification to go from argument to parameter type and vice versa.
// For constraint type inference, we use bidirectional unification
// where both the x and y type parameters are identical. This is done
package p
-func f1[M1 map[K1]int, K1 comparable](m1 M1) {}
+// The core type of M2 unifies with the type of m1
+// during function argument type inference.
+// M2's constraint is unnamed.
+func f1[K1 comparable, E1 any](m1 map[K1]E1) {}
-func f2[M2 map[K2]int, K2 comparable](m2 M2) {
+func f2[M2 map[string]int](m2 M2) {
f1(m2)
}
+// The core type of M3 unifies with the type of m1
+// during function argument type inference.
+// M3's constraint is named.
+type Map3 map[string]int
+
+func f3[M3 Map3](m3 M3) {
+ f1(m3)
+}
+
+// The core type of M5 unifies with the core type of M4
+// during constraint type inference.
+func f4[M4 map[K4]int, K4 comparable](m4 M4) {}
+
+func f5[M5 map[K5]int, K5 comparable](m5 M5) {
+ f4(m5)
+}
+
// test case from issue
func Copy[MC ~map[KC]VC, KC comparable, VC any](dst, src MC) {
// parameter P ("x" side), but the argument type P must be left alone so
// that unification resolves the type parameter P to P.
//
-// For bidirection unification, both sets are provided. This enables
+// For bidirectional unification, both sets are provided. This enables
// unification to go from argument to parameter type and vice versa.
// For constraint type inference, we use bidirectional unification
// where both the x and y type parameters are identical. This is done