typeCheckAndRequireTupleElems asserts that all elements in the Tuple are comparable to the input Expr given the input comparison operator.
( ctx context.Context, semaCtx *SemaContext, expr TypedExpr, tuple *Tuple, op ComparisonOperator, )
| 1649 | // typeCheckAndRequireTupleElems asserts that all elements in the Tuple are |
| 1650 | // comparable to the input Expr given the input comparison operator. |
| 1651 | func typeCheckAndRequireTupleElems( |
| 1652 | ctx context.Context, semaCtx *SemaContext, expr TypedExpr, tuple *Tuple, op ComparisonOperator, |
| 1653 | ) (TypedExpr, error) { |
| 1654 | tuple.typ = types.MakeTuple(make([]*types.T, len(tuple.Exprs))) |
| 1655 | for i, subExpr := range tuple.Exprs { |
| 1656 | // Require that the sub expression is comparable to the required type. |
| 1657 | _, rightTyped, _, _, err := typeCheckComparisonOp(ctx, semaCtx, op, expr, subExpr) |
| 1658 | if err != nil { |
| 1659 | return nil, err |
| 1660 | } |
| 1661 | tuple.Exprs[i] = rightTyped |
| 1662 | tuple.typ.TupleContents()[i] = rightTyped.ResolvedType() |
| 1663 | } |
| 1664 | return tuple, nil |
| 1665 | } |
| 1666 | |
| 1667 | func typeCheckAndRequireBoolean( |
| 1668 | ctx context.Context, semaCtx *SemaContext, expr Expr, op string, |
no test coverage detected