src/test/06-Errors/error-depend-class-func.ck
raw| 1 | // within class definition of Foo, go() needs 'myVal', cannot call go() before before 'myVal' initializes |
| 2 | |
| 3 | // class definition |
| 4 | class Foo |
| 5 | { |
| 6 | // no work -- go() depends on myVal being initialized |
| 7 | go(); |
| 8 | |
| 9 | // the dependency |
| 10 | 5 => int myVal; |
| 11 | |
| 12 | // member func |
| 13 | fun void go() |
| 14 | { |
| 15 | // needs myVal to be initialized |
| 16 | <<< myVal >>>; |
| 17 | } |
| 18 | } |
| 19 | |
| 20 | // should have error'ed out by this point |
| 21 | Foo foo; |
| 22 | // call go() |
| 23 | foo.go(); |
| 24 |