record R {
param flag = true;
}
proc foo(type t) {
if t == R then
writeln("Got an R");
else
writeln("It seems I didn't get an R, but rather a ", R:string);
}
foo(R);
expecting to get the "Got an R" case, since R is a fully-defaulted generic type and t is that same fully-defaulted type. However, it lands in the second case instead, printing:
It seems I didn't get an R, but rather a R
If I change the comparison to t == R(true) then it works as expected, but that doesn't seem like it should be necessary.
Interestingly, if I change the comparison to t == R(?) I don't get a complaint about comparisons against generic types not being supported, but also don't end up in the "then" clause (where I'd expect one of those two behaviors).
I wrote code similar to the following:
expecting to get the "Got an R" case, since
R
is a fully-defaulted generic type andt
is that same fully-defaulted type. However, it lands in the second case instead, printing:If I change the comparison to
t == R(true)
then it works as expected, but that doesn't seem like it should be necessary.Interestingly, if I change the comparison to
t == R(?)
I don't get a complaint about comparisons against generic types not being supported, but also don't end up in the "then" clause (where I'd expect one of those two behaviors).