aboutsummaryrefslogtreecommitdiff
path: root/compiler/tests/backend/enum.good
blob: d8fc2410819b43c745faa6a51874daffe8ee92ba (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

() t1() {
    // Duplicate anon enums should be defined only once
    int enum () anon1;
    int enum () anon2;
    int enum (A,B) anon3;
    int enum (A,B) anon4 = :B;
    var int enum (A,C) anon5 = :C;
    anon5 = :A;
    byte enum () anonb1;
    byte enum () anonb2;
    byte enum (A,B) anonb3;
    byte enum (A,B) anonb4 = :B;
    var byte enum (A,C) anonb5 = :C;
    anonb5 = :A;
}
() t2() {
    // Same names of values in different enums should work
    typedef E = int enum (A, B);
    typedef F = int enum (A, B);
    E e = E:A;
    E f = :B;
    F g = :A;
    G h = :A;
    H i = H:A;
    int enumbase1 = enumbase E:B;
    int enumbase2 = enumbase G:B;  // G is defined after, so it is not "DefinedByBackend" when this line is processed
}

typedef G = int enum (A, B);
typedef H = int enum (A, B);