Debian Codegraph @

src/test/06-Errors/error-depend-nest3.ck

raw
1 // error case: test for dependency through transitive function calls
2 // i.e., in this case, nest() essentially inherits the dependencies
3 // of printArray() which includes 'array'
4
5 // should not work here
6 nest();
7
8 [1, 2, 3] @=> int array[];
9
10 // function definition
11 fun void nest()
12 {
13 // calls printArray(); in dependency tracking, nest() inherits
14 // printArray()'s dependencies
15 printArray();
16 }
17
18 // function definition
19 fun void printArray()
20 {
21 // need 'array' to be initialized
22 <<< array[0], array[1], array[2] >>>;
23 }