Skip to content

Commit 6b7ecea

Browse files
Remove non-functional optional test in field selection (#1161)
1 parent 94b45f0 commit 6b7ecea

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

‎cel/cel_test.go‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2669,6 +2669,22 @@ func TestOptionalValuesEval(t *testing.T) {
26692669
in map[string]any
26702670
out any
26712671
}{
2672+
{
2673+
expr: `has({'foo': optional.none()}.foo)`,
2674+
out: types.True,
2675+
},
2676+
{
2677+
expr: `has({'foo': optional.none()}.foo.value)`,
2678+
out: types.False,
2679+
},
2680+
{
2681+
expr: `has({?'foo': optional.none()}.foo)`,
2682+
out: types.False,
2683+
},
2684+
{
2685+
expr: `has({?'foo': optional.none()}.foo.value)`,
2686+
out: "no such key: foo",
2687+
},
26722688
{
26732689
expr: `{}.?invalid`,
26742690
out: types.OptionalNone,

‎interpreter/interpretable.go‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,6 @@ func (q *testOnlyQualifier) Qualify(vars Activation, obj any) (any, error) {
194194
if unk, isUnk := out.(types.Unknown); isUnk {
195195
return unk, nil
196196
}
197-
if opt, isOpt := out.(types.Optional); isOpt {
198-
return opt.HasValue(), nil
199-
}
200197
return present, nil
201198
}
202199

0 commit comments

Comments
 (0)