Skip to content

Commit 413d9a6

Browse files
committed
Merge branch 'master' into strictNullChecks
Conflicts: src/compiler/diagnosticMessages.json src/compiler/types.ts tests/baselines/reference/typeGuardOfFormTypeOfEqualEqualHasNoEffect.symbols tests/baselines/reference/typeGuardOfFormTypeOfNotEqualHasNoEffect.symbols
2 parents b497243 + e052eb1 commit 413d9a6

File tree

1,271 files changed

+9524
-7018
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,271 files changed

+9524
-7018
lines changed

Jakefile.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,10 @@ var harnessSources = harnessCoreSources.concat([
150150
"reuseProgramStructure.ts",
151151
"cachingInServerLSHost.ts",
152152
"moduleResolution.ts",
153-
"tsconfigParsing.ts"
153+
"tsconfigParsing.ts",
154+
"commandLineParsing.ts",
155+
"convertCompilerOptionsFromJson.ts",
156+
"convertTypingOptionsFromJson.ts"
154157
].map(function (f) {
155158
return path.join(unittestsDirectory, f);
156159
})).concat([

src/compiler/checker.ts

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1445,12 +1445,6 @@ namespace ts {
14451445
return result;
14461446
}
14471447
break;
1448-
case SyntaxKind.ClassDeclaration:
1449-
case SyntaxKind.InterfaceDeclaration:
1450-
if (result = callback(getSymbolOfNode(location).members)) {
1451-
return result;
1452-
}
1453-
break;
14541448
}
14551449
}
14561450

@@ -1516,7 +1510,9 @@ namespace ts {
15161510
}
15171511

15181512
if (symbol) {
1519-
return forEachSymbolTableInScope(enclosingDeclaration, getAccessibleSymbolChainFromSymbolTable);
1513+
if (!(isPropertyOrMethodDeclarationSymbol(symbol))) {
1514+
return forEachSymbolTableInScope(enclosingDeclaration, getAccessibleSymbolChainFromSymbolTable);
1515+
}
15201516
}
15211517
}
15221518

@@ -1549,6 +1545,24 @@ namespace ts {
15491545
return qualify;
15501546
}
15511547

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+
15521566
function isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessibilityResult {
15531567
if (symbol && enclosingDeclaration && !(symbol.flags & SymbolFlags.TypeParameter)) {
15541568
const initialSymbol = symbol;
@@ -5701,7 +5715,7 @@ namespace ts {
57015715
}
57025716
}
57035717
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))) {
57055719
return result;
57065720
}
57075721
}
@@ -6798,7 +6812,6 @@ namespace ts {
67986812
function inferTypes(context: InferenceContext, source: Type, target: Type) {
67996813
let sourceStack: Type[];
68006814
let targetStack: Type[];
6801-
const maxDepth = 5;
68026815
let depth = 0;
68036816
let inferiority = 0;
68046817
const visited: Map<boolean> = {};
@@ -6927,11 +6940,6 @@ namespace ts {
69276940
if (isInProcess(source, target)) {
69286941
return;
69296942
}
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-
}
69356943
if (isDeeplyNestedGeneric(source, sourceStack, depth) && isDeeplyNestedGeneric(target, targetStack, depth)) {
69366944
return;
69376945
}
@@ -15496,8 +15504,14 @@ namespace ts {
1549615504
const symbol = getSymbolOfNode(node);
1549715505
const target = resolveAlias(symbol);
1549815506
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).
1549915513
const excludedMeanings =
15500-
(symbol.flags & SymbolFlags.Value ? SymbolFlags.Value : 0) |
15514+
(symbol.flags & (SymbolFlags.Value | SymbolFlags.ExportValue) ? SymbolFlags.Value : 0) |
1550115515
(symbol.flags & SymbolFlags.Type ? SymbolFlags.Type : 0) |
1550215516
(symbol.flags & SymbolFlags.Namespace ? SymbolFlags.Namespace : 0);
1550315517
if (target.flags & excludedMeanings) {

0 commit comments

Comments
 (0)