Newer
Older
zweic / tests / 4 / field00.zwei
@ajaggi ajaggi on 26 Dec 2005 469 bytes Added some test cases
// zweic - test program for field typing
// M. Ganguin, J. Ruffin 2005

// Field

// Containing class typing

class C { UNKNOWN a; } // 1/2 failure of clause 1 (incorrect field type)
class B { B b; } // success of clause 2 (recursive class definition)

// field name check

class foo {
    Int a; // success
    Null a; // 2/2 failure of clause 3 (field already defined)
}

{
    foo f = new foo(1);
    f.a; // success of clause 4 (class with new field is in scope)
}