Debian Codegraph @

src/test/06-Errors/error-class-auto-s.ck

raw
1 // error case: top-level class vars cannot be declared as auto
2 // static edition
3 //
4 // introduced in 1.5.1.1 as class vars could be accessed
5 // from anywhere but currently there is no mechanism to
6 // resolve the 'auto' until type checking stage...
7
8 class Foo
9 {
10 // ok
11 for( auto x : [1,2,3] ) { <<< x >>>; }
12
13 // ok
14 fun void bar()
15 {
16 4 => auto y;
17 <<< y >>>;
18 }
19
20 // ok
21 if( true ) { 5 => auto x; }
22
23 // ok
24 { 6 => auto x; }
25
26 // not ok *** compiler should report error
27 // 7 => auto m_var;
28
29 // not ok *** compiler should report error
30 8 => static auto m_var;
31 }