Debian Codegraph @

src/test/06-Errors/error-depend-nest2.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 class Bar which includes 'foo'
4
5 // nest function definition
6 fun void nest()
7 {
8 // causes nest to inherit Bar's dependencies
9 Bar bar;
10 }
11
12 // should not work here, since nest() needs class Bar
13 // which needs 'foo', but nest() is called before 'foo'
14 // initializes
15 nest();
16
17 // initialize
18 5 => float foo;
19
20 // class definition
21 class Bar
22 {
23 <<< foo >>>;
24 }