Skip to content

Commit e0fd0e8

Browse files
author
Andy Hanson
committed
Merge branch 'master' into walk_symbol
2 parents 739ec8e + 3cca17e commit e0fd0e8

File tree

2,221 files changed

+21595
-14448
lines changed

Some content is hidden

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

2,221 files changed

+21595
-14448
lines changed

Jakefile.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ var servicesSources = [
126126
"classifier.ts",
127127
"completions.ts",
128128
"documentHighlights.ts",
129+
"documentRegistry.ts",
129130
"findAllReferences.ts",
130131
"goToDefinition.ts",
131132
"jsDoc.ts",

lib/lib.es2015.collection.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ interface Map<K, V> {
2020
forEach(callbackfn: (value: V, index: K, map: Map<K, V>) => void, thisArg?: any): void;
2121
get(key: K): V | undefined;
2222
has(key: K): boolean;
23-
set(key: K, value?: V): this;
23+
set(key: K, value: V): this;
2424
readonly size: number;
2525
}
2626

@@ -36,7 +36,7 @@ interface WeakMap<K, V> {
3636
delete(key: K): boolean;
3737
get(key: K): V | undefined;
3838
has(key: K): boolean;
39-
set(key: K, value?: V): this;
39+
set(key: K, value: V): this;
4040
}
4141

4242
interface WeakMapConstructor {

src/compiler/binder.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,9 @@ namespace ts {
591591
case SyntaxKind.PrefixUnaryExpression:
592592
bindPrefixUnaryExpressionFlow(<PrefixUnaryExpression>node);
593593
break;
594+
case SyntaxKind.PostfixUnaryExpression:
595+
bindPostfixUnaryExpressionFlow(<PostfixUnaryExpression>node);
596+
break;
594597
case SyntaxKind.BinaryExpression:
595598
bindBinaryExpressionFlow(<BinaryExpression>node);
596599
break;
@@ -1106,6 +1109,16 @@ namespace ts {
11061109
}
11071110
else {
11081111
forEachChild(node, bind);
1112+
if (node.operator === SyntaxKind.PlusEqualsToken || node.operator === SyntaxKind.MinusMinusToken) {
1113+
bindAssignmentTargetFlow(node.operand);
1114+
}
1115+
}
1116+
}
1117+
1118+
function bindPostfixUnaryExpressionFlow(node: PostfixUnaryExpression) {
1119+
forEachChild(node, bind);
1120+
if (node.operator === SyntaxKind.PlusPlusToken || node.operator === SyntaxKind.MinusMinusToken) {
1121+
bindAssignmentTargetFlow(node.operand);
11091122
}
11101123
}
11111124

src/compiler/checker.ts

Lines changed: 123 additions & 133 deletions
Large diffs are not rendered by default.

src/compiler/diagnosticMessages.json

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,10 +1063,6 @@
10631063
"category": "Error",
10641064
"code": 2353
10651065
},
1066-
"No best common type exists among return expressions.": {
1067-
"category": "Error",
1068-
"code": 2354
1069-
},
10701066
"A function whose declared type is neither 'void' nor 'any' must return a value.": {
10711067
"category": "Error",
10721068
"code": 2355
@@ -1631,10 +1627,6 @@
16311627
"category": "Error",
16321628
"code": 2503
16331629
},
1634-
"No best common type exists among yield expressions.": {
1635-
"category": "Error",
1636-
"code": 2504
1637-
},
16381630
"A generator cannot have a 'void' type annotation.": {
16391631
"category": "Error",
16401632
"code": 2505

src/compiler/types.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2593,13 +2593,14 @@ namespace ts {
25932593
export interface TypeInferences {
25942594
primary: Type[]; // Inferences made directly to a type parameter
25952595
secondary: Type[]; // Inferences made to a type parameter in a union type
2596+
topLevel: boolean; // True if all inferences were made from top-level (not nested in object type) locations
25962597
isFixed: boolean; // Whether the type parameter is fixed, as defined in section 4.12.2 of the TypeScript spec
25972598
// If a type parameter is fixed, no more inferences can be made for the type parameter
25982599
}
25992600

26002601
/* @internal */
26012602
export interface InferenceContext {
2602-
typeParameters: TypeParameter[]; // Type parameters for which inferences are made
2603+
signature: Signature; // Generic signature for which inferences are made
26032604
inferUnionTypes: boolean; // Infer union types for disjoint candidates (otherwise undefinedType)
26042605
inferences: TypeInferences[]; // Inferences made for each type parameter
26052606
inferredTypes: Type[]; // Inferred type for each type parameter

src/harness/fourslash.ts

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -954,26 +954,20 @@ namespace FourSlash {
954954
assert.equal(actual, expected);
955955
}
956956

957-
public verifyQuickInfoString(negative: boolean, expectedText?: string, expectedDocumentation?: string) {
957+
public verifyQuickInfoString(negative: boolean, expectedText: string, expectedDocumentation?: string) {
958958
const actualQuickInfo = this.languageService.getQuickInfoAtPosition(this.activeFile.fileName, this.currentCaretPosition);
959959
const actualQuickInfoText = actualQuickInfo ? ts.displayPartsToString(actualQuickInfo.displayParts) : "";
960960
const actualQuickInfoDocumentation = actualQuickInfo ? ts.displayPartsToString(actualQuickInfo.documentation) : "";
961961

962962
if (negative) {
963-
if (expectedText !== undefined) {
964-
assert.notEqual(actualQuickInfoText, expectedText, this.messageAtLastKnownMarker("quick info text"));
965-
}
966-
// TODO: should be '==='?
967-
if (expectedDocumentation != undefined) {
963+
assert.notEqual(actualQuickInfoText, expectedText, this.messageAtLastKnownMarker("quick info text"));
964+
if (expectedDocumentation !== undefined) {
968965
assert.notEqual(actualQuickInfoDocumentation, expectedDocumentation, this.messageAtLastKnownMarker("quick info doc comment"));
969966
}
970967
}
971968
else {
972-
if (expectedText !== undefined) {
973-
assert.equal(actualQuickInfoText, expectedText, this.messageAtLastKnownMarker("quick info text"));
974-
}
975-
// TODO: should be '==='?
976-
if (expectedDocumentation != undefined) {
969+
assert.equal(actualQuickInfoText, expectedText, this.messageAtLastKnownMarker("quick info text"));
970+
if (expectedDocumentation !== undefined) {
977971
assert.equal(actualQuickInfoDocumentation, expectedDocumentation, this.assertionMessageAtLastKnownMarker("quick info doc"));
978972
}
979973
}
@@ -2969,7 +2963,7 @@ namespace FourSlashInterface {
29692963
this.state.verifyErrorExistsAfterMarker(markerName, !this.negative, /*after*/ false);
29702964
}
29712965

2972-
public quickInfoIs(expectedText?: string, expectedDocumentation?: string) {
2966+
public quickInfoIs(expectedText: string, expectedDocumentation?: string) {
29732967
this.state.verifyQuickInfoString(this.negative, expectedText, expectedDocumentation);
29742968
}
29752969

src/harness/harnessLanguageService.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,9 @@ namespace Harness.LanguageService {
408408
getCompletionEntryDetails(fileName: string, position: number, entryName: string): ts.CompletionEntryDetails {
409409
return unwrapJSONCallResult(this.shim.getCompletionEntryDetails(fileName, position, entryName));
410410
}
411+
getCompletionEntrySymbol(fileName: string, position: number, entryName: string): ts.Symbol {
412+
throw new Error("getCompletionEntrySymbol not implemented across the shim layer.");
413+
}
411414
getQuickInfoAtPosition(fileName: string, position: number): ts.QuickInfo {
412415
return unwrapJSONCallResult(this.shim.getQuickInfoAtPosition(fileName, position));
413416
}

src/server/client.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,10 @@ namespace ts.server {
246246
return response.body[0];
247247
}
248248

249+
getCompletionEntrySymbol(fileName: string, position: number, entryName: string): Symbol {
250+
throw new Error("Not Implemented Yet.");
251+
}
252+
249253
getNavigateToItems(searchValue: string): NavigateToItem[] {
250254
const args: protocol.NavtoRequestArgs = {
251255
searchValue,

src/services/completions.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -736,6 +736,22 @@ namespace ts.Completions {
736736
return undefined;
737737
}
738738

739+
export function getCompletionEntrySymbol(typeChecker: TypeChecker, log: (message: string) => void, compilerOptions: CompilerOptions, sourceFile: SourceFile, position: number, entryName: string): Symbol {
740+
// Compute all the completion symbols again.
741+
const completionData = getCompletionData(typeChecker, log, sourceFile, position);
742+
if (completionData) {
743+
const { symbols, location } = completionData;
744+
745+
// Find the symbol with the matching entry name.
746+
// We don't need to perform character checks here because we're only comparing the
747+
// name against 'entryName' (which is known to be good), not building a new
748+
// completion entry.
749+
return forEach(symbols, s => getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, /*performCharacterChecks*/ false, location) === entryName ? s : undefined);
750+
}
751+
752+
return undefined;
753+
}
754+
739755
function getCompletionData(typeChecker: TypeChecker, log: (message: string) => void, sourceFile: SourceFile, position: number) {
740756
const isJavaScriptFile = isSourceFileJavaScript(sourceFile);
741757

0 commit comments

Comments
 (0)