tests/cases/compiler/checkSuperCallBeforeThisAccess.ts(7,18): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
tests/cases/compiler/checkSuperCallBeforeThisAccess.ts(8,18): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
tests/cases/compiler/checkSuperCallBeforeThisAccess.ts(9,18): error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class.
tests/cases/compiler/checkSuperCallBeforeThisAccess.ts(20,22): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
tests/cases/compiler/checkSuperCallBeforeThisAccess.ts(21,22): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
tests/cases/compiler/checkSuperCallBeforeThisAccess.ts(22,22): error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class.
tests/cases/compiler/checkSuperCallBeforeThisAccess.ts(30,30): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
tests/cases/compiler/checkSuperCallBeforeThisAccess.ts(39,22): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
tests/cases/compiler/checkSuperCallBeforeThisAccess.ts(43,18): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
tests/cases/compiler/checkSuperCallBeforeThisAccess.ts(44,18): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
tests/cases/compiler/checkSuperCallBeforeThisAccess.ts(45,18): error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class.
tests/cases/compiler/checkSuperCallBeforeThisAccess.ts(59,27): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
tests/cases/compiler/checkSuperCallBeforeThisAccess.ts(75,27): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.


==== tests/cases/compiler/checkSuperCallBeforeThisAccess.ts (13 errors) ====
    class A {
        x = 1;
    }
    
    class C1 extends A {
        constructor(n: number) {
            let a1 = this;  // Error
                     ~~~~
!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
            let a2 = this.x;  // Error
                     ~~~~
!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
            let a3 = super.x;  // Error
                     ~~~~~
!!! error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class.
            let a4 = () => this;
            let a5 = () => this.x;
            let a6 = () => super.x;
            if (!!true) {
                super();
                let b1 = this;
                let b2 = this.x;
                let b3 = super.x;
            }
            else {
                let c1 = this;  // Error
                         ~~~~
!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
                let c2 = this.x;  // Error
                         ~~~~
!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
                let c3 = super.x;  // Error
                         ~~~~~
!!! error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class.
            }
            if (!!true) {
                switch (n) {
                    case 1:
                        super();
                        let d1 = this.x;
                    case 2:
                        let d2 = this.x;  // Error
                                 ~~~~
!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
                    default:
                        super();
                        let d3 = this.x;
                }
                let d4 = this.x;
            }
            if (!!true) {
                let e1 = { w: !!true ? super() : 0 };
                let e2 = this.x;  // Error
                         ~~~~
!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
                let e3 = { w: !!true ? super() : super() };
                let e4 = this.x;
            }
            let f1 = this;  // Error
                     ~~~~
!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
            let f2 = this.x;  // Error
                     ~~~~
!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
            let f3 = super.x;  // Error
                     ~~~~~
!!! error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class.
        }
    }
    
    // Repro from #38512
    
    export class Foo {
        constructor(value: number) {
        }
    }
    
    export class BarCorrectlyFails extends Foo {
        constructor(something: boolean) {
            if (!something) {
                const value = this.bar();  // Error
                              ~~~~
!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
                super(value);
            }
            else {
                super(1337);
            }
        }
        bar(): number { return 4; }
    }
    
    export class BarIncorrectlyWorks extends Foo {
        constructor(something: boolean) {
            if (something) {
                super(1337);
            }
            else {
                const value = this.bar();  // Error
                              ~~~~
!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
                super(value);
            }
        }
        bar(): number { return 4; }
    }
    