aboutsummaryrefslogtreecommitdiff
path: root/compiler/tests/verifier/assignability.bad
blob: 216906d2c4f3d6488ba27ab8c09ca652b99c6456 (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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76


typedef A = (
    int i,
    const int c,
);

typedef Deep = (
    A a,
    const A ca,
    (int xx) x,
    ((A yyy)#[1] yy)#[1] y,
);

int constglobal = 0;
var int varglobal;

A conststructglobal = (0, 0);
var A semiconstglobal = (0, 0);

var Deep deepvarglobal;
Deep deepconstglobal;

() test()
{
    int constlocal;
    A conststructlocal;
    var A semiconstlocal;
    Deep deepconstlocal;
    var Deep deepvarlocal;
    
    /* ERRORS */
    constlocal = 1;
    constglobal = 1;
    conststructglobal.i = 1;
    conststructglobal.c = 1;
    conststructlocal.c = 1;
    conststructlocal.i = 1;
    semiconstglobal.c = 1;
    semiconstlocal.c = 1;
    
    /* ERRORS */
    deepvarglobal.a.c = 1;
    deepvarglobal.ca.i = 1;
    deepvarglobal.ca.c = 1;
    deepvarglobal.va.c = 1;
    deepvarglobal.cb.i = 1;

    /* ERRORS */
    deepvarlocal.a.c = 1;
    deepvarlocal.ca.i = 1;
    deepvarlocal.ca.c = 1;
    deepvarlocal.y#[0].yy#[0].yyy.c = 1;

    /* ERRORS */
    deepconstglobal.a.i = 1;
    deepconstglobal.a.c = 1;
    deepconstglobal.ca.i = 1;
    deepconstglobal.ca.c = 1;
    deepconstglobal.y#[0].yy#[0].yyy.i = 1;
    deepconstglobal.y#[0].yy#[0].yyy.c = 1;

    /* ERRORS */
    deepconstlocal.a.i = 1;
    deepconstlocal.a.c = 1;
    deepconstlocal.ca.i = 1;
    deepconstlocal.ca.c = 1;
    deepconstlocal.y#[0].yy#[0].yyy.i = 1;
    deepconstlocal.y#[0].yy#[0].yyy.c = 1;
    
    var int? opt;
    /* ERRORS not valid l-values */
    opt? = 1;
    (1 + 1 as int) = 2;
    test = test;
}