From 28f5b8331a0712e9c287d0ba4043354061ec65d3 Mon Sep 17 00:00:00 2001 From: James Shubin Date: Sun, 8 Dec 2024 16:24:42 -0500 Subject: [PATCH] lang: funcs: structs: Improve naming These could print nicer for debugging. --- lang/funcs/structs/composite.go | 3 + lang/funcs/structs/const.go | 5 +- .../TestAstFunc1/changing-func.txtar | 4 +- .../TestAstFunc1/classes-polyfuncs.txtar | 24 +++--- .../TestAstFunc1/doubleclass.txtar | 46 +++++------ .../TestAstFunc1/doubleinclude.txtar | 6 +- .../TestAstFunc1/duplicate_resource.txtar | 16 ++-- .../TestAstFunc1/efficient-lambda.txtar | 4 +- .../TestAstFunc1/empty-res-list-0.txtar | 2 +- .../TestAstFunc1/empty-res-list-1.txtar | 18 ++--- .../interpret_test/TestAstFunc1/graph10.txtar | 6 +- .../interpret_test/TestAstFunc1/graph11.txtar | 6 +- .../interpret_test/TestAstFunc1/graph12.txtar | 10 +-- .../interpret_test/TestAstFunc1/graph13.txtar | 8 +- lang/interpret_test/TestAstFunc1/graph3.txtar | 4 +- lang/interpret_test/TestAstFunc1/graph4.txtar | 2 +- lang/interpret_test/TestAstFunc1/graph5.txtar | 8 +- lang/interpret_test/TestAstFunc1/graph6.txtar | 12 +-- lang/interpret_test/TestAstFunc1/graph7.txtar | 10 +-- lang/interpret_test/TestAstFunc1/hello0.txtar | 6 +- .../TestAstFunc1/importscope0.txtar | 10 +-- .../TestAstFunc1/importscope2.txtar | 10 +-- .../TestAstFunc1/lambda-chained.txtar | 2 +- .../TestAstFunc1/module_search1.txtar | 36 ++++----- .../TestAstFunc1/polydoubleinclude.txtar | 28 +++---- .../TestAstFunc1/recursive_module1.txtar | 36 ++++----- .../TestAstFunc1/resdupefields5.txtar | 76 +++++++++---------- .../TestAstFunc1/shadowing1.txtar | 4 +- .../TestAstFunc1/shadowing2.txtar | 4 +- .../TestAstFunc1/simple-func2.txtar | 6 +- .../TestAstFunc1/simple-lambda2.txtar | 6 +- .../TestAstFunc1/slow_unification0.txtar | 60 +++++++-------- .../TestAstFunc1/static-function0.txtar | 6 +- .../TestAstFunc1/static-function1.txtar | 6 +- 34 files changed, 247 insertions(+), 243 deletions(-) diff --git a/lang/funcs/structs/composite.go b/lang/funcs/structs/composite.go index 93f97b5e..0dccef90 100644 --- a/lang/funcs/structs/composite.go +++ b/lang/funcs/structs/composite.go @@ -59,6 +59,9 @@ type CompositeFunc struct { // String returns a simple name for this function. This is needed so this struct // can satisfy the pgraph.Vertex interface. func (obj *CompositeFunc) String() string { + if obj.Type != nil { + return fmt.Sprintf("%s: %s", CompositeFuncName, obj.Type.String()) + } return CompositeFuncName } diff --git a/lang/funcs/structs/const.go b/lang/funcs/structs/const.go index 504eb4c6..3d61325f 100644 --- a/lang/funcs/structs/const.go +++ b/lang/funcs/structs/const.go @@ -56,9 +56,10 @@ func (obj *ConstFunc) String() string { if obj.NameHint != "" { return obj.NameHint } + if obj.Value != nil && obj.Value.Type() != nil { + return fmt.Sprintf("%s: %s(%s)", ConstFuncName, obj.Value.Type().String(), obj.Value.String()) + } return ConstFuncName - //return fmt.Sprintf("%s: %s(%s)", ConstFuncName, obj.Value.Type().String(), obj.Value.String()) - //return fmt.Sprintf("%s(%s)", obj.Value.Type().String(), obj.Value.String()) } // Validate makes sure we've built our struct properly. diff --git a/lang/interpret_test/TestAstFunc1/changing-func.txtar b/lang/interpret_test/TestAstFunc1/changing-func.txtar index 3240ca4e..d482a522 100644 --- a/lang/interpret_test/TestAstFunc1/changing-func.txtar +++ b/lang/interpret_test/TestAstFunc1/changing-func.txtar @@ -31,5 +31,5 @@ Vertex: call Vertex: call Vertex: call Vertex: call -Vertex: const -Vertex: const +Vertex: const: bool(false) +Vertex: const: bool(true) diff --git a/lang/interpret_test/TestAstFunc1/classes-polyfuncs.txtar b/lang/interpret_test/TestAstFunc1/classes-polyfuncs.txtar index 69021599..496d052a 100644 --- a/lang/interpret_test/TestAstFunc1/classes-polyfuncs.txtar +++ b/lang/interpret_test/TestAstFunc1/classes-polyfuncs.txtar @@ -8,19 +8,19 @@ class c1($b) { -- OUTPUT -- Edge: FuncValue -> call # fn Edge: FuncValue -> call # fn -Edge: call -> composite # 0 -Edge: const -> composite # 0 -Edge: const -> composite # 1 -Edge: const -> composite # 2 -Edge: const -> composite # 3 +Edge: call -> composite: []str # 0 +Edge: const: int(-37) -> composite: []int # 3 +Edge: const: int(0) -> composite: []int # 2 +Edge: const: int(13) -> composite: []int # 0 +Edge: const: int(42) -> composite: []int # 1 Vertex: FuncValue Vertex: FuncValue Vertex: call Vertex: call -Vertex: composite -Vertex: composite -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const +Vertex: composite: []int +Vertex: composite: []str +Vertex: const: int(-37) +Vertex: const: int(0) +Vertex: const: int(13) +Vertex: const: int(42) +Vertex: const: str("len is: %d") diff --git a/lang/interpret_test/TestAstFunc1/doubleclass.txtar b/lang/interpret_test/TestAstFunc1/doubleclass.txtar index fb9dbba1..39627921 100644 --- a/lang/interpret_test/TestAstFunc1/doubleclass.txtar +++ b/lang/interpret_test/TestAstFunc1/doubleclass.txtar @@ -24,9 +24,9 @@ Edge: FuncValue -> call # fn Edge: FuncValue -> call # fn Edge: FuncValue -> call # fn Edge: FuncValue -> call # fn -Edge: call -> composite # 0 -Edge: call -> composite # 0 -Edge: call -> composite # 0 +Edge: call -> composite: []str # 0 +Edge: call -> composite: []str # 0 +Edge: call -> composite: []str # 0 Vertex: FuncValue Vertex: FuncValue Vertex: FuncValue @@ -45,23 +45,23 @@ Vertex: call Vertex: call Vertex: call Vertex: call -Vertex: composite -Vertex: composite -Vertex: composite -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const +Vertex: composite: []str +Vertex: composite: []str +Vertex: composite: []str +Vertex: const: int(1) +Vertex: const: int(13) +Vertex: const: int(2) +Vertex: const: int(3) +Vertex: const: int(4) +Vertex: const: int(4) +Vertex: const: int(4) +Vertex: const: int(42) +Vertex: const: str("+") +Vertex: const: str("+") +Vertex: const: str("+") +Vertex: const: str("+") +Vertex: const: str("+") +Vertex: const: str("+") +Vertex: const: str("test-%d-%d") +Vertex: const: str("test-%d-%d") +Vertex: const: str("test-%d-%d") diff --git a/lang/interpret_test/TestAstFunc1/doubleinclude.txtar b/lang/interpret_test/TestAstFunc1/doubleinclude.txtar index 19e9ec05..11190070 100644 --- a/lang/interpret_test/TestAstFunc1/doubleinclude.txtar +++ b/lang/interpret_test/TestAstFunc1/doubleinclude.txtar @@ -8,6 +8,6 @@ class c1($a) { } $foo = "hey" -- OUTPUT -- -Vertex: const -Vertex: const -Vertex: const +Vertex: const: str("hey") +Vertex: const: str("t1") +Vertex: const: str("t2") diff --git a/lang/interpret_test/TestAstFunc1/duplicate_resource.txtar b/lang/interpret_test/TestAstFunc1/duplicate_resource.txtar index 5a6fc402..9b38787e 100644 --- a/lang/interpret_test/TestAstFunc1/duplicate_resource.txtar +++ b/lang/interpret_test/TestAstFunc1/duplicate_resource.txtar @@ -20,11 +20,11 @@ pkg "cowsay" { Edge: FuncValue -> call # fn Vertex: FuncValue Vertex: call -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const +Vertex: const: str("/tmp/foo") +Vertex: const: str("/tmp/foo") +Vertex: const: str("cowsay") +Vertex: const: str("cowsay") +Vertex: const: str("hello world") +Vertex: const: str("hello world") +Vertex: const: str("installed") +Vertex: const: str("newest") diff --git a/lang/interpret_test/TestAstFunc1/efficient-lambda.txtar b/lang/interpret_test/TestAstFunc1/efficient-lambda.txtar index 1908c88d..ddb6f00b 100644 --- a/lang/interpret_test/TestAstFunc1/efficient-lambda.txtar +++ b/lang/interpret_test/TestAstFunc1/efficient-lambda.txtar @@ -15,5 +15,5 @@ Edge: FuncValue -> call # fn Vertex: FuncValue Vertex: call Vertex: call -Vertex: const -Vertex: const +Vertex: const: str("a") +Vertex: const: str("b") diff --git a/lang/interpret_test/TestAstFunc1/empty-res-list-0.txtar b/lang/interpret_test/TestAstFunc1/empty-res-list-0.txtar index 830e4fc3..251b4474 100644 --- a/lang/interpret_test/TestAstFunc1/empty-res-list-0.txtar +++ b/lang/interpret_test/TestAstFunc1/empty-res-list-0.txtar @@ -4,4 +4,4 @@ # unification solving, but now we can support it without that. test [] {} -- OUTPUT -- -Vertex: composite +Vertex: composite: []str diff --git a/lang/interpret_test/TestAstFunc1/empty-res-list-1.txtar b/lang/interpret_test/TestAstFunc1/empty-res-list-1.txtar index eb2cbf44..3484f88f 100644 --- a/lang/interpret_test/TestAstFunc1/empty-res-list-1.txtar +++ b/lang/interpret_test/TestAstFunc1/empty-res-list-1.txtar @@ -9,12 +9,12 @@ test $names {} # multiples resources, defined by list test ["hello", "world",] {} -- OUTPUT -- -Edge: const -> composite # 0 -Edge: const -> composite # 0 -Edge: const -> composite # 1 -Vertex: composite -Vertex: composite -Vertex: const -Vertex: const -Vertex: const -Vertex: const +Edge: const: str("hello") -> composite: []str # 0 +Edge: const: str("hey") -> composite: []str # 0 +Edge: const: str("world") -> composite: []str # 1 +Vertex: composite: []str +Vertex: composite: []str +Vertex: const: str("hello") +Vertex: const: str("hey") +Vertex: const: str("name") +Vertex: const: str("world") diff --git a/lang/interpret_test/TestAstFunc1/graph10.txtar b/lang/interpret_test/TestAstFunc1/graph10.txtar index 029cbbc1..a43fb3dc 100644 --- a/lang/interpret_test/TestAstFunc1/graph10.txtar +++ b/lang/interpret_test/TestAstFunc1/graph10.txtar @@ -8,6 +8,6 @@ test "t" { stringptr => $x, } -- OUTPUT -- -Vertex: const -Vertex: const -Vertex: const +Vertex: const: bool(true) +Vertex: const: str("hello") +Vertex: const: str("t") diff --git a/lang/interpret_test/TestAstFunc1/graph11.txtar b/lang/interpret_test/TestAstFunc1/graph11.txtar index 8af1f616..f47f5a1f 100644 --- a/lang/interpret_test/TestAstFunc1/graph11.txtar +++ b/lang/interpret_test/TestAstFunc1/graph11.txtar @@ -9,6 +9,6 @@ if true { } } -- OUTPUT -- -Vertex: const -Vertex: const -Vertex: const +Vertex: const: bool(true) +Vertex: const: str("t") +Vertex: const: str("world") diff --git a/lang/interpret_test/TestAstFunc1/graph12.txtar b/lang/interpret_test/TestAstFunc1/graph12.txtar index 4d908687..852b4303 100644 --- a/lang/interpret_test/TestAstFunc1/graph12.txtar +++ b/lang/interpret_test/TestAstFunc1/graph12.txtar @@ -12,8 +12,8 @@ test "t1" { stringptr => $x, } -- OUTPUT -- -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const +Vertex: const: bool(true) +Vertex: const: str("hello") +Vertex: const: str("t1") +Vertex: const: str("t2") +Vertex: const: str("world") diff --git a/lang/interpret_test/TestAstFunc1/graph13.txtar b/lang/interpret_test/TestAstFunc1/graph13.txtar index 6bb23cad..d235b223 100644 --- a/lang/interpret_test/TestAstFunc1/graph13.txtar +++ b/lang/interpret_test/TestAstFunc1/graph13.txtar @@ -8,7 +8,7 @@ pkg "cowsay" { state => "newest", } -- OUTPUT -- -Vertex: const -Vertex: const -Vertex: const -Vertex: const +Vertex: const: str("cowsay") +Vertex: const: str("cowsay") +Vertex: const: str("installed") +Vertex: const: str("newest") diff --git a/lang/interpret_test/TestAstFunc1/graph3.txtar b/lang/interpret_test/TestAstFunc1/graph3.txtar index 7f7cd0a5..7f1abb4a 100644 --- a/lang/interpret_test/TestAstFunc1/graph3.txtar +++ b/lang/interpret_test/TestAstFunc1/graph3.txtar @@ -7,5 +7,5 @@ $c = $b $b = $a $a = 42 -- OUTPUT -- -Vertex: const -Vertex: const +Vertex: const: int(42) +Vertex: const: str("t") diff --git a/lang/interpret_test/TestAstFunc1/graph4.txtar b/lang/interpret_test/TestAstFunc1/graph4.txtar index 532467e7..f9af4958 100644 --- a/lang/interpret_test/TestAstFunc1/graph4.txtar +++ b/lang/interpret_test/TestAstFunc1/graph4.txtar @@ -4,4 +4,4 @@ if $b { } $b = true -- OUTPUT -- -Vertex: const +Vertex: const: bool(true) diff --git a/lang/interpret_test/TestAstFunc1/graph5.txtar b/lang/interpret_test/TestAstFunc1/graph5.txtar index 831e09bd..1d18f7c0 100644 --- a/lang/interpret_test/TestAstFunc1/graph5.txtar +++ b/lang/interpret_test/TestAstFunc1/graph5.txtar @@ -7,7 +7,7 @@ test "t" { Edge: FuncValue -> call # fn Vertex: FuncValue Vertex: call -Vertex: const -Vertex: const -Vertex: const -Vertex: const +Vertex: const: int(13) +Vertex: const: int(42) +Vertex: const: str("+") +Vertex: const: str("t") diff --git a/lang/interpret_test/TestAstFunc1/graph6.txtar b/lang/interpret_test/TestAstFunc1/graph6.txtar index 2fcc17ba..6d97d88b 100644 --- a/lang/interpret_test/TestAstFunc1/graph6.txtar +++ b/lang/interpret_test/TestAstFunc1/graph6.txtar @@ -10,9 +10,9 @@ Vertex: FuncValue Vertex: FuncValue Vertex: call Vertex: call -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const +Vertex: const: int(13) +Vertex: const: int(42) +Vertex: const: int(99) +Vertex: const: str("+") +Vertex: const: str("-") +Vertex: const: str("t") diff --git a/lang/interpret_test/TestAstFunc1/graph7.txtar b/lang/interpret_test/TestAstFunc1/graph7.txtar index f98331f5..97677968 100644 --- a/lang/interpret_test/TestAstFunc1/graph7.txtar +++ b/lang/interpret_test/TestAstFunc1/graph7.txtar @@ -11,8 +11,8 @@ $i = 13 Edge: FuncValue -> call # fn Vertex: FuncValue Vertex: call -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const +Vertex: const: bool(true) +Vertex: const: int(13) +Vertex: const: int(42) +Vertex: const: str("+") +Vertex: const: str("t") diff --git a/lang/interpret_test/TestAstFunc1/hello0.txtar b/lang/interpret_test/TestAstFunc1/hello0.txtar index 0129a4fc..94440bf4 100644 --- a/lang/interpret_test/TestAstFunc1/hello0.txtar +++ b/lang/interpret_test/TestAstFunc1/hello0.txtar @@ -10,6 +10,6 @@ test "greeting" { Edge: FuncValue -> call # fn Vertex: FuncValue Vertex: call -Vertex: const -Vertex: const -Vertex: const +Vertex: const: str("greeting") +Vertex: const: str("hello: %s") +Vertex: const: str("world") diff --git a/lang/interpret_test/TestAstFunc1/importscope0.txtar b/lang/interpret_test/TestAstFunc1/importscope0.txtar index ae02ec70..ec34957e 100644 --- a/lang/interpret_test/TestAstFunc1/importscope0.txtar +++ b/lang/interpret_test/TestAstFunc1/importscope0.txtar @@ -18,11 +18,11 @@ class xclass { -- OUTPUT -- Edge: FuncValue -> call # fn Edge: call -> if # c -Edge: const -> if # a -Edge: const -> if # b +Edge: const: str("bbb") -> if # a +Edge: const: str("ccc") -> if # b Vertex: FuncValue Vertex: call -Vertex: const -Vertex: const -Vertex: const +Vertex: const: str("bbb") +Vertex: const: str("ccc") +Vertex: const: str("hello") Vertex: if diff --git a/lang/interpret_test/TestAstFunc1/importscope2.txtar b/lang/interpret_test/TestAstFunc1/importscope2.txtar index 899623da..79acdda8 100644 --- a/lang/interpret_test/TestAstFunc1/importscope2.txtar +++ b/lang/interpret_test/TestAstFunc1/importscope2.txtar @@ -17,11 +17,11 @@ class xclass { -- OUTPUT -- Edge: FuncValue -> call # fn Edge: call -> if # c -Edge: const -> if # a -Edge: const -> if # b +Edge: const: str("bbb") -> if # a +Edge: const: str("ccc") -> if # b Vertex: FuncValue Vertex: call -Vertex: const -Vertex: const -Vertex: const +Vertex: const: str("bbb") +Vertex: const: str("ccc") +Vertex: const: str("hello") Vertex: if diff --git a/lang/interpret_test/TestAstFunc1/lambda-chained.txtar b/lang/interpret_test/TestAstFunc1/lambda-chained.txtar index 5efaca22..19da0824 100644 --- a/lang/interpret_test/TestAstFunc1/lambda-chained.txtar +++ b/lang/interpret_test/TestAstFunc1/lambda-chained.txtar @@ -17,4 +17,4 @@ Edge: FuncValue -> call # fn Vertex: FuncValue Vertex: call Vertex: call -Vertex: const +Vertex: const: str("world") diff --git a/lang/interpret_test/TestAstFunc1/module_search1.txtar b/lang/interpret_test/TestAstFunc1/module_search1.txtar index fa0f51e2..3f3a97bd 100644 --- a/lang/interpret_test/TestAstFunc1/module_search1.txtar +++ b/lang/interpret_test/TestAstFunc1/module_search1.txtar @@ -83,21 +83,21 @@ Vertex: call Vertex: call Vertex: call Vertex: call -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const +Vertex: const: int(3) +Vertex: const: int(42) +Vertex: const: str("+") +Vertex: const: str("+") +Vertex: const: str("+") +Vertex: const: str("+") +Vertex: const: str("hello") +Vertex: const: str("hello2") +Vertex: const: str("hello3") +Vertex: const: str("i am github.com/purpleidea/mgmt-example1/ and i contain: ") +Vertex: const: str("i am github.com/purpleidea/mgmt-example1/ and i contain: ") +Vertex: const: str("i imported local: %s") +Vertex: const: str("i imported remote: %s and %s") +Vertex: const: str("the answer is: %d") +Vertex: const: str("this is module mod1 which contains: ") +Vertex: const: str("this is the nested git module mod1") +Vertex: const: str("this is the nested git module mod1") +Vertex: const: str("this is the nested local module mod1") diff --git a/lang/interpret_test/TestAstFunc1/polydoubleinclude.txtar b/lang/interpret_test/TestAstFunc1/polydoubleinclude.txtar index ddbd2916..ca0da33c 100644 --- a/lang/interpret_test/TestAstFunc1/polydoubleinclude.txtar +++ b/lang/interpret_test/TestAstFunc1/polydoubleinclude.txtar @@ -14,10 +14,10 @@ Edge: FuncValue -> call # fn Edge: FuncValue -> call # fn Edge: FuncValue -> call # fn Edge: FuncValue -> call # fn -Edge: const -> composite # 0 -Edge: const -> composite # 1 -Edge: const -> composite # 2 -Edge: const -> composite # 3 +Edge: const: int(-37) -> composite: []int # 3 +Edge: const: int(0) -> composite: []int # 2 +Edge: const: int(13) -> composite: []int # 0 +Edge: const: int(42) -> composite: []int # 1 Vertex: FuncValue Vertex: FuncValue Vertex: FuncValue @@ -26,13 +26,13 @@ Vertex: call Vertex: call Vertex: call Vertex: call -Vertex: composite -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const +Vertex: composite: []int +Vertex: const: int(-37) +Vertex: const: int(0) +Vertex: const: int(13) +Vertex: const: int(42) +Vertex: const: str("hello") +Vertex: const: str("len is: %d") +Vertex: const: str("len is: %d") +Vertex: const: str("t1") +Vertex: const: str("t2") diff --git a/lang/interpret_test/TestAstFunc1/recursive_module1.txtar b/lang/interpret_test/TestAstFunc1/recursive_module1.txtar index b1fcecb2..fb306f56 100644 --- a/lang/interpret_test/TestAstFunc1/recursive_module1.txtar +++ b/lang/interpret_test/TestAstFunc1/recursive_module1.txtar @@ -81,21 +81,21 @@ Vertex: call Vertex: call Vertex: call Vertex: call -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const +Vertex: const: int(3) +Vertex: const: int(42) +Vertex: const: str("+") +Vertex: const: str("+") +Vertex: const: str("+") +Vertex: const: str("+") +Vertex: const: str("hello") +Vertex: const: str("hello2") +Vertex: const: str("hello3") +Vertex: const: str("i am github.com/purpleidea/mgmt-example1/ and i contain: ") +Vertex: const: str("i am github.com/purpleidea/mgmt-example1/ and i contain: ") +Vertex: const: str("i imported local: %s") +Vertex: const: str("i imported remote: %s and %s") +Vertex: const: str("the answer is: %d") +Vertex: const: str("this is module mod1 which contains: ") +Vertex: const: str("this is the nested git module mod1") +Vertex: const: str("this is the nested git module mod1") +Vertex: const: str("this is the nested local module mod1") diff --git a/lang/interpret_test/TestAstFunc1/resdupefields5.txtar b/lang/interpret_test/TestAstFunc1/resdupefields5.txtar index fbdc155c..274ccec8 100644 --- a/lang/interpret_test/TestAstFunc1/resdupefields5.txtar +++ b/lang/interpret_test/TestAstFunc1/resdupefields5.txtar @@ -25,41 +25,41 @@ test "test" { #}, } -- OUTPUT -- -Edge: composite -> composite # sema -Edge: const -> composite # 0 -Edge: const -> composite # 1 -Edge: const -> composite # autoedge -Edge: const -> composite # autogroup -Edge: const -> composite # burst -Edge: const -> composite # delay -Edge: const -> composite # dollar -Edge: const -> composite # limit -Edge: const -> composite # noop -Edge: const -> composite # poll -Edge: const -> composite # realize -Edge: const -> composite # reset -Edge: const -> composite # retry -Edge: const -> composite # retryreset -Edge: const -> composite # reverse -Edge: const -> composite # rewatch -Vertex: composite -Vertex: composite -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const +Edge: composite: []str -> composite: struct{noop bool; retry int; retryreset bool; delay int; poll int; limit float; burst int; reset bool; sema []str; rewatch bool; realize bool; dollar bool; reverse bool; autoedge bool; autogroup bool} # sema +Edge: const: bool(false) -> composite: struct{noop bool; retry int; retryreset bool; delay int; poll int; limit float; burst int; reset bool; sema []str; rewatch bool; realize bool; dollar bool; reverse bool; autoedge bool; autogroup bool} # dollar +Edge: const: bool(false) -> composite: struct{noop bool; retry int; retryreset bool; delay int; poll int; limit float; burst int; reset bool; sema []str; rewatch bool; realize bool; dollar bool; reverse bool; autoedge bool; autogroup bool} # noop +Edge: const: bool(false) -> composite: struct{noop bool; retry int; retryreset bool; delay int; poll int; limit float; burst int; reset bool; sema []str; rewatch bool; realize bool; dollar bool; reverse bool; autoedge bool; autogroup bool} # reset +Edge: const: bool(false) -> composite: struct{noop bool; retry int; retryreset bool; delay int; poll int; limit float; burst int; reset bool; sema []str; rewatch bool; realize bool; dollar bool; reverse bool; autoedge bool; autogroup bool} # retryreset +Edge: const: bool(false) -> composite: struct{noop bool; retry int; retryreset bool; delay int; poll int; limit float; burst int; reset bool; sema []str; rewatch bool; realize bool; dollar bool; reverse bool; autoedge bool; autogroup bool} # rewatch +Edge: const: bool(true) -> composite: struct{noop bool; retry int; retryreset bool; delay int; poll int; limit float; burst int; reset bool; sema []str; rewatch bool; realize bool; dollar bool; reverse bool; autoedge bool; autogroup bool} # autoedge +Edge: const: bool(true) -> composite: struct{noop bool; retry int; retryreset bool; delay int; poll int; limit float; burst int; reset bool; sema []str; rewatch bool; realize bool; dollar bool; reverse bool; autoedge bool; autogroup bool} # autogroup +Edge: const: bool(true) -> composite: struct{noop bool; retry int; retryreset bool; delay int; poll int; limit float; burst int; reset bool; sema []str; rewatch bool; realize bool; dollar bool; reverse bool; autoedge bool; autogroup bool} # realize +Edge: const: bool(true) -> composite: struct{noop bool; retry int; retryreset bool; delay int; poll int; limit float; burst int; reset bool; sema []str; rewatch bool; realize bool; dollar bool; reverse bool; autoedge bool; autogroup bool} # reverse +Edge: const: float(4.2) -> composite: struct{noop bool; retry int; retryreset bool; delay int; poll int; limit float; burst int; reset bool; sema []str; rewatch bool; realize bool; dollar bool; reverse bool; autoedge bool; autogroup bool} # limit +Edge: const: int(-1) -> composite: struct{noop bool; retry int; retryreset bool; delay int; poll int; limit float; burst int; reset bool; sema []str; rewatch bool; realize bool; dollar bool; reverse bool; autoedge bool; autogroup bool} # retry +Edge: const: int(0) -> composite: struct{noop bool; retry int; retryreset bool; delay int; poll int; limit float; burst int; reset bool; sema []str; rewatch bool; realize bool; dollar bool; reverse bool; autoedge bool; autogroup bool} # delay +Edge: const: int(3) -> composite: struct{noop bool; retry int; retryreset bool; delay int; poll int; limit float; burst int; reset bool; sema []str; rewatch bool; realize bool; dollar bool; reverse bool; autoedge bool; autogroup bool} # burst +Edge: const: int(5) -> composite: struct{noop bool; retry int; retryreset bool; delay int; poll int; limit float; burst int; reset bool; sema []str; rewatch bool; realize bool; dollar bool; reverse bool; autoedge bool; autogroup bool} # poll +Edge: const: str("bar:3") -> composite: []str # 1 +Edge: const: str("foo:1") -> composite: []str # 0 +Vertex: composite: []str +Vertex: composite: struct{noop bool; retry int; retryreset bool; delay int; poll int; limit float; burst int; reset bool; sema []str; rewatch bool; realize bool; dollar bool; reverse bool; autoedge bool; autogroup bool} +Vertex: const: bool(false) +Vertex: const: bool(false) +Vertex: const: bool(false) +Vertex: const: bool(false) +Vertex: const: bool(false) +Vertex: const: bool(true) +Vertex: const: bool(true) +Vertex: const: bool(true) +Vertex: const: bool(true) +Vertex: const: bool(true) +Vertex: const: float(4.2) +Vertex: const: int(-1) +Vertex: const: int(0) +Vertex: const: int(3) +Vertex: const: int(5) +Vertex: const: str("bar:3") +Vertex: const: str("foo:1") +Vertex: const: str("test") +Vertex: const: str("test") diff --git a/lang/interpret_test/TestAstFunc1/shadowing1.txtar b/lang/interpret_test/TestAstFunc1/shadowing1.txtar index b6d1cb7e..fa711647 100644 --- a/lang/interpret_test/TestAstFunc1/shadowing1.txtar +++ b/lang/interpret_test/TestAstFunc1/shadowing1.txtar @@ -6,5 +6,5 @@ if true { } test "${x}" {} -- OUTPUT -- -Vertex: const -Vertex: const +Vertex: const: bool(true) +Vertex: const: str("hello") diff --git a/lang/interpret_test/TestAstFunc1/shadowing2.txtar b/lang/interpret_test/TestAstFunc1/shadowing2.txtar index b872f333..182deb79 100644 --- a/lang/interpret_test/TestAstFunc1/shadowing2.txtar +++ b/lang/interpret_test/TestAstFunc1/shadowing2.txtar @@ -6,5 +6,5 @@ if true { test "${x}" {} } -- OUTPUT -- -Vertex: const -Vertex: const +Vertex: const: bool(true) +Vertex: const: str("world") diff --git a/lang/interpret_test/TestAstFunc1/simple-func2.txtar b/lang/interpret_test/TestAstFunc1/simple-func2.txtar index b0006025..47ad52b2 100644 --- a/lang/interpret_test/TestAstFunc1/simple-func2.txtar +++ b/lang/interpret_test/TestAstFunc1/simple-func2.txtar @@ -11,12 +11,12 @@ test [$out1 + $out2,] {} Edge: FuncValue -> call # fn Edge: FuncValue -> call # fn Edge: FuncValue -> call # fn -Edge: call -> composite # 0 +Edge: call -> composite: []str # 0 Vertex: FuncValue Vertex: FuncValue Vertex: FuncValue Vertex: call Vertex: call Vertex: call -Vertex: composite -Vertex: const +Vertex: composite: []str +Vertex: const: str("+") diff --git a/lang/interpret_test/TestAstFunc1/simple-lambda2.txtar b/lang/interpret_test/TestAstFunc1/simple-lambda2.txtar index ce2a7441..7509bf5d 100644 --- a/lang/interpret_test/TestAstFunc1/simple-lambda2.txtar +++ b/lang/interpret_test/TestAstFunc1/simple-lambda2.txtar @@ -14,11 +14,11 @@ test [$out1 + $out2,] {} Edge: FuncValue -> call # fn Edge: FuncValue -> call # fn Edge: FuncValue -> call # fn -Edge: call -> composite # 0 +Edge: call -> composite: []str # 0 Vertex: FuncValue Vertex: FuncValue Vertex: call Vertex: call Vertex: call -Vertex: composite -Vertex: const +Vertex: composite: []str +Vertex: const: str("+") diff --git a/lang/interpret_test/TestAstFunc1/slow_unification0.txtar b/lang/interpret_test/TestAstFunc1/slow_unification0.txtar index 274d77fd..6aab423a 100644 --- a/lang/interpret_test/TestAstFunc1/slow_unification0.txtar +++ b/lang/interpret_test/TestAstFunc1/slow_unification0.txtar @@ -73,33 +73,33 @@ Vertex: call Vertex: call Vertex: call Vertex: call -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const -Vertex: const +Vertex: const: str("") +Vertex: const: str("/tmp/mgmt/state") +Vertex: const: str("/tmp/mgmt/state") +Vertex: const: str("/tmp/mgmt/state") +Vertex: const: str("/usr/bin/sleep 1s") +Vertex: const: str("/usr/bin/sleep 1s") +Vertex: const: str("/usr/bin/sleep 1s") +Vertex: const: str("==") +Vertex: const: str("==") +Vertex: const: str("==") +Vertex: const: str("==") +Vertex: const: str("default") +Vertex: const: str("default") +Vertex: const: str("estate") +Vertex: const: str("one") +Vertex: const: str("one") +Vertex: const: str("or") +Vertex: const: str("state: one\n") +Vertex: const: str("state: three\n") +Vertex: const: str("state: two\n") +Vertex: const: str("three") +Vertex: const: str("three") +Vertex: const: str("timer") +Vertex: const: str("timer") +Vertex: const: str("timer") +Vertex: const: str("timer") +Vertex: const: str("timer") +Vertex: const: str("timer") +Vertex: const: str("two") +Vertex: const: str("two") diff --git a/lang/interpret_test/TestAstFunc1/static-function0.txtar b/lang/interpret_test/TestAstFunc1/static-function0.txtar index b93e310d..a9d7523a 100644 --- a/lang/interpret_test/TestAstFunc1/static-function0.txtar +++ b/lang/interpret_test/TestAstFunc1/static-function0.txtar @@ -23,6 +23,6 @@ Vertex: FuncValue Vertex: call Vertex: call Vertex: call -Vertex: const -Vertex: const -Vertex: const +Vertex: const: str("greeting1") +Vertex: const: str("greeting2") +Vertex: const: str("greeting3") diff --git a/lang/interpret_test/TestAstFunc1/static-function1.txtar b/lang/interpret_test/TestAstFunc1/static-function1.txtar index 91a91f34..5e0916ce 100644 --- a/lang/interpret_test/TestAstFunc1/static-function1.txtar +++ b/lang/interpret_test/TestAstFunc1/static-function1.txtar @@ -25,6 +25,6 @@ Vertex: FuncValue Vertex: call Vertex: call Vertex: call -Vertex: const -Vertex: const -Vertex: const +Vertex: const: str("greeting1") +Vertex: const: str("greeting2") +Vertex: const: str("greeting3")