lang: Add a simple test of a non-tree dag

This commit is contained in:
James Shubin
2025-08-04 20:37:18 -04:00
parent 04ff2a8c5c
commit 5692837175

View File

@@ -0,0 +1,28 @@
-- main.mcl --
# This code produces a DAG which is not a tree.
$x = "hi"
func foo($a) {
$a + $x + "there"
}
$out = foo($x) + $x
test "${out}" {}
-- OUTPUT --
Edge: _operator -> _operator # a
Edge: _operator -> _operator # a
Edge: const: str("+") -> _operator # op
Edge: const: str("+") -> _operator # op
Edge: const: str("+") -> _operator # op
Edge: const: str("hi") -> _operator # a, b
Edge: const: str("hi") -> _operator # b
Edge: const: str("there") -> _operator # b
Vertex: _operator
Vertex: _operator
Vertex: _operator
Vertex: const: str("+")
Vertex: const: str("+")
Vertex: const: str("+")
Vertex: const: str("hi")
Vertex: const: str("there")