(adapter types.Adapter, ev *valuepb.ExprValue)
| 146 | } |
| 147 | |
| 148 | func exprValueToRefValue(adapter types.Adapter, ev *valuepb.ExprValue) (ref.Val, error) { |
| 149 | switch ev.Kind.(type) { |
| 150 | case *valuepb.ExprValue_Value: |
| 151 | return cel.ProtoAsValue(adapter, ev.GetValue()) |
| 152 | case *valuepb.ExprValue_Error: |
| 153 | // An error ExprValue is a repeated set of statuspb.Status |
| 154 | // messages, with no convention for the status details. |
| 155 | // To convert this to a types.Err, we need to convert |
| 156 | // these Status messages to a single string, and be |
| 157 | // able to decompose that string on output so we can |
| 158 | // round-trip arbitrary ExprValue messages. |
| 159 | // TODO(jimlarson) make a convention for this. |
| 160 | return types.NewErr("XXX add details later"), nil |
| 161 | case *valuepb.ExprValue_Unknown: |
| 162 | var unk *types.Unknown |
| 163 | for _, id := range ev.GetUnknown().GetExprs() { |
| 164 | if unk == nil { |
| 165 | unk = types.NewUnknown(id, nil) |
| 166 | } |
| 167 | unk = types.MergeUnknowns(types.NewUnknown(id, nil), unk) |
| 168 | } |
| 169 | return unk, nil |
| 170 | } |
| 171 | return nil, errors.New("unknown ExprValue kind") |
| 172 | } |
| 173 | |
| 174 | func diffType(want proto.Message, t *cel.Type) (string, error) { |
| 175 | got, err := types.TypeToProto(t) |
no test coverage detected