This commit is contained in:
Alexander Wang 2023-02-22 16:21:16 -08:00
parent 691b45733d
commit a027564100
No known key found for this signature in database
GPG key ID: D89FA31966BDBECE
2 changed files with 2 additions and 7 deletions

View file

@ -62,16 +62,12 @@ func (c *compiler) compileSteps(m *Map) {
for i, sf := range steps.Fields {
if sf.Map() == nil || sf.Primary() != nil {
c.errorf(sf.References[0].Context.Key, "invalid step")
continue
break
}
var base *Map
if i == 0 {
base = m.CopyBase(sf)
} else {
if steps.Fields[i-1].Map() == nil || steps.Fields[i-1].Primary() != nil {
c.errorf(steps.Fields[i-1].References[0].Context.Key, "invalid step")
continue
}
base = steps.Fields[i-1].Map().CopyBase(sf)
}
OverlayMap(base, sf.Map())

View file

@ -433,8 +433,7 @@ scenarios: {
}`)
assert.ErrorString(t, err, `TestCompile/steps/steps_panic.d2:6:3: invalid scenario
TestCompile/steps/steps_panic.d2:7:3: invalid scenario
TestCompile/steps/steps_panic.d2:2:3: invalid step
TestCompile/steps/steps_panic.d2:3:3: invalid step`)
TestCompile/steps/steps_panic.d2:2:3: invalid step`)
},
},
{