Test:reference ambient block scoped vars in different file

This commit is contained in:
Nathan Shively-Sanders
2017-05-11 11:38:26 -07:00
parent e76c96ce54
commit 7803c1ce17
4 changed files with 147 additions and 0 deletions
@@ -0,0 +1,35 @@
//// [tests/cases/compiler/blockScopedNamespaceDifferentFile.ts] ////
//// [test.ts]
// #15734 failed when test.ts comes before typings.d.ts
namespace C {
export class Name {
static funcData = A.AA.func();
static someConst = A.AA.foo;
constructor(parameters) {}
}
}
//// [typings.d.ts]
declare namespace A {
namespace AA {
function func(): number;
const foo = "";
}
}
//// [out.js]
// #15734 failed when test.ts comes before typings.d.ts
var C;
(function (C) {
var Name = (function () {
function Name(parameters) {
}
return Name;
}());
Name.funcData = A.AA.func();
Name.someConst = A.AA.foo;
C.Name = Name;
})(C || (C = {}));
@@ -0,0 +1,44 @@
=== tests/cases/compiler/test.ts ===
// #15734 failed when test.ts comes before typings.d.ts
namespace C {
>C : Symbol(C, Decl(test.ts, 0, 0))
export class Name {
>Name : Symbol(Name, Decl(test.ts, 1, 13))
static funcData = A.AA.func();
>funcData : Symbol(Name.funcData, Decl(test.ts, 2, 23))
>A.AA.func : Symbol(A.AA.func, Decl(typings.d.ts, 1, 18))
>A.AA : Symbol(A.AA, Decl(typings.d.ts, 0, 21))
>A : Symbol(A, Decl(typings.d.ts, 0, 0))
>AA : Symbol(A.AA, Decl(typings.d.ts, 0, 21))
>func : Symbol(A.AA.func, Decl(typings.d.ts, 1, 18))
static someConst = A.AA.foo;
>someConst : Symbol(Name.someConst, Decl(test.ts, 3, 38))
>A.AA.foo : Symbol(A.AA.foo, Decl(typings.d.ts, 3, 13))
>A.AA : Symbol(A.AA, Decl(typings.d.ts, 0, 21))
>A : Symbol(A, Decl(typings.d.ts, 0, 0))
>AA : Symbol(A.AA, Decl(typings.d.ts, 0, 21))
>foo : Symbol(A.AA.foo, Decl(typings.d.ts, 3, 13))
constructor(parameters) {}
>parameters : Symbol(parameters, Decl(test.ts, 6, 20))
}
}
=== tests/cases/compiler/typings.d.ts ===
declare namespace A {
>A : Symbol(A, Decl(typings.d.ts, 0, 0))
namespace AA {
>AA : Symbol(AA, Decl(typings.d.ts, 0, 21))
function func(): number;
>func : Symbol(func, Decl(typings.d.ts, 1, 18))
const foo = "";
>foo : Symbol(foo, Decl(typings.d.ts, 3, 13))
}
}
@@ -0,0 +1,46 @@
=== tests/cases/compiler/test.ts ===
// #15734 failed when test.ts comes before typings.d.ts
namespace C {
>C : typeof C
export class Name {
>Name : Name
static funcData = A.AA.func();
>funcData : number
>A.AA.func() : number
>A.AA.func : () => number
>A.AA : typeof A.AA
>A : typeof A
>AA : typeof A.AA
>func : () => number
static someConst = A.AA.foo;
>someConst : string
>A.AA.foo : ""
>A.AA : typeof A.AA
>A : typeof A
>AA : typeof A.AA
>foo : ""
constructor(parameters) {}
>parameters : any
}
}
=== tests/cases/compiler/typings.d.ts ===
declare namespace A {
>A : typeof A
namespace AA {
>AA : typeof AA
function func(): number;
>func : () => number
const foo = "";
>foo : ""
>"" : ""
}
}
@@ -0,0 +1,22 @@
// @target: es5
// @outFile: out.js
// @module: amd
// #15734 failed when test.ts comes before typings.d.ts
// @Filename: test.ts
namespace C {
export class Name {
static funcData = A.AA.func();
static someConst = A.AA.foo;
constructor(parameters) {}
}
}
// @Filename: typings.d.ts
declare namespace A {
namespace AA {
function func(): number;
const foo = "";
}
}