Skip to content

Commit

Permalink
internal/core/adt: unwrap ConjunctGroup in EnvExpr
Browse files Browse the repository at this point in the history
This does not seem to change anything, but it seems
that this is strictly a better thing to do and could prevent
bugs down the line.

Issue #2884

Signed-off-by: Marcel van Lohuizen <mpvl@gmail.com>
Change-Id: I3b3673be258fd1d0ddfe7788531fbde9e170cf15
  • Loading branch information
mpvl committed May 8, 2024
1 parent e2bf914 commit 33b001e
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions internal/core/adt/composite.go
Original file line number Diff line number Diff line change
Expand Up @@ -1387,9 +1387,17 @@ func (c Conjunct) EnvExpr() (*Environment, Expr) {
// evaluated.
func EnvExpr(env *Environment, elem Elem) (*Environment, Expr) {
for {
if c, ok := elem.(*Comprehension); ok {
env = linkChildren(env, c)
c := MakeConjunct(env, c.Value, CloseInfo{})
switch x := elem.(type) {
case *ConjunctGroup:
if len(*x) == 1 {
c := (*x)[0]
env = c.Env
elem = c.Elem()
continue
}
case *Comprehension:
env = linkChildren(env, x)
c := MakeConjunct(env, x.Value, CloseInfo{})
elem = c.Elem()
continue
}
Expand Down

0 comments on commit 33b001e

Please sign in to comment.