-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
The code below compiles, but produces incorrect results --- 'hash' is referred to, but not given a value (it should come from %, in the same way as q). The problem is due to the conditional test '% has BasicType' not being noted correctly by the with body.
The function zz shows the same behaviour, but is less tractable, as the 'first' function depends on the value of T.
Trivial workaround for the first problem is to uncomment the commented line.
#include "foamlib"
I ==> SingleInteger;
Foo: Category == with {
f: % -> I;
q: % -> I;
default {
basic? ==> % has BasicType;
f(n: %): I == {
basic? => hash n;
q n;
}
-- if % has BasicType then { qq(a: %): I == never }
zz(T: BasicType, x: %): T == if % has ListCategory T then first x else never;
}
}