16316, “mppf”, “nested call in function call returning runtime type executes twice”, “2020-08-31T21:26:22Z”
Consider the statement type t = returnsArrayType(makeArray());
in the below. How many times should makeArray()
be called?
proc returnsArrayType(arg) type {
return arg.type;
}
proc makeArray() {
writeln("in makeArray()");
var A:[1..10] int;
return A;
}
proc test() {
type t = returnsArrayType(makeArray());
}
test();
The program prints out
in makeArray()
in makeArray()
I would expect it to only print in makeArray()
once.