tests/cases/conformance/controlFlow/controlFlowIterationErrors.ts(12,17): error TS2345: Argument of type 'string | number' is not assignable to parameter of type 'string'.
  Type 'number' is not assignable to type 'string'.
tests/cases/conformance/controlFlow/controlFlowIterationErrors.ts(23,17): error TS2345: Argument of type 'string | number' is not assignable to parameter of type 'string'.
  Type 'number' is not assignable to type 'string'.
tests/cases/conformance/controlFlow/controlFlowIterationErrors.ts(35,17): error TS2345: Argument of type 'string | number' is not assignable to parameter of type 'number'.
  Type 'string' is not assignable to type 'number'.
tests/cases/conformance/controlFlow/controlFlowIterationErrors.ts(46,17): error TS2345: Argument of type 'string | number' is not assignable to parameter of type 'number'.
  Type 'string' is not assignable to type 'number'.
tests/cases/conformance/controlFlow/controlFlowIterationErrors.ts(77,13): error TS7022: 'y' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.
tests/cases/conformance/controlFlow/controlFlowIterationErrors.ts(77,26): error TS2345: Argument of type 'string | number | boolean' is not assignable to parameter of type 'string | number'.
  Type 'true' is not assignable to type 'string | number'.
tests/cases/conformance/controlFlow/controlFlowIterationErrors.ts(88,13): error TS7022: 'y' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.
tests/cases/conformance/controlFlow/controlFlowIterationErrors.ts(88,26): error TS2345: Argument of type 'string | number | boolean' is not assignable to parameter of type 'string | number'.
  Type 'true' is not assignable to type 'string | number'.


==== tests/cases/conformance/controlFlow/controlFlowIterationErrors.ts (8 errors) ====
    
    let cond: boolean;
    
    function len(s: string) {
        return s.length;
    }
    
    function f1() {
        let x: string | number | boolean;
        x = "";
        while (cond) {
            x = len(x);
                    ~
!!! error TS2345: Argument of type 'string | number' is not assignable to parameter of type 'string'.
!!! error TS2345:   Type 'number' is not assignable to type 'string'.
            x;
        }
        x;
    }
    
    function f2() {
        let x: string | number | boolean;
        x = "";
        while (cond) {
            x;
            x = len(x);
                    ~
!!! error TS2345: Argument of type 'string | number' is not assignable to parameter of type 'string'.
!!! error TS2345:   Type 'number' is not assignable to type 'string'.
        }
        x;
    }
    
    declare function foo(x: string): number;
    declare function foo(x: number): string;
    
    function g1() {
        let x: string | number | boolean;
        x = "";
        while (cond) {
            x = foo(x);
                    ~
!!! error TS2345: Argument of type 'string | number' is not assignable to parameter of type 'number'.
!!! error TS2345:   Type 'string' is not assignable to type 'number'.
            x;
        }
        x;
    }
    
    function g2() {
        let x: string | number | boolean;
        x = "";
        while (cond) {
            x;
            x = foo(x);
                    ~
!!! error TS2345: Argument of type 'string | number' is not assignable to parameter of type 'number'.
!!! error TS2345:   Type 'string' is not assignable to type 'number'.
        }
        x;
    }
    
    function asNumber(x: string | number): number {
        return +x;
    }
    
    function h1() {
        let x: string | number | boolean;
        x = "0";
        while (cond) {
            x = +x + 1;
            x;
        }
    }
    
    function h2() {
        let x: string | number | boolean;
        x = "0";
        while (cond) {
            x = asNumber(x) + 1;
            x;
        }
    }
    
    function h3() {
        let x: string | number | boolean;
        x = "0";
        while (cond) {
            let y = asNumber(x);
                ~
!!! error TS7022: 'y' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.
                             ~
!!! error TS2345: Argument of type 'string | number | boolean' is not assignable to parameter of type 'string | number'.
!!! error TS2345:   Type 'true' is not assignable to type 'string | number'.
            x = y + 1;
            x;
        }
    }
    
    function h4() {
        let x: string | number | boolean;
        x = "0";
        while (cond) {
            x;
            let y = asNumber(x);
                ~
!!! error TS7022: 'y' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.
                             ~
!!! error TS2345: Argument of type 'string | number | boolean' is not assignable to parameter of type 'string | number'.
!!! error TS2345:   Type 'true' is not assignable to type 'string | number'.
            x = y + 1;
            x;
        }
    }
    