// If a constraint has a structural type, unify the corresponding type parameter with it.
for _, tpar := range tparams {
- typ := tpar
sbound := structure(tpar)
if sbound != nil {
// If the structural type is the underlying type of a single
if named, _ := tpar.singleType().(*Named); named != nil {
sbound = named
}
- if !u.unify(typ, sbound) {
- check.errorf(tpar.obj, "%s does not match %s", tpar.obj, sbound)
+ if !u.unify(tpar, sbound) {
+ // TODO(gri) improve error message by providing the type arguments
+ // which we know already
+ check.errorf(tpar.obj, "%s does not match %s", tpar, sbound)
return nil, 0
}
}
package issue45985
// TODO(gri): this error should be on app[int] below.
-func app[S /* ERROR "type S S does not match" */ interface{ ~[]T }, T any](s S, e T) S {
+func app[S /* ERROR "S does not match" */ interface{ ~[]T }, T any](s S, e T) S {
return append(s, e)
}