Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions runtime/vam/expr/logic.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,17 +201,20 @@ func FlattenBool(vec vector.Any) *vector.Bool {
}

type In struct {
lhs Evaluator
rhs Evaluator
pw *PredicateWalk
lhs Evaluator
rhs Evaluator
defuse *Defuse
pw *PredicateWalk
}

func NewIn(sctx *super.Context, lhs, rhs Evaluator) *In {
return &In{lhs, rhs, NewPredicateWalk(sctx, NewCompare(sctx, "==", nil, nil).eval)}
return &In{lhs, rhs, NewDefuse(sctx), NewPredicateWalk(sctx, NewCompare(sctx, "==", nil, nil).eval)}
}

func (i *In) Eval(this vector.Any) vector.Any {
return vector.Apply(vector.ApplyRipUnions, i.eval, i.lhs.Eval(this), i.rhs.Eval(this))
lhs := i.defuse.Eval(i.lhs.Eval(this))
rhs := i.defuse.Eval(i.rhs.Eval(this))
return vector.Apply(vector.ApplyRipUnions, i.eval, lhs, rhs)
}

func (i *In) eval(vecs ...vector.Any) vector.Any {
Expand Down
2 changes: 2 additions & 0 deletions runtime/ztests/expr/in.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ input: |
"b"::enum(b,c)
"b"::enum(b,d)
[{a:1},[2],set[3],map{4:4},"b"::enum(b,c)]
fusion([fusion(2::(int64|{a:int64}),<int64>)],<[int64]>)

output: |
true
Expand All @@ -86,6 +87,7 @@ output: |
true
false
true
true

---

Expand Down
Loading