defaultTypeCheck type checks the constant and placeholder expressions without a preference and adds them to the type checked slice.
( ctx context.Context, semaCtx *SemaContext, s *typeCheckOverloadState, errorOnPlaceholders bool, )
| 786 | // defaultTypeCheck type checks the constant and placeholder expressions without a preference |
| 787 | // and adds them to the type checked slice. |
| 788 | func defaultTypeCheck( |
| 789 | ctx context.Context, semaCtx *SemaContext, s *typeCheckOverloadState, errorOnPlaceholders bool, |
| 790 | ) error { |
| 791 | for _, i := range s.constIdxs { |
| 792 | typ, err := s.exprs[i].TypeCheck(ctx, semaCtx, types.Any) |
| 793 | if err != nil { |
| 794 | return pgerror.Wrapf(err, pgcode.InvalidParameterValue, |
| 795 | "error type checking constant value") |
| 796 | } |
| 797 | s.typedExprs[i] = typ |
| 798 | } |
| 799 | for _, i := range s.placeholderIdxs { |
| 800 | if errorOnPlaceholders { |
| 801 | _, err := s.exprs[i].TypeCheck(ctx, semaCtx, types.Any) |
| 802 | return err |
| 803 | } |
| 804 | // If we dont want to error on args, avoid type checking them without a desired type. |
| 805 | s.typedExprs[i] = StripParens(s.exprs[i]).(*Placeholder) |
| 806 | } |
| 807 | return nil |
| 808 | } |
| 809 | |
| 810 | // checkReturn checks the number of remaining overloaded function |
| 811 | // implementations. |
no test coverage detected