Add merging tests
This commit is contained in:
parent
1541ebe781
commit
ed6bfcdb08
|
@ -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
|
||||
|
|
16
tests/baselines/reference/ambientShorthand_duplicate.js
Normal file
16
tests/baselines/reference/ambientShorthand_duplicate.js
Normal file
|
@ -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]
|
||||
///<reference path="declarations1.d.ts" />
|
||||
///<reference path="declarations1.d.ts" />
|
||||
import foo from "foo";
|
||||
|
||||
|
||||
//// [user.js]
|
||||
"use strict";
|
10
tests/baselines/reference/ambientShorthand_duplicate.symbols
Normal file
10
tests/baselines/reference/ambientShorthand_duplicate.symbols
Normal file
|
@ -0,0 +1,10 @@
|
|||
=== tests/cases/conformance/ambient/user.ts ===
|
||||
///<reference path="declarations1.d.ts" />
|
||||
///<reference path="declarations1.d.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.
|
10
tests/baselines/reference/ambientShorthand_duplicate.types
Normal file
10
tests/baselines/reference/ambientShorthand_duplicate.types
Normal file
|
@ -0,0 +1,10 @@
|
|||
=== tests/cases/conformance/ambient/user.ts ===
|
||||
///<reference path="declarations1.d.ts" />
|
||||
///<reference path="declarations1.d.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.
|
18
tests/baselines/reference/ambientShorthand_merging.js
Normal file
18
tests/baselines/reference/ambientShorthand_merging.js
Normal file
|
@ -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]
|
||||
///<reference path="declarations1.d.ts" />
|
||||
///<reference path="declarations1.d.ts" />
|
||||
import foo, {bar} from "foo";
|
||||
|
||||
|
||||
//// [user.js]
|
||||
"use strict";
|
11
tests/baselines/reference/ambientShorthand_merging.symbols
Normal file
11
tests/baselines/reference/ambientShorthand_merging.symbols
Normal file
|
@ -0,0 +1,11 @@
|
|||
=== tests/cases/conformance/ambient/user.ts ===
|
||||
///<reference path="declarations1.d.ts" />
|
||||
///<reference path="declarations1.d.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.
|
11
tests/baselines/reference/ambientShorthand_merging.types
Normal file
11
tests/baselines/reference/ambientShorthand_merging.types
Normal file
|
@ -0,0 +1,11 @@
|
|||
=== tests/cases/conformance/ambient/user.ts ===
|
||||
///<reference path="declarations1.d.ts" />
|
||||
///<reference path="declarations1.d.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.
|
|
@ -0,0 +1,10 @@
|
|||
// @Filename: declarations1.d.ts
|
||||
declare module "foo";
|
||||
|
||||
// @Filename: declarations2.d.ts
|
||||
declare module "foo";
|
||||
|
||||
// @Filename: user.ts
|
||||
///<reference path="declarations1.d.ts" />
|
||||
///<reference path="declarations1.d.ts" />
|
||||
import foo from "foo";
|
12
tests/cases/conformance/ambient/ambientShorthand_merging.ts
Normal file
12
tests/cases/conformance/ambient/ambientShorthand_merging.ts
Normal file
|
@ -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
|
||||
///<reference path="declarations1.d.ts" />
|
||||
///<reference path="declarations1.d.ts" />
|
||||
import foo, {bar} from "foo";
|
Loading…
Reference in a new issue