Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ca87eed

Browse filesBrowse files
committed
Merge remote-tracking branch 'origin/master' into correctCommentsScaffolding
2 parents 081c692 + f79fca7 commit ca87eed
Copy full SHA for ca87eed

191 files changed

+1,644-1,367Lines changed: 1644 additions & 1367 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/compiler/checker.ts‎

Copy file name to clipboardExpand all lines: src/compiler/checker.ts
+4-3Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13475,13 +13475,14 @@ namespace ts {
1347513475
const containingClass = getContainingClass(node);
1347613476
if (containingClass) {
1347713477
const containingType = getTypeOfNode(containingClass);
13478-
const baseTypes = getBaseTypes(<InterfaceType>containingType);
13479-
if (baseTypes.length) {
13478+
let baseTypes = getBaseTypes(containingType as InterfaceType);
13479+
while (baseTypes.length) {
1348013480
const baseType = baseTypes[0];
1348113481
if (modifiers & ModifierFlags.Protected &&
1348213482
baseType.symbol === declaration.parent.symbol) {
1348313483
return true;
1348413484
}
13485+
baseTypes = getBaseTypes(baseType as InterfaceType);
1348513486
}
1348613487
}
1348713488
if (modifiers & ModifierFlags.Private) {
@@ -16207,7 +16208,7 @@ namespace ts {
1620716208
return undefined;
1620816209
}
1620916210

16210-
const onfulfilledParameterType = getTypeWithFacts(getUnionType(map(thenSignatures, getTypeOfFirstParameterOfSignature)), TypeFacts.NEUndefined);
16211+
const onfulfilledParameterType = getTypeWithFacts(getUnionType(map(thenSignatures, getTypeOfFirstParameterOfSignature)), TypeFacts.NEUndefinedOrNull);
1621116212
if (isTypeAny(onfulfilledParameterType)) {
1621216213
return undefined;
1621316214
}
Collapse file

‎src/compiler/core.ts‎

Copy file name to clipboardExpand all lines: src/compiler/core.ts
-18Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -863,24 +863,6 @@ namespace ts {
863863
return result;
864864
}
865865

866-
/**
867-
* Reduce the properties defined on a map-like (but not from its prototype chain).
868-
*
869-
* NOTE: This is intended for use with MapLike<T> objects. For Map<T> objects, use
870-
* reduceProperties instead as it offers better performance.
871-
*
872-
* @param map The map-like to reduce
873-
* @param callback An aggregation function that is called for each entry in the map
874-
* @param initial The initial value for the reduction.
875-
*/
876-
export function reduceOwnProperties<T, U>(map: MapLike<T>, callback: (aggregate: U, value: T, key: string) => U, initial: U): U {
877-
let result = initial;
878-
for (const key in map) if (hasOwnProperty.call(map, key)) {
879-
result = callback(result, map[key], String(key));
880-
}
881-
return result;
882-
}
883-
884866
/**
885867
* Performs a shallow equality comparison of the contents of two map-likes.
886868
*
Collapse file

‎src/compiler/sourcemap.ts‎

Copy file name to clipboardExpand all lines: src/compiler/sourcemap.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ namespace ts {
427427

428428
encodeLastRecordedSourceMapSpan();
429429

430-
return stringify({
430+
return JSON.stringify({
431431
version: 3,
432432
file: sourceMapData.sourceMapFile,
433433
sourceRoot: sourceMapData.sourceMapSourceRoot,
Collapse file

‎src/compiler/transformers/ts.ts‎

Copy file name to clipboardExpand all lines: src/compiler/transformers/ts.ts
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1223,11 +1223,12 @@ namespace ts {
12231223
}
12241224

12251225
const { firstAccessor, secondAccessor, setAccessor } = getAllAccessorDeclarations(node.members, accessor);
1226-
if (accessor !== firstAccessor) {
1226+
const firstAccessorWithDecorators = firstAccessor.decorators ? firstAccessor : secondAccessor && secondAccessor.decorators ? secondAccessor : undefined;
1227+
if (!firstAccessorWithDecorators || accessor !== firstAccessorWithDecorators) {
12271228
return undefined;
12281229
}
12291230

1230-
const decorators = firstAccessor.decorators || (secondAccessor && secondAccessor.decorators);
1231+
const decorators = firstAccessorWithDecorators.decorators;
12311232
const parameters = getDecoratorsOfParameters(setAccessor);
12321233
if (!decorators && !parameters) {
12331234
return undefined;
Collapse file

‎src/compiler/utilities.ts‎

Copy file name to clipboardExpand all lines: src/compiler/utilities.ts
-49Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -3189,55 +3189,6 @@ namespace ts {
31893189
return output;
31903190
}
31913191

3192-
/**
3193-
* Serialize an object graph into a JSON string. This is intended only for use on an acyclic graph
3194-
* as the fallback implementation does not check for circular references by default.
3195-
*/
3196-
export const stringify: (value: any) => string = typeof JSON !== "undefined" && JSON.stringify
3197-
? JSON.stringify
3198-
: stringifyFallback;
3199-
3200-
/**
3201-
* Serialize an object graph into a JSON string.
3202-
*/
3203-
function stringifyFallback(value: any): string {
3204-
// JSON.stringify returns `undefined` here, instead of the string "undefined".
3205-
return value === undefined ? undefined : stringifyValue(value);
3206-
}
3207-
3208-
function stringifyValue(value: any): string {
3209-
return typeof value === "string" ? `"${escapeString(value)}"`
3210-
: typeof value === "number" ? isFinite(value) ? String(value) : "null"
3211-
: typeof value === "boolean" ? value ? "true" : "false"
3212-
: typeof value === "object" && value ? isArray(value) ? cycleCheck(stringifyArray, value) : cycleCheck(stringifyObject, value)
3213-
: /*fallback*/ "null";
3214-
}
3215-
3216-
function cycleCheck(cb: (value: any) => string, value: any) {
3217-
Debug.assert(!value.hasOwnProperty("__cycle"), "Converting circular structure to JSON");
3218-
value.__cycle = true;
3219-
const result = cb(value);
3220-
delete value.__cycle;
3221-
return result;
3222-
}
3223-
3224-
function stringifyArray(value: any) {
3225-
return `[${reduceLeft(value, stringifyElement, "")}]`;
3226-
}
3227-
3228-
function stringifyElement(memo: string, value: any) {
3229-
return (memo ? memo + "," : memo) + stringifyValue(value);
3230-
}
3231-
3232-
function stringifyObject(value: any) {
3233-
return `{${reduceOwnProperties(value, stringifyProperty, "")}}`;
3234-
}
3235-
3236-
function stringifyProperty(memo: string, value: any, key: string) {
3237-
return value === undefined || typeof value === "function" || key === "__cycle" ? memo
3238-
: (memo ? memo + "," : memo) + `"${escapeString(key)}":${stringifyValue(value)}`;
3239-
}
3240-
32413192
const base64Digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
32423193

32433194
/**
Collapse file

‎src/harness/fourslash.ts‎

Copy file name to clipboardExpand all lines: src/harness/fourslash.ts
+5-60Lines changed: 5 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -607,23 +607,13 @@ namespace FourSlash {
607607
});
608608
}
609609

610-
public verifyMemberListContains(symbol: string, text?: string, documentation?: string, kind?: string) {
611-
const members = this.getMemberListAtCaret();
612-
if (members) {
613-
this.assertItemInCompletionList(members.entries, symbol, text, documentation, kind);
614-
}
615-
else {
616-
this.raiseError("Expected a member list, but none was provided");
617-
}
618-
}
619-
620-
public verifyMemberListCount(expectedCount: number, negative: boolean) {
610+
public verifyCompletionListCount(expectedCount: number, negative: boolean) {
621611
if (expectedCount === 0 && negative) {
622-
this.verifyMemberListIsEmpty(/*negative*/ false);
612+
this.verifyCompletionListIsEmpty(/*negative*/ false);
623613
return;
624614
}
625615

626-
const members = this.getMemberListAtCaret();
616+
const members = this.getCompletionListAtCaret();
627617

628618
if (members) {
629619
const match = members.entries.length === expectedCount;
@@ -637,13 +627,6 @@ namespace FourSlash {
637627
}
638628
}
639629

640-
public verifyMemberListDoesNotContain(symbol: string) {
641-
const members = this.getMemberListAtCaret();
642-
if (members && members.entries.filter(e => e.name === symbol).length !== 0) {
643-
this.raiseError(`Member list did contain ${symbol}`);
644-
}
645-
}
646-
647630
public verifyCompletionListItemsCountIsGreaterThan(count: number, negative: boolean) {
648631
const completions = this.getCompletionListAtCaret();
649632
const itemsCount = completions.entries.length;
@@ -685,16 +668,6 @@ namespace FourSlash {
685668
}
686669
}
687670

688-
public verifyMemberListIsEmpty(negative: boolean) {
689-
const members = this.getMemberListAtCaret();
690-
if ((!members || members.entries.length === 0) && negative) {
691-
this.raiseError("Member list is empty at Caret");
692-
}
693-
else if ((members && members.entries.length !== 0) && !negative) {
694-
this.raiseError(`Member list is not empty at Caret:\nMember List contains: ${stringify(members.entries.map(e => e.name))}`);
695-
}
696-
}
697-
698671
public verifyCompletionListIsEmpty(negative: boolean) {
699672
const completions = this.getCompletionListAtCaret();
700673
if ((!completions || completions.entries.length === 0) && negative) {
@@ -892,10 +865,6 @@ namespace FourSlash {
892865
this.raiseError(`verifyReferencesAtPositionListContains failed - could not find the item: ${stringify(missingItem)} in the returned list: (${stringify(references)})`);
893866
}
894867

895-
private getMemberListAtCaret() {
896-
return this.languageService.getCompletionsAtPosition(this.activeFile.fileName, this.currentCaretPosition);
897-
}
898-
899868
private getCompletionListAtCaret() {
900869
return this.languageService.getCompletionsAtPosition(this.activeFile.fileName, this.currentCaretPosition);
901870
}
@@ -1353,11 +1322,6 @@ namespace FourSlash {
13531322
Harness.IO.log(stringify(sigHelp));
13541323
}
13551324

1356-
public printMemberListMembers() {
1357-
const members = this.getMemberListAtCaret();
1358-
this.printMembersOrCompletions(members);
1359-
}
1360-
13611325
public printCompletionListMembers() {
13621326
const completions = this.getCompletionListAtCaret();
13631327
this.printMembersOrCompletions(completions);
@@ -3061,19 +3025,8 @@ namespace FourSlashInterface {
30613025
}
30623026
}
30633027

3064-
// Verifies the member list contains the specified symbol. The
3065-
// member list is brought up if necessary
3066-
public memberListContains(symbol: string, text?: string, documentation?: string, kind?: string) {
3067-
if (this.negative) {
3068-
this.state.verifyMemberListDoesNotContain(symbol);
3069-
}
3070-
else {
3071-
this.state.verifyMemberListContains(symbol, text, documentation, kind);
3072-
}
3073-
}
3074-
3075-
public memberListCount(expectedCount: number) {
3076-
this.state.verifyMemberListCount(expectedCount, this.negative);
3028+
public completionListCount(expectedCount: number) {
3029+
this.state.verifyCompletionListCount(expectedCount, this.negative);
30773030
}
30783031

30793032
// Verifies the completion list contains the specified symbol. The
@@ -3109,10 +3062,6 @@ namespace FourSlashInterface {
31093062
this.state.verifyCompletionListAllowsNewIdentifier(this.negative);
31103063
}
31113064

3112-
public memberListIsEmpty() {
3113-
this.state.verifyMemberListIsEmpty(this.negative);
3114-
}
3115-
31163065
public signatureHelpPresent() {
31173066
this.state.verifySignatureHelpPresent(!this.negative);
31183067
}
@@ -3514,10 +3463,6 @@ namespace FourSlashInterface {
35143463
this.state.printCurrentSignatureHelp();
35153464
}
35163465

3517-
public printMemberListMembers() {
3518-
this.state.printMemberListMembers();
3519-
}
3520-
35213466
public printCompletionListMembers() {
35223467
this.state.printCompletionListMembers();
35233468
}
Collapse file
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
//// [awaitInheritedPromise_es2017.ts]
2+
interface A extends Promise<string> {}
3+
declare var a: A;
4+
async function f() {
5+
await a;
6+
}
7+
8+
//// [awaitInheritedPromise_es2017.js]
9+
async function f() {
10+
await a;
11+
}
Collapse file
+15Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
=== tests/cases/conformance/async/es2017/awaitInheritedPromise_es2017.ts ===
2+
interface A extends Promise<string> {}
3+
>A : Symbol(A, Decl(awaitInheritedPromise_es2017.ts, 0, 0))
4+
>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
5+
6+
declare var a: A;
7+
>a : Symbol(a, Decl(awaitInheritedPromise_es2017.ts, 1, 11))
8+
>A : Symbol(A, Decl(awaitInheritedPromise_es2017.ts, 0, 0))
9+
10+
async function f() {
11+
>f : Symbol(f, Decl(awaitInheritedPromise_es2017.ts, 1, 17))
12+
13+
await a;
14+
>a : Symbol(a, Decl(awaitInheritedPromise_es2017.ts, 1, 11))
15+
}
Collapse file
+16Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
=== tests/cases/conformance/async/es2017/awaitInheritedPromise_es2017.ts ===
2+
interface A extends Promise<string> {}
3+
>A : A
4+
>Promise : Promise<T>
5+
6+
declare var a: A;
7+
>a : A
8+
>A : A
9+
10+
async function f() {
11+
>f : () => Promise<void>
12+
13+
await a;
14+
>await a : string
15+
>a : A
16+
}
Collapse file
+41Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor7.ts(26,5): error TS1207: Decorators cannot be applied to multiple get/set accessors of the same name.
2+
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor7.ts(31,5): error TS1207: Decorators cannot be applied to multiple get/set accessors of the same name.
3+
4+
5+
==== tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor7.ts (2 errors) ====
6+
declare function dec1<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
7+
declare function dec2<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
8+
9+
class A {
10+
@dec1 get x() { return 0; }
11+
set x(value: number) { }
12+
}
13+
14+
class B {
15+
get x() { return 0; }
16+
@dec2 set x(value: number) { }
17+
}
18+
19+
class C {
20+
@dec1 set x(value: number) { }
21+
get x() { return 0; }
22+
}
23+
24+
class D {
25+
set x(value: number) { }
26+
@dec2 get x() { return 0; }
27+
}
28+
29+
class E {
30+
@dec1 get x() { return 0; }
31+
@dec2 set x(value: number) { }
32+
~
33+
!!! error TS1207: Decorators cannot be applied to multiple get/set accessors of the same name.
34+
}
35+
36+
class F {
37+
@dec1 set x(value: number) { }
38+
@dec2 get x() { return 0; }
39+
~
40+
!!! error TS1207: Decorators cannot be applied to multiple get/set accessors of the same name.
41+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.