cue: add IsIncomplete for checking for incomplete errors
Currently `Value.Err` returns a non-nil error for incomplete errors,
even though it might be possible for the value to become complete later.
That isn't great, particularly when we want to unmarshal non-concrete
values into Go structs.
We could potentially change `Value.Err` so that it returns nil in such
cases, but that seems like a potentially dangerous change and might well
break existing clientrs.
Instead we add an `IsIncomplete` function to determine if an error _is_
an incomplete error, and use it inside `Value.Decode` so that we allow
decoding incomplete values when we're decoding into a CUE value.
Signed-off-by: Roger Peppe <rogpeppe@gmail.com>
Change-Id: Ia6ddffe226be9f4dd7843915a1cc5f3ed88d33dd
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1229425
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
Reviewed-by: Marcel van Lohuizen <mpvl@gmail.com>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>