(n *InferenceState, sources []*Type, targets []*Type, matches func(c *Checker, s *Type, t *Type) bool)
| 391 | } |
| 392 | |
| 393 | func (c *Checker) inferFromMatchingTypes(n *InferenceState, sources []*Type, targets []*Type, matches func(c *Checker, s *Type, t *Type) bool) ([]*Type, []*Type) { |
| 394 | var matchedSources []*Type |
| 395 | var matchedTargets []*Type |
| 396 | for _, t := range targets { |
| 397 | for _, s := range sources { |
| 398 | if matches(c, s, t) { |
| 399 | c.inferFromTypes(n, s, t) |
| 400 | matchedSources = core.AppendIfUnique(matchedSources, s) |
| 401 | matchedTargets = core.AppendIfUnique(matchedTargets, t) |
| 402 | } |
| 403 | } |
| 404 | } |
| 405 | if len(matchedSources) != 0 { |
| 406 | sources = core.Filter(sources, func(t *Type) bool { return !slices.Contains(matchedSources, t) }) |
| 407 | } |
| 408 | if len(matchedTargets) != 0 { |
| 409 | targets = core.Filter(targets, func(t *Type) bool { return !slices.Contains(matchedTargets, t) }) |
| 410 | } |
| 411 | return sources, targets |
| 412 | } |
| 413 | |
| 414 | func (c *Checker) inferToMultipleTypes(n *InferenceState, source *Type, targets []*Type, targetFlags TypeFlags) { |
| 415 | typeVariableCount := 0 |
no test coverage detected