tests/cases/compiler/constEnumErrors.ts(1,12): error TS2300: Duplicate identifier 'E'.
tests/cases/compiler/constEnumErrors.ts(5,8): error TS2300: Duplicate identifier 'E'.
tests/cases/compiler/constEnumErrors.ts(12,9): error TS2651: A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums.
tests/cases/compiler/constEnumErrors.ts(14,9): error TS2474: In 'const' enum declarations member initializer must be constant expression.
tests/cases/compiler/constEnumErrors.ts(15,10): error TS2474: In 'const' enum declarations member initializer must be constant expression.
tests/cases/compiler/constEnumErrors.ts(22,13): error TS2476: A const enum member can only be accessed using a string literal.
tests/cases/compiler/constEnumErrors.ts(24,13): error TS2476: A const enum member can only be accessed using a string literal.
tests/cases/compiler/constEnumErrors.ts(26,9): error TS2475: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment.
tests/cases/compiler/constEnumErrors.ts(27,10): error TS2475: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment.
tests/cases/compiler/constEnumErrors.ts(32,5): error TS2475: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment.
tests/cases/compiler/constEnumErrors.ts(40,9): error TS2477: 'const' enum member initializer was evaluated to a non-finite value.
tests/cases/compiler/constEnumErrors.ts(41,9): error TS2477: 'const' enum member initializer was evaluated to a non-finite value.
tests/cases/compiler/constEnumErrors.ts(42,9): error TS2478: 'const' enum member initializer was evaluated to disallowed value 'NaN'.


==== tests/cases/compiler/constEnumErrors.ts (13 errors) ====
    const enum E {
               ~
!!! error TS2300: Duplicate identifier 'E'.
        A
    }
    
    module E {
           ~
!!! error TS2300: Duplicate identifier 'E'.
        var x = 1;
    }
    
    const enum E1 {
        // illegal case
        // forward reference to the element of the same enum
        X = Y, 
            ~
!!! error TS2651: A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums.
        // forward reference to the element of the same enum
        Y = E1.Z,
            ~~~~
!!! error TS2474: In 'const' enum declarations member initializer must be constant expression.
        Y1 = E1["Z"]
             ~~~~~~~
!!! error TS2474: In 'const' enum declarations member initializer must be constant expression.
    }
    
    const enum E2 {
        A
    }
    
    var y0 = E2[1]
                ~
!!! error TS2476: A const enum member can only be accessed using a string literal.
    var name = "A";
    var y1 = E2[name];
                ~~~~
!!! error TS2476: A const enum member can only be accessed using a string literal.
    
    var x = E2;
            ~~
!!! error TS2475: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment.
    var y = [E2];
             ~~
!!! error TS2475: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment.
    
    function foo(t: any): void {
    }
    
    foo(E2);
        ~~
!!! error TS2475: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment.
    
    const enum NaNOrInfinity {
        A = 9007199254740992,
        B = A * A,
        C = B * B,
        D = C * C,
        E = D * D,
        F = E * E, // overflow
            ~~~~~
!!! error TS2477: 'const' enum member initializer was evaluated to a non-finite value.
        G = 1 / 0, // overflow
            ~~~~~
!!! error TS2477: 'const' enum member initializer was evaluated to a non-finite value.
        H = 0 / 0  // NaN
            ~~~~~
!!! error TS2478: 'const' enum member initializer was evaluated to disallowed value 'NaN'.
    }