encoding/jsonschema: fix panic on impossible enum
When all possible values of an enum are excluded by the allowed types we
were invoking s.all.add with a nil expression which resulted in a panic.
Fix that by avoiding adding the constraint in that case: the
allowedTypes logic will catch the "impossible constraint" option when
finalize is called.
Signed-off-by: Roger Peppe <rogpeppe@gmail.com>
Change-Id: I0836d0444a24df62f6392261a5d5733387529ff6
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1199410
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>