Files
mgmt/lang/interpret_test/TestAstFunc2/structlookup1/main.mcl
James Shubin 3e4652dca3 lang: funcs: Fix structlookup unification bug
We had mapped the field type to a dummy type instead of to T2 the return
type. Fixed now and added some tests.

This broke the unification for the load function lookups.
2021-05-23 22:52:50 -04:00

36 lines
632 B
Plaintext

$st0 = struct{x1 => 1.0, x5 => 2.1, x15 => 3.2,}
$s0a = if structlookup($st0, "x1") == 1.0 {
"passed0a"
} else {
"failed"
}
test $s0a {}
$s0b = if structlookup($st0, "x5") == 2.1 {
"passed0b"
} else {
"failed"
}
test $s0b {}
$s0c = if structlookup($st0, "x15") == 3.2 {
"passed0c"
} else {
"failed"
}
test $s0c {}
$st1 struct{x1 float; x5 float; x15 float} = struct{x1 => 1.0, x5 => 2.1, x15 => 3.2,}
$s1 = if structlookup($st1, "x5") == 2.1 {
"passed1"
} else {
"failed"
}
test $s1 {}
$st2 = struct{x1 => 1.0, x5 => 2.1, x15 => 3.2,}
$s2 = if structlookup($st2, "x5") == 2.1 {
"passed2"
} else {
"failed"
}
test $s2 {}