diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 50f1ce0d208..c28502907d7 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -380,7 +380,6 @@ namespace ts { } function mergeSymbol(target: Symbol, source: Symbol) { - //TODO: how to merge w/ shorthand ambient module? if (!(target.flags & getExcludedSymbolFlags(source.flags))) { if (source.flags & SymbolFlags.ValueModule && target.flags & SymbolFlags.ValueModule && target.constEnumOnlyModule && !source.constEnumOnlyModule) { // reset flag when merging instantiated module into value module that has only const enums diff --git a/tests/baselines/reference/ambientShorthand_duplicate.js b/tests/baselines/reference/ambientShorthand_duplicate.js new file mode 100644 index 00000000000..d99eb3d27dc --- /dev/null +++ b/tests/baselines/reference/ambientShorthand_duplicate.js @@ -0,0 +1,16 @@ +//// [tests/cases/conformance/ambient/ambientShorthand_duplicate.ts] //// + +//// [declarations1.d.ts] +declare module "foo"; + +//// [declarations2.d.ts] +declare module "foo"; + +//// [user.ts] +/// +/// +import foo from "foo"; + + +//// [user.js] +"use strict"; diff --git a/tests/baselines/reference/ambientShorthand_duplicate.symbols b/tests/baselines/reference/ambientShorthand_duplicate.symbols new file mode 100644 index 00000000000..05856b47b92 --- /dev/null +++ b/tests/baselines/reference/ambientShorthand_duplicate.symbols @@ -0,0 +1,10 @@ +=== tests/cases/conformance/ambient/user.ts === +/// +/// +import foo from "foo"; +>foo : Symbol(foo, Decl(user.ts, 2, 6)) + +=== tests/cases/conformance/ambient/declarations1.d.ts === +declare module "foo"; +No type information for this code. +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/ambientShorthand_duplicate.types b/tests/baselines/reference/ambientShorthand_duplicate.types new file mode 100644 index 00000000000..1520c5447ec --- /dev/null +++ b/tests/baselines/reference/ambientShorthand_duplicate.types @@ -0,0 +1,10 @@ +=== tests/cases/conformance/ambient/user.ts === +/// +/// +import foo from "foo"; +>foo : any + +=== tests/cases/conformance/ambient/declarations1.d.ts === +declare module "foo"; +No type information for this code. +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/ambientShorthand_merging.js b/tests/baselines/reference/ambientShorthand_merging.js new file mode 100644 index 00000000000..f0aaefc6366 --- /dev/null +++ b/tests/baselines/reference/ambientShorthand_merging.js @@ -0,0 +1,18 @@ +//// [tests/cases/conformance/ambient/ambientShorthand_merging.ts] //// + +//// [declarations1.d.ts] +declare module "foo"; + +//// [declarations2.d.ts] +declare module "foo" { + export const bar: number; +} + +//// [user.ts] +/// +/// +import foo, {bar} from "foo"; + + +//// [user.js] +"use strict"; diff --git a/tests/baselines/reference/ambientShorthand_merging.symbols b/tests/baselines/reference/ambientShorthand_merging.symbols new file mode 100644 index 00000000000..8a0ca5acb74 --- /dev/null +++ b/tests/baselines/reference/ambientShorthand_merging.symbols @@ -0,0 +1,11 @@ +=== tests/cases/conformance/ambient/user.ts === +/// +/// +import foo, {bar} from "foo"; +>foo : Symbol(foo, Decl(user.ts, 2, 6)) +>bar : Symbol(bar, Decl(user.ts, 2, 13)) + +=== tests/cases/conformance/ambient/declarations1.d.ts === +declare module "foo"; +No type information for this code. +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/ambientShorthand_merging.types b/tests/baselines/reference/ambientShorthand_merging.types new file mode 100644 index 00000000000..78390a35dd8 --- /dev/null +++ b/tests/baselines/reference/ambientShorthand_merging.types @@ -0,0 +1,11 @@ +=== tests/cases/conformance/ambient/user.ts === +/// +/// +import foo, {bar} from "foo"; +>foo : any +>bar : any + +=== tests/cases/conformance/ambient/declarations1.d.ts === +declare module "foo"; +No type information for this code. +No type information for this code. \ No newline at end of file diff --git a/tests/cases/conformance/ambient/ambientShorthand_duplicate.ts b/tests/cases/conformance/ambient/ambientShorthand_duplicate.ts new file mode 100644 index 00000000000..03a0dd72249 --- /dev/null +++ b/tests/cases/conformance/ambient/ambientShorthand_duplicate.ts @@ -0,0 +1,10 @@ +// @Filename: declarations1.d.ts +declare module "foo"; + +// @Filename: declarations2.d.ts +declare module "foo"; + +// @Filename: user.ts +/// +/// +import foo from "foo"; diff --git a/tests/cases/conformance/ambient/ambientShorthand_merging.ts b/tests/cases/conformance/ambient/ambientShorthand_merging.ts new file mode 100644 index 00000000000..a7bd7784d43 --- /dev/null +++ b/tests/cases/conformance/ambient/ambientShorthand_merging.ts @@ -0,0 +1,12 @@ +// @Filename: declarations1.d.ts +declare module "foo"; + +// @Filename: declarations2.d.ts +declare module "foo" { + export const bar: number; +} + +// @Filename: user.ts +/// +/// +import foo, {bar} from "foo";