Merge pull request #466 from sparecycles/fix/checker-declaration

fix --declaration typechecking (complex case)
This commit is contained in:
Sheetal Nandi 2014-08-18 13:32:50 -07:00
commit 7a5512cdd0
3 changed files with 56 additions and 2 deletions

View File

@ -780,7 +780,7 @@ module ts {
// But it cant, hence the accessible is going to be undefined, but that doesnt mean m.c is accessible
// It is accessible if the parent m is accessible because then m.c can be accessed through qualification
meaningToLook = getQualifiedLeftMeaning(meaning);
symbol = symbol.parent;
symbol = getParentOfSymbol(symbol);
}
// This could be a symbol that is not exported in the external module
@ -903,7 +903,7 @@ module ts {
if (accessibleSymbolChain && !needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) {
break;
}
symbol = accessibleSymbolChain ? accessibleSymbolChain[0].parent : symbol.parent;
symbol = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol);
meaning = getQualifiedLeftMeaning(meaning);
}

View File

@ -0,0 +1,42 @@
//// [tests/cases/compiler/moduleSymbolMerging.ts] ////
//// [A.ts]
module A { export interface I {} }
//// [B.ts]
///<reference path="A.ts" />
module A { ; }
module B {
export function f(): A.I { return null; }
}
//// [A.js]
//// [B.js]
var A;
(function (A) {
;
})(A || (A = {}));
var B;
(function (B) {
function f() {
return null;
}
B.f = f;
})(B || (B = {}));
//// [A.d.ts]
declare module A {
interface I {
}
}
//// [B.d.ts]
/// <reference path='A.d.ts' />
declare module A {
}
declare module B {
function f(): A.I;
}

View File

@ -0,0 +1,12 @@
// @declaration: true
// @Filename: A.ts
module A { export interface I {} }
// @Filename: B.ts
///<reference path="A.ts" />
module A { ; }
module B {
export function f(): A.I { return null; }
}