Skip to content

Bad Codegen for ModuleNames shadowed by Parameters #601

@sparecycles

Description

@sparecycles

[EDITED]

Input

module X.M {
    export var x = false;

    function q(M) {
    }

    M.x = true;
}

Output

var X;
(function (X) {
    (function (_M) {
        _M.x = false;
        function q(M) {
        }
        M.x = true; // <--- crash, M is not bound to X.M yet.  Should we use _M instead?
    })(X.M || (X.M = {}));
    var M = X.M;
})(X || (X = {}));

I'm not sure if the correct fix is to codegen _M at that line, or to not bump the module's parameter name to _M because of the function parameter name.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFixedA PR has been merged for this issueHigh Priority

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions