Skip to content

Module local renaming does not take into account block scoped locals #2852

@JsonFreeman

Description

@JsonFreeman

Compile the following in ES6:

module M {
    export class C { }
}
module M {
    {
        let M = 0;
        new C();
    }
}

The output you get will cause a crash:

var M;
(function (M) {
    class C {
    }
    M.C = C;
})(M || (M = {}));
var M;
(function (M) { // Should be renamed to M_1
    {
        let M = 0;
        new M.C(); // Emits M.C instead of M_1.C
    }
})(M || (M = {}));

This does not repro in pre-ES6 emit

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptFixedA PR has been merged for this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions