Fix merge

An incompatibility between #440 and #438 was not caught until after
merging both to the main branch.
This commit is contained in:
Alisdair McDiarmid 2021-01-06 09:34:54 -05:00
parent 0cdbaf8bd0
commit 6eb7705df8
1 changed files with 2 additions and 14 deletions

View File

@ -1139,13 +1139,7 @@ func (e *ForExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) {
// Extract and merge marks from the include expression into the // Extract and merge marks from the include expression into the
// main set of marks // main set of marks
includeUnmarked, includeMarks := include.Unmark() includeUnmarked, includeMarks := include.Unmark()
if marks == nil { marks = append(marks, includeMarks)
marks = includeMarks
} else {
for k := range includeMarks {
marks[k] = struct{}{}
}
}
if includeUnmarked.False() { if includeUnmarked.False() {
// Skip this element // Skip this element
continue continue
@ -1296,13 +1290,7 @@ func (e *ForExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) {
// Extract and merge marks from the include expression into the // Extract and merge marks from the include expression into the
// main set of marks // main set of marks
includeUnmarked, includeMarks := include.Unmark() includeUnmarked, includeMarks := include.Unmark()
if marks == nil { marks = append(marks, includeMarks)
marks = includeMarks
} else {
for k := range includeMarks {
marks[k] = struct{}{}
}
}
if includeUnmarked.False() { if includeUnmarked.False() {
// Skip this element // Skip this element
continue continue