ensureExpectedType will return an error if a datum does not match the provided type. If the expected type is Any or if the datum is a Null type, then no error will be returned.
(exp *types.T, d Datum)
| 4118 | // provided type. If the expected type is Any or if the datum is a Null |
| 4119 | // type, then no error will be returned. |
| 4120 | func ensureExpectedType(exp *types.T, d Datum) error { |
| 4121 | if !(exp.Family() == types.AnyFamily || d.ResolvedType().Family() == types.UnknownFamily || |
| 4122 | d.ResolvedType().Equivalent(exp)) { |
| 4123 | return errors.AssertionFailedf( |
| 4124 | "expected return type %q, got: %q", errors.Safe(exp), errors.Safe(d.ResolvedType())) |
| 4125 | } |
| 4126 | return nil |
| 4127 | } |
| 4128 | |
| 4129 | // Eval implements the TypedExpr interface. |
| 4130 | func (expr *IfErrExpr) Eval(ctx *EvalContext) (Datum, error) { |
no test coverage detected
searching dependent graphs…