filterAttempt attempts to filter the overloads down to a single candidate. If it succeeds, it will return true, along with the overload (in a slice for convenience) and a possible error. If it fails, it will return false and undo any filtering performed during the attempt.
( ctx *SemaContext, s *typeCheckOverloadState, attempt func(), )
| 742 | // convenience) and a possible error. If it fails, it will return false and |
| 743 | // undo any filtering performed during the attempt. |
| 744 | func filterAttempt( |
| 745 | ctx *SemaContext, s *typeCheckOverloadState, attempt func(), |
| 746 | ) (ok bool, _ []TypedExpr, _ []overloadImpl, _ error) { |
| 747 | before := s.overloadIdxs |
| 748 | attempt() |
| 749 | if len(s.overloadIdxs) == 1 { |
| 750 | ok, typedExprs, fns, err := checkReturn(ctx, s) |
| 751 | if err != nil { |
| 752 | return false, nil, nil, err |
| 753 | } |
| 754 | if ok { |
| 755 | return true, typedExprs, fns, err |
| 756 | } |
| 757 | } |
| 758 | s.overloadIdxs = before |
| 759 | return false, nil, nil, nil |
| 760 | } |
| 761 | |
| 762 | // filterOverloads filters overloads which do not satisfy the predicate. |
| 763 | func filterOverloads( |
no test coverage detected
searching dependent graphs…