Newer
Older
zweic / tests / four / term-block.zwei
@glproj03 glproj03 on 28 Dec 2005 652 bytes wicked cool test file added: script.sh
// Block

// Select
class bar {
    Int h;
}

class bof extends bar {}

class IfTest {
    Null foo() {
        Int t = 0;

        bar b = new bar(2);
        bar z = new bof(3);

        bar y = if (t) b else z; // 7/7 failure of clause 3 (return type mismatch)
    }
}

class BlockTest {
    Null foo() {
        {
            Int x = null; // 1/2 failure of clause 1 (incorrectly typed statement in block)
            return x
        };
        {
            Int x = 2;
            return y // 2/2 failure of clause 2 (expression not in block scope)
        };
        {
            Int x = 2;
            return x // success
        };
    }
}

0