@@ -1445,12 +1445,6 @@ namespace ts {
1445
1445
return result;
1446
1446
}
1447
1447
break;
1448
- case SyntaxKind.ClassDeclaration:
1449
- case SyntaxKind.InterfaceDeclaration:
1450
- if (result = callback(getSymbolOfNode(location).members)) {
1451
- return result;
1452
- }
1453
- break;
1454
1448
}
1455
1449
}
1456
1450
@@ -1516,7 +1510,9 @@ namespace ts {
1516
1510
}
1517
1511
1518
1512
if (symbol) {
1519
- return forEachSymbolTableInScope(enclosingDeclaration, getAccessibleSymbolChainFromSymbolTable);
1513
+ if (!(isPropertyOrMethodDeclarationSymbol(symbol))) {
1514
+ return forEachSymbolTableInScope(enclosingDeclaration, getAccessibleSymbolChainFromSymbolTable);
1515
+ }
1520
1516
}
1521
1517
}
1522
1518
@@ -1549,6 +1545,24 @@ namespace ts {
1549
1545
return qualify;
1550
1546
}
1551
1547
1548
+ function isPropertyOrMethodDeclarationSymbol(symbol: Symbol) {
1549
+ if (symbol.declarations && symbol.declarations.length) {
1550
+ for (const declaration of symbol.declarations) {
1551
+ switch (declaration.kind) {
1552
+ case SyntaxKind.PropertyDeclaration:
1553
+ case SyntaxKind.MethodDeclaration:
1554
+ case SyntaxKind.GetAccessor:
1555
+ case SyntaxKind.SetAccessor:
1556
+ continue;
1557
+ default:
1558
+ return false;
1559
+ }
1560
+ }
1561
+ return true;
1562
+ }
1563
+ return false;
1564
+ }
1565
+
1552
1566
function isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessibilityResult {
1553
1567
if (symbol && enclosingDeclaration && !(symbol.flags & SymbolFlags.TypeParameter)) {
1554
1568
const initialSymbol = symbol;
@@ -5701,7 +5715,7 @@ namespace ts {
5701
5715
}
5702
5716
}
5703
5717
if (target.flags & TypeFlags.Union) {
5704
- if (result = typeRelatedToSomeType(source, <UnionType>target, reportErrors)) {
5718
+ if (result = typeRelatedToSomeType(source, <UnionType>target, reportErrors && !(source.flags & TypeFlags.Primitive) )) {
5705
5719
return result;
5706
5720
}
5707
5721
}
@@ -6798,7 +6812,6 @@ namespace ts {
6798
6812
function inferTypes(context: InferenceContext, source: Type, target: Type) {
6799
6813
let sourceStack: Type[];
6800
6814
let targetStack: Type[];
6801
- const maxDepth = 5;
6802
6815
let depth = 0;
6803
6816
let inferiority = 0;
6804
6817
const visited: Map<boolean> = {};
@@ -6927,11 +6940,6 @@ namespace ts {
6927
6940
if (isInProcess(source, target)) {
6928
6941
return;
6929
6942
}
6930
- // we delibirately limit the depth we examine to infer types: this speeds up the overall inference process
6931
- // and user rarely expects inferences to be made from the deeply nested constituents.
6932
- if (depth > maxDepth) {
6933
- return;
6934
- }
6935
6943
if (isDeeplyNestedGeneric(source, sourceStack, depth) && isDeeplyNestedGeneric(target, targetStack, depth)) {
6936
6944
return;
6937
6945
}
@@ -15496,8 +15504,14 @@ namespace ts {
15496
15504
const symbol = getSymbolOfNode(node);
15497
15505
const target = resolveAlias(symbol);
15498
15506
if (target !== unknownSymbol) {
15507
+ // For external modules symbol represent local symbol for an alias.
15508
+ // This local symbol will merge any other local declarations (excluding other aliases)
15509
+ // and symbol.flags will contains combined representation for all merged declaration.
15510
+ // Based on symbol.flags we can compute a set of excluded meanings (meaning that resolved alias should not have,
15511
+ // otherwise it will conflict with some local declaration). Note that in addition to normal flags we include matching SymbolFlags.Export*
15512
+ // in order to prevent collisions with declarations that were exported from the current module (they still contribute to local names).
15499
15513
const excludedMeanings =
15500
- (symbol.flags & SymbolFlags.Value ? SymbolFlags.Value : 0) |
15514
+ (symbol.flags & ( SymbolFlags.Value | SymbolFlags.ExportValue) ? SymbolFlags.Value : 0) |
15501
15515
(symbol.flags & SymbolFlags.Type ? SymbolFlags.Type : 0) |
15502
15516
(symbol.flags & SymbolFlags.Namespace ? SymbolFlags.Namespace : 0);
15503
15517
if (target.flags & excludedMeanings) {
0 commit comments