aboutsummaryrefslogtreecommitdiff
path: root/compiler/tests/verifier/statement_typeassert.bad
blob: 4d16eed61b84dd01416e0a8af784aaf9edb58d29 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41

() test()
{
    int i = 255;

    typeassert nonexistent is byte; // ERROR

    typeassert i is int8; // ERROR wrong type
    byte b = i;
    
    typeassert i is i; // ERROR not a type
    
    nonexistenttype brokenvar; // ERROR
    typeassert brokenvar ;  // ERROR missing "is" or "in" part
    uint32 usebroken = brokenvar;

    int notptr;
    typeassert notptr is int^; // ERROR completely different types

    /* ERRORS syntax errors */
    typeassert;
    typeassert x1;
    typeassert x2 is;
    typeassert x3 int;
    typeassert x4 else;
    typeassert x5 {};
    typeassert x6 is else;
    typeassert x7 is {};
    typeassert x8 is do;
    typeassert x9 is int else;
    typeassert x10 is int else else;
    typeassert x11 is int do else;
    typeassert x12 is int do {} else;
    typeassert x13 is int "";
    typeassert x14 is int do return else;
    typeassert x15 int do {} else {};
    typeassert x16 is do {} else {};
    typeassert x17 is else return; do return;
    typeassert x18 int is do {} else {};
    typeassert x19 is int else {} do {};
}