fix module record nonambiguous case, add test for it

This commit is contained in:
Wesley Wigham
2015-11-26 14:24:12 -08:00
parent d167e55097
commit 54ab1e99c0
5 changed files with 62 additions and 1 deletions
+1 -1
View File
@@ -1113,7 +1113,7 @@ namespace ts {
};
}
}
else if (lookupTable && exportNode && id !== "default" && hasProperty(target, id)) {
else if (lookupTable && exportNode && id !== "default" && hasProperty(target, id) && target[id] !== source[id]) {
lookupTable[id].exportsWithDuplicate.push(exportNode);
}
}
@@ -0,0 +1,28 @@
//// [tests/cases/compiler/moduleSameValueDuplicateExportedBindings.ts] ////
//// [a.ts]
export * from "./b";
export * from "./c";
//// [b.ts]
export * from "./c";
//// [c.ts]
export var foo = 42;
//// [c.js]
"use strict";
exports.foo = 42;
//// [b.js]
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
__export(require("./c"));
//// [a.js]
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
__export(require("./b"));
__export(require("./c"));
@@ -0,0 +1,11 @@
=== tests/cases/compiler/a.ts ===
export * from "./b";
No type information for this code.export * from "./c";
No type information for this code.
No type information for this code.=== tests/cases/compiler/b.ts ===
export * from "./c";
No type information for this code.
No type information for this code.=== tests/cases/compiler/c.ts ===
export var foo = 42;
>foo : Symbol(foo, Decl(c.ts, 0, 10))
@@ -0,0 +1,12 @@
=== tests/cases/compiler/a.ts ===
export * from "./b";
No type information for this code.export * from "./c";
No type information for this code.
No type information for this code.=== tests/cases/compiler/b.ts ===
export * from "./c";
No type information for this code.
No type information for this code.=== tests/cases/compiler/c.ts ===
export var foo = 42;
>foo : number
>42 : number
@@ -0,0 +1,10 @@
// @module: commonjs
// @filename: a.ts
export * from "./b";
export * from "./c";
// @filename: b.ts
export * from "./c";
// @filename: c.ts
export var foo = 42;