update validation and test

This commit is contained in:
Gavin Nishizawa 2023-09-28 18:29:49 -07:00
parent a03d9bd24e
commit b41a9e4e96
No known key found for this signature in database
GPG key ID: AE3B177777CE55CD
5 changed files with 10956 additions and 206 deletions

View file

@ -1083,6 +1083,14 @@ func (c *compiler) validateNear(g *d2graph.Graph) {
if (isSrcNearConst || isDstNearConst) && srcNearContainer != dstNearContainer {
// c.errorf(edge.References[0].Edge, "cannot connect objects from within a container, that has near constant set, to objects outside that container")
}
if edge.Src.IsConstantNear() && edge.Dst.IsDescendantOf(edge.Src) {
c.errorf(edge.GetAstEdge(), "edge from constant near %#v cannot enter itself", edge.Src.AbsID())
continue
}
if edge.Dst.IsConstantNear() && edge.Src.IsDescendantOf(edge.Dst) {
c.errorf(edge.GetAstEdge(), "edge from constant near %#v cannot enter itself", edge.Dst.AbsID())
continue
}
}
}

View file

@ -1226,7 +1226,7 @@ func (obj *Object) Connect(srcID, dstID []string, srcArrow, dstArrow bool, label
dst := obj.ensureChildEdge(dstID)
if src.OuterSequenceDiagram() != dst.OuterSequenceDiagram() {
return nil, errors.New("connections within sequence diagrams can connect only to other objects within the same sequence diagram")
// return nil, errors.New("connections within sequence diagrams can connect only to other objects within the same sequence diagram")
}
e := &Edge{

View file

@ -24,7 +24,7 @@ l: Left Constant Near {
grid: {
shape: sequence_diagram
with -> a -> sequence diagram -> you can
with -> a -> sequence diagram.x -> you can
you can: {
grid-rows: 2
@ -45,6 +45,7 @@ l: Left Constant Near {
continue -> nesting
}
}
you can.here and.nesting -> sequence diagram.x: {class: green}
}
this.row 2 -> is.child of is.grandchild: {class: green}
# this.row 2 -> grid.you can
@ -246,6 +247,9 @@ more: {
more.container.a_sequence -> directions.v.d.4: {class: green}
directions.l.2 -> center.step: {class: green}
center.step -> more.stylish.x: {class: green}
directions.l.1 -> seq.item.a.b: to inside sequence diagram {class: green}
directions.l.1 -> seq.itemResponse.a: to inside sequence diagram {class: green}
directions.v.d.2 -> seq.scorer.abc: to inside sequence diagram {class: green}
center.cloud -> more.stylish: {class: green}
more.container.a_shape -> r.is: to constant near {class: green}

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 116 KiB