This commit is contained in:
Alexander Wang 2023-02-24 19:05:23 -08:00
parent 6374223365
commit 1fcb075e04
No known key found for this signature in database
GPG key ID: D89FA31966BDBECE
2 changed files with 15 additions and 0 deletions

View file

@ -678,6 +678,10 @@ func (c *compiler) validateNear(g *d2graph.Graph) {
c.errorf(obj.Attributes.NearKey, "near keys cannot be set to an descendant")
continue
}
if nearObj.OuterSequenceDiagram() != nil {
c.errorf(obj.Attributes.NearKey, "near keys cannot be set to an object within sequence diagrams")
continue
}
} else if isConst {
is := false
for _, e := range g.Edges {

View file

@ -1774,6 +1774,17 @@ dst.id <-> src.dst_id
assert.String(t, "sequence_diagram", g.Objects[0].Attributes.Shape.Value)
},
},
{
name: "near_sequence",
text: `x: {
shape: sequence_diagram
a
}
b.near: x.a
`,
expErr: `d2/testdata/d2compiler/TestCompile/near_sequence.d2:5:9: near keys cannot be set to an object within sequence diagrams`,
},
{
name: "sequence-timestamp",