aboutsummaryrefslogtreecommitdiff
path: root/compiler/tests/verifier/expr_typeparam_types.good
blob: 3b738e0dc2970cc8a752eb18335e1c5891ddd9a2 (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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102


typedef ta[T] = (
    T^ value,
);

typedef tb[T,U] = (
    T^ value,
    U^#[2] deep,
);

typedef tc[T,U] = (
    T^ value,
    (U^#[2] x) deep,
);

typedef td[T,U] = (
    T^ value,
    (U^#[2] x)^ deep,
);

typedef nested[T] = (
    tb[byte,T] inner,
);


var int i;
var int var^ ip;
var float f;
var float var^ fp;
var byte by;
var byte var^ byp;
var bool bo;
var bool^ bop;


() testa()
{
    var ta[int] t;
    
    ip = t.value;
    t.value = ip;
    t.value = @i;
}

() testb()
{
    var tb[int,float] t;
    
    t.value = ip;
    float^#[2] arr;
    t.deep = arr;
}

() acceptrc((float^#[2] x) param) { }
() acceptpc(tc[int,float]^ param) { }
() acceptpc2[A,B](tc[A,B]^ param) { }
() acceptpc3[A]((A^#[2] x)^ param) { }
() testc()
{
    var tc[int,float] t;
    
    t.value = ip;
    var (float^#[2] x) struc;
    struc = t.deep;
    acceptrc(struc);
    acceptrc(t.deep);
    acceptrc(([@1.23, @4.56],));
    acceptpc(@t);
    acceptpc2[int,float](@t);
    acceptpc3[float](@t.deep);
    t.deep = struc;
    t.deep = ([@1.23, @4.56],);
}

() testd()
{
    var td[int,float] t;
    
    t.value = ip;
    (float^#[2] x) struc;
    t.deep = @struc;
    t.deep = @([@1.23, @4.56],);
}

() acceptrnested((byte^, bool^#[2])^ param);
() acceptpnested(tb[byte,bool]^ param);
() testnested()
{
    var nested[bool] t;
    
    t.inner.value = byp;
    bool^#[2] arr;
    t.inner.deep = arr;
    acceptrnested(@t.inner);
    acceptpnested(@t.inner);
}