From ff43d464fc74e2617de0f8675961193a2f53a34f Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Thu, 8 Oct 2015 16:36:15 -0700 Subject: [PATCH] Add test case --- .../ambientClassDeclarationWithExtends.js | 13 ++++++++++++ ...ambientClassDeclarationWithExtends.symbols | 19 ++++++++++++++++++ .../ambientClassDeclarationWithExtends.types | 20 +++++++++++++++++++ .../ambientClassDeclarationWithExtends.ts | 8 ++++++++ 4 files changed, 60 insertions(+) diff --git a/tests/baselines/reference/ambientClassDeclarationWithExtends.js b/tests/baselines/reference/ambientClassDeclarationWithExtends.js index 5fd4d5b4b28..5a31486bcf0 100644 --- a/tests/baselines/reference/ambientClassDeclarationWithExtends.js +++ b/tests/baselines/reference/ambientClassDeclarationWithExtends.js @@ -1,6 +1,19 @@ //// [ambientClassDeclarationWithExtends.ts] declare class A { } declare class B extends A { } + +declare class C { + public foo; +} +namespace D { var x; } +declare class D extends C { } + +var d: C = new D(); //// [ambientClassDeclarationWithExtends.js] +var D; +(function (D) { + var x; +})(D || (D = {})); +var d = new D(); diff --git a/tests/baselines/reference/ambientClassDeclarationWithExtends.symbols b/tests/baselines/reference/ambientClassDeclarationWithExtends.symbols index 71d1e1a66d8..ba678910a9c 100644 --- a/tests/baselines/reference/ambientClassDeclarationWithExtends.symbols +++ b/tests/baselines/reference/ambientClassDeclarationWithExtends.symbols @@ -6,3 +6,22 @@ declare class B extends A { } >B : Symbol(B, Decl(ambientClassDeclarationWithExtends.ts, 0, 19)) >A : Symbol(A, Decl(ambientClassDeclarationWithExtends.ts, 0, 0)) +declare class C { +>C : Symbol(C, Decl(ambientClassDeclarationWithExtends.ts, 1, 29)) + + public foo; +>foo : Symbol(foo, Decl(ambientClassDeclarationWithExtends.ts, 3, 17)) +} +namespace D { var x; } +>D : Symbol(D, Decl(ambientClassDeclarationWithExtends.ts, 5, 1), Decl(ambientClassDeclarationWithExtends.ts, 6, 22)) +>x : Symbol(x, Decl(ambientClassDeclarationWithExtends.ts, 6, 17)) + +declare class D extends C { } +>D : Symbol(D, Decl(ambientClassDeclarationWithExtends.ts, 5, 1), Decl(ambientClassDeclarationWithExtends.ts, 6, 22)) +>C : Symbol(C, Decl(ambientClassDeclarationWithExtends.ts, 1, 29)) + +var d: C = new D(); +>d : Symbol(d, Decl(ambientClassDeclarationWithExtends.ts, 9, 3)) +>C : Symbol(C, Decl(ambientClassDeclarationWithExtends.ts, 1, 29)) +>D : Symbol(D, Decl(ambientClassDeclarationWithExtends.ts, 5, 1), Decl(ambientClassDeclarationWithExtends.ts, 6, 22)) + diff --git a/tests/baselines/reference/ambientClassDeclarationWithExtends.types b/tests/baselines/reference/ambientClassDeclarationWithExtends.types index 7609856882b..528496e753d 100644 --- a/tests/baselines/reference/ambientClassDeclarationWithExtends.types +++ b/tests/baselines/reference/ambientClassDeclarationWithExtends.types @@ -6,3 +6,23 @@ declare class B extends A { } >B : B >A : A +declare class C { +>C : C + + public foo; +>foo : any +} +namespace D { var x; } +>D : typeof D +>x : any + +declare class D extends C { } +>D : D +>C : C + +var d: C = new D(); +>d : C +>C : C +>new D() : D +>D : typeof D + diff --git a/tests/cases/compiler/ambientClassDeclarationWithExtends.ts b/tests/cases/compiler/ambientClassDeclarationWithExtends.ts index 0c5d8d156bf..554a436c5ef 100644 --- a/tests/cases/compiler/ambientClassDeclarationWithExtends.ts +++ b/tests/cases/compiler/ambientClassDeclarationWithExtends.ts @@ -1,2 +1,10 @@ declare class A { } declare class B extends A { } + +declare class C { + public foo; +} +namespace D { var x; } +declare class D extends C { } + +var d: C = new D();