lang/interpret_test/TestAstFunc2/lookup3.txtar
raw| 1 | -- main.mcl -- |
| 2 | |
| 3 | $st = struct{ |
| 4 | a => 42, |
| 5 | b => true, |
| 6 | c => "wow", |
| 7 | } |
| 8 | |
| 9 | # Since there is no field named "missing", we can't guess what the zero value |
| 10 | # would be for this field, and as a result, we can't unify or compile this code! |
| 11 | $name = $st->missing + "fail" |
| 12 | test "${name}" {} # this can't unify! |
| 13 | |
| 14 | -- OUTPUT -- |
| 15 | # err: errUnify: error setting type: func() { <built-in:_struct_lookup> }, error: field missing was not found in struct |