Skip to content

Commit 30ccc7a

Browse files
author
Andy Hanson
committed
Merge branch 'master' into map5
2 parents 6b6c34b + 7a45149 commit 30ccc7a

File tree

121 files changed

+5375
-2795
lines changed

Some content is hidden

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

121 files changed

+5375
-2795
lines changed

Gulpfile.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -242,23 +242,21 @@ function needsUpdate(source: string | string[], dest: string | string[]): boolea
242242
return true;
243243
}
244244

245+
// Doing tsconfig inheritance manually. https://github.com/ivogabe/gulp-typescript/issues/459
246+
const tsconfigBase = JSON.parse(fs.readFileSync("src/tsconfig-base.json", "utf-8")).compilerOptions;
247+
245248
function getCompilerSettings(base: tsc.Settings, useBuiltCompiler?: boolean): tsc.Settings {
246249
const copy: tsc.Settings = {};
247-
copy.noEmitOnError = true;
248-
copy.noImplicitAny = true;
249-
copy.noImplicitThis = true;
250-
copy.pretty = true;
251-
copy.types = [];
250+
for (const key in tsconfigBase) {
251+
copy[key] = tsconfigBase[key];
252+
}
252253
for (const key in base) {
253254
copy[key] = base[key];
254255
}
255256
if (!useDebugMode) {
256257
if (copy.removeComments === undefined) copy.removeComments = true;
257258
copy.newLine = "lf";
258259
}
259-
else {
260-
copy.preserveConstEnums = true;
261-
}
262260
if (useBuiltCompiler === true) {
263261
copy.typescript = require("./built/local/typescript.js");
264262
}

src/compiler/checker.ts

Lines changed: 74 additions & 78 deletions
Large diffs are not rendered by default.

src/compiler/declarationEmitter.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,7 @@ namespace ts {
390390
case SyntaxKind.StringKeyword:
391391
case SyntaxKind.NumberKeyword:
392392
case SyntaxKind.BooleanKeyword:
393+
case SyntaxKind.ObjectKeyword:
393394
case SyntaxKind.SymbolKeyword:
394395
case SyntaxKind.VoidKeyword:
395396
case SyntaxKind.UndefinedKeyword:

src/compiler/scanner.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -732,11 +732,11 @@ namespace ts {
732732
return comments;
733733
}
734734

735-
export function getLeadingCommentRanges(text: string, pos: number): CommentRange[] {
735+
export function getLeadingCommentRanges(text: string, pos: number): CommentRange[] | undefined {
736736
return reduceEachLeadingCommentRange(text, pos, appendCommentRange, undefined, undefined);
737737
}
738738

739-
export function getTrailingCommentRanges(text: string, pos: number): CommentRange[] {
739+
export function getTrailingCommentRanges(text: string, pos: number): CommentRange[] | undefined {
740740
return reduceEachTrailingCommentRange(text, pos, appendCommentRange, undefined, undefined);
741741
}
742742

src/compiler/tsc.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ namespace ts {
157157
output += `${ diagnostic.file.fileName }(${ loc.line + 1 },${ loc.character + 1 }): `;
158158
}
159159

160-
output += `${ flattenDiagnosticMessageText(diagnostic.messageText, sys.newLine) }${ sys.newLine }`;
160+
output += `${ flattenDiagnosticMessageText(diagnostic.messageText, sys.newLine) }${ sys.newLine + sys.newLine + sys.newLine }`;
161161

162162
sys.write(output);
163163
}

src/compiler/types.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2360,6 +2360,11 @@
23602360
getIndexTypeOfType(type: Type, kind: IndexKind): Type;
23612361
getBaseTypes(type: InterfaceType): ObjectType[];
23622362
getReturnTypeOfSignature(signature: Signature): Type;
2363+
/**
2364+
* Gets the type of a parameter at a given position in a signature.
2365+
* Returns `any` if the index is not valid.
2366+
*/
2367+
/* @internal */ getParameterType(signature: Signature, parameterIndex: number): Type;
23632368
getNonNullableType(type: Type): Type;
23642369

23652370
getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[];
@@ -2389,6 +2394,8 @@
23892394
isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean;
23902395
getAliasedSymbol(symbol: Symbol): Symbol;
23912396
getExportsOfModule(moduleSymbol: Symbol): Symbol[];
2397+
/** Unlike `getExportsOfModule`, this includes properties of an `export =` value. */
2398+
/* @internal */ getExportsAndPropertiesOfModule(moduleSymbol: Symbol): Symbol[];
23922399

23932400
getJsxElementAttributesType(elementNode: JsxOpeningLikeElement): Type;
23942401
getJsxIntrinsicTagNames(): Symbol[];

src/harness/fourslash.ts

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,8 +421,7 @@ namespace FourSlash {
421421
}
422422

423423
private raiseError(message: string) {
424-
message = this.messageAtLastKnownMarker(message);
425-
throw new Error(message);
424+
throw new Error(this.messageAtLastKnownMarker(message));
426425
}
427426

428427
private messageAtLastKnownMarker(message: string) {
@@ -720,6 +719,27 @@ namespace FourSlash {
720719
}
721720
}
722721

722+
public verifyCompletionsAt(markerName: string, expected: string[]) {
723+
this.goToMarker(markerName);
724+
725+
const actualCompletions = this.getCompletionListAtCaret();
726+
if (!actualCompletions) {
727+
this.raiseError(`No completions at position '${this.currentCaretPosition}'.`);
728+
}
729+
730+
const actual = actualCompletions.entries;
731+
732+
if (actual.length !== expected.length) {
733+
this.raiseError(`Expected ${expected.length} completions, got ${actual.map(a => a.name)}.`);
734+
}
735+
736+
ts.zipWith(actual, expected, (completion, expectedCompletion, index) => {
737+
if (completion.name !== expectedCompletion) {
738+
this.raiseError(`Expected completion at index ${index} to be ${expectedCompletion}, got ${completion.name}`);
739+
}
740+
});
741+
}
742+
723743
public verifyCompletionListContains(symbol: string, text?: string, documentation?: string, kind?: string, spanIndex?: number) {
724744
const completions = this.getCompletionListAtCaret();
725745
if (completions) {
@@ -3162,6 +3182,10 @@ namespace FourSlashInterface {
31623182
super(state);
31633183
}
31643184

3185+
public completionsAt(markerName: string, completions: string[]) {
3186+
this.state.verifyCompletionsAt(markerName, completions);
3187+
}
3188+
31653189
public quickInfoIs(expectedText: string, expectedDocumentation?: string) {
31663190
this.state.verifyQuickInfoString(expectedText, expectedDocumentation);
31673191
}

0 commit comments

Comments
 (0)