Skip to content

Commit

Permalink
add validation for sequence diagram edges to descendant
Browse files Browse the repository at this point in the history
  • Loading branch information
gavin-ts committed Oct 2, 2023
1 parent a8af739 commit 84affc9
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions d2compiler/compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -1102,6 +1102,14 @@ func (c *compiler) validateEdges(g *d2graph.Graph) {
c.errorf(edge.GetAstEdge(), "edge from grid cell %#v cannot enter itself", edge.Dst.AbsID())
continue
}
if edge.Src.IsSequenceDiagram() && edge.Dst.IsDescendantOf(edge.Src) {
c.errorf(edge.GetAstEdge(), "edge from sequence diagram %#v cannot enter itself", edge.Src.AbsID())
continue
}
if edge.Dst.IsSequenceDiagram() && edge.Src.IsDescendantOf(edge.Dst) {
c.errorf(edge.GetAstEdge(), "edge from sequence diagram %#v cannot enter itself", edge.Dst.AbsID())
continue
}
}
}

Expand Down

0 comments on commit 84affc9

Please sign in to comment.