Debian Codegraph @

lang/interpret_test/TestAstFunc2/unify-template.txtar

raw
1 -- main.mcl --
2 import "golang"
3 import "sys"
4
5 $tmplvalues = struct{num => 42, load => $theload,}
6
7 $theload bool = sys.load()->x1 # wrong type, make sure the compiler catches it!
8
9 file "/tmp/datetime" {
10 state => $const.res.file.state.exists,
11 content => golang.template("num: {{ .num }} seconds\nload average: {{ .load }}\n", $tmplvalues),
12 }
13 -- OUTPUT --
14 # err: errUnify: error setting type: func() { <built-in:_struct_lookup> }, error: field x1 type error: base kind does not match (bool != float)