Merge pull request #15258 from Microsoft/mergeSymbol-uses-first-decl-not-valueDecl

mergeSymbol uses first declaration, not valueDeclaration
This commit is contained in:
Nathan Shively-Sanders 2017-04-19 08:47:43 -07:00 committed by GitHub
commit a8593996f9
4 changed files with 31 additions and 1 deletions

View file

@ -574,7 +574,7 @@ namespace ts {
recordMergedSymbol(target, source);
}
else if (target.flags & SymbolFlags.NamespaceModule) {
error(source.valueDeclaration.name, Diagnostics.Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity, symbolToString(target));
error(source.declarations[0].name, Diagnostics.Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity, symbolToString(target));
}
else {
const message = target.flags & SymbolFlags.BlockScopedVariable || source.flags & SymbolFlags.BlockScopedVariable

View file

@ -0,0 +1,12 @@
tests/cases/compiler/final.ts(1,6): error TS2649: Cannot augment module 'A' with value exports because it resolves to a non-module entity.
==== tests/cases/compiler/initial.ts (0 errors) ====
interface A { }
namespace A {}
==== tests/cases/compiler/final.ts (1 errors) ====
type A = {}
~
!!! error TS2649: Cannot augment module 'A' with value exports because it resolves to a non-module entity.

View file

@ -0,0 +1,12 @@
//// [tests/cases/compiler/noSymbolForMergeCrash.ts] ////
//// [initial.ts]
interface A { }
namespace A {}
//// [final.ts]
type A = {}
//// [initial.js]
//// [final.js]

View file

@ -0,0 +1,6 @@
// @Filename: initial.ts
interface A { }
namespace A {}
// @Filename: final.ts
type A = {}