Merge pull request #3041 from Microsoft/fixCircularAliasError
Fix circular alias error
This commit is contained in:
commit
69de046074
|
@ -350,9 +350,9 @@ module ts {
|
||||||
}
|
}
|
||||||
else if (location.kind === SyntaxKind.SourceFile ||
|
else if (location.kind === SyntaxKind.SourceFile ||
|
||||||
(location.kind === SyntaxKind.ModuleDeclaration && (<ModuleDeclaration>location).name.kind === SyntaxKind.StringLiteral)) {
|
(location.kind === SyntaxKind.ModuleDeclaration && (<ModuleDeclaration>location).name.kind === SyntaxKind.StringLiteral)) {
|
||||||
result = getSymbol(getSymbolOfNode(location).exports, "default", meaning & SymbolFlags.ModuleMember);
|
result = getSymbolOfNode(location).exports["default"];
|
||||||
let localSymbol = getLocalSymbolForExportDefault(result);
|
let localSymbol = getLocalSymbolForExportDefault(result);
|
||||||
if (result && (result.flags & meaning) && localSymbol && localSymbol.name === name) {
|
if (result && localSymbol && (result.flags & meaning) && localSymbol.name === name) {
|
||||||
break loop;
|
break loop;
|
||||||
}
|
}
|
||||||
result = undefined;
|
result = undefined;
|
||||||
|
|
|
@ -1695,7 +1695,7 @@ module ts {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getLocalSymbolForExportDefault(symbol: Symbol) {
|
export function getLocalSymbolForExportDefault(symbol: Symbol) {
|
||||||
return symbol && symbol.valueDeclaration && (symbol.valueDeclaration.flags & NodeFlags.Default) ? symbol.valueDeclaration.localSymbol : undefined;
|
return symbol && symbol.valueDeclaration && (symbol.valueDeclaration.flags & NodeFlags.Default) ? symbol.valueDeclaration.localSymbol : undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
12
tests/baselines/reference/exportDefaultVariable.js
Normal file
12
tests/baselines/reference/exportDefaultVariable.js
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
//// [exportDefaultVariable.ts]
|
||||||
|
// Regression test for #3018
|
||||||
|
|
||||||
|
declare var io: any;
|
||||||
|
|
||||||
|
declare module 'module' {
|
||||||
|
export default io;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//// [exportDefaultVariable.js]
|
||||||
|
// Regression test for #3018
|
11
tests/baselines/reference/exportDefaultVariable.symbols
Normal file
11
tests/baselines/reference/exportDefaultVariable.symbols
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
=== tests/cases/compiler/exportDefaultVariable.ts ===
|
||||||
|
// Regression test for #3018
|
||||||
|
|
||||||
|
declare var io: any;
|
||||||
|
>io : Symbol(io, Decl(exportDefaultVariable.ts, 2, 11))
|
||||||
|
|
||||||
|
declare module 'module' {
|
||||||
|
export default io;
|
||||||
|
>io : Symbol(default, Decl(exportDefaultVariable.ts, 2, 11))
|
||||||
|
}
|
||||||
|
|
11
tests/baselines/reference/exportDefaultVariable.types
Normal file
11
tests/baselines/reference/exportDefaultVariable.types
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
=== tests/cases/compiler/exportDefaultVariable.ts ===
|
||||||
|
// Regression test for #3018
|
||||||
|
|
||||||
|
declare var io: any;
|
||||||
|
>io : any
|
||||||
|
|
||||||
|
declare module 'module' {
|
||||||
|
export default io;
|
||||||
|
>io : any
|
||||||
|
}
|
||||||
|
|
7
tests/cases/compiler/exportDefaultVariable.ts
Normal file
7
tests/cases/compiler/exportDefaultVariable.ts
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
// Regression test for #3018
|
||||||
|
|
||||||
|
declare var io: any;
|
||||||
|
|
||||||
|
declare module 'module' {
|
||||||
|
export default io;
|
||||||
|
}
|
Loading…
Reference in a new issue