From 8a28e151460df8e26ad161e61637c8dfbca2a847 Mon Sep 17 00:00:00 2001 From: Yui T Date: Wed, 31 May 2017 12:05:31 -0700 Subject: [PATCH 01/62] Get jsDoctype for property assignment --- src/compiler/checker.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index c5afb367cf4..87aa6dc8d3c 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -13273,6 +13273,7 @@ namespace ts { let patternWithComputedProperties = false; let hasComputedStringProperty = false; let hasComputedNumberProperty = false; + const isInJSFile = isInJavaScriptFile(node); let offset = 0; for (let i = 0; i < node.properties.length; i++) { @@ -13281,6 +13282,11 @@ namespace ts { if (memberDecl.kind === SyntaxKind.PropertyAssignment || memberDecl.kind === SyntaxKind.ShorthandPropertyAssignment || isObjectLiteralMethod(memberDecl)) { + let jsdocType: Type; + if (isInJSFile) { + jsdocType = getTypeForDeclarationFromJSDocComment(memberDecl); + } + let type: Type; if (memberDecl.kind === SyntaxKind.PropertyAssignment) { type = checkPropertyAssignment(memberDecl, checkMode); @@ -13293,6 +13299,11 @@ namespace ts { type = checkExpressionForMutableLocation((memberDecl).name, checkMode); } + if (jsdocType) { + checkTypeAssignableTo(type, jsdocType, memberDecl); + type = jsdocType; + } + typeFlags |= type.flags; const prop = createSymbol(SymbolFlags.Property | member.flags, member.name); if (inDestructuringPattern) { From 558cb2e2faaae17043664666ae8b12f15d5f89e7 Mon Sep 17 00:00:00 2001 From: Yui T Date: Wed, 31 May 2017 12:15:50 -0700 Subject: [PATCH 02/62] Add tests --- .../checkJsdocTypeTagOnObjectProperty1.ts | 24 +++++++++++++++++++ .../checkJsdocTypeTagOnObjectProperty2.ts | 20 ++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 tests/cases/conformance/jsdoc/checkJsdocTypeTagOnObjectProperty1.ts create mode 100644 tests/cases/conformance/jsdoc/checkJsdocTypeTagOnObjectProperty2.ts diff --git a/tests/cases/conformance/jsdoc/checkJsdocTypeTagOnObjectProperty1.ts b/tests/cases/conformance/jsdoc/checkJsdocTypeTagOnObjectProperty1.ts new file mode 100644 index 00000000000..b45f3f0cc51 --- /dev/null +++ b/tests/cases/conformance/jsdoc/checkJsdocTypeTagOnObjectProperty1.ts @@ -0,0 +1,24 @@ +// @allowJS: true +// @suppressOutputPathCheck: true +// @strictNullChecks: true + +// @filename: 0.js +// @ts-check +var lol = "hello Lol" +const obj = { + /** @type {string|undefined} */ + foo: undefined, + /** @type {string|undefined} */ + bar: 42, + /** @type {function(number): number} */ + method1(n1) { + return n1 + 42; + }, + /** @type {string} */ + lol +} +obj.foo = 'string' +obj.foo; +obj.lol +obj.bar = undefined; +var k = obj.method1(0); \ No newline at end of file diff --git a/tests/cases/conformance/jsdoc/checkJsdocTypeTagOnObjectProperty2.ts b/tests/cases/conformance/jsdoc/checkJsdocTypeTagOnObjectProperty2.ts new file mode 100644 index 00000000000..26285838137 --- /dev/null +++ b/tests/cases/conformance/jsdoc/checkJsdocTypeTagOnObjectProperty2.ts @@ -0,0 +1,20 @@ +// @allowJS: true +// @suppressOutputPathCheck: true +// @strictNullChecks: true + +// @filename: 0.js +// @ts-check +const obj = { + /** @type {string|undefined} */ + foo: undefined, + /** @type {string|undefined} */ + bar: 42, + /** @type {function(number): number} */ + method1(n1) { + return (n1 + 42).toString() + }, + /** @type {string} */ + lol +} +var lol = "string" +obj.foo = 5 From 1daff75d466b73afd5a2a48a2c5c23b955e12202 Mon Sep 17 00:00:00 2001 From: Kanchalai Tanglertsampan Date: Wed, 31 May 2017 13:13:25 -0700 Subject: [PATCH 03/62] Update tests/baselines --- .../checkJsdocTypeTagOnObjectProperty1.js | 47 ++++++++++++ ...checkJsdocTypeTagOnObjectProperty1.symbols | 58 ++++++++++++++ .../checkJsdocTypeTagOnObjectProperty1.types | 76 +++++++++++++++++++ ...ckJsdocTypeTagOnObjectProperty2.errors.txt | 39 ++++++++++ .../checkJsdocTypeTagOnObjectProperty2.js | 37 +++++++++ .../checkJsdocTypeTagOnObjectProperty1.ts | 10 ++- .../checkJsdocTypeTagOnObjectProperty2.ts | 12 +-- 7 files changed, 270 insertions(+), 9 deletions(-) create mode 100644 tests/baselines/reference/checkJsdocTypeTagOnObjectProperty1.js create mode 100644 tests/baselines/reference/checkJsdocTypeTagOnObjectProperty1.symbols create mode 100644 tests/baselines/reference/checkJsdocTypeTagOnObjectProperty1.types create mode 100644 tests/baselines/reference/checkJsdocTypeTagOnObjectProperty2.errors.txt create mode 100644 tests/baselines/reference/checkJsdocTypeTagOnObjectProperty2.js diff --git a/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty1.js b/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty1.js new file mode 100644 index 00000000000..79f5d7bfd9a --- /dev/null +++ b/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty1.js @@ -0,0 +1,47 @@ +//// [0.js] +// @ts-check +var lol = "hello Lol" +const obj = { + /** @type {string|undefined} */ + foo: undefined, + /** @type {string|undefined} */ + bar: "42", + /** @type {function(number): number} */ + method1(n1) { + return n1 + 42; + }, + /** @type {string} */ + lol, + /** @type {number} */ + ['b' + 'ar1']: 42, +} +obj.foo = 'string' +obj.lol +obj.bar = undefined; +var k = obj.method1(0); +obj.bar1 = "42"; + +//// [0.js] +// @ts-check +var lol = "hello Lol"; +var obj = (_a = { + /** @type {string|undefined} */ + foo: undefined, + /** @type {string|undefined} */ + bar: "42", + /** @type {function(number): number} */ + method1: function (n1) { + return n1 + 42; + }, + /** @type {string} */ + lol: lol + }, + /** @type {number} */ + _a['b' + 'ar1'] = 42, + _a); +obj.foo = 'string'; +obj.lol; +obj.bar = undefined; +var k = obj.method1(0); +obj.bar1 = "42"; +var _a; diff --git a/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty1.symbols b/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty1.symbols new file mode 100644 index 00000000000..9a1b1acb8a8 --- /dev/null +++ b/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty1.symbols @@ -0,0 +1,58 @@ +=== tests/cases/conformance/jsdoc/0.js === +// @ts-check +var lol = "hello Lol" +>lol : Symbol(lol, Decl(0.js, 1, 3)) + +const obj = { +>obj : Symbol(obj, Decl(0.js, 2, 5)) + + /** @type {string|undefined} */ + foo: undefined, +>foo : Symbol(foo, Decl(0.js, 2, 13)) +>undefined : Symbol(undefined) + + /** @type {string|undefined} */ + bar: "42", +>bar : Symbol(bar, Decl(0.js, 4, 17)) + + /** @type {function(number): number} */ + method1(n1) { +>method1 : Symbol(method1, Decl(0.js, 6, 12)) +>n1 : Symbol(n1, Decl(0.js, 8, 10)) + + return n1 + 42; +>n1 : Symbol(n1, Decl(0.js, 8, 10)) + + }, + /** @type {string} */ + lol, +>lol : Symbol(lol, Decl(0.js, 10, 4)) + + /** @type {number} */ + ['b' + 'ar1']: 42, +} +obj.foo = 'string' +>obj.foo : Symbol(foo, Decl(0.js, 2, 13)) +>obj : Symbol(obj, Decl(0.js, 2, 5)) +>foo : Symbol(foo, Decl(0.js, 2, 13)) + +obj.lol +>obj.lol : Symbol(lol, Decl(0.js, 10, 4)) +>obj : Symbol(obj, Decl(0.js, 2, 5)) +>lol : Symbol(lol, Decl(0.js, 10, 4)) + +obj.bar = undefined; +>obj.bar : Symbol(bar, Decl(0.js, 4, 17)) +>obj : Symbol(obj, Decl(0.js, 2, 5)) +>bar : Symbol(bar, Decl(0.js, 4, 17)) +>undefined : Symbol(undefined) + +var k = obj.method1(0); +>k : Symbol(k, Decl(0.js, 19, 3)) +>obj.method1 : Symbol(method1, Decl(0.js, 6, 12)) +>obj : Symbol(obj, Decl(0.js, 2, 5)) +>method1 : Symbol(method1, Decl(0.js, 6, 12)) + +obj.bar1 = "42"; +>obj : Symbol(obj, Decl(0.js, 2, 5)) + diff --git a/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty1.types b/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty1.types new file mode 100644 index 00000000000..39ae9d39c8e --- /dev/null +++ b/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty1.types @@ -0,0 +1,76 @@ +=== tests/cases/conformance/jsdoc/0.js === +// @ts-check +var lol = "hello Lol" +>lol : string +>"hello Lol" : "hello Lol" + +const obj = { +>obj : { [x: string]: any; foo: string | undefined; bar: string | undefined; method1(arg0: number): number; lol: string; } +>{ /** @type {string|undefined} */ foo: undefined, /** @type {string|undefined} */ bar: "42", /** @type {function(number): number} */ method1(n1) { return n1 + 42; }, /** @type {string} */ lol, /** @type {number} */ ['b' + 'ar1']: 42,} : { [x: string]: any; foo: string | undefined; bar: string | undefined; method1(arg0: number): number; lol: string; } + + /** @type {string|undefined} */ + foo: undefined, +>foo : string | undefined +>undefined : undefined + + /** @type {string|undefined} */ + bar: "42", +>bar : string | undefined +>"42" : "42" + + /** @type {function(number): number} */ + method1(n1) { +>method1 : (n1: any) => any +>n1 : any + + return n1 + 42; +>n1 + 42 : any +>n1 : any +>42 : 42 + + }, + /** @type {string} */ + lol, +>lol : string + + /** @type {number} */ + ['b' + 'ar1']: 42, +>'b' + 'ar1' : string +>'b' : "b" +>'ar1' : "ar1" +>42 : 42 +} +obj.foo = 'string' +>obj.foo = 'string' : "string" +>obj.foo : string | undefined +>obj : { [x: string]: any; foo: string | undefined; bar: string | undefined; method1(arg0: number): number; lol: string; } +>foo : string | undefined +>'string' : "string" + +obj.lol +>obj.lol : string +>obj : { [x: string]: any; foo: string | undefined; bar: string | undefined; method1(arg0: number): number; lol: string; } +>lol : string + +obj.bar = undefined; +>obj.bar = undefined : undefined +>obj.bar : string | undefined +>obj : { [x: string]: any; foo: string | undefined; bar: string | undefined; method1(arg0: number): number; lol: string; } +>bar : string | undefined +>undefined : undefined + +var k = obj.method1(0); +>k : number +>obj.method1(0) : number +>obj.method1 : (arg0: number) => number +>obj : { [x: string]: any; foo: string | undefined; bar: string | undefined; method1(arg0: number): number; lol: string; } +>method1 : (arg0: number) => number +>0 : 0 + +obj.bar1 = "42"; +>obj.bar1 = "42" : "42" +>obj.bar1 : any +>obj : { [x: string]: any; foo: string | undefined; bar: string | undefined; method1(arg0: number): number; lol: string; } +>bar1 : any +>"42" : "42" + diff --git a/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty2.errors.txt b/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty2.errors.txt new file mode 100644 index 00000000000..007bb61ab7d --- /dev/null +++ b/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty2.errors.txt @@ -0,0 +1,39 @@ +tests/cases/conformance/jsdoc/0.js(5,3): error TS2322: Type 'number' is not assignable to type 'string | undefined'. +tests/cases/conformance/jsdoc/0.js(7,3): error TS2322: Type '(n1: any) => string' is not assignable to type '(arg0: number) => number'. + Type 'string' is not assignable to type 'number'. +tests/cases/conformance/jsdoc/0.js(11,3): error TS2322: Type '(n1: any) => string' is not assignable to type '(arg0: number) => number'. + Type 'string' is not assignable to type 'number'. +tests/cases/conformance/jsdoc/0.js(13,3): error TS2322: Type 'undefined' is not assignable to type 'string'. +tests/cases/conformance/jsdoc/0.js(17,5): error TS2322: Type 'number' is not assignable to type 'string'. + + +==== tests/cases/conformance/jsdoc/0.js (5 errors) ==== + // @ts-check + var lol; + const obj = { + /** @type {string|undefined} */ + bar: 42, + ~~~~~~~ +!!! error TS2322: Type 'number' is not assignable to type 'string | undefined'. + /** @type {function(number): number} */ + method1(n1) { + ~~~~~~~ +!!! error TS2322: Type '(n1: any) => string' is not assignable to type '(arg0: number) => number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. + return "42"; + }, + /** @type {function(number): number} */ + method2: (n1) => "lol", + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type '(n1: any) => string' is not assignable to type '(arg0: number) => number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. + /** @type {string} */ + lol + ~~~ +!!! error TS2322: Type 'undefined' is not assignable to type 'string'. + } + lol = "string" + /** @type {string} */ + var s = obj.method1(0); + ~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty2.js b/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty2.js new file mode 100644 index 00000000000..ee2a2b76dcd --- /dev/null +++ b/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty2.js @@ -0,0 +1,37 @@ +//// [0.js] +// @ts-check +var lol; +const obj = { + /** @type {string|undefined} */ + bar: 42, + /** @type {function(number): number} */ + method1(n1) { + return "42"; + }, + /** @type {function(number): number} */ + method2: (n1) => "lol", + /** @type {string} */ + lol +} +lol = "string" +/** @type {string} */ +var s = obj.method1(0); + +//// [0.js] +// @ts-check +var lol; +var obj = { + /** @type {string|undefined} */ + bar: 42, + /** @type {function(number): number} */ + method1: function (n1) { + return "42"; + }, + /** @type {function(number): number} */ + method2: function (n1) { return "lol"; }, + /** @type {string} */ + lol: lol +}; +lol = "string"; +/** @type {string} */ +var s = obj.method1(0); diff --git a/tests/cases/conformance/jsdoc/checkJsdocTypeTagOnObjectProperty1.ts b/tests/cases/conformance/jsdoc/checkJsdocTypeTagOnObjectProperty1.ts index b45f3f0cc51..a0f98b1cd59 100644 --- a/tests/cases/conformance/jsdoc/checkJsdocTypeTagOnObjectProperty1.ts +++ b/tests/cases/conformance/jsdoc/checkJsdocTypeTagOnObjectProperty1.ts @@ -9,16 +9,18 @@ const obj = { /** @type {string|undefined} */ foo: undefined, /** @type {string|undefined} */ - bar: 42, + bar: "42", /** @type {function(number): number} */ method1(n1) { return n1 + 42; }, /** @type {string} */ - lol + lol, + /** @type {number} */ + ['b' + 'ar1']: 42, } obj.foo = 'string' -obj.foo; obj.lol obj.bar = undefined; -var k = obj.method1(0); \ No newline at end of file +var k = obj.method1(0); +obj.bar1 = "42"; \ No newline at end of file diff --git a/tests/cases/conformance/jsdoc/checkJsdocTypeTagOnObjectProperty2.ts b/tests/cases/conformance/jsdoc/checkJsdocTypeTagOnObjectProperty2.ts index 26285838137..3ef19f73d7f 100644 --- a/tests/cases/conformance/jsdoc/checkJsdocTypeTagOnObjectProperty2.ts +++ b/tests/cases/conformance/jsdoc/checkJsdocTypeTagOnObjectProperty2.ts @@ -4,17 +4,19 @@ // @filename: 0.js // @ts-check +var lol; const obj = { - /** @type {string|undefined} */ - foo: undefined, /** @type {string|undefined} */ bar: 42, /** @type {function(number): number} */ method1(n1) { - return (n1 + 42).toString() + return "42"; }, + /** @type {function(number): number} */ + method2: (n1) => "lol", /** @type {string} */ lol } -var lol = "string" -obj.foo = 5 +lol = "string" +/** @type {string} */ +var s = obj.method1(0); \ No newline at end of file From cc87e29e13824e1c68749878d2b2f20fa3e43beb Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Thu, 8 Jun 2017 13:45:21 -0700 Subject: [PATCH 04/62] Skip block scope check with no error location An example of a symbol with no error location is a global symbol like Promise. --- src/compiler/checker.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 266fbe573be..65f85b25b53 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1124,7 +1124,7 @@ namespace ts { return undefined; } - // Only check for block-scoped variable if we are looking for the + // Only check for block-scoped variable if we have an error location and are looking for the // name with variable meaning // For example, // declare module foo { @@ -1135,8 +1135,9 @@ namespace ts { // block-scoped variable and namespace module. However, only when we // try to resolve name in /*1*/ which is used in variable position, // we want to check for block-scoped - if (meaning & SymbolFlags.BlockScopedVariable || - ((meaning & SymbolFlags.Class || meaning & SymbolFlags.Enum) && (meaning & SymbolFlags.Value) === SymbolFlags.Value)) { + if (errorLocation && + (meaning & SymbolFlags.BlockScopedVariable || + ((meaning & SymbolFlags.Class || meaning & SymbolFlags.Enum) && (meaning & SymbolFlags.Value) === SymbolFlags.Value))) { const exportOrLocalSymbol = getExportSymbolOfValueSymbolIfExported(result); if (exportOrLocalSymbol.flags & SymbolFlags.BlockScopedVariable || exportOrLocalSymbol.flags & SymbolFlags.Class || exportOrLocalSymbol.flags & SymbolFlags.Enum) { checkResolvedBlockScopedVariable(exportOrLocalSymbol, errorLocation); From 91f4f3910dd9a7f04e1addb5630cd25ebb492edf Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Thu, 8 Jun 2017 13:46:48 -0700 Subject: [PATCH 05/62] Test:Block-scoped definition of Promise works Previously, a block-scoped definition of Promise like `class Promise` in a script would cause a crash --- .../reference/promiseDefinitionTest.js | 53 +++++++++++++++++++ .../reference/promiseDefinitionTest.symbols | 12 +++++ .../reference/promiseDefinitionTest.types | 13 +++++ tests/cases/compiler/promiseDefinitionTest.ts | 4 ++ 4 files changed, 82 insertions(+) create mode 100644 tests/baselines/reference/promiseDefinitionTest.js create mode 100644 tests/baselines/reference/promiseDefinitionTest.symbols create mode 100644 tests/baselines/reference/promiseDefinitionTest.types create mode 100644 tests/cases/compiler/promiseDefinitionTest.ts diff --git a/tests/baselines/reference/promiseDefinitionTest.js b/tests/baselines/reference/promiseDefinitionTest.js new file mode 100644 index 00000000000..317e15c99ca --- /dev/null +++ b/tests/baselines/reference/promiseDefinitionTest.js @@ -0,0 +1,53 @@ +//// [promiseDefinitionTest.ts] +class Promise {} +async function foo() {} +const x = foo(); + + +//// [promiseDefinitionTest.js] +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __generator = (this && this.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [0, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; +var Promise = (function () { + function Promise() { + } + return Promise; +}()); +function foo() { + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { + return [2 /*return*/]; + }); }); +} +var x = foo(); diff --git a/tests/baselines/reference/promiseDefinitionTest.symbols b/tests/baselines/reference/promiseDefinitionTest.symbols new file mode 100644 index 00000000000..cd9fcd6c4dd --- /dev/null +++ b/tests/baselines/reference/promiseDefinitionTest.symbols @@ -0,0 +1,12 @@ +=== tests/cases/compiler/promiseDefinitionTest.ts === +class Promise {} +>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(promiseDefinitionTest.ts, 0, 0)) +>T : Symbol(T, Decl(lib.d.ts, --, --), Decl(promiseDefinitionTest.ts, 0, 14)) + +async function foo() {} +>foo : Symbol(foo, Decl(promiseDefinitionTest.ts, 0, 19)) + +const x = foo(); +>x : Symbol(x, Decl(promiseDefinitionTest.ts, 2, 5)) +>foo : Symbol(foo, Decl(promiseDefinitionTest.ts, 0, 19)) + diff --git a/tests/baselines/reference/promiseDefinitionTest.types b/tests/baselines/reference/promiseDefinitionTest.types new file mode 100644 index 00000000000..2181ea01c4d --- /dev/null +++ b/tests/baselines/reference/promiseDefinitionTest.types @@ -0,0 +1,13 @@ +=== tests/cases/compiler/promiseDefinitionTest.ts === +class Promise {} +>Promise : Promise +>T : T + +async function foo() {} +>foo : () => Promise + +const x = foo(); +>x : Promise +>foo() : Promise +>foo : () => Promise + diff --git a/tests/cases/compiler/promiseDefinitionTest.ts b/tests/cases/compiler/promiseDefinitionTest.ts new file mode 100644 index 00000000000..0e80137983c --- /dev/null +++ b/tests/cases/compiler/promiseDefinitionTest.ts @@ -0,0 +1,4 @@ +// @target: es5 +class Promise {} +async function foo() {} +const x = foo(); From d392f1edabce9cef0550af8a5d50eb2237189382 Mon Sep 17 00:00:00 2001 From: Kanchalai Tanglertsampan Date: Tue, 13 Jun 2017 14:09:16 -0700 Subject: [PATCH 06/62] Remove unnecessary get type from JSDoc comment --- src/compiler/checker.ts | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index a3f3eee44b7..83286caf782 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -12748,12 +12748,6 @@ namespace ts { if (typeNode) { return getTypeFromTypeNode(typeNode); } - if (isInJavaScriptFile(declaration)) { - const jsDocType = getTypeForDeclarationFromJSDocComment(declaration); - if (jsDocType) { - return jsDocType; - } - } if (declaration.kind === SyntaxKind.Parameter) { const type = getContextuallyTypedParameterType(declaration); if (type) { From 3062d36463cf4777932274e5633755fe8aaee536 Mon Sep 17 00:00:00 2001 From: Kanchalai Tanglertsampan Date: Tue, 13 Jun 2017 15:20:52 -0700 Subject: [PATCH 07/62] Add "undefined" as return type --- src/compiler/utilities.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 3833fc30875..fde03cc7db2 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -2721,11 +2721,11 @@ namespace ts { * Gets the effective type annotation of a variable, parameter, or property. If the node was * parsed in a JavaScript file, gets the type annotation from JSDoc. */ - export function getEffectiveTypeAnnotationNode(node: VariableLikeDeclaration): TypeNode { + export function getEffectiveTypeAnnotationNode(node: VariableLikeDeclaration): TypeNode | undefined { if (node.type) { return node.type; } - if (node.flags & NodeFlags.JavaScriptFile) { + if (isInJavaScriptFile(node)) { return getJSDocType(node); } } @@ -2734,11 +2734,11 @@ namespace ts { * Gets the effective return type annotation of a signature. If the node was parsed in a * JavaScript file, gets the return type annotation from JSDoc. */ - export function getEffectiveReturnTypeNode(node: SignatureDeclaration): TypeNode { + export function getEffectiveReturnTypeNode(node: SignatureDeclaration): TypeNode | undefined { if (node.type) { return node.type; } - if (node.flags & NodeFlags.JavaScriptFile) { + if (isInJavaScriptFile(node)) { return getJSDocReturnType(node); } } From 9df2931aa3b8b7715cbb5410f46fdb3cf7ba3a63 Mon Sep 17 00:00:00 2001 From: Kanchalai Tanglertsampan Date: Tue, 13 Jun 2017 15:24:05 -0700 Subject: [PATCH 08/62] Add tests and update baselines --- .../checkJsdocTypeTagOnObjectProperty1.js | 8 ++++- ...checkJsdocTypeTagOnObjectProperty1.symbols | 12 +++++++- .../checkJsdocTypeTagOnObjectProperty1.types | 30 ++++++++++++++----- ...ckJsdocTypeTagOnObjectProperty2.errors.txt | 23 +++++++++++--- .../checkJsdocTypeTagOnObjectProperty2.js | 14 ++++++++- .../checkJsdocTypeTagOnObjectProperty1.ts | 5 +++- .../checkJsdocTypeTagOnObjectProperty2.ts | 7 ++++- 7 files changed, 83 insertions(+), 16 deletions(-) diff --git a/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty1.js b/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty1.js index 79f5d7bfd9a..26f19815855 100644 --- a/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty1.js +++ b/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty1.js @@ -14,12 +14,15 @@ const obj = { lol, /** @type {number} */ ['b' + 'ar1']: 42, + /** @type {function(number): number} */ + arrowFunc: (num) => num + 42 } obj.foo = 'string' obj.lol obj.bar = undefined; var k = obj.method1(0); -obj.bar1 = "42"; +obj.bar1 = "42"; +obj.arrowFunc(0); //// [0.js] // @ts-check @@ -38,10 +41,13 @@ var obj = (_a = { }, /** @type {number} */ _a['b' + 'ar1'] = 42, + /** @type {function(number): number} */ + _a.arrowFunc = function (num) { return num + 42; }, _a); obj.foo = 'string'; obj.lol; obj.bar = undefined; var k = obj.method1(0); obj.bar1 = "42"; +obj.arrowFunc(0); var _a; diff --git a/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty1.symbols b/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty1.symbols index 9a1b1acb8a8..27f70798c71 100644 --- a/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty1.symbols +++ b/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty1.symbols @@ -30,6 +30,11 @@ const obj = { /** @type {number} */ ['b' + 'ar1']: 42, + /** @type {function(number): number} */ + arrowFunc: (num) => num + 42 +>arrowFunc : Symbol(arrowFunc, Decl(0.js, 14, 20)) +>num : Symbol(num, Decl(0.js, 16, 14)) +>num : Symbol(num, Decl(0.js, 16, 14)) } obj.foo = 'string' >obj.foo : Symbol(foo, Decl(0.js, 2, 13)) @@ -48,7 +53,7 @@ obj.bar = undefined; >undefined : Symbol(undefined) var k = obj.method1(0); ->k : Symbol(k, Decl(0.js, 19, 3)) +>k : Symbol(k, Decl(0.js, 21, 3)) >obj.method1 : Symbol(method1, Decl(0.js, 6, 12)) >obj : Symbol(obj, Decl(0.js, 2, 5)) >method1 : Symbol(method1, Decl(0.js, 6, 12)) @@ -56,3 +61,8 @@ var k = obj.method1(0); obj.bar1 = "42"; >obj : Symbol(obj, Decl(0.js, 2, 5)) +obj.arrowFunc(0); +>obj.arrowFunc : Symbol(arrowFunc, Decl(0.js, 14, 20)) +>obj : Symbol(obj, Decl(0.js, 2, 5)) +>arrowFunc : Symbol(arrowFunc, Decl(0.js, 14, 20)) + diff --git a/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty1.types b/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty1.types index 39ae9d39c8e..72c5c55228e 100644 --- a/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty1.types +++ b/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty1.types @@ -5,8 +5,8 @@ var lol = "hello Lol" >"hello Lol" : "hello Lol" const obj = { ->obj : { [x: string]: any; foo: string | undefined; bar: string | undefined; method1(arg0: number): number; lol: string; } ->{ /** @type {string|undefined} */ foo: undefined, /** @type {string|undefined} */ bar: "42", /** @type {function(number): number} */ method1(n1) { return n1 + 42; }, /** @type {string} */ lol, /** @type {number} */ ['b' + 'ar1']: 42,} : { [x: string]: any; foo: string | undefined; bar: string | undefined; method1(arg0: number): number; lol: string; } +>obj : { [x: string]: any; foo: string | undefined; bar: string | undefined; method1(arg0: number): number; lol: string; arrowFunc: (arg0: number) => number; } +>{ /** @type {string|undefined} */ foo: undefined, /** @type {string|undefined} */ bar: "42", /** @type {function(number): number} */ method1(n1) { return n1 + 42; }, /** @type {string} */ lol, /** @type {number} */ ['b' + 'ar1']: 42, /** @type {function(number): number} */ arrowFunc: (num) => num + 42} : { [x: string]: any; foo: string | undefined; bar: string | undefined; method1(arg0: number): number; lol: string; arrowFunc: (arg0: number) => number; } /** @type {string|undefined} */ foo: undefined, @@ -38,24 +38,33 @@ const obj = { >'b' + 'ar1' : string >'b' : "b" >'ar1' : "ar1" +>42 : 42 + + /** @type {function(number): number} */ + arrowFunc: (num) => num + 42 +>arrowFunc : (arg0: number) => number +>(num) => num + 42 : (num: any) => any +>num : any +>num + 42 : any +>num : any >42 : 42 } obj.foo = 'string' >obj.foo = 'string' : "string" >obj.foo : string | undefined ->obj : { [x: string]: any; foo: string | undefined; bar: string | undefined; method1(arg0: number): number; lol: string; } +>obj : { [x: string]: any; foo: string | undefined; bar: string | undefined; method1(arg0: number): number; lol: string; arrowFunc: (arg0: number) => number; } >foo : string | undefined >'string' : "string" obj.lol >obj.lol : string ->obj : { [x: string]: any; foo: string | undefined; bar: string | undefined; method1(arg0: number): number; lol: string; } +>obj : { [x: string]: any; foo: string | undefined; bar: string | undefined; method1(arg0: number): number; lol: string; arrowFunc: (arg0: number) => number; } >lol : string obj.bar = undefined; >obj.bar = undefined : undefined >obj.bar : string | undefined ->obj : { [x: string]: any; foo: string | undefined; bar: string | undefined; method1(arg0: number): number; lol: string; } +>obj : { [x: string]: any; foo: string | undefined; bar: string | undefined; method1(arg0: number): number; lol: string; arrowFunc: (arg0: number) => number; } >bar : string | undefined >undefined : undefined @@ -63,14 +72,21 @@ var k = obj.method1(0); >k : number >obj.method1(0) : number >obj.method1 : (arg0: number) => number ->obj : { [x: string]: any; foo: string | undefined; bar: string | undefined; method1(arg0: number): number; lol: string; } +>obj : { [x: string]: any; foo: string | undefined; bar: string | undefined; method1(arg0: number): number; lol: string; arrowFunc: (arg0: number) => number; } >method1 : (arg0: number) => number >0 : 0 obj.bar1 = "42"; >obj.bar1 = "42" : "42" >obj.bar1 : any ->obj : { [x: string]: any; foo: string | undefined; bar: string | undefined; method1(arg0: number): number; lol: string; } +>obj : { [x: string]: any; foo: string | undefined; bar: string | undefined; method1(arg0: number): number; lol: string; arrowFunc: (arg0: number) => number; } >bar1 : any >"42" : "42" +obj.arrowFunc(0); +>obj.arrowFunc(0) : number +>obj.arrowFunc : (arg0: number) => number +>obj : { [x: string]: any; foo: string | undefined; bar: string | undefined; method1(arg0: number): number; lol: string; arrowFunc: (arg0: number) => number; } +>arrowFunc : (arg0: number) => number +>0 : 0 + diff --git a/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty2.errors.txt b/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty2.errors.txt index 007bb61ab7d..33c83e61172 100644 --- a/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty2.errors.txt +++ b/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty2.errors.txt @@ -3,11 +3,15 @@ tests/cases/conformance/jsdoc/0.js(7,3): error TS2322: Type '(n1: any) => string Type 'string' is not assignable to type 'number'. tests/cases/conformance/jsdoc/0.js(11,3): error TS2322: Type '(n1: any) => string' is not assignable to type '(arg0: number) => number'. Type 'string' is not assignable to type 'number'. -tests/cases/conformance/jsdoc/0.js(13,3): error TS2322: Type 'undefined' is not assignable to type 'string'. -tests/cases/conformance/jsdoc/0.js(17,5): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/conformance/jsdoc/0.js(13,3): error TS2322: Type '(num?: string) => string' is not assignable to type '(arg0: number) => number'. + Types of parameters 'num' and 'arg0' are incompatible. + Type 'number' is not assignable to type 'string | undefined'. +tests/cases/conformance/jsdoc/0.js(15,3): error TS2322: Type 'undefined' is not assignable to type 'string'. +tests/cases/conformance/jsdoc/0.js(19,5): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/conformance/jsdoc/0.js(22,22): error TS2345: Argument of type '"0"' is not assignable to parameter of type 'number'. -==== tests/cases/conformance/jsdoc/0.js (5 errors) ==== +==== tests/cases/conformance/jsdoc/0.js (7 errors) ==== // @ts-check var lol; const obj = { @@ -27,6 +31,12 @@ tests/cases/conformance/jsdoc/0.js(17,5): error TS2322: Type 'number' is not ass ~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2322: Type '(n1: any) => string' is not assignable to type '(arg0: number) => number'. !!! error TS2322: Type 'string' is not assignable to type 'number'. + /** @type {function(number): number} */ + arrowFunc: (num="0") => num + 42, + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type '(num?: string) => string' is not assignable to type '(arg0: number) => number'. +!!! error TS2322: Types of parameters 'num' and 'arg0' are incompatible. +!!! error TS2322: Type 'number' is not assignable to type 'string | undefined'. /** @type {string} */ lol ~~~ @@ -36,4 +46,9 @@ tests/cases/conformance/jsdoc/0.js(17,5): error TS2322: Type 'number' is not ass /** @type {string} */ var s = obj.method1(0); ~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. \ No newline at end of file +!!! error TS2322: Type 'number' is not assignable to type 'string'. + + /** @type {string} */ + var s1 = obj.method2("0"); + ~~~ +!!! error TS2345: Argument of type '"0"' is not assignable to parameter of type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty2.js b/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty2.js index ee2a2b76dcd..ab574fddced 100644 --- a/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty2.js +++ b/tests/baselines/reference/checkJsdocTypeTagOnObjectProperty2.js @@ -10,12 +10,17 @@ const obj = { }, /** @type {function(number): number} */ method2: (n1) => "lol", + /** @type {function(number): number} */ + arrowFunc: (num="0") => num + 42, /** @type {string} */ lol } lol = "string" /** @type {string} */ -var s = obj.method1(0); +var s = obj.method1(0); + +/** @type {string} */ +var s1 = obj.method2("0"); //// [0.js] // @ts-check @@ -29,9 +34,16 @@ var obj = { }, /** @type {function(number): number} */ method2: function (n1) { return "lol"; }, + /** @type {function(number): number} */ + arrowFunc: function (num) { + if (num === void 0) { num = "0"; } + return num + 42; + }, /** @type {string} */ lol: lol }; lol = "string"; /** @type {string} */ var s = obj.method1(0); +/** @type {string} */ +var s1 = obj.method2("0"); diff --git a/tests/cases/conformance/jsdoc/checkJsdocTypeTagOnObjectProperty1.ts b/tests/cases/conformance/jsdoc/checkJsdocTypeTagOnObjectProperty1.ts index a0f98b1cd59..a98b0a70a2a 100644 --- a/tests/cases/conformance/jsdoc/checkJsdocTypeTagOnObjectProperty1.ts +++ b/tests/cases/conformance/jsdoc/checkJsdocTypeTagOnObjectProperty1.ts @@ -18,9 +18,12 @@ const obj = { lol, /** @type {number} */ ['b' + 'ar1']: 42, + /** @type {function(number): number} */ + arrowFunc: (num) => num + 42 } obj.foo = 'string' obj.lol obj.bar = undefined; var k = obj.method1(0); -obj.bar1 = "42"; \ No newline at end of file +obj.bar1 = "42"; +obj.arrowFunc(0); \ No newline at end of file diff --git a/tests/cases/conformance/jsdoc/checkJsdocTypeTagOnObjectProperty2.ts b/tests/cases/conformance/jsdoc/checkJsdocTypeTagOnObjectProperty2.ts index 3ef19f73d7f..9bab96dee9b 100644 --- a/tests/cases/conformance/jsdoc/checkJsdocTypeTagOnObjectProperty2.ts +++ b/tests/cases/conformance/jsdoc/checkJsdocTypeTagOnObjectProperty2.ts @@ -14,9 +14,14 @@ const obj = { }, /** @type {function(number): number} */ method2: (n1) => "lol", + /** @type {function(number): number} */ + arrowFunc: (num="0") => num + 42, /** @type {string} */ lol } lol = "string" /** @type {string} */ -var s = obj.method1(0); \ No newline at end of file +var s = obj.method1(0); + +/** @type {string} */ +var s1 = obj.method2("0"); \ No newline at end of file From 4c40c42f56f2d1faa334e9e3c36a1978d86e73c7 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Mon, 19 Jun 2017 20:30:24 -0700 Subject: [PATCH 09/62] format on open curly --- src/services/formatting/formatting.ts | 73 ++++++++++++------- src/services/formatting/formattingContext.ts | 8 -- .../formatting/formattingRequestKind.ts | 1 + src/services/formatting/rules.ts | 2 +- src/services/services.ts | 6 +- 5 files changed, 54 insertions(+), 36 deletions(-) diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index 531b768f6d8..1e40d6e1d0b 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -97,11 +97,23 @@ namespace ts.formatting { } export function formatOnSemicolon(position: number, sourceFile: SourceFile, rulesProvider: RulesProvider, options: FormatCodeSettings): TextChange[] { - return formatOutermostParent(position, SyntaxKind.SemicolonToken, sourceFile, options, rulesProvider, FormattingRequestKind.FormatOnSemicolon); + const outermostParent = findOutermostParentWithinListLevelFromPosition(position, SyntaxKind.SemicolonToken, sourceFile); + return formatOutermostParent(outermostParent, sourceFile, options, rulesProvider, FormattingRequestKind.FormatOnSemicolon); + } + + export function formatOnOpeningCurly(position: number, sourceFile: SourceFile, rulesProvider: RulesProvider, options: FormatCodeSettings): TextChange[] { + const openingCurly = findPrecedingTokenOfKind(position, SyntaxKind.FirstPunctuation, sourceFile); + const block = openingCurly && openingCurly.parent; + if (!(block && isBlock(block))) { + return []; + } + const outermostParent = findOutermostParentWithinListLevel(block); + return formatOutermostParent(outermostParent, sourceFile, options, rulesProvider, FormattingRequestKind.FormatOnOpeningCurlyBrace); } export function formatOnClosingCurly(position: number, sourceFile: SourceFile, rulesProvider: RulesProvider, options: FormatCodeSettings): TextChange[] { - return formatOutermostParent(position, SyntaxKind.CloseBraceToken, sourceFile, options, rulesProvider, FormattingRequestKind.FormatOnClosingCurlyBrace); + const outermostParent = findOutermostParentWithinListLevelFromPosition(position, SyntaxKind.CloseBraceToken, sourceFile); + return formatOutermostParent(outermostParent, sourceFile, options, rulesProvider, FormattingRequestKind.FormatOnClosingCurlyBrace); } export function formatDocument(sourceFile: SourceFile, rulesProvider: RulesProvider, options: FormatCodeSettings): TextChange[] { @@ -121,44 +133,55 @@ namespace ts.formatting { return formatSpan(span, sourceFile, options, rulesProvider, FormattingRequestKind.FormatSelection); } - function formatOutermostParent(position: number, expectedLastToken: SyntaxKind, sourceFile: SourceFile, options: FormatCodeSettings, rulesProvider: RulesProvider, requestKind: FormattingRequestKind): TextChange[] { - const parent = findOutermostParent(position, expectedLastToken, sourceFile); + function formatOutermostParent(parent: Node | undefined, sourceFile: SourceFile, options: FormatCodeSettings, rulesProvider: RulesProvider, requestKind: FormattingRequestKind): TextChange[] { if (!parent) { return []; } + const span = { pos: getLineStartPositionForPosition(parent.getStart(sourceFile), sourceFile), end: parent.end }; + return formatSpan(span, sourceFile, options, rulesProvider, requestKind); } - function findOutermostParent(position: number, expectedTokenKind: SyntaxKind, sourceFile: SourceFile): Node { + function findPrecedingTokenOfKind(position: number, expectedTokenKind: SyntaxKind, sourceFile: SourceFile): Node | undefined { const precedingToken = findPrecedingToken(position, sourceFile); - // when it is claimed that trigger character was typed at given position - // we verify that there is a token with a matching kind whose end is equal to position (because the character was just typed). - // If this condition is not hold - then trigger character was typed in some other context, - // i.e.in comment and thus should not trigger autoformatting - if (!precedingToken || - precedingToken.kind !== expectedTokenKind || - position !== precedingToken.getEnd()) { - return undefined; - } + return precedingToken && precedingToken.kind === expectedTokenKind && position === precedingToken.getEnd() ? + precedingToken : + undefined; + } - // walk up and search for the parent node that ends at the same position with precedingToken. - // for cases like this - // - // let x = 1; - // while (true) { - // } - // after typing close curly in while statement we want to reformat just the while statement. - // However if we just walk upwards searching for the parent that has the same end value - - // we'll end up with the whole source file. isListElement allows to stop on the list element level - let current = precedingToken; + /** + * Validating `expectedLastToken` ensures the token was typed in the context we expect (eg: not a comment). + * @param expectedLastToken The last token constituting the desired parent node. + */ + function findOutermostParentWithinListLevelFromPosition(position: number, expectedLastToken: SyntaxKind, sourceFile: SourceFile) { + const precedingToken = findPrecedingTokenOfKind(position, expectedLastToken, sourceFile); + return precedingToken && findOutermostParentWithinListLevel(precedingToken); + } + + /** + * Finds the outermost parent within the same list level as the token at position. + * + * Consider typing the following + * ``` + * let x = 1; + * while (true) { + * } + * ``` + * Upon typing the closing curly, we want to format the entire `while`-statement, but not the preceding + * variable declaration. + */ + function findOutermostParentWithinListLevel(token: Node): Node { + // If we walk upwards searching for the parent that has the same end value, we'll end up with the whole source file. + // `isListElement` allows to stop on the list element level. + let current = token; while (current && current.parent && - current.parent.end === precedingToken.end && + current.parent.end === token.end && !isListElement(current.parent, current)) { current = current.parent; } diff --git a/src/services/formatting/formattingContext.ts b/src/services/formatting/formattingContext.ts index 043df72f434..fd79481173e 100644 --- a/src/services/formatting/formattingContext.ts +++ b/src/services/formatting/formattingContext.ts @@ -47,14 +47,6 @@ namespace ts.formatting { return this.contextNodeAllOnSameLine; } - public NextNodeAllOnSameLine(): boolean { - if (this.nextNodeAllOnSameLine === undefined) { - this.nextNodeAllOnSameLine = this.NodeIsOnOneLine(this.nextTokenParent); - } - - return this.nextNodeAllOnSameLine; - } - public TokensAreOnSameLine(): boolean { if (this.tokensAreOnSameLine === undefined) { const startLine = this.sourceFile.getLineAndCharacterOfPosition(this.currentTokenSpan.pos).line; diff --git a/src/services/formatting/formattingRequestKind.ts b/src/services/formatting/formattingRequestKind.ts index d0397e4a8d9..6c671e1b888 100644 --- a/src/services/formatting/formattingRequestKind.ts +++ b/src/services/formatting/formattingRequestKind.ts @@ -7,6 +7,7 @@ namespace ts.formatting { FormatSelection, FormatOnEnter, FormatOnSemicolon, + FormatOnOpeningCurlyBrace, FormatOnClosingCurlyBrace } } \ No newline at end of file diff --git a/src/services/formatting/rules.ts b/src/services/formatting/rules.ts index 2c1becb8dd1..7f5d362e796 100644 --- a/src/services/formatting/rules.ts +++ b/src/services/formatting/rules.ts @@ -671,7 +671,7 @@ namespace ts.formatting { // This check is done before an open brace in a control construct, a function, or a typescript block declaration static IsBeforeMultilineBlockContext(context: FormattingContext): boolean { - return Rules.IsBeforeBlockContext(context) && !(context.NextNodeAllOnSameLine() || context.NextNodeBlockIsOnOneLine()); + return Rules.IsBeforeBlockContext(context) && !(context.NextNodeBlockIsOnOneLine()); } static IsMultilineBlockContext(context: FormattingContext): boolean { diff --git a/src/services/services.ts b/src/services/services.ts index b508285b182..bd8bfc81884 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -1763,8 +1763,10 @@ namespace ts { function getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions | FormatCodeSettings): TextChange[] { const sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); const settings = toEditorSettings(options); - - if (key === "}") { + if (key === "{") { + return formatting.formatOnOpeningCurly(position, sourceFile, getRuleProvider(settings), settings); + } + else if (key === "}") { return formatting.formatOnClosingCurly(position, sourceFile, getRuleProvider(settings), settings); } else if (key === ";") { From 0df66a5e6d3b237c3697d61a7475b5f87639e326 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Tue, 20 Jun 2017 11:49:36 -0700 Subject: [PATCH 10/62] format space before single-line blocks --- src/services/formatting/rules.ts | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/src/services/formatting/rules.ts b/src/services/formatting/rules.ts index 7f5d362e796..d490741d27b 100644 --- a/src/services/formatting/rules.ts +++ b/src/services/formatting/rules.ts @@ -290,15 +290,15 @@ namespace ts.formatting { // Place a space before open brace in a function declaration this.FunctionOpenBraceLeftTokenRange = Shared.TokenRange.AnyIncludingMultilineComments; - this.SpaceBeforeOpenBraceInFunction = new Rule(RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, SyntaxKind.OpenBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsBeforeBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), RuleAction.Space), RuleFlags.CanDeleteNewLines); + this.SpaceBeforeOpenBraceInFunction = new Rule(RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, SyntaxKind.OpenBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsBeforeBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeBlockContext), RuleAction.Space), RuleFlags.CanDeleteNewLines); // Place a space before open brace in a TypeScript declaration that has braces as children (class, module, enum, etc) this.TypeScriptOpenBraceLeftTokenRange = Shared.TokenRange.FromTokens([SyntaxKind.Identifier, SyntaxKind.MultiLineCommentTrivia, SyntaxKind.ClassKeyword, SyntaxKind.ExportKeyword, SyntaxKind.ImportKeyword]); - this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock = new Rule(RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, SyntaxKind.OpenBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), RuleAction.Space), RuleFlags.CanDeleteNewLines); + this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock = new Rule(RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, SyntaxKind.OpenBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeBlockContext), RuleAction.Space), RuleFlags.CanDeleteNewLines); // Place a space before open brace in a control flow construct this.ControlOpenBraceLeftTokenRange = Shared.TokenRange.FromTokens([SyntaxKind.CloseParenToken, SyntaxKind.MultiLineCommentTrivia, SyntaxKind.DoKeyword, SyntaxKind.TryKeyword, SyntaxKind.FinallyKeyword, SyntaxKind.ElseKeyword]); - this.SpaceBeforeOpenBraceInControl = new Rule(RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, SyntaxKind.OpenBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsControlDeclContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), RuleAction.Space), RuleFlags.CanDeleteNewLines); + this.SpaceBeforeOpenBraceInControl = new Rule(RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, SyntaxKind.OpenBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsControlDeclContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeBlockContext), RuleAction.Space), RuleFlags.CanDeleteNewLines); // Insert a space after { and before } in single-line contexts, but remove space from empty object literals {}. this.SpaceAfterOpenBrace = new Rule(RuleDescriptor.create3(SyntaxKind.OpenBraceToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsOptionEnabledOrUndefined("insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces"), Rules.IsBraceWrappedContext), RuleAction.Space)); @@ -644,25 +644,8 @@ namespace ts.formatting { return context.contextNode.kind === SyntaxKind.ConditionalExpression; } - static IsSameLineTokenOrBeforeMultilineBlockContext(context: FormattingContext): boolean { - //// This check is mainly used inside SpaceBeforeOpenBraceInControl and SpaceBeforeOpenBraceInFunction. - //// - //// Ex: - //// if (1) { .... - //// * ) and { are on the same line so apply the rule. Here we don't care whether it's same or multi block context - //// - //// Ex: - //// if (1) - //// { ... } - //// * ) and { are on different lines. We only need to format if the block is multiline context. So in this case we don't format. - //// - //// Ex: - //// if (1) - //// { ... - //// } - //// * ) and { are on different lines. We only need to format if the block is multiline context. So in this case we format. - - return context.TokensAreOnSameLine() || Rules.IsBeforeMultilineBlockContext(context); + static IsSameLineTokenOrBeforeBlockContext(context: FormattingContext): boolean { + return context.TokensAreOnSameLine() || Rules.IsBeforeBlockContext(context); } static IsBraceWrappedContext(context: FormattingContext): boolean { From 28fce55e1f1845439b0843e29108f8134a612df7 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Mon, 19 Jun 2017 20:30:11 -0700 Subject: [PATCH 11/62] add and update tests --- .../fourslash/autoFormattingOnPasting.ts | 23 +++++++++---------- .../forceIndentAfterNewLineInsert.ts | 23 +++++++++++-------- .../formatOnEnterOpenBraceRemoveNewLine.ts | 14 +++++++++++ .../formatRemoveNewLineAfterOpenBrace.ts | 15 ++++++++++++ .../formattingOfMultilineBlockConstructs.ts | 2 +- .../fourslash/formattingOnSingleLineBlocks.ts | 19 ++++++--------- 6 files changed, 62 insertions(+), 34 deletions(-) create mode 100644 tests/cases/fourslash/formatOnEnterOpenBraceRemoveNewLine.ts create mode 100644 tests/cases/fourslash/formatRemoveNewLineAfterOpenBrace.ts diff --git a/tests/cases/fourslash/autoFormattingOnPasting.ts b/tests/cases/fourslash/autoFormattingOnPasting.ts index 0c7f471d43d..5c9e2c86e37 100644 --- a/tests/cases/fourslash/autoFormattingOnPasting.ts +++ b/tests/cases/fourslash/autoFormattingOnPasting.ts @@ -4,11 +4,11 @@ /////**/ ////} goTo.marker(""); -edit.paste(" class TestClass{\r\n\ -private foo;\r\n\ -public testMethod( )\r\n\ -{}\r\n\ -}"); +edit.paste(` class TestClass{ +private foo; +public testMethod( ) +{} +}`); // We're missing scenarios of formatting option settings due to bug 693273 - [TypeScript] Need to improve fourslash support for formatting options. // Missing scenario ** Uncheck Tools->Options->Text Editor->TypeScript->Formatting->General->Format on paste ** //verify.currentFileContentIs("module TestModule {\r\n\ @@ -19,10 +19,9 @@ public testMethod( )\r\n\ //}\r\n\ //}"); // Missing scenario ** Check Tools->Options->Text Editor->TypeScript->Formatting->General->Format on paste ** -verify.currentFileContentIs("module TestModule {\r\n\ - class TestClass {\r\n\ - private foo;\r\n\ - public testMethod()\r\n\ - { }\r\n\ - }\r\n\ -}"); \ No newline at end of file +verify.currentFileContentIs(`module TestModule { + class TestClass { + private foo; + public testMethod() { } + } +}`); \ No newline at end of file diff --git a/tests/cases/fourslash/forceIndentAfterNewLineInsert.ts b/tests/cases/fourslash/forceIndentAfterNewLineInsert.ts index a076213ebb6..d4c41be01ee 100644 --- a/tests/cases/fourslash/forceIndentAfterNewLineInsert.ts +++ b/tests/cases/fourslash/forceIndentAfterNewLineInsert.ts @@ -1,18 +1,23 @@ /// -////function f() +////function f1() ////{ return 0; } +////function f2() +////{ +////return 0; +////} ////function g() ////{ function h() { ////return 0; ////}} format.document(); verify.currentFileContentIs( - "function f()\n" + - "{ return 0; }\n" + - "function g() {\n" + - " function h() {\n" + - " return 0;\n" + - " }\n" + - "}" - ); +`function f1() { return 0; } +function f2() { + return 0; +} +function g() { + function h() { + return 0; + } +}`); diff --git a/tests/cases/fourslash/formatOnEnterOpenBraceRemoveNewLine.ts b/tests/cases/fourslash/formatOnEnterOpenBraceRemoveNewLine.ts new file mode 100644 index 00000000000..6a1d5937255 --- /dev/null +++ b/tests/cases/fourslash/formatOnEnterOpenBraceRemoveNewLine.ts @@ -0,0 +1,14 @@ +/// + +//// if(true) +//// /**/ + + +format.setOption("PlaceOpenBraceOnNewLineForControlBlocks", false); +goTo.marker(""); +edit.insert("{"); +// TODO: figure out how to get rid of 3 extra spaces on second last line. +verify.currentFileContentIs( + `if (true) {`); + + \ No newline at end of file diff --git a/tests/cases/fourslash/formatRemoveNewLineAfterOpenBrace.ts b/tests/cases/fourslash/formatRemoveNewLineAfterOpenBrace.ts new file mode 100644 index 00000000000..6309ef21805 --- /dev/null +++ b/tests/cases/fourslash/formatRemoveNewLineAfterOpenBrace.ts @@ -0,0 +1,15 @@ +/// + +//// function foo() +//// { +//// } +//// if (true) +//// { +//// } + +format.document(); +verify.currentFileContentIs( +`function foo() { +} +if (true) { +}`); diff --git a/tests/cases/fourslash/formattingOfMultilineBlockConstructs.ts b/tests/cases/fourslash/formattingOfMultilineBlockConstructs.ts index 18f497496d8..fc52df62da3 100644 --- a/tests/cases/fourslash/formattingOfMultilineBlockConstructs.ts +++ b/tests/cases/fourslash/formattingOfMultilineBlockConstructs.ts @@ -47,7 +47,7 @@ verify.currentLineContentIs("enum E {"); goTo.marker('4'); verify.currentLineContentIs("class MyClass {"); goTo.marker('cons'); -verify.currentLineContentIs(" constructor()"); +verify.currentLineContentIs(" constructor() { }"); goTo.marker('5'); verify.currentLineContentIs(" public MyFunction() {"); goTo.marker('6'); diff --git a/tests/cases/fourslash/formattingOnSingleLineBlocks.ts b/tests/cases/fourslash/formattingOnSingleLineBlocks.ts index fc1a6818b95..67990056274 100644 --- a/tests/cases/fourslash/formattingOnSingleLineBlocks.ts +++ b/tests/cases/fourslash/formattingOnSingleLineBlocks.ts @@ -1,16 +1,11 @@ /// -/////*1*/class C -////{}/*2*/ -/////*3*/if (true) -////{}/*4*/ +////class C +////{} +////if (true) +////{} format.document(); -goTo.marker("1"); -verify.currentLineContentIs("class C"); -goTo.marker("2"); -verify.currentLineContentIs("{ }"); -goTo.marker("3"); -verify.currentLineContentIs("if (true)"); -goTo.marker("4"); -verify.currentLineContentIs("{ }"); \ No newline at end of file +verify.currentFileContentIs( +`class C { } +if (true) { }`); \ No newline at end of file From 2690d792c15996b85f06799c451b399eef390d28 Mon Sep 17 00:00:00 2001 From: Andrew Casey Date: Tue, 20 Jun 2017 15:32:32 -0700 Subject: [PATCH 12/62] Short-circuit getTokenAtPositionWorker The children of a given node are sorted by start position so, if one of them starts after a given position, all subsequent children all start after that position. --- src/services/utilities.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/services/utilities.ts b/src/services/utilities.ts index c5483251c61..d74e829cf45 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -649,7 +649,8 @@ namespace ts { const start = allowPositionInLeadingTrivia ? child.getFullStart() : child.getStart(sourceFile, includeJsDocComment); if (start > position) { - continue; + // If this child begins after position, then all subsequent children will as well. + break; } const end = child.getEnd(); From 09be5377869041412a222d10be5ddb60ed7d4d29 Mon Sep 17 00:00:00 2001 From: Dick van den Brink Date: Thu, 22 Jun 2017 16:41:40 +0200 Subject: [PATCH 13/62] Also check TypeAlias for unused type parameters Fixes #15208 --- src/compiler/checker.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 05c20ffb11a..e5c63cbd50c 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -19426,6 +19426,9 @@ namespace ts { case SyntaxKind.ConstructorType: checkUnusedTypeParameters(node); break; + case SyntaxKind.TypeAliasDeclaration: + checkUnusedTypeParameters(node); + break; } } } @@ -19503,7 +19506,7 @@ namespace ts { } } - function checkUnusedTypeParameters(node: ClassDeclaration | ClassExpression | FunctionDeclaration | MethodDeclaration | FunctionExpression | ArrowFunction | ConstructorDeclaration | SignatureDeclaration | InterfaceDeclaration) { + function checkUnusedTypeParameters(node: ClassDeclaration | ClassExpression | FunctionDeclaration | MethodDeclaration | FunctionExpression | ArrowFunction | ConstructorDeclaration | SignatureDeclaration | InterfaceDeclaration | TypeAliasDeclaration) { if (compilerOptions.noUnusedLocals && !isInAmbientContext(node)) { if (node.typeParameters) { // Only report errors on the last declaration for the type parameter container; @@ -21208,6 +21211,7 @@ namespace ts { checkTypeNameIsReserved(node.name, Diagnostics.Type_alias_name_cannot_be_0); checkTypeParameters(node.typeParameters); checkSourceElement(node.type); + registerForUnusedIdentifiersCheck(node); } function computeEnumMemberValues(node: EnumDeclaration) { From 33224747b33ddf6218bdf1e9006ff9bd87902cab Mon Sep 17 00:00:00 2001 From: Dick van den Brink Date: Thu, 22 Jun 2017 16:45:09 +0200 Subject: [PATCH 14/62] Added test for unused typeparameters in a typealias declaration --- .../reference/unusedTypeParameters10.errors.txt | 9 +++++++++ tests/baselines/reference/unusedTypeParameters10.js | 6 ++++++ tests/cases/compiler/unusedTypeParameters10.ts | 5 +++++ 3 files changed, 20 insertions(+) create mode 100644 tests/baselines/reference/unusedTypeParameters10.errors.txt create mode 100644 tests/baselines/reference/unusedTypeParameters10.js create mode 100644 tests/cases/compiler/unusedTypeParameters10.ts diff --git a/tests/baselines/reference/unusedTypeParameters10.errors.txt b/tests/baselines/reference/unusedTypeParameters10.errors.txt new file mode 100644 index 00000000000..7bfd5676df3 --- /dev/null +++ b/tests/baselines/reference/unusedTypeParameters10.errors.txt @@ -0,0 +1,9 @@ +tests/cases/compiler/unusedTypeParameters10.ts(1,12): error TS6133: 'T' is declared but never used. + + +==== tests/cases/compiler/unusedTypeParameters10.ts (1 errors) ==== + type Alias = { }; + ~ +!!! error TS6133: 'T' is declared but never used. + type Alias2 = { x: T }; + \ No newline at end of file diff --git a/tests/baselines/reference/unusedTypeParameters10.js b/tests/baselines/reference/unusedTypeParameters10.js new file mode 100644 index 00000000000..5738e6f48e8 --- /dev/null +++ b/tests/baselines/reference/unusedTypeParameters10.js @@ -0,0 +1,6 @@ +//// [unusedTypeParameters10.ts] +type Alias = { }; +type Alias2 = { x: T }; + + +//// [unusedTypeParameters10.js] diff --git a/tests/cases/compiler/unusedTypeParameters10.ts b/tests/cases/compiler/unusedTypeParameters10.ts new file mode 100644 index 00000000000..cda482e5bdc --- /dev/null +++ b/tests/cases/compiler/unusedTypeParameters10.ts @@ -0,0 +1,5 @@ +//@noUnusedLocals:true +//@noUnusedParameters:true + +type Alias = { }; +type Alias2 = { x: T }; From 8d9e66baddd18f62dc08e3b825587514bc03a150 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Thu, 22 Jun 2017 10:49:47 -0700 Subject: [PATCH 15/62] Ignore jsdoc when inferring rest args in JavaScript --- src/compiler/checker.ts | 2 +- .../baselines/reference/argumentsObjectCreatesRestForJs.types | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 05c20ffb11a..d46d9c50ae3 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -6391,7 +6391,7 @@ namespace ts { undefined; // JS functions get a free rest parameter if they reference `arguments` let hasRestLikeParameter = hasRestParameter(declaration); - if (!hasRestLikeParameter && isInJavaScriptFile(declaration) && !hasJSDocParameterTags(declaration) && containsArgumentsReference(declaration)) { + if (!hasRestLikeParameter && isInJavaScriptFile(declaration) && containsArgumentsReference(declaration)) { hasRestLikeParameter = true; const syntheticArgsSymbol = createSymbol(SymbolFlags.Variable, "args"); syntheticArgsSymbol.type = anyArrayType; diff --git a/tests/baselines/reference/argumentsObjectCreatesRestForJs.types b/tests/baselines/reference/argumentsObjectCreatesRestForJs.types index 10596fb10c7..28cdfcda413 100644 --- a/tests/baselines/reference/argumentsObjectCreatesRestForJs.types +++ b/tests/baselines/reference/argumentsObjectCreatesRestForJs.types @@ -35,13 +35,13 @@ someRest(1, 2, 3); * @param {number} x - a thing */ function jsdocced(x) { arguments; } ->jsdocced : (x: number) => void +>jsdocced : (x: number, ...args: any[]) => void >x : number >arguments : IArguments jsdocced(1); >jsdocced(1) : void ->jsdocced : (x: number) => void +>jsdocced : (x: number, ...args: any[]) => void >1 : 1 function dontDoubleRest(x, ...y) { arguments; } From f9592b6479ba79a7fa4e05199591c90ad0cda262 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Thu, 22 Jun 2017 11:17:38 -0700 Subject: [PATCH 16/62] fix and add test --- .../formatOnEnterOpenBraceAddNewLine.ts | 18 ++++++++++++++++++ .../formatOnEnterOpenBraceRemoveNewLine.ts | 4 ---- 2 files changed, 18 insertions(+), 4 deletions(-) create mode 100644 tests/cases/fourslash/formatOnEnterOpenBraceAddNewLine.ts diff --git a/tests/cases/fourslash/formatOnEnterOpenBraceAddNewLine.ts b/tests/cases/fourslash/formatOnEnterOpenBraceAddNewLine.ts new file mode 100644 index 00000000000..63276d3ce7c --- /dev/null +++ b/tests/cases/fourslash/formatOnEnterOpenBraceAddNewLine.ts @@ -0,0 +1,18 @@ +/// + +//// if(true) {/*0*/} +//// if(false)/*1*/{ +//// } + +format.setOption("PlaceOpenBraceOnNewLineForControlBlocks", true); +goTo.marker("0"); +edit.insertLine(""); +goTo.marker("1"); +edit.insertLine(""); +verify.currentFileContentIs( +`if (true) +{ +} +if (false) +{ +}`); \ No newline at end of file diff --git a/tests/cases/fourslash/formatOnEnterOpenBraceRemoveNewLine.ts b/tests/cases/fourslash/formatOnEnterOpenBraceRemoveNewLine.ts index 6a1d5937255..262a96daa42 100644 --- a/tests/cases/fourslash/formatOnEnterOpenBraceRemoveNewLine.ts +++ b/tests/cases/fourslash/formatOnEnterOpenBraceRemoveNewLine.ts @@ -3,12 +3,8 @@ //// if(true) //// /**/ - format.setOption("PlaceOpenBraceOnNewLineForControlBlocks", false); goTo.marker(""); edit.insert("{"); -// TODO: figure out how to get rid of 3 extra spaces on second last line. verify.currentFileContentIs( `if (true) {`); - - \ No newline at end of file From 485927b26aefe4d1719d110b9566057fcbd0b9a9 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Thu, 22 Jun 2017 11:17:55 -0700 Subject: [PATCH 17/62] clarify comment --- src/services/formatting/formatting.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index 1e40d6e1d0b..4ede9da335b 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -1119,7 +1119,7 @@ namespace ts.formatting { return; } - // edit should not be applied only if we have one line feed between elements + // edit should not be applied if we have one line feed between elements const lineDelta = currentStartLine - previousStartLine; if (lineDelta !== 1) { recordReplace(previousRange.end, currentRange.pos - previousRange.end, options.newLineCharacter); From 04d750f9f8fa6d4f687f355713b548ee946b5d61 Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Thu, 22 Jun 2017 11:42:12 -0700 Subject: [PATCH 18/62] Preserve method comments in JS->ES6 conversion. Fixes #16622 --- .../refactors/convertFunctionToEs6Class.ts | 42 +++++++++++++++---- .../convertFunctionToEs6ClassJsDoc.ts | 29 +++++++++++++ 2 files changed, 64 insertions(+), 7 deletions(-) create mode 100644 tests/cases/fourslash/convertFunctionToEs6ClassJsDoc.ts diff --git a/src/services/refactors/convertFunctionToEs6Class.ts b/src/services/refactors/convertFunctionToEs6Class.ts index d275924b76a..925f0856a3f 100644 --- a/src/services/refactors/convertFunctionToEs6Class.ts +++ b/src/services/refactors/convertFunctionToEs6Class.ts @@ -164,12 +164,15 @@ namespace ts.refactor { } switch (assignmentBinaryExpression.right.kind) { - case SyntaxKind.FunctionExpression: + case SyntaxKind.FunctionExpression: { const functionExpression = assignmentBinaryExpression.right as FunctionExpression; - return createMethod(/*decorators*/ undefined, modifiers, /*asteriskToken*/ undefined, memberDeclaration.name, /*questionToken*/ undefined, + const method = createMethod(/*decorators*/ undefined, modifiers, /*asteriskToken*/ undefined, memberDeclaration.name, /*questionToken*/ undefined, /*typeParameters*/ undefined, functionExpression.parameters, /*type*/ undefined, functionExpression.body); + copyComments(assignmentBinaryExpression, method); + return method; + } - case SyntaxKind.ArrowFunction: + case SyntaxKind.ArrowFunction: { const arrowFunction = assignmentBinaryExpression.right as ArrowFunction; const arrowFunctionBody = arrowFunction.body; let bodyBlock: Block; @@ -183,20 +186,40 @@ namespace ts.refactor { const expression = arrowFunctionBody as Expression; bodyBlock = createBlock([createReturn(expression)]); } - return createMethod(/*decorators*/ undefined, modifiers, /*asteriskToken*/ undefined, memberDeclaration.name, /*questionToken*/ undefined, + const method = createMethod(/*decorators*/ undefined, modifiers, /*asteriskToken*/ undefined, memberDeclaration.name, /*questionToken*/ undefined, /*typeParameters*/ undefined, arrowFunction.parameters, /*type*/ undefined, bodyBlock); + copyComments(assignmentBinaryExpression, method); + return method; + } - default: + default: { // Don't try to declare members in JavaScript files if (isSourceFileJavaScript(sourceFile)) { return; } return createProperty(/*decorators*/ undefined, modifiers, memberDeclaration.name, /*questionToken*/ undefined, /*type*/ undefined, assignmentBinaryExpression.right); + } } } } + function copyComments(sourceNode: Node, targetNode: Node) { + forEachLeadingCommentRange(sourceFile.text, sourceNode.pos, (pos, end, kind, htnl) => { + if (kind === SyntaxKind.MultiLineCommentTrivia) { + // Remove leading /* + pos += 2; + // Remove trailing */ + end -= 2; + } + else { + // Remove leading // + pos += 2; + } + addSyntheticLeadingComment(targetNode, kind, sourceFile.text.slice(pos, end), htnl); + }); + } + function createClassFromVariableDeclaration(node: VariableDeclaration): ClassDeclaration { const initializer = node.initializer as FunctionExpression; if (!initializer || initializer.kind !== SyntaxKind.FunctionExpression) { @@ -212,8 +235,10 @@ namespace ts.refactor { memberElements.unshift(createConstructor(/*decorators*/ undefined, /*modifiers*/ undefined, initializer.parameters, initializer.body)); } - return createClassDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, node.name, + const cls = createClassDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, node.name, /*typeParameters*/ undefined, /*heritageClauses*/ undefined, memberElements); + // Don't call copyComments here because we'll already leave them in place + return cls; } function createClassFromFunctionDeclaration(node: FunctionDeclaration): ClassDeclaration { @@ -221,8 +246,11 @@ namespace ts.refactor { if (node.body) { memberElements.unshift(createConstructor(/*decorators*/ undefined, /*modifiers*/ undefined, node.parameters, node.body)); } - return createClassDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, node.name, + + const cls = createClassDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, node.name, /*typeParameters*/ undefined, /*heritageClauses*/ undefined, memberElements); + // Don't call copyComments here because we'll already leave them in place + return cls; } } } \ No newline at end of file diff --git a/tests/cases/fourslash/convertFunctionToEs6ClassJsDoc.ts b/tests/cases/fourslash/convertFunctionToEs6ClassJsDoc.ts new file mode 100644 index 00000000000..afa4c6acf3e --- /dev/null +++ b/tests/cases/fourslash/convertFunctionToEs6ClassJsDoc.ts @@ -0,0 +1,29 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: test123.js +//// function fn() { +//// this.x = 100; +//// } +//// +//// /** +//// * This is a cool function! +//// */ +//// /*1*/fn.prototype.bar = function (x, y, z) { +//// this.x = y; +//// }; + +verify.fileAfterApplyingRefactorAtMarker('1', +`class fn { + constructor() { + this.x = 100; + } + /** + * This is a cool function! + */ + bar(x, y, z) { + this.x = y; + } +} + +`, 'Convert to ES2015 class', 'convert'); From feefd520b679541179374645a887b85eb2449a65 Mon Sep 17 00:00:00 2001 From: Kanchalai Tanglertsampan Date: Thu, 22 Jun 2017 11:51:00 -0700 Subject: [PATCH 19/62] Reorder promise.all signatures --- src/lib/es2015.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/es2015.d.ts b/src/lib/es2015.d.ts index ba30ea74669..36f22af6241 100644 --- a/src/lib/es2015.d.ts +++ b/src/lib/es2015.d.ts @@ -1,8 +1,8 @@ /// /// /// -/// /// +/// /// /// /// From 77d69c8c1d77334a1f1ee3e02478575094f7c26a Mon Sep 17 00:00:00 2001 From: Kanchalai Tanglertsampan Date: Thu, 22 Jun 2017 11:56:49 -0700 Subject: [PATCH 20/62] Add tests and update baselines --- .../reference/correctOrderOfPromiseMethod.js | 92 +++++++++++++++++++ .../correctOrderOfPromiseMethod.symbols | 71 ++++++++++++++ .../correctOrderOfPromiseMethod.types | 83 +++++++++++++++++ .../compiler/correctOrderOfPromiseMethod.ts | 27 ++++++ 4 files changed, 273 insertions(+) create mode 100644 tests/baselines/reference/correctOrderOfPromiseMethod.js create mode 100644 tests/baselines/reference/correctOrderOfPromiseMethod.symbols create mode 100644 tests/baselines/reference/correctOrderOfPromiseMethod.types create mode 100644 tests/cases/compiler/correctOrderOfPromiseMethod.ts diff --git a/tests/baselines/reference/correctOrderOfPromiseMethod.js b/tests/baselines/reference/correctOrderOfPromiseMethod.js new file mode 100644 index 00000000000..d28dbd66098 --- /dev/null +++ b/tests/baselines/reference/correctOrderOfPromiseMethod.js @@ -0,0 +1,92 @@ +//// [correctOrderOfPromiseMethod.ts] +interface A { + id: string +} + +interface B { + id: string + fieldB: string +} + +async function countEverything(): Promise { + const providerA = async (): Promise => { return [] } + const providerB = async (): Promise => { return [] } + + const [resultA, resultB] = await Promise.all([ + providerA(), + providerB(), + ]); + + const dataA: A[] = resultA; + const dataB: B[] = resultB; + if (dataA && dataB) { + return dataA.length + dataB.length; + } + return 0; +} + +//// [correctOrderOfPromiseMethod.js] +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __generator = (this && this.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [0, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; +function countEverything() { + return __awaiter(this, void 0, void 0, function () { + var _this = this; + var providerA, providerB, _a, resultA, resultB, dataA, dataB; + return __generator(this, function (_b) { + switch (_b.label) { + case 0: + providerA = function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) { + return [2 /*return*/, []]; + }); }); }; + providerB = function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) { + return [2 /*return*/, []]; + }); }); }; + return [4 /*yield*/, Promise.all([ + providerA(), + providerB(), + ])]; + case 1: + _a = _b.sent(), resultA = _a[0], resultB = _a[1]; + dataA = resultA; + dataB = resultB; + if (dataA && dataB) { + return [2 /*return*/, dataA.length + dataB.length]; + } + return [2 /*return*/, 0]; + } + }); + }); +} diff --git a/tests/baselines/reference/correctOrderOfPromiseMethod.symbols b/tests/baselines/reference/correctOrderOfPromiseMethod.symbols new file mode 100644 index 00000000000..2182af4a367 --- /dev/null +++ b/tests/baselines/reference/correctOrderOfPromiseMethod.symbols @@ -0,0 +1,71 @@ +=== tests/cases/compiler/correctOrderOfPromiseMethod.ts === +interface A { +>A : Symbol(A, Decl(correctOrderOfPromiseMethod.ts, 0, 0)) + + id: string +>id : Symbol(A.id, Decl(correctOrderOfPromiseMethod.ts, 0, 13)) +} + +interface B { +>B : Symbol(B, Decl(correctOrderOfPromiseMethod.ts, 2, 1)) + + id: string +>id : Symbol(B.id, Decl(correctOrderOfPromiseMethod.ts, 4, 13)) + + fieldB: string +>fieldB : Symbol(B.fieldB, Decl(correctOrderOfPromiseMethod.ts, 5, 14)) +} + +async function countEverything(): Promise { +>countEverything : Symbol(countEverything, Decl(correctOrderOfPromiseMethod.ts, 7, 1)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + + const providerA = async (): Promise => { return [] } +>providerA : Symbol(providerA, Decl(correctOrderOfPromiseMethod.ts, 10, 9)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>A : Symbol(A, Decl(correctOrderOfPromiseMethod.ts, 0, 0)) + + const providerB = async (): Promise => { return [] } +>providerB : Symbol(providerB, Decl(correctOrderOfPromiseMethod.ts, 11, 9)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>B : Symbol(B, Decl(correctOrderOfPromiseMethod.ts, 2, 1)) + + const [resultA, resultB] = await Promise.all([ +>resultA : Symbol(resultA, Decl(correctOrderOfPromiseMethod.ts, 13, 11)) +>resultB : Symbol(resultB, Decl(correctOrderOfPromiseMethod.ts, 13, 19)) +>Promise.all : Symbol(PromiseConstructor.all, Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>all : Symbol(PromiseConstructor.all, Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + + providerA(), +>providerA : Symbol(providerA, Decl(correctOrderOfPromiseMethod.ts, 10, 9)) + + providerB(), +>providerB : Symbol(providerB, Decl(correctOrderOfPromiseMethod.ts, 11, 9)) + + ]); + + const dataA: A[] = resultA; +>dataA : Symbol(dataA, Decl(correctOrderOfPromiseMethod.ts, 18, 9)) +>A : Symbol(A, Decl(correctOrderOfPromiseMethod.ts, 0, 0)) +>resultA : Symbol(resultA, Decl(correctOrderOfPromiseMethod.ts, 13, 11)) + + const dataB: B[] = resultB; +>dataB : Symbol(dataB, Decl(correctOrderOfPromiseMethod.ts, 19, 9)) +>B : Symbol(B, Decl(correctOrderOfPromiseMethod.ts, 2, 1)) +>resultB : Symbol(resultB, Decl(correctOrderOfPromiseMethod.ts, 13, 19)) + + if (dataA && dataB) { +>dataA : Symbol(dataA, Decl(correctOrderOfPromiseMethod.ts, 18, 9)) +>dataB : Symbol(dataB, Decl(correctOrderOfPromiseMethod.ts, 19, 9)) + + return dataA.length + dataB.length; +>dataA.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --)) +>dataA : Symbol(dataA, Decl(correctOrderOfPromiseMethod.ts, 18, 9)) +>length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --)) +>dataB.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --)) +>dataB : Symbol(dataB, Decl(correctOrderOfPromiseMethod.ts, 19, 9)) +>length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --)) + } + return 0; +} diff --git a/tests/baselines/reference/correctOrderOfPromiseMethod.types b/tests/baselines/reference/correctOrderOfPromiseMethod.types new file mode 100644 index 00000000000..fb4843bd3f1 --- /dev/null +++ b/tests/baselines/reference/correctOrderOfPromiseMethod.types @@ -0,0 +1,83 @@ +=== tests/cases/compiler/correctOrderOfPromiseMethod.ts === +interface A { +>A : A + + id: string +>id : string +} + +interface B { +>B : B + + id: string +>id : string + + fieldB: string +>fieldB : string +} + +async function countEverything(): Promise { +>countEverything : () => Promise +>Promise : Promise + + const providerA = async (): Promise => { return [] } +>providerA : () => Promise +>async (): Promise => { return [] } : () => Promise +>Promise : Promise +>A : A +>[] : undefined[] + + const providerB = async (): Promise => { return [] } +>providerB : () => Promise +>async (): Promise => { return [] } : () => Promise +>Promise : Promise +>B : B +>[] : undefined[] + + const [resultA, resultB] = await Promise.all([ +>resultA : A[] +>resultB : B[] +>await Promise.all([ providerA(), providerB(), ]) : [A[], B[]] +>Promise.all([ providerA(), providerB(), ]) : Promise<[A[], B[]]> +>Promise.all : { (values: Iterable>): Promise; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike, T10 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike]): Promise<[T1, T2, T3, T4, T5]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike]): Promise<[T1, T2, T3, T4]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise<[T1, T2, T3]>; (values: [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>; (values: (T | PromiseLike)[]): Promise; } +>Promise : PromiseConstructor +>all : { (values: Iterable>): Promise; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike, T10 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike]): Promise<[T1, T2, T3, T4, T5]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike]): Promise<[T1, T2, T3, T4]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise<[T1, T2, T3]>; (values: [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>; (values: (T | PromiseLike)[]): Promise; } +>[ providerA(), providerB(), ] : [Promise, Promise] + + providerA(), +>providerA() : Promise +>providerA : () => Promise + + providerB(), +>providerB() : Promise +>providerB : () => Promise + + ]); + + const dataA: A[] = resultA; +>dataA : A[] +>A : A +>resultA : A[] + + const dataB: B[] = resultB; +>dataB : B[] +>B : B +>resultB : B[] + + if (dataA && dataB) { +>dataA && dataB : B[] +>dataA : A[] +>dataB : B[] + + return dataA.length + dataB.length; +>dataA.length + dataB.length : number +>dataA.length : number +>dataA : A[] +>length : number +>dataB.length : number +>dataB : B[] +>length : number + } + return 0; +>0 : 0 +} diff --git a/tests/cases/compiler/correctOrderOfPromiseMethod.ts b/tests/cases/compiler/correctOrderOfPromiseMethod.ts new file mode 100644 index 00000000000..069c900a4aa --- /dev/null +++ b/tests/cases/compiler/correctOrderOfPromiseMethod.ts @@ -0,0 +1,27 @@ +// @lib: dom, es7 + +interface A { + id: string +} + +interface B { + id: string + fieldB: string +} + +async function countEverything(): Promise { + const providerA = async (): Promise => { return [] } + const providerB = async (): Promise => { return [] } + + const [resultA, resultB] = await Promise.all([ + providerA(), + providerB(), + ]); + + const dataA: A[] = resultA; + const dataB: B[] = resultB; + if (dataA && dataB) { + return dataA.length + dataB.length; + } + return 0; +} \ No newline at end of file From d0bb6e1e8a4f49c63e2d5d90e1c0631aa0c26c37 Mon Sep 17 00:00:00 2001 From: Kanchalai Tanglertsampan Date: Thu, 22 Jun 2017 13:45:14 -0700 Subject: [PATCH 21/62] Update symbols baselines from re-ordering of the signatures --- .../asyncAliasReturnType_es6.symbols | 2 +- .../asyncArrowFunction1_es2017.symbols | 2 +- .../reference/asyncArrowFunction1_es6.symbols | 2 +- ...syncAwaitWithCapturedBlockScopeVar.symbols | 2 +- .../reference/asyncAwait_es2017.symbols | 20 ++-- .../reference/asyncAwait_es6.symbols | 20 ++-- .../asyncFunctionDeclaration11_es2017.symbols | 2 +- .../asyncFunctionDeclaration11_es6.symbols | 2 +- .../asyncFunctionDeclaration14_es2017.symbols | 2 +- .../asyncFunctionDeclaration14_es6.symbols | 2 +- .../asyncFunctionDeclaration1_es2017.symbols | 2 +- .../asyncFunctionDeclaration1_es6.symbols | 2 +- .../reference/asyncFunctionReturnType.symbols | 52 +++++----- .../asyncFunctionsAndStrictNullChecks.symbols | 2 +- ...nParenthesizedArrowFunction_es2017.symbols | 2 +- ...ncUnParenthesizedArrowFunction_es6.symbols | 2 +- .../reference/asyncUseStrict_es2017.symbols | 4 +- .../reference/asyncUseStrict_es6.symbols | 4 +- .../awaitBinaryExpression1_es2017.symbols | 4 +- .../awaitBinaryExpression1_es6.symbols | 4 +- .../awaitBinaryExpression2_es2017.symbols | 4 +- .../awaitBinaryExpression2_es6.symbols | 4 +- .../awaitBinaryExpression3_es2017.symbols | 4 +- .../awaitBinaryExpression3_es6.symbols | 4 +- .../awaitBinaryExpression4_es2017.symbols | 4 +- .../awaitBinaryExpression4_es6.symbols | 4 +- .../awaitBinaryExpression5_es2017.symbols | 4 +- .../awaitBinaryExpression5_es6.symbols | 4 +- .../awaitCallExpression1_es2017.symbols | 8 +- .../awaitCallExpression1_es6.symbols | 8 +- .../awaitCallExpression2_es2017.symbols | 8 +- .../awaitCallExpression2_es6.symbols | 8 +- .../awaitCallExpression3_es2017.symbols | 8 +- .../awaitCallExpression3_es6.symbols | 8 +- .../awaitCallExpression4_es2017.symbols | 8 +- .../awaitCallExpression4_es6.symbols | 8 +- .../awaitCallExpression5_es2017.symbols | 8 +- .../awaitCallExpression5_es6.symbols | 8 +- .../awaitCallExpression6_es2017.symbols | 8 +- .../awaitCallExpression6_es6.symbols | 8 +- .../awaitCallExpression7_es2017.symbols | 8 +- .../awaitCallExpression7_es6.symbols | 8 +- .../awaitCallExpression8_es2017.symbols | 8 +- .../awaitCallExpression8_es6.symbols | 8 +- .../awaitClassExpression_es2017.symbols | 4 +- .../awaitClassExpression_es6.symbols | 4 +- .../awaitInheritedPromise_es2017.symbols | 2 +- .../reference/controlFlowInstanceof.symbols | 2 +- .../decoratorMetadataPromise.symbols | 6 +- .../defaultExportInAwaitExpression01.symbols | 2 +- .../defaultExportInAwaitExpression02.symbols | 2 +- .../reference/es2017basicAsync.symbols | 18 ++-- .../exportDefaultAsyncFunction.symbols | 2 +- .../exportDefaultAsyncFunction2.symbols | 2 +- .../importCallExpression2ESNext.symbols | 2 +- ...portCallExpressionDeclarationEmit3.symbols | 6 +- .../importCallExpressionInAMD2.symbols | 2 +- .../importCallExpressionInCJS2.symbols | 2 +- .../importCallExpressionInCJS3.symbols | 2 +- .../importCallExpressionInSystem2.symbols | 2 +- .../importCallExpressionInUMD2.symbols | 2 +- ...rtCallExpressionReturnPromiseOfAny.symbols | 8 +- .../reference/inferenceLimit.symbols | 10 +- .../baselines/reference/inferenceLimit.types | 4 +- ...ibrary_NoErrorDuplicateLibOptions1.symbols | 2 +- ...ibrary_NoErrorDuplicateLibOptions2.symbols | 2 +- ...larizeLibrary_TargetES5UsingES6Lib.symbols | 2 +- .../noImplicitReturnsInAsync1.symbols | 2 +- tests/baselines/reference/promiseType.symbols | 94 +++++++++---------- .../reference/promiseTypeStrictNull.symbols | 94 +++++++++---------- .../promiseVoidErrorCallback.symbols | 4 +- .../transformNestedGeneratorsWithTry.symbols | 4 +- .../types.asyncGenerators.esnext.1.symbols | 32 +++---- 73 files changed, 307 insertions(+), 307 deletions(-) diff --git a/tests/baselines/reference/asyncAliasReturnType_es6.symbols b/tests/baselines/reference/asyncAliasReturnType_es6.symbols index fccb2e5c737..c9c279dcc41 100644 --- a/tests/baselines/reference/asyncAliasReturnType_es6.symbols +++ b/tests/baselines/reference/asyncAliasReturnType_es6.symbols @@ -2,7 +2,7 @@ type PromiseAlias = Promise; >PromiseAlias : Symbol(PromiseAlias, Decl(asyncAliasReturnType_es6.ts, 0, 0)) >T : Symbol(T, Decl(asyncAliasReturnType_es6.ts, 0, 18)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >T : Symbol(T, Decl(asyncAliasReturnType_es6.ts, 0, 18)) async function f(): PromiseAlias { diff --git a/tests/baselines/reference/asyncArrowFunction1_es2017.symbols b/tests/baselines/reference/asyncArrowFunction1_es2017.symbols index 15739132d35..43b5055e81c 100644 --- a/tests/baselines/reference/asyncArrowFunction1_es2017.symbols +++ b/tests/baselines/reference/asyncArrowFunction1_es2017.symbols @@ -1,6 +1,6 @@ === tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction1_es2017.ts === var foo = async (): Promise => { >foo : Symbol(foo, Decl(asyncArrowFunction1_es2017.ts, 0, 3)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) }; diff --git a/tests/baselines/reference/asyncArrowFunction1_es6.symbols b/tests/baselines/reference/asyncArrowFunction1_es6.symbols index 2ef65441ff9..81cc2d29593 100644 --- a/tests/baselines/reference/asyncArrowFunction1_es6.symbols +++ b/tests/baselines/reference/asyncArrowFunction1_es6.symbols @@ -1,6 +1,6 @@ === tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction1_es6.ts === var foo = async (): Promise => { >foo : Symbol(foo, Decl(asyncArrowFunction1_es6.ts, 0, 3)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) }; diff --git a/tests/baselines/reference/asyncAwaitWithCapturedBlockScopeVar.symbols b/tests/baselines/reference/asyncAwaitWithCapturedBlockScopeVar.symbols index acd490f5266..32063138fbb 100644 --- a/tests/baselines/reference/asyncAwaitWithCapturedBlockScopeVar.symbols +++ b/tests/baselines/reference/asyncAwaitWithCapturedBlockScopeVar.symbols @@ -65,7 +65,7 @@ async function fn3() { async function fn4(): Promise { >fn4 : Symbol(fn4, Decl(asyncAwaitWithCapturedBlockScopeVar.ts, 24, 1)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) let ar = []; >ar : Symbol(ar, Decl(asyncAwaitWithCapturedBlockScopeVar.ts, 27, 7)) diff --git a/tests/baselines/reference/asyncAwait_es2017.symbols b/tests/baselines/reference/asyncAwait_es2017.symbols index a456a224295..0f302638276 100644 --- a/tests/baselines/reference/asyncAwait_es2017.symbols +++ b/tests/baselines/reference/asyncAwait_es2017.symbols @@ -2,16 +2,16 @@ type MyPromise = Promise; >MyPromise : Symbol(MyPromise, Decl(asyncAwait_es2017.ts, 0, 0), Decl(asyncAwait_es2017.ts, 1, 11)) >T : Symbol(T, Decl(asyncAwait_es2017.ts, 0, 15)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >T : Symbol(T, Decl(asyncAwait_es2017.ts, 0, 15)) declare var MyPromise: typeof Promise; >MyPromise : Symbol(MyPromise, Decl(asyncAwait_es2017.ts, 0, 0), Decl(asyncAwait_es2017.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) declare var p: Promise; >p : Symbol(p, Decl(asyncAwait_es2017.ts, 2, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) declare var mp: MyPromise; >mp : Symbol(mp, Decl(asyncAwait_es2017.ts, 3, 11)) @@ -22,7 +22,7 @@ async function f0() { } async function f1(): Promise { } >f1 : Symbol(f1, Decl(asyncAwait_es2017.ts, 5, 23)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) async function f3(): MyPromise { } >f3 : Symbol(f3, Decl(asyncAwait_es2017.ts, 6, 38)) @@ -33,7 +33,7 @@ let f4 = async function() { } let f5 = async function(): Promise { } >f5 : Symbol(f5, Decl(asyncAwait_es2017.ts, 10, 3)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) let f6 = async function(): MyPromise { } >f6 : Symbol(f6, Decl(asyncAwait_es2017.ts, 11, 3)) @@ -44,7 +44,7 @@ let f7 = async () => { }; let f8 = async (): Promise => { }; >f8 : Symbol(f8, Decl(asyncAwait_es2017.ts, 14, 3)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) let f9 = async (): MyPromise => { }; >f9 : Symbol(f9, Decl(asyncAwait_es2017.ts, 15, 3)) @@ -60,7 +60,7 @@ let f11 = async () => mp; let f12 = async (): Promise => mp; >f12 : Symbol(f12, Decl(asyncAwait_es2017.ts, 18, 3)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >mp : Symbol(mp, Decl(asyncAwait_es2017.ts, 3, 11)) let f13 = async (): MyPromise => p; @@ -76,7 +76,7 @@ let o = { async m2(): Promise { }, >m2 : Symbol(m2, Decl(asyncAwait_es2017.ts, 22, 16)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) async m3(): MyPromise { } >m3 : Symbol(m3, Decl(asyncAwait_es2017.ts, 23, 31)) @@ -92,7 +92,7 @@ class C { async m2(): Promise { } >m2 : Symbol(C.m2, Decl(asyncAwait_es2017.ts, 28, 15)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) async m3(): MyPromise { } >m3 : Symbol(C.m3, Decl(asyncAwait_es2017.ts, 29, 30)) @@ -103,7 +103,7 @@ class C { static async m5(): Promise { } >m5 : Symbol(C.m5, Decl(asyncAwait_es2017.ts, 31, 22)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) static async m6(): MyPromise { } >m6 : Symbol(C.m6, Decl(asyncAwait_es2017.ts, 32, 37)) diff --git a/tests/baselines/reference/asyncAwait_es6.symbols b/tests/baselines/reference/asyncAwait_es6.symbols index 25032b1a943..9093fc69064 100644 --- a/tests/baselines/reference/asyncAwait_es6.symbols +++ b/tests/baselines/reference/asyncAwait_es6.symbols @@ -2,16 +2,16 @@ type MyPromise = Promise; >MyPromise : Symbol(MyPromise, Decl(asyncAwait_es6.ts, 0, 0), Decl(asyncAwait_es6.ts, 1, 11)) >T : Symbol(T, Decl(asyncAwait_es6.ts, 0, 15)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >T : Symbol(T, Decl(asyncAwait_es6.ts, 0, 15)) declare var MyPromise: typeof Promise; >MyPromise : Symbol(MyPromise, Decl(asyncAwait_es6.ts, 0, 0), Decl(asyncAwait_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) declare var p: Promise; >p : Symbol(p, Decl(asyncAwait_es6.ts, 2, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) declare var mp: MyPromise; >mp : Symbol(mp, Decl(asyncAwait_es6.ts, 3, 11)) @@ -22,7 +22,7 @@ async function f0() { } async function f1(): Promise { } >f1 : Symbol(f1, Decl(asyncAwait_es6.ts, 5, 23)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) async function f3(): MyPromise { } >f3 : Symbol(f3, Decl(asyncAwait_es6.ts, 6, 38)) @@ -33,7 +33,7 @@ let f4 = async function() { } let f5 = async function(): Promise { } >f5 : Symbol(f5, Decl(asyncAwait_es6.ts, 10, 3)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) let f6 = async function(): MyPromise { } >f6 : Symbol(f6, Decl(asyncAwait_es6.ts, 11, 3)) @@ -44,7 +44,7 @@ let f7 = async () => { }; let f8 = async (): Promise => { }; >f8 : Symbol(f8, Decl(asyncAwait_es6.ts, 14, 3)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) let f9 = async (): MyPromise => { }; >f9 : Symbol(f9, Decl(asyncAwait_es6.ts, 15, 3)) @@ -60,7 +60,7 @@ let f11 = async () => mp; let f12 = async (): Promise => mp; >f12 : Symbol(f12, Decl(asyncAwait_es6.ts, 18, 3)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >mp : Symbol(mp, Decl(asyncAwait_es6.ts, 3, 11)) let f13 = async (): MyPromise => p; @@ -76,7 +76,7 @@ let o = { async m2(): Promise { }, >m2 : Symbol(m2, Decl(asyncAwait_es6.ts, 22, 16)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) async m3(): MyPromise { } >m3 : Symbol(m3, Decl(asyncAwait_es6.ts, 23, 31)) @@ -92,7 +92,7 @@ class C { async m2(): Promise { } >m2 : Symbol(C.m2, Decl(asyncAwait_es6.ts, 28, 15)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) async m3(): MyPromise { } >m3 : Symbol(C.m3, Decl(asyncAwait_es6.ts, 29, 30)) @@ -103,7 +103,7 @@ class C { static async m5(): Promise { } >m5 : Symbol(C.m5, Decl(asyncAwait_es6.ts, 31, 22)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) static async m6(): MyPromise { } >m6 : Symbol(C.m6, Decl(asyncAwait_es6.ts, 32, 37)) diff --git a/tests/baselines/reference/asyncFunctionDeclaration11_es2017.symbols b/tests/baselines/reference/asyncFunctionDeclaration11_es2017.symbols index d9ae9715c2e..aebb5a7c968 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration11_es2017.symbols +++ b/tests/baselines/reference/asyncFunctionDeclaration11_es2017.symbols @@ -1,5 +1,5 @@ === tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration11_es2017.ts === async function await(): Promise { >await : Symbol(await, Decl(asyncFunctionDeclaration11_es2017.ts, 0, 0)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) } diff --git a/tests/baselines/reference/asyncFunctionDeclaration11_es6.symbols b/tests/baselines/reference/asyncFunctionDeclaration11_es6.symbols index 4f1aea28635..2ebbad8ca08 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration11_es6.symbols +++ b/tests/baselines/reference/asyncFunctionDeclaration11_es6.symbols @@ -1,5 +1,5 @@ === tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration11_es6.ts === async function await(): Promise { >await : Symbol(await, Decl(asyncFunctionDeclaration11_es6.ts, 0, 0)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) } diff --git a/tests/baselines/reference/asyncFunctionDeclaration14_es2017.symbols b/tests/baselines/reference/asyncFunctionDeclaration14_es2017.symbols index 0c410ece27d..c7b505fa6ca 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration14_es2017.symbols +++ b/tests/baselines/reference/asyncFunctionDeclaration14_es2017.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration14_es2017.ts === async function foo(): Promise { >foo : Symbol(foo, Decl(asyncFunctionDeclaration14_es2017.ts, 0, 0)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) return; } diff --git a/tests/baselines/reference/asyncFunctionDeclaration14_es6.symbols b/tests/baselines/reference/asyncFunctionDeclaration14_es6.symbols index 2aa5c7e0b23..89c9913c1cc 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration14_es6.symbols +++ b/tests/baselines/reference/asyncFunctionDeclaration14_es6.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration14_es6.ts === async function foo(): Promise { >foo : Symbol(foo, Decl(asyncFunctionDeclaration14_es6.ts, 0, 0)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) return; } diff --git a/tests/baselines/reference/asyncFunctionDeclaration1_es2017.symbols b/tests/baselines/reference/asyncFunctionDeclaration1_es2017.symbols index 32b86eb69c7..a9078b39dd7 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration1_es2017.symbols +++ b/tests/baselines/reference/asyncFunctionDeclaration1_es2017.symbols @@ -1,5 +1,5 @@ === tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration1_es2017.ts === async function foo(): Promise { >foo : Symbol(foo, Decl(asyncFunctionDeclaration1_es2017.ts, 0, 0)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) } diff --git a/tests/baselines/reference/asyncFunctionDeclaration1_es6.symbols b/tests/baselines/reference/asyncFunctionDeclaration1_es6.symbols index fc645fa038e..e8f03e0b55b 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration1_es6.symbols +++ b/tests/baselines/reference/asyncFunctionDeclaration1_es6.symbols @@ -1,5 +1,5 @@ === tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration1_es6.ts === async function foo(): Promise { >foo : Symbol(foo, Decl(asyncFunctionDeclaration1_es6.ts, 0, 0)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) } diff --git a/tests/baselines/reference/asyncFunctionReturnType.symbols b/tests/baselines/reference/asyncFunctionReturnType.symbols index 7939fe7e83c..ea0df55fb89 100644 --- a/tests/baselines/reference/asyncFunctionReturnType.symbols +++ b/tests/baselines/reference/asyncFunctionReturnType.symbols @@ -8,7 +8,7 @@ async function fAsync() { async function fAsyncExplicit(): Promise<[number, boolean]> { >fAsyncExplicit : Symbol(fAsyncExplicit, Decl(asyncFunctionReturnType.ts, 3, 1)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) // This is contextually typed as a tuple. return [1, true]; @@ -29,7 +29,7 @@ async function fIndexedTypeForStringProp(obj: Obj): Promise { >fIndexedTypeForStringProp : Symbol(fIndexedTypeForStringProp, Decl(asyncFunctionReturnType.ts, 14, 1)) >obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 16, 41)) >Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) return obj.stringProp; @@ -42,12 +42,12 @@ async function fIndexedTypeForPromiseOfStringProp(obj: Obj): PromisefIndexedTypeForPromiseOfStringProp : Symbol(fIndexedTypeForPromiseOfStringProp, Decl(asyncFunctionReturnType.ts, 18, 1)) >obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 20, 50)) >Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) return Promise.resolve(obj.stringProp); >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >obj.stringProp : Symbol(Obj.stringProp, Decl(asyncFunctionReturnType.ts, 11, 15)) >obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 20, 50)) @@ -58,12 +58,12 @@ async function fIndexedTypeForExplicitPromiseOfStringProp(obj: Obj): PromisefIndexedTypeForExplicitPromiseOfStringProp : Symbol(fIndexedTypeForExplicitPromiseOfStringProp, Decl(asyncFunctionReturnType.ts, 22, 1)) >obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 24, 58)) >Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) return Promise.resolve(obj.stringProp); >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) >obj.stringProp : Symbol(Obj.stringProp, Decl(asyncFunctionReturnType.ts, 11, 15)) @@ -75,7 +75,7 @@ async function fIndexedTypeForAnyProp(obj: Obj): Promise { >fIndexedTypeForAnyProp : Symbol(fIndexedTypeForAnyProp, Decl(asyncFunctionReturnType.ts, 26, 1)) >obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 28, 38)) >Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) return obj.anyProp; @@ -88,12 +88,12 @@ async function fIndexedTypeForPromiseOfAnyProp(obj: Obj): PromisefIndexedTypeForPromiseOfAnyProp : Symbol(fIndexedTypeForPromiseOfAnyProp, Decl(asyncFunctionReturnType.ts, 30, 1)) >obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 32, 47)) >Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) return Promise.resolve(obj.anyProp); >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >obj.anyProp : Symbol(Obj.anyProp, Decl(asyncFunctionReturnType.ts, 12, 23)) >obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 32, 47)) @@ -104,12 +104,12 @@ async function fIndexedTypeForExplicitPromiseOfAnyProp(obj: Obj): PromisefIndexedTypeForExplicitPromiseOfAnyProp : Symbol(fIndexedTypeForExplicitPromiseOfAnyProp, Decl(asyncFunctionReturnType.ts, 34, 1)) >obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 36, 55)) >Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) return Promise.resolve(obj.anyProp); >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) >obj.anyProp : Symbol(Obj.anyProp, Decl(asyncFunctionReturnType.ts, 12, 23)) @@ -123,7 +123,7 @@ async function fGenericIndexedTypeForStringProp(obj: TObj): Pr >Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) >obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 40, 66)) >TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 40, 48)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 40, 48)) return obj.stringProp; @@ -138,12 +138,12 @@ async function fGenericIndexedTypeForPromiseOfStringProp(obj: >Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) >obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 44, 75)) >TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 44, 57)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 44, 57)) return Promise.resolve(obj.stringProp); >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >obj.stringProp : Symbol(Obj.stringProp, Decl(asyncFunctionReturnType.ts, 11, 15)) >obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 44, 75)) @@ -156,12 +156,12 @@ async function fGenericIndexedTypeForExplicitPromiseOfStringPropObj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) >obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 48, 83)) >TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 48, 65)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 48, 65)) return Promise.resolve(obj.stringProp); >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 48, 65)) >obj.stringProp : Symbol(Obj.stringProp, Decl(asyncFunctionReturnType.ts, 11, 15)) @@ -175,7 +175,7 @@ async function fGenericIndexedTypeForAnyProp(obj: TObj): Promi >Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) >obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 52, 63)) >TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 52, 45)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 52, 45)) return obj.anyProp; @@ -190,12 +190,12 @@ async function fGenericIndexedTypeForPromiseOfAnyProp(obj: TOb >Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) >obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 56, 72)) >TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 56, 54)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 56, 54)) return Promise.resolve(obj.anyProp); >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >obj.anyProp : Symbol(Obj.anyProp, Decl(asyncFunctionReturnType.ts, 12, 23)) >obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 56, 72)) @@ -208,12 +208,12 @@ async function fGenericIndexedTypeForExplicitPromiseOfAnyProp( >Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) >obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 60, 80)) >TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 60, 62)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 60, 62)) return Promise.resolve(obj.anyProp); >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 60, 62)) >obj.anyProp : Symbol(Obj.anyProp, Decl(asyncFunctionReturnType.ts, 12, 23)) @@ -231,7 +231,7 @@ async function fGenericIndexedTypeForKPropTObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 64, 43)) >key : Symbol(key, Decl(asyncFunctionReturnType.ts, 64, 93)) >K : Symbol(K, Decl(asyncFunctionReturnType.ts, 64, 60)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 64, 43)) >K : Symbol(K, Decl(asyncFunctionReturnType.ts, 64, 60)) @@ -250,13 +250,13 @@ async function fGenericIndexedTypeForPromiseOfKPropTObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 68, 52)) >key : Symbol(key, Decl(asyncFunctionReturnType.ts, 68, 102)) >K : Symbol(K, Decl(asyncFunctionReturnType.ts, 68, 69)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 68, 52)) >K : Symbol(K, Decl(asyncFunctionReturnType.ts, 68, 69)) return Promise.resolve(obj[key]); >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 68, 92)) >key : Symbol(key, Decl(asyncFunctionReturnType.ts, 68, 102)) @@ -272,13 +272,13 @@ async function fGenericIndexedTypeForExplicitPromiseOfKPropTObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 72, 60)) >key : Symbol(key, Decl(asyncFunctionReturnType.ts, 72, 110)) >K : Symbol(K, Decl(asyncFunctionReturnType.ts, 72, 77)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 72, 60)) >K : Symbol(K, Decl(asyncFunctionReturnType.ts, 72, 77)) return Promise.resolve(obj[key]); >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 72, 60)) >K : Symbol(K, Decl(asyncFunctionReturnType.ts, 72, 77)) diff --git a/tests/baselines/reference/asyncFunctionsAndStrictNullChecks.symbols b/tests/baselines/reference/asyncFunctionsAndStrictNullChecks.symbols index be15e466463..f6c8862e100 100644 --- a/tests/baselines/reference/asyncFunctionsAndStrictNullChecks.symbols +++ b/tests/baselines/reference/asyncFunctionsAndStrictNullChecks.symbols @@ -105,7 +105,7 @@ declare function resolve1(value: T): Promise; >T : Symbol(T, Decl(asyncFunctionsAndStrictNullChecks.ts, 17, 26)) >value : Symbol(value, Decl(asyncFunctionsAndStrictNullChecks.ts, 17, 29)) >T : Symbol(T, Decl(asyncFunctionsAndStrictNullChecks.ts, 17, 26)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >T : Symbol(T, Decl(asyncFunctionsAndStrictNullChecks.ts, 17, 26)) declare function resolve2(value: T): Windows.Foundation.IPromise; diff --git a/tests/baselines/reference/asyncUnParenthesizedArrowFunction_es2017.symbols b/tests/baselines/reference/asyncUnParenthesizedArrowFunction_es2017.symbols index 45361cfb78e..181f4a223ad 100644 --- a/tests/baselines/reference/asyncUnParenthesizedArrowFunction_es2017.symbols +++ b/tests/baselines/reference/asyncUnParenthesizedArrowFunction_es2017.symbols @@ -2,7 +2,7 @@ declare function someOtherFunction(i: any): Promise; >someOtherFunction : Symbol(someOtherFunction, Decl(asyncUnParenthesizedArrowFunction_es2017.ts, 0, 0)) >i : Symbol(i, Decl(asyncUnParenthesizedArrowFunction_es2017.ts, 0, 35)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const x = async i => await someOtherFunction(i) >x : Symbol(x, Decl(asyncUnParenthesizedArrowFunction_es2017.ts, 1, 5)) diff --git a/tests/baselines/reference/asyncUnParenthesizedArrowFunction_es6.symbols b/tests/baselines/reference/asyncUnParenthesizedArrowFunction_es6.symbols index 26dc2840d2f..afc6968eedb 100644 --- a/tests/baselines/reference/asyncUnParenthesizedArrowFunction_es6.symbols +++ b/tests/baselines/reference/asyncUnParenthesizedArrowFunction_es6.symbols @@ -2,7 +2,7 @@ declare function someOtherFunction(i: any): Promise; >someOtherFunction : Symbol(someOtherFunction, Decl(asyncUnParenthesizedArrowFunction_es6.ts, 0, 0)) >i : Symbol(i, Decl(asyncUnParenthesizedArrowFunction_es6.ts, 0, 35)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const x = async i => await someOtherFunction(i) >x : Symbol(x, Decl(asyncUnParenthesizedArrowFunction_es6.ts, 1, 5)) diff --git a/tests/baselines/reference/asyncUseStrict_es2017.symbols b/tests/baselines/reference/asyncUseStrict_es2017.symbols index ecd5c992cd8..36c5604c263 100644 --- a/tests/baselines/reference/asyncUseStrict_es2017.symbols +++ b/tests/baselines/reference/asyncUseStrict_es2017.symbols @@ -4,11 +4,11 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(asyncUseStrict_es2017.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) async function func(): Promise { >func : Symbol(func, Decl(asyncUseStrict_es2017.ts, 1, 32)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) "use strict"; var b = await p || a; diff --git a/tests/baselines/reference/asyncUseStrict_es6.symbols b/tests/baselines/reference/asyncUseStrict_es6.symbols index 8aa3606c3b4..deecf6b81fe 100644 --- a/tests/baselines/reference/asyncUseStrict_es6.symbols +++ b/tests/baselines/reference/asyncUseStrict_es6.symbols @@ -4,11 +4,11 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(asyncUseStrict_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) async function func(): Promise { >func : Symbol(func, Decl(asyncUseStrict_es6.ts, 1, 32)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) "use strict"; var b = await p || a; diff --git a/tests/baselines/reference/awaitBinaryExpression1_es2017.symbols b/tests/baselines/reference/awaitBinaryExpression1_es2017.symbols index b763a454458..17bacd3b807 100644 --- a/tests/baselines/reference/awaitBinaryExpression1_es2017.symbols +++ b/tests/baselines/reference/awaitBinaryExpression1_es2017.symbols @@ -4,7 +4,7 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitBinaryExpression1_es2017.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) declare function before(): void; >before : Symbol(before, Decl(awaitBinaryExpression1_es2017.ts, 1, 32)) @@ -14,7 +14,7 @@ declare function after(): void; async function func(): Promise { >func : Symbol(func, Decl(awaitBinaryExpression1_es2017.ts, 3, 31)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) before(); >before : Symbol(before, Decl(awaitBinaryExpression1_es2017.ts, 1, 32)) diff --git a/tests/baselines/reference/awaitBinaryExpression1_es6.symbols b/tests/baselines/reference/awaitBinaryExpression1_es6.symbols index f6782d36636..f65763b36a3 100644 --- a/tests/baselines/reference/awaitBinaryExpression1_es6.symbols +++ b/tests/baselines/reference/awaitBinaryExpression1_es6.symbols @@ -4,7 +4,7 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitBinaryExpression1_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) declare function before(): void; >before : Symbol(before, Decl(awaitBinaryExpression1_es6.ts, 1, 32)) @@ -14,7 +14,7 @@ declare function after(): void; async function func(): Promise { >func : Symbol(func, Decl(awaitBinaryExpression1_es6.ts, 3, 31)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) before(); >before : Symbol(before, Decl(awaitBinaryExpression1_es6.ts, 1, 32)) diff --git a/tests/baselines/reference/awaitBinaryExpression2_es2017.symbols b/tests/baselines/reference/awaitBinaryExpression2_es2017.symbols index 7f97d409b51..a41b4ca3e8a 100644 --- a/tests/baselines/reference/awaitBinaryExpression2_es2017.symbols +++ b/tests/baselines/reference/awaitBinaryExpression2_es2017.symbols @@ -4,7 +4,7 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitBinaryExpression2_es2017.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) declare function before(): void; >before : Symbol(before, Decl(awaitBinaryExpression2_es2017.ts, 1, 32)) @@ -14,7 +14,7 @@ declare function after(): void; async function func(): Promise { >func : Symbol(func, Decl(awaitBinaryExpression2_es2017.ts, 3, 31)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) before(); >before : Symbol(before, Decl(awaitBinaryExpression2_es2017.ts, 1, 32)) diff --git a/tests/baselines/reference/awaitBinaryExpression2_es6.symbols b/tests/baselines/reference/awaitBinaryExpression2_es6.symbols index e2b724e2c2d..52fa3178d8a 100644 --- a/tests/baselines/reference/awaitBinaryExpression2_es6.symbols +++ b/tests/baselines/reference/awaitBinaryExpression2_es6.symbols @@ -4,7 +4,7 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitBinaryExpression2_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) declare function before(): void; >before : Symbol(before, Decl(awaitBinaryExpression2_es6.ts, 1, 32)) @@ -14,7 +14,7 @@ declare function after(): void; async function func(): Promise { >func : Symbol(func, Decl(awaitBinaryExpression2_es6.ts, 3, 31)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) before(); >before : Symbol(before, Decl(awaitBinaryExpression2_es6.ts, 1, 32)) diff --git a/tests/baselines/reference/awaitBinaryExpression3_es2017.symbols b/tests/baselines/reference/awaitBinaryExpression3_es2017.symbols index 1d7e1ff74a0..7270c58eb85 100644 --- a/tests/baselines/reference/awaitBinaryExpression3_es2017.symbols +++ b/tests/baselines/reference/awaitBinaryExpression3_es2017.symbols @@ -4,7 +4,7 @@ declare var a: number; declare var p: Promise; >p : Symbol(p, Decl(awaitBinaryExpression3_es2017.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) declare function before(): void; >before : Symbol(before, Decl(awaitBinaryExpression3_es2017.ts, 1, 31)) @@ -14,7 +14,7 @@ declare function after(): void; async function func(): Promise { >func : Symbol(func, Decl(awaitBinaryExpression3_es2017.ts, 3, 31)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) before(); >before : Symbol(before, Decl(awaitBinaryExpression3_es2017.ts, 1, 31)) diff --git a/tests/baselines/reference/awaitBinaryExpression3_es6.symbols b/tests/baselines/reference/awaitBinaryExpression3_es6.symbols index afd2ae97641..db67f41e3a4 100644 --- a/tests/baselines/reference/awaitBinaryExpression3_es6.symbols +++ b/tests/baselines/reference/awaitBinaryExpression3_es6.symbols @@ -4,7 +4,7 @@ declare var a: number; declare var p: Promise; >p : Symbol(p, Decl(awaitBinaryExpression3_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) declare function before(): void; >before : Symbol(before, Decl(awaitBinaryExpression3_es6.ts, 1, 31)) @@ -14,7 +14,7 @@ declare function after(): void; async function func(): Promise { >func : Symbol(func, Decl(awaitBinaryExpression3_es6.ts, 3, 31)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) before(); >before : Symbol(before, Decl(awaitBinaryExpression3_es6.ts, 1, 31)) diff --git a/tests/baselines/reference/awaitBinaryExpression4_es2017.symbols b/tests/baselines/reference/awaitBinaryExpression4_es2017.symbols index cf01d5ec858..b878df08349 100644 --- a/tests/baselines/reference/awaitBinaryExpression4_es2017.symbols +++ b/tests/baselines/reference/awaitBinaryExpression4_es2017.symbols @@ -4,7 +4,7 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitBinaryExpression4_es2017.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) declare function before(): void; >before : Symbol(before, Decl(awaitBinaryExpression4_es2017.ts, 1, 32)) @@ -14,7 +14,7 @@ declare function after(): void; async function func(): Promise { >func : Symbol(func, Decl(awaitBinaryExpression4_es2017.ts, 3, 31)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) before(); >before : Symbol(before, Decl(awaitBinaryExpression4_es2017.ts, 1, 32)) diff --git a/tests/baselines/reference/awaitBinaryExpression4_es6.symbols b/tests/baselines/reference/awaitBinaryExpression4_es6.symbols index 61e12001c6a..3f16bd0ca6f 100644 --- a/tests/baselines/reference/awaitBinaryExpression4_es6.symbols +++ b/tests/baselines/reference/awaitBinaryExpression4_es6.symbols @@ -4,7 +4,7 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitBinaryExpression4_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) declare function before(): void; >before : Symbol(before, Decl(awaitBinaryExpression4_es6.ts, 1, 32)) @@ -14,7 +14,7 @@ declare function after(): void; async function func(): Promise { >func : Symbol(func, Decl(awaitBinaryExpression4_es6.ts, 3, 31)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) before(); >before : Symbol(before, Decl(awaitBinaryExpression4_es6.ts, 1, 32)) diff --git a/tests/baselines/reference/awaitBinaryExpression5_es2017.symbols b/tests/baselines/reference/awaitBinaryExpression5_es2017.symbols index 4b684c44f77..d22cd1c129b 100644 --- a/tests/baselines/reference/awaitBinaryExpression5_es2017.symbols +++ b/tests/baselines/reference/awaitBinaryExpression5_es2017.symbols @@ -4,7 +4,7 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitBinaryExpression5_es2017.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) declare function before(): void; >before : Symbol(before, Decl(awaitBinaryExpression5_es2017.ts, 1, 32)) @@ -14,7 +14,7 @@ declare function after(): void; async function func(): Promise { >func : Symbol(func, Decl(awaitBinaryExpression5_es2017.ts, 3, 31)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) before(); >before : Symbol(before, Decl(awaitBinaryExpression5_es2017.ts, 1, 32)) diff --git a/tests/baselines/reference/awaitBinaryExpression5_es6.symbols b/tests/baselines/reference/awaitBinaryExpression5_es6.symbols index fb50640ce7c..2182062def1 100644 --- a/tests/baselines/reference/awaitBinaryExpression5_es6.symbols +++ b/tests/baselines/reference/awaitBinaryExpression5_es6.symbols @@ -4,7 +4,7 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitBinaryExpression5_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) declare function before(): void; >before : Symbol(before, Decl(awaitBinaryExpression5_es6.ts, 1, 32)) @@ -14,7 +14,7 @@ declare function after(): void; async function func(): Promise { >func : Symbol(func, Decl(awaitBinaryExpression5_es6.ts, 3, 31)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) before(); >before : Symbol(before, Decl(awaitBinaryExpression5_es6.ts, 1, 32)) diff --git a/tests/baselines/reference/awaitCallExpression1_es2017.symbols b/tests/baselines/reference/awaitCallExpression1_es2017.symbols index 373654dd11a..dd057bb3f77 100644 --- a/tests/baselines/reference/awaitCallExpression1_es2017.symbols +++ b/tests/baselines/reference/awaitCallExpression1_es2017.symbols @@ -4,7 +4,7 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitCallExpression1_es2017.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; >fn : Symbol(fn, Decl(awaitCallExpression1_es2017.ts, 1, 32)) @@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >pfn : Symbol(pfn, Decl(awaitCallExpression1_es2017.ts, 4, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >arg0 : Symbol(arg0, Decl(awaitCallExpression1_es2017.ts, 4, 28)) >arg1 : Symbol(arg1, Decl(awaitCallExpression1_es2017.ts, 4, 42)) >arg2 : Symbol(arg2, Decl(awaitCallExpression1_es2017.ts, 4, 57)) declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >po : Symbol(po, Decl(awaitCallExpression1_es2017.ts, 5, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >fn : Symbol(fn, Decl(awaitCallExpression1_es2017.ts, 5, 25)) >arg0 : Symbol(arg0, Decl(awaitCallExpression1_es2017.ts, 5, 29)) >arg1 : Symbol(arg1, Decl(awaitCallExpression1_es2017.ts, 5, 43)) @@ -42,7 +42,7 @@ declare function after(): void; async function func(): Promise { >func : Symbol(func, Decl(awaitCallExpression1_es2017.ts, 7, 31)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) before(); >before : Symbol(before, Decl(awaitCallExpression1_es2017.ts, 5, 84)) diff --git a/tests/baselines/reference/awaitCallExpression1_es6.symbols b/tests/baselines/reference/awaitCallExpression1_es6.symbols index a81586bc4fe..8f08901eee7 100644 --- a/tests/baselines/reference/awaitCallExpression1_es6.symbols +++ b/tests/baselines/reference/awaitCallExpression1_es6.symbols @@ -4,7 +4,7 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitCallExpression1_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; >fn : Symbol(fn, Decl(awaitCallExpression1_es6.ts, 1, 32)) @@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >pfn : Symbol(pfn, Decl(awaitCallExpression1_es6.ts, 4, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >arg0 : Symbol(arg0, Decl(awaitCallExpression1_es6.ts, 4, 28)) >arg1 : Symbol(arg1, Decl(awaitCallExpression1_es6.ts, 4, 42)) >arg2 : Symbol(arg2, Decl(awaitCallExpression1_es6.ts, 4, 57)) declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >po : Symbol(po, Decl(awaitCallExpression1_es6.ts, 5, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >fn : Symbol(fn, Decl(awaitCallExpression1_es6.ts, 5, 25)) >arg0 : Symbol(arg0, Decl(awaitCallExpression1_es6.ts, 5, 29)) >arg1 : Symbol(arg1, Decl(awaitCallExpression1_es6.ts, 5, 43)) @@ -42,7 +42,7 @@ declare function after(): void; async function func(): Promise { >func : Symbol(func, Decl(awaitCallExpression1_es6.ts, 7, 31)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) before(); >before : Symbol(before, Decl(awaitCallExpression1_es6.ts, 5, 84)) diff --git a/tests/baselines/reference/awaitCallExpression2_es2017.symbols b/tests/baselines/reference/awaitCallExpression2_es2017.symbols index 6bf77f40d19..a820355cad1 100644 --- a/tests/baselines/reference/awaitCallExpression2_es2017.symbols +++ b/tests/baselines/reference/awaitCallExpression2_es2017.symbols @@ -4,7 +4,7 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitCallExpression2_es2017.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; >fn : Symbol(fn, Decl(awaitCallExpression2_es2017.ts, 1, 32)) @@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >pfn : Symbol(pfn, Decl(awaitCallExpression2_es2017.ts, 4, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >arg0 : Symbol(arg0, Decl(awaitCallExpression2_es2017.ts, 4, 28)) >arg1 : Symbol(arg1, Decl(awaitCallExpression2_es2017.ts, 4, 42)) >arg2 : Symbol(arg2, Decl(awaitCallExpression2_es2017.ts, 4, 57)) declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >po : Symbol(po, Decl(awaitCallExpression2_es2017.ts, 5, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >fn : Symbol(fn, Decl(awaitCallExpression2_es2017.ts, 5, 25)) >arg0 : Symbol(arg0, Decl(awaitCallExpression2_es2017.ts, 5, 29)) >arg1 : Symbol(arg1, Decl(awaitCallExpression2_es2017.ts, 5, 43)) @@ -42,7 +42,7 @@ declare function after(): void; async function func(): Promise { >func : Symbol(func, Decl(awaitCallExpression2_es2017.ts, 7, 31)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) before(); >before : Symbol(before, Decl(awaitCallExpression2_es2017.ts, 5, 84)) diff --git a/tests/baselines/reference/awaitCallExpression2_es6.symbols b/tests/baselines/reference/awaitCallExpression2_es6.symbols index 91de39742dc..335af879cd2 100644 --- a/tests/baselines/reference/awaitCallExpression2_es6.symbols +++ b/tests/baselines/reference/awaitCallExpression2_es6.symbols @@ -4,7 +4,7 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitCallExpression2_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; >fn : Symbol(fn, Decl(awaitCallExpression2_es6.ts, 1, 32)) @@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >pfn : Symbol(pfn, Decl(awaitCallExpression2_es6.ts, 4, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >arg0 : Symbol(arg0, Decl(awaitCallExpression2_es6.ts, 4, 28)) >arg1 : Symbol(arg1, Decl(awaitCallExpression2_es6.ts, 4, 42)) >arg2 : Symbol(arg2, Decl(awaitCallExpression2_es6.ts, 4, 57)) declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >po : Symbol(po, Decl(awaitCallExpression2_es6.ts, 5, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >fn : Symbol(fn, Decl(awaitCallExpression2_es6.ts, 5, 25)) >arg0 : Symbol(arg0, Decl(awaitCallExpression2_es6.ts, 5, 29)) >arg1 : Symbol(arg1, Decl(awaitCallExpression2_es6.ts, 5, 43)) @@ -42,7 +42,7 @@ declare function after(): void; async function func(): Promise { >func : Symbol(func, Decl(awaitCallExpression2_es6.ts, 7, 31)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) before(); >before : Symbol(before, Decl(awaitCallExpression2_es6.ts, 5, 84)) diff --git a/tests/baselines/reference/awaitCallExpression3_es2017.symbols b/tests/baselines/reference/awaitCallExpression3_es2017.symbols index f42254489ce..446bff9b558 100644 --- a/tests/baselines/reference/awaitCallExpression3_es2017.symbols +++ b/tests/baselines/reference/awaitCallExpression3_es2017.symbols @@ -4,7 +4,7 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitCallExpression3_es2017.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; >fn : Symbol(fn, Decl(awaitCallExpression3_es2017.ts, 1, 32)) @@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >pfn : Symbol(pfn, Decl(awaitCallExpression3_es2017.ts, 4, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >arg0 : Symbol(arg0, Decl(awaitCallExpression3_es2017.ts, 4, 28)) >arg1 : Symbol(arg1, Decl(awaitCallExpression3_es2017.ts, 4, 42)) >arg2 : Symbol(arg2, Decl(awaitCallExpression3_es2017.ts, 4, 57)) declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >po : Symbol(po, Decl(awaitCallExpression3_es2017.ts, 5, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >fn : Symbol(fn, Decl(awaitCallExpression3_es2017.ts, 5, 25)) >arg0 : Symbol(arg0, Decl(awaitCallExpression3_es2017.ts, 5, 29)) >arg1 : Symbol(arg1, Decl(awaitCallExpression3_es2017.ts, 5, 43)) @@ -42,7 +42,7 @@ declare function after(): void; async function func(): Promise { >func : Symbol(func, Decl(awaitCallExpression3_es2017.ts, 7, 31)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) before(); >before : Symbol(before, Decl(awaitCallExpression3_es2017.ts, 5, 84)) diff --git a/tests/baselines/reference/awaitCallExpression3_es6.symbols b/tests/baselines/reference/awaitCallExpression3_es6.symbols index 6b559d847d9..7e28ec765ba 100644 --- a/tests/baselines/reference/awaitCallExpression3_es6.symbols +++ b/tests/baselines/reference/awaitCallExpression3_es6.symbols @@ -4,7 +4,7 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitCallExpression3_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; >fn : Symbol(fn, Decl(awaitCallExpression3_es6.ts, 1, 32)) @@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >pfn : Symbol(pfn, Decl(awaitCallExpression3_es6.ts, 4, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >arg0 : Symbol(arg0, Decl(awaitCallExpression3_es6.ts, 4, 28)) >arg1 : Symbol(arg1, Decl(awaitCallExpression3_es6.ts, 4, 42)) >arg2 : Symbol(arg2, Decl(awaitCallExpression3_es6.ts, 4, 57)) declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >po : Symbol(po, Decl(awaitCallExpression3_es6.ts, 5, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >fn : Symbol(fn, Decl(awaitCallExpression3_es6.ts, 5, 25)) >arg0 : Symbol(arg0, Decl(awaitCallExpression3_es6.ts, 5, 29)) >arg1 : Symbol(arg1, Decl(awaitCallExpression3_es6.ts, 5, 43)) @@ -42,7 +42,7 @@ declare function after(): void; async function func(): Promise { >func : Symbol(func, Decl(awaitCallExpression3_es6.ts, 7, 31)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) before(); >before : Symbol(before, Decl(awaitCallExpression3_es6.ts, 5, 84)) diff --git a/tests/baselines/reference/awaitCallExpression4_es2017.symbols b/tests/baselines/reference/awaitCallExpression4_es2017.symbols index 60fc9f643f9..f1be8514132 100644 --- a/tests/baselines/reference/awaitCallExpression4_es2017.symbols +++ b/tests/baselines/reference/awaitCallExpression4_es2017.symbols @@ -4,7 +4,7 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitCallExpression4_es2017.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; >fn : Symbol(fn, Decl(awaitCallExpression4_es2017.ts, 1, 32)) @@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >pfn : Symbol(pfn, Decl(awaitCallExpression4_es2017.ts, 4, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >arg0 : Symbol(arg0, Decl(awaitCallExpression4_es2017.ts, 4, 28)) >arg1 : Symbol(arg1, Decl(awaitCallExpression4_es2017.ts, 4, 42)) >arg2 : Symbol(arg2, Decl(awaitCallExpression4_es2017.ts, 4, 57)) declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >po : Symbol(po, Decl(awaitCallExpression4_es2017.ts, 5, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >fn : Symbol(fn, Decl(awaitCallExpression4_es2017.ts, 5, 25)) >arg0 : Symbol(arg0, Decl(awaitCallExpression4_es2017.ts, 5, 29)) >arg1 : Symbol(arg1, Decl(awaitCallExpression4_es2017.ts, 5, 43)) @@ -42,7 +42,7 @@ declare function after(): void; async function func(): Promise { >func : Symbol(func, Decl(awaitCallExpression4_es2017.ts, 7, 31)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) before(); >before : Symbol(before, Decl(awaitCallExpression4_es2017.ts, 5, 84)) diff --git a/tests/baselines/reference/awaitCallExpression4_es6.symbols b/tests/baselines/reference/awaitCallExpression4_es6.symbols index 33117d2d80b..efc2c9275b6 100644 --- a/tests/baselines/reference/awaitCallExpression4_es6.symbols +++ b/tests/baselines/reference/awaitCallExpression4_es6.symbols @@ -4,7 +4,7 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitCallExpression4_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; >fn : Symbol(fn, Decl(awaitCallExpression4_es6.ts, 1, 32)) @@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >pfn : Symbol(pfn, Decl(awaitCallExpression4_es6.ts, 4, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >arg0 : Symbol(arg0, Decl(awaitCallExpression4_es6.ts, 4, 28)) >arg1 : Symbol(arg1, Decl(awaitCallExpression4_es6.ts, 4, 42)) >arg2 : Symbol(arg2, Decl(awaitCallExpression4_es6.ts, 4, 57)) declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >po : Symbol(po, Decl(awaitCallExpression4_es6.ts, 5, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >fn : Symbol(fn, Decl(awaitCallExpression4_es6.ts, 5, 25)) >arg0 : Symbol(arg0, Decl(awaitCallExpression4_es6.ts, 5, 29)) >arg1 : Symbol(arg1, Decl(awaitCallExpression4_es6.ts, 5, 43)) @@ -42,7 +42,7 @@ declare function after(): void; async function func(): Promise { >func : Symbol(func, Decl(awaitCallExpression4_es6.ts, 7, 31)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) before(); >before : Symbol(before, Decl(awaitCallExpression4_es6.ts, 5, 84)) diff --git a/tests/baselines/reference/awaitCallExpression5_es2017.symbols b/tests/baselines/reference/awaitCallExpression5_es2017.symbols index ffad2bda5a6..2f9889f82fd 100644 --- a/tests/baselines/reference/awaitCallExpression5_es2017.symbols +++ b/tests/baselines/reference/awaitCallExpression5_es2017.symbols @@ -4,7 +4,7 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitCallExpression5_es2017.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; >fn : Symbol(fn, Decl(awaitCallExpression5_es2017.ts, 1, 32)) @@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >pfn : Symbol(pfn, Decl(awaitCallExpression5_es2017.ts, 4, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >arg0 : Symbol(arg0, Decl(awaitCallExpression5_es2017.ts, 4, 28)) >arg1 : Symbol(arg1, Decl(awaitCallExpression5_es2017.ts, 4, 42)) >arg2 : Symbol(arg2, Decl(awaitCallExpression5_es2017.ts, 4, 57)) declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >po : Symbol(po, Decl(awaitCallExpression5_es2017.ts, 5, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >fn : Symbol(fn, Decl(awaitCallExpression5_es2017.ts, 5, 25)) >arg0 : Symbol(arg0, Decl(awaitCallExpression5_es2017.ts, 5, 29)) >arg1 : Symbol(arg1, Decl(awaitCallExpression5_es2017.ts, 5, 43)) @@ -42,7 +42,7 @@ declare function after(): void; async function func(): Promise { >func : Symbol(func, Decl(awaitCallExpression5_es2017.ts, 7, 31)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) before(); >before : Symbol(before, Decl(awaitCallExpression5_es2017.ts, 5, 84)) diff --git a/tests/baselines/reference/awaitCallExpression5_es6.symbols b/tests/baselines/reference/awaitCallExpression5_es6.symbols index cf6afde09ed..2861eeb1333 100644 --- a/tests/baselines/reference/awaitCallExpression5_es6.symbols +++ b/tests/baselines/reference/awaitCallExpression5_es6.symbols @@ -4,7 +4,7 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitCallExpression5_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; >fn : Symbol(fn, Decl(awaitCallExpression5_es6.ts, 1, 32)) @@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >pfn : Symbol(pfn, Decl(awaitCallExpression5_es6.ts, 4, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >arg0 : Symbol(arg0, Decl(awaitCallExpression5_es6.ts, 4, 28)) >arg1 : Symbol(arg1, Decl(awaitCallExpression5_es6.ts, 4, 42)) >arg2 : Symbol(arg2, Decl(awaitCallExpression5_es6.ts, 4, 57)) declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >po : Symbol(po, Decl(awaitCallExpression5_es6.ts, 5, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >fn : Symbol(fn, Decl(awaitCallExpression5_es6.ts, 5, 25)) >arg0 : Symbol(arg0, Decl(awaitCallExpression5_es6.ts, 5, 29)) >arg1 : Symbol(arg1, Decl(awaitCallExpression5_es6.ts, 5, 43)) @@ -42,7 +42,7 @@ declare function after(): void; async function func(): Promise { >func : Symbol(func, Decl(awaitCallExpression5_es6.ts, 7, 31)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) before(); >before : Symbol(before, Decl(awaitCallExpression5_es6.ts, 5, 84)) diff --git a/tests/baselines/reference/awaitCallExpression6_es2017.symbols b/tests/baselines/reference/awaitCallExpression6_es2017.symbols index f540e418f4a..81f5f4f685e 100644 --- a/tests/baselines/reference/awaitCallExpression6_es2017.symbols +++ b/tests/baselines/reference/awaitCallExpression6_es2017.symbols @@ -4,7 +4,7 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitCallExpression6_es2017.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; >fn : Symbol(fn, Decl(awaitCallExpression6_es2017.ts, 1, 32)) @@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >pfn : Symbol(pfn, Decl(awaitCallExpression6_es2017.ts, 4, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >arg0 : Symbol(arg0, Decl(awaitCallExpression6_es2017.ts, 4, 28)) >arg1 : Symbol(arg1, Decl(awaitCallExpression6_es2017.ts, 4, 42)) >arg2 : Symbol(arg2, Decl(awaitCallExpression6_es2017.ts, 4, 57)) declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >po : Symbol(po, Decl(awaitCallExpression6_es2017.ts, 5, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >fn : Symbol(fn, Decl(awaitCallExpression6_es2017.ts, 5, 25)) >arg0 : Symbol(arg0, Decl(awaitCallExpression6_es2017.ts, 5, 29)) >arg1 : Symbol(arg1, Decl(awaitCallExpression6_es2017.ts, 5, 43)) @@ -42,7 +42,7 @@ declare function after(): void; async function func(): Promise { >func : Symbol(func, Decl(awaitCallExpression6_es2017.ts, 7, 31)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) before(); >before : Symbol(before, Decl(awaitCallExpression6_es2017.ts, 5, 84)) diff --git a/tests/baselines/reference/awaitCallExpression6_es6.symbols b/tests/baselines/reference/awaitCallExpression6_es6.symbols index 35feb7c8ea0..dc7c711e900 100644 --- a/tests/baselines/reference/awaitCallExpression6_es6.symbols +++ b/tests/baselines/reference/awaitCallExpression6_es6.symbols @@ -4,7 +4,7 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitCallExpression6_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; >fn : Symbol(fn, Decl(awaitCallExpression6_es6.ts, 1, 32)) @@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >pfn : Symbol(pfn, Decl(awaitCallExpression6_es6.ts, 4, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >arg0 : Symbol(arg0, Decl(awaitCallExpression6_es6.ts, 4, 28)) >arg1 : Symbol(arg1, Decl(awaitCallExpression6_es6.ts, 4, 42)) >arg2 : Symbol(arg2, Decl(awaitCallExpression6_es6.ts, 4, 57)) declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >po : Symbol(po, Decl(awaitCallExpression6_es6.ts, 5, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >fn : Symbol(fn, Decl(awaitCallExpression6_es6.ts, 5, 25)) >arg0 : Symbol(arg0, Decl(awaitCallExpression6_es6.ts, 5, 29)) >arg1 : Symbol(arg1, Decl(awaitCallExpression6_es6.ts, 5, 43)) @@ -42,7 +42,7 @@ declare function after(): void; async function func(): Promise { >func : Symbol(func, Decl(awaitCallExpression6_es6.ts, 7, 31)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) before(); >before : Symbol(before, Decl(awaitCallExpression6_es6.ts, 5, 84)) diff --git a/tests/baselines/reference/awaitCallExpression7_es2017.symbols b/tests/baselines/reference/awaitCallExpression7_es2017.symbols index 525af853729..b30b9ae9711 100644 --- a/tests/baselines/reference/awaitCallExpression7_es2017.symbols +++ b/tests/baselines/reference/awaitCallExpression7_es2017.symbols @@ -4,7 +4,7 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitCallExpression7_es2017.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; >fn : Symbol(fn, Decl(awaitCallExpression7_es2017.ts, 1, 32)) @@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >pfn : Symbol(pfn, Decl(awaitCallExpression7_es2017.ts, 4, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >arg0 : Symbol(arg0, Decl(awaitCallExpression7_es2017.ts, 4, 28)) >arg1 : Symbol(arg1, Decl(awaitCallExpression7_es2017.ts, 4, 42)) >arg2 : Symbol(arg2, Decl(awaitCallExpression7_es2017.ts, 4, 57)) declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >po : Symbol(po, Decl(awaitCallExpression7_es2017.ts, 5, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >fn : Symbol(fn, Decl(awaitCallExpression7_es2017.ts, 5, 25)) >arg0 : Symbol(arg0, Decl(awaitCallExpression7_es2017.ts, 5, 29)) >arg1 : Symbol(arg1, Decl(awaitCallExpression7_es2017.ts, 5, 43)) @@ -42,7 +42,7 @@ declare function after(): void; async function func(): Promise { >func : Symbol(func, Decl(awaitCallExpression7_es2017.ts, 7, 31)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) before(); >before : Symbol(before, Decl(awaitCallExpression7_es2017.ts, 5, 84)) diff --git a/tests/baselines/reference/awaitCallExpression7_es6.symbols b/tests/baselines/reference/awaitCallExpression7_es6.symbols index fe6c1fb0eeb..17d143e5312 100644 --- a/tests/baselines/reference/awaitCallExpression7_es6.symbols +++ b/tests/baselines/reference/awaitCallExpression7_es6.symbols @@ -4,7 +4,7 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitCallExpression7_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; >fn : Symbol(fn, Decl(awaitCallExpression7_es6.ts, 1, 32)) @@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >pfn : Symbol(pfn, Decl(awaitCallExpression7_es6.ts, 4, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >arg0 : Symbol(arg0, Decl(awaitCallExpression7_es6.ts, 4, 28)) >arg1 : Symbol(arg1, Decl(awaitCallExpression7_es6.ts, 4, 42)) >arg2 : Symbol(arg2, Decl(awaitCallExpression7_es6.ts, 4, 57)) declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >po : Symbol(po, Decl(awaitCallExpression7_es6.ts, 5, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >fn : Symbol(fn, Decl(awaitCallExpression7_es6.ts, 5, 25)) >arg0 : Symbol(arg0, Decl(awaitCallExpression7_es6.ts, 5, 29)) >arg1 : Symbol(arg1, Decl(awaitCallExpression7_es6.ts, 5, 43)) @@ -42,7 +42,7 @@ declare function after(): void; async function func(): Promise { >func : Symbol(func, Decl(awaitCallExpression7_es6.ts, 7, 31)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) before(); >before : Symbol(before, Decl(awaitCallExpression7_es6.ts, 5, 84)) diff --git a/tests/baselines/reference/awaitCallExpression8_es2017.symbols b/tests/baselines/reference/awaitCallExpression8_es2017.symbols index 53ba162671d..42e41b65e2a 100644 --- a/tests/baselines/reference/awaitCallExpression8_es2017.symbols +++ b/tests/baselines/reference/awaitCallExpression8_es2017.symbols @@ -4,7 +4,7 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitCallExpression8_es2017.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; >fn : Symbol(fn, Decl(awaitCallExpression8_es2017.ts, 1, 32)) @@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >pfn : Symbol(pfn, Decl(awaitCallExpression8_es2017.ts, 4, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >arg0 : Symbol(arg0, Decl(awaitCallExpression8_es2017.ts, 4, 28)) >arg1 : Symbol(arg1, Decl(awaitCallExpression8_es2017.ts, 4, 42)) >arg2 : Symbol(arg2, Decl(awaitCallExpression8_es2017.ts, 4, 57)) declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >po : Symbol(po, Decl(awaitCallExpression8_es2017.ts, 5, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >fn : Symbol(fn, Decl(awaitCallExpression8_es2017.ts, 5, 25)) >arg0 : Symbol(arg0, Decl(awaitCallExpression8_es2017.ts, 5, 29)) >arg1 : Symbol(arg1, Decl(awaitCallExpression8_es2017.ts, 5, 43)) @@ -42,7 +42,7 @@ declare function after(): void; async function func(): Promise { >func : Symbol(func, Decl(awaitCallExpression8_es2017.ts, 7, 31)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) before(); >before : Symbol(before, Decl(awaitCallExpression8_es2017.ts, 5, 84)) diff --git a/tests/baselines/reference/awaitCallExpression8_es6.symbols b/tests/baselines/reference/awaitCallExpression8_es6.symbols index 037ab79b68f..1b98fc1f4de 100644 --- a/tests/baselines/reference/awaitCallExpression8_es6.symbols +++ b/tests/baselines/reference/awaitCallExpression8_es6.symbols @@ -4,7 +4,7 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitCallExpression8_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; >fn : Symbol(fn, Decl(awaitCallExpression8_es6.ts, 1, 32)) @@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >pfn : Symbol(pfn, Decl(awaitCallExpression8_es6.ts, 4, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >arg0 : Symbol(arg0, Decl(awaitCallExpression8_es6.ts, 4, 28)) >arg1 : Symbol(arg1, Decl(awaitCallExpression8_es6.ts, 4, 42)) >arg2 : Symbol(arg2, Decl(awaitCallExpression8_es6.ts, 4, 57)) declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >po : Symbol(po, Decl(awaitCallExpression8_es6.ts, 5, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >fn : Symbol(fn, Decl(awaitCallExpression8_es6.ts, 5, 25)) >arg0 : Symbol(arg0, Decl(awaitCallExpression8_es6.ts, 5, 29)) >arg1 : Symbol(arg1, Decl(awaitCallExpression8_es6.ts, 5, 43)) @@ -42,7 +42,7 @@ declare function after(): void; async function func(): Promise { >func : Symbol(func, Decl(awaitCallExpression8_es6.ts, 7, 31)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) before(); >before : Symbol(before, Decl(awaitCallExpression8_es6.ts, 5, 84)) diff --git a/tests/baselines/reference/awaitClassExpression_es2017.symbols b/tests/baselines/reference/awaitClassExpression_es2017.symbols index 1c497d80951..fbf0e971b07 100644 --- a/tests/baselines/reference/awaitClassExpression_es2017.symbols +++ b/tests/baselines/reference/awaitClassExpression_es2017.symbols @@ -4,12 +4,12 @@ declare class C { } declare var p: Promise; >p : Symbol(p, Decl(awaitClassExpression_es2017.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >C : Symbol(C, Decl(awaitClassExpression_es2017.ts, 0, 0)) async function func(): Promise { >func : Symbol(func, Decl(awaitClassExpression_es2017.ts, 1, 33)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) class D extends (await p) { >D : Symbol(D, Decl(awaitClassExpression_es2017.ts, 3, 38)) diff --git a/tests/baselines/reference/awaitClassExpression_es6.symbols b/tests/baselines/reference/awaitClassExpression_es6.symbols index b7c485e88c6..6162e121c81 100644 --- a/tests/baselines/reference/awaitClassExpression_es6.symbols +++ b/tests/baselines/reference/awaitClassExpression_es6.symbols @@ -4,12 +4,12 @@ declare class C { } declare var p: Promise; >p : Symbol(p, Decl(awaitClassExpression_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >C : Symbol(C, Decl(awaitClassExpression_es6.ts, 0, 0)) async function func(): Promise { >func : Symbol(func, Decl(awaitClassExpression_es6.ts, 1, 33)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) class D extends (await p) { >D : Symbol(D, Decl(awaitClassExpression_es6.ts, 3, 38)) diff --git a/tests/baselines/reference/awaitInheritedPromise_es2017.symbols b/tests/baselines/reference/awaitInheritedPromise_es2017.symbols index f4cf33bfe83..8779d6068b2 100644 --- a/tests/baselines/reference/awaitInheritedPromise_es2017.symbols +++ b/tests/baselines/reference/awaitInheritedPromise_es2017.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/async/es2017/awaitInheritedPromise_es2017.ts === interface A extends Promise {} >A : Symbol(A, Decl(awaitInheritedPromise_es2017.ts, 0, 0)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) declare var a: A; >a : Symbol(a, Decl(awaitInheritedPromise_es2017.ts, 1, 11)) diff --git a/tests/baselines/reference/controlFlowInstanceof.symbols b/tests/baselines/reference/controlFlowInstanceof.symbols index 299bacbb8fe..f61f6b58616 100644 --- a/tests/baselines/reference/controlFlowInstanceof.symbols +++ b/tests/baselines/reference/controlFlowInstanceof.symbols @@ -45,7 +45,7 @@ function f2(s: Set | Set) { if (s instanceof Promise) { >s : Symbol(s, Decl(controlFlowInstanceof.ts, 12, 12)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) s; // Set & Promise >s : Symbol(s, Decl(controlFlowInstanceof.ts, 12, 12)) diff --git a/tests/baselines/reference/decoratorMetadataPromise.symbols b/tests/baselines/reference/decoratorMetadataPromise.symbols index ae929a4e342..4ec97538aa5 100644 --- a/tests/baselines/reference/decoratorMetadataPromise.symbols +++ b/tests/baselines/reference/decoratorMetadataPromise.symbols @@ -17,7 +17,7 @@ class A { async bar(): Promise { return 0; } >bar : Symbol(A.bar, Decl(decoratorMetadataPromise.ts, 4, 18)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) @decorator >decorator : Symbol(decorator, Decl(decoratorMetadataPromise.ts, 0, 13)) @@ -25,8 +25,8 @@ class A { baz(n: Promise): Promise { return n; } >baz : Symbol(A.baz, Decl(decoratorMetadataPromise.ts, 6, 46)) >n : Symbol(n, Decl(decoratorMetadataPromise.ts, 8, 8)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >n : Symbol(n, Decl(decoratorMetadataPromise.ts, 8, 8)) } diff --git a/tests/baselines/reference/defaultExportInAwaitExpression01.symbols b/tests/baselines/reference/defaultExportInAwaitExpression01.symbols index 9b77ee1a68b..2741f624cff 100644 --- a/tests/baselines/reference/defaultExportInAwaitExpression01.symbols +++ b/tests/baselines/reference/defaultExportInAwaitExpression01.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/modules/a.ts === const x = new Promise( ( resolve, reject ) => { resolve( {} ); } ); >x : Symbol(x, Decl(a.ts, 0, 5)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(resolve, Decl(a.ts, 0, 24)) >reject : Symbol(reject, Decl(a.ts, 0, 33)) >resolve : Symbol(resolve, Decl(a.ts, 0, 24)) diff --git a/tests/baselines/reference/defaultExportInAwaitExpression02.symbols b/tests/baselines/reference/defaultExportInAwaitExpression02.symbols index 9b77ee1a68b..2741f624cff 100644 --- a/tests/baselines/reference/defaultExportInAwaitExpression02.symbols +++ b/tests/baselines/reference/defaultExportInAwaitExpression02.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/modules/a.ts === const x = new Promise( ( resolve, reject ) => { resolve( {} ); } ); >x : Symbol(x, Decl(a.ts, 0, 5)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(resolve, Decl(a.ts, 0, 24)) >reject : Symbol(reject, Decl(a.ts, 0, 33)) >resolve : Symbol(resolve, Decl(a.ts, 0, 24)) diff --git a/tests/baselines/reference/es2017basicAsync.symbols b/tests/baselines/reference/es2017basicAsync.symbols index f1957cd94e5..673ea4438fb 100644 --- a/tests/baselines/reference/es2017basicAsync.symbols +++ b/tests/baselines/reference/es2017basicAsync.symbols @@ -1,6 +1,6 @@ === tests/cases/compiler/es2017basicAsync.ts === async (): Promise => { ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) await 0; } @@ -13,7 +13,7 @@ async function asyncFunc() { const asyncArrowFunc = async (): Promise => { >asyncArrowFunc : Symbol(asyncArrowFunc, Decl(es2017basicAsync.ts, 8, 5)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) await 0; } @@ -24,20 +24,20 @@ async function asyncIIFE() { await 0; await (async function(): Promise { ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) await 1; })(); await (async function asyncNamedFunc(): Promise { >asyncNamedFunc : Symbol(asyncNamedFunc, Decl(es2017basicAsync.ts, 19, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) await 1; })(); await (async (): Promise => { ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) await 1; })(); @@ -48,7 +48,7 @@ class AsyncClass { asyncPropFunc = async function(): Promise { >asyncPropFunc : Symbol(AsyncClass.asyncPropFunc, Decl(es2017basicAsync.ts, 28, 18)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) await 2; } @@ -56,21 +56,21 @@ class AsyncClass { asyncPropNamedFunc = async function namedFunc(): Promise { >asyncPropNamedFunc : Symbol(AsyncClass.asyncPropNamedFunc, Decl(es2017basicAsync.ts, 31, 5)) >namedFunc : Symbol(namedFunc, Decl(es2017basicAsync.ts, 33, 24)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) await 2; } asyncPropArrowFunc = async (): Promise => { >asyncPropArrowFunc : Symbol(AsyncClass.asyncPropArrowFunc, Decl(es2017basicAsync.ts, 35, 5)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) await 2; } async asyncMethod(): Promise { >asyncMethod : Symbol(AsyncClass.asyncMethod, Decl(es2017basicAsync.ts, 39, 5)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) await 2; } diff --git a/tests/baselines/reference/exportDefaultAsyncFunction.symbols b/tests/baselines/reference/exportDefaultAsyncFunction.symbols index a86226fe678..3b65dbc0245 100644 --- a/tests/baselines/reference/exportDefaultAsyncFunction.symbols +++ b/tests/baselines/reference/exportDefaultAsyncFunction.symbols @@ -1,7 +1,7 @@ === tests/cases/compiler/exportDefaultAsyncFunction.ts === export default async function foo(): Promise {} >foo : Symbol(foo, Decl(exportDefaultAsyncFunction.ts, 0, 0)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) foo(); >foo : Symbol(foo, Decl(exportDefaultAsyncFunction.ts, 0, 0)) diff --git a/tests/baselines/reference/exportDefaultAsyncFunction2.symbols b/tests/baselines/reference/exportDefaultAsyncFunction2.symbols index 02b32f7ee28..9816f3120a1 100644 --- a/tests/baselines/reference/exportDefaultAsyncFunction2.symbols +++ b/tests/baselines/reference/exportDefaultAsyncFunction2.symbols @@ -17,7 +17,7 @@ export default async(() => await(Promise.resolve(1))); >async : Symbol(async, Decl(a.ts, 0, 8)) >await : Symbol(await, Decl(a.ts, 0, 15)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) === tests/cases/compiler/b.ts === diff --git a/tests/baselines/reference/importCallExpression2ESNext.symbols b/tests/baselines/reference/importCallExpression2ESNext.symbols index 9c0a8ebbbb4..bd2bf47f5c1 100644 --- a/tests/baselines/reference/importCallExpression2ESNext.symbols +++ b/tests/baselines/reference/importCallExpression2ESNext.symbols @@ -10,7 +10,7 @@ export class B { function foo(x: Promise) { >foo : Symbol(foo, Decl(2.ts, 0, 0)) >x : Symbol(x, Decl(2.ts, 0, 13)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) x.then(value => { >x.then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) diff --git a/tests/baselines/reference/importCallExpressionDeclarationEmit3.symbols b/tests/baselines/reference/importCallExpressionDeclarationEmit3.symbols index d3b10cbb320..d12a38fdc80 100644 --- a/tests/baselines/reference/importCallExpressionDeclarationEmit3.symbols +++ b/tests/baselines/reference/importCallExpressionDeclarationEmit3.symbols @@ -14,18 +14,18 @@ import("./0"); export var p0: Promise = import(getPath()); >p0 : Symbol(p0, Decl(1.ts, 4, 10)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Zero : Symbol(Zero, Decl(1.ts, 1, 6)) >getPath : Symbol(getPath, Decl(1.ts, 0, 0)) export var p1: Promise = import("./0"); >p1 : Symbol(p1, Decl(1.ts, 5, 10)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Zero : Symbol(Zero, Decl(1.ts, 1, 6)) >"./0" : Symbol(Zero, Decl(0.ts, 0, 0)) export var p2: Promise = import("./0"); >p2 : Symbol(p2, Decl(1.ts, 6, 10)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >"./0" : Symbol(Zero, Decl(0.ts, 0, 0)) diff --git a/tests/baselines/reference/importCallExpressionInAMD2.symbols b/tests/baselines/reference/importCallExpressionInAMD2.symbols index b4809afbf50..e44123a80f1 100644 --- a/tests/baselines/reference/importCallExpressionInAMD2.symbols +++ b/tests/baselines/reference/importCallExpressionInAMD2.symbols @@ -11,7 +11,7 @@ export class B { function foo(x: Promise) { >foo : Symbol(foo, Decl(2.ts, 0, 0)) >x : Symbol(x, Decl(2.ts, 1, 13)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) x.then(value => { >x.then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) diff --git a/tests/baselines/reference/importCallExpressionInCJS2.symbols b/tests/baselines/reference/importCallExpressionInCJS2.symbols index c60760c6184..5fff639c85b 100644 --- a/tests/baselines/reference/importCallExpressionInCJS2.symbols +++ b/tests/baselines/reference/importCallExpressionInCJS2.symbols @@ -10,7 +10,7 @@ export function backup() { return "backup"; } async function compute(promise: Promise) { >compute : Symbol(compute, Decl(2.ts, 0, 0)) >promise : Symbol(promise, Decl(2.ts, 0, 23)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) let j = await promise; >j : Symbol(j, Decl(2.ts, 1, 7)) diff --git a/tests/baselines/reference/importCallExpressionInCJS3.symbols b/tests/baselines/reference/importCallExpressionInCJS3.symbols index b4809afbf50..e44123a80f1 100644 --- a/tests/baselines/reference/importCallExpressionInCJS3.symbols +++ b/tests/baselines/reference/importCallExpressionInCJS3.symbols @@ -11,7 +11,7 @@ export class B { function foo(x: Promise) { >foo : Symbol(foo, Decl(2.ts, 0, 0)) >x : Symbol(x, Decl(2.ts, 1, 13)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) x.then(value => { >x.then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) diff --git a/tests/baselines/reference/importCallExpressionInSystem2.symbols b/tests/baselines/reference/importCallExpressionInSystem2.symbols index b4809afbf50..e44123a80f1 100644 --- a/tests/baselines/reference/importCallExpressionInSystem2.symbols +++ b/tests/baselines/reference/importCallExpressionInSystem2.symbols @@ -11,7 +11,7 @@ export class B { function foo(x: Promise) { >foo : Symbol(foo, Decl(2.ts, 0, 0)) >x : Symbol(x, Decl(2.ts, 1, 13)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) x.then(value => { >x.then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) diff --git a/tests/baselines/reference/importCallExpressionInUMD2.symbols b/tests/baselines/reference/importCallExpressionInUMD2.symbols index b4809afbf50..e44123a80f1 100644 --- a/tests/baselines/reference/importCallExpressionInUMD2.symbols +++ b/tests/baselines/reference/importCallExpressionInUMD2.symbols @@ -11,7 +11,7 @@ export class B { function foo(x: Promise) { >foo : Symbol(foo, Decl(2.ts, 0, 0)) >x : Symbol(x, Decl(2.ts, 1, 13)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) x.then(value => { >x.then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) diff --git a/tests/baselines/reference/importCallExpressionReturnPromiseOfAny.symbols b/tests/baselines/reference/importCallExpressionReturnPromiseOfAny.symbols index 0d46961475f..3cb4d99ad25 100644 --- a/tests/baselines/reference/importCallExpressionReturnPromiseOfAny.symbols +++ b/tests/baselines/reference/importCallExpressionReturnPromiseOfAny.symbols @@ -33,12 +33,12 @@ var p1 = import(ValidSomeCondition() ? "./0" : "externalModule"); var p1: Promise = import(getSpecifier()); >p1 : Symbol(p1, Decl(1.ts, 10, 3), Decl(1.ts, 11, 3)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >getSpecifier : Symbol(getSpecifier, Decl(1.ts, 0, 47)) var p11: Promise = import(getSpecifier()); >p11 : Symbol(p11, Decl(1.ts, 12, 3)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >defaultModule : Symbol(defaultModule, Decl(1.ts, 0, 6)) >getSpecifier : Symbol(getSpecifier, Decl(1.ts, 0, 47)) @@ -46,7 +46,7 @@ const p2 = import(whatToLoad ? getSpecifier() : "defaulPath") as Promisep2 : Symbol(p2, Decl(1.ts, 13, 5)) >whatToLoad : Symbol(whatToLoad, Decl(1.ts, 3, 11)) >getSpecifier : Symbol(getSpecifier, Decl(1.ts, 0, 47)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >defaultModule : Symbol(defaultModule, Decl(1.ts, 0, 6)) p1.then(zero => { @@ -65,7 +65,7 @@ let j: string; var p3: Promise = import(j=getSpecifier()); >p3 : Symbol(p3, Decl(1.ts, 19, 3)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >defaultModule : Symbol(defaultModule, Decl(1.ts, 0, 6)) >j : Symbol(j, Decl(1.ts, 18, 3)) >getSpecifier : Symbol(getSpecifier, Decl(1.ts, 0, 47)) diff --git a/tests/baselines/reference/inferenceLimit.symbols b/tests/baselines/reference/inferenceLimit.symbols index 70bbad69b3e..2a1ebc075fa 100644 --- a/tests/baselines/reference/inferenceLimit.symbols +++ b/tests/baselines/reference/inferenceLimit.symbols @@ -14,7 +14,7 @@ export class BrokenClass { >value : Symbol(value, Decl(file1.ts, 7, 36)) return new Promise>((resolve, reject) => { ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) >MyModule : Symbol(MyModule, Decl(file1.ts, 1, 6)) >MyModel : Symbol(MyModule.MyModel, Decl(mymodule.ts, 0, 0)) @@ -32,7 +32,7 @@ export class BrokenClass { >order : Symbol(order, Decl(file1.ts, 12, 25)) return new Promise((resolve, reject) => { ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(resolve, Decl(file1.ts, 13, 26)) >reject : Symbol(reject, Decl(file1.ts, 13, 34)) @@ -61,9 +61,9 @@ export class BrokenClass { return Promise.all(result.map(populateItems)) >Promise.all(result.map(populateItems)) .then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) ->Promise.all : Symbol(PromiseConstructor.all, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) ->all : Symbol(PromiseConstructor.all, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise.all : Symbol(PromiseConstructor.all, Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>all : Symbol(PromiseConstructor.all, Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >result.map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --)) >result : Symbol(result, Decl(file1.ts, 10, 7)) >map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --)) diff --git a/tests/baselines/reference/inferenceLimit.types b/tests/baselines/reference/inferenceLimit.types index 667d322f547..4a398932232 100644 --- a/tests/baselines/reference/inferenceLimit.types +++ b/tests/baselines/reference/inferenceLimit.types @@ -80,9 +80,9 @@ export class BrokenClass { >Promise.all(result.map(populateItems)) .then((orders: Array) => { resolve(orders); }) : Promise >Promise.all(result.map(populateItems)) .then : (onfulfilled?: (value: {}[]) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >Promise.all(result.map(populateItems)) : Promise<{}[]> ->Promise.all : { (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike, T10 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike]): Promise<[T1, T2, T3, T4, T5]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike]): Promise<[T1, T2, T3, T4]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise<[T1, T2, T3]>; (values: [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>; (values: (T | PromiseLike)[]): Promise; (values: Iterable>): Promise; } +>Promise.all : { (values: Iterable>): Promise; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike, T10 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike]): Promise<[T1, T2, T3, T4, T5]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike]): Promise<[T1, T2, T3, T4]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise<[T1, T2, T3]>; (values: [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>; (values: (T | PromiseLike)[]): Promise; } >Promise : PromiseConstructor ->all : { (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike, T10 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike]): Promise<[T1, T2, T3, T4, T5]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike]): Promise<[T1, T2, T3, T4]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise<[T1, T2, T3]>; (values: [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>; (values: (T | PromiseLike)[]): Promise; (values: Iterable>): Promise; } +>all : { (values: Iterable>): Promise; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike, T10 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike]): Promise<[T1, T2, T3, T4, T5]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike]): Promise<[T1, T2, T3, T4]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise<[T1, T2, T3]>; (values: [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>; (values: (T | PromiseLike)[]): Promise; } >result.map(populateItems) : Promise<{}>[] >result.map : (callbackfn: (value: MyModule.MyModel, index: number, array: MyModule.MyModel[]) => U, thisArg?: any) => U[] >result : MyModule.MyModel[] diff --git a/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions1.symbols b/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions1.symbols index 75728993569..52efbf5805d 100644 --- a/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions1.symbols +++ b/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions1.symbols @@ -111,7 +111,7 @@ async function out() { >out : Symbol(out, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 44, 37)) return new Promise(function (resolve, reject) {}); ->Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >resolve : Symbol(resolve, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 48, 33)) >reject : Symbol(reject, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 48, 41)) } diff --git a/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions2.symbols b/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions2.symbols index a98353eb077..4bdffff4f41 100644 --- a/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions2.symbols +++ b/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions2.symbols @@ -111,7 +111,7 @@ async function out() { >out : Symbol(out, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 44, 37)) return new Promise(function (resolve, reject) {}); ->Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >resolve : Symbol(resolve, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 48, 33)) >reject : Symbol(reject, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 48, 41)) } diff --git a/tests/baselines/reference/modularizeLibrary_TargetES5UsingES6Lib.symbols b/tests/baselines/reference/modularizeLibrary_TargetES5UsingES6Lib.symbols index c42e7a20374..fd9714416ff 100644 --- a/tests/baselines/reference/modularizeLibrary_TargetES5UsingES6Lib.symbols +++ b/tests/baselines/reference/modularizeLibrary_TargetES5UsingES6Lib.symbols @@ -111,7 +111,7 @@ async function out() { >out : Symbol(out, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 44, 37)) return new Promise(function (resolve, reject) {}); ->Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >resolve : Symbol(resolve, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 48, 33)) >reject : Symbol(reject, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 48, 41)) } diff --git a/tests/baselines/reference/noImplicitReturnsInAsync1.symbols b/tests/baselines/reference/noImplicitReturnsInAsync1.symbols index 3d8a37ff080..b039eb555f7 100644 --- a/tests/baselines/reference/noImplicitReturnsInAsync1.symbols +++ b/tests/baselines/reference/noImplicitReturnsInAsync1.symbols @@ -11,6 +11,6 @@ async function test(isError: boolean = false) { let x = await Promise.resolve("The test is passed without an error."); >x : Symbol(x, Decl(noImplicitReturnsInAsync1.ts, 4, 7)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) } diff --git a/tests/baselines/reference/promiseType.symbols b/tests/baselines/reference/promiseType.symbols index 5320a666413..5eea680f9fb 100644 --- a/tests/baselines/reference/promiseType.symbols +++ b/tests/baselines/reference/promiseType.symbols @@ -1,7 +1,7 @@ === tests/cases/compiler/promiseType.ts === declare var p: Promise; >p : Symbol(p, Decl(promiseType.ts, 0, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) declare var x: any; >x : Symbol(x, Decl(promiseType.ts, 1, 11)) @@ -92,7 +92,7 @@ async function F() { return Promise.reject(Error()); >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) } @@ -151,7 +151,7 @@ async function I() { return Promise.reject(Error()); >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) } @@ -228,7 +228,7 @@ const p18 = p.catch(() => Promise.reject(1)); >p : Symbol(p, Decl(promiseType.ts, 0, 11)) >catch : Symbol(Promise.catch, Decl(lib.es5.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const p19 = p.catch(() => Promise.resolve(1)); @@ -237,7 +237,7 @@ const p19 = p.catch(() => Promise.resolve(1)); >p : Symbol(p, Decl(promiseType.ts, 0, 11)) >catch : Symbol(Promise.catch, Decl(lib.es5.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const p20 = p.then(undefined); @@ -297,7 +297,7 @@ const p28 = p.then(() => Promise.resolve(1)); >p : Symbol(p, Decl(promiseType.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const p29 = p.then(() => Promise.reject(1)); @@ -306,7 +306,7 @@ const p29 = p.then(() => Promise.reject(1)); >p : Symbol(p, Decl(promiseType.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const p30 = p.then(undefined, undefined); @@ -375,7 +375,7 @@ const p38 = p.then(undefined, () => Promise.resolve(1)); >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >undefined : Symbol(undefined) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const p39 = p.then(undefined, () => Promise.reject(1)); @@ -385,7 +385,7 @@ const p39 = p.then(undefined, () => Promise.reject(1)); >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >undefined : Symbol(undefined) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const p40 = p.then(null, undefined); @@ -445,7 +445,7 @@ const p48 = p.then(null, () => Promise.resolve(1)); >p : Symbol(p, Decl(promiseType.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const p49 = p.then(null, () => Promise.reject(1)); @@ -454,7 +454,7 @@ const p49 = p.then(null, () => Promise.reject(1)); >p : Symbol(p, Decl(promiseType.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const p50 = p.then(() => "1", undefined); @@ -514,7 +514,7 @@ const p58 = p.then(() => "1", () => Promise.resolve(1)); >p : Symbol(p, Decl(promiseType.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const p59 = p.then(() => "1", () => Promise.reject(1)); @@ -523,7 +523,7 @@ const p59 = p.then(() => "1", () => Promise.reject(1)); >p : Symbol(p, Decl(promiseType.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const p60 = p.then(() => x, undefined); @@ -592,7 +592,7 @@ const p68 = p.then(() => x, () => Promise.resolve(1)); >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >x : Symbol(x, Decl(promiseType.ts, 1, 11)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const p69 = p.then(() => x, () => Promise.reject(1)); @@ -602,7 +602,7 @@ const p69 = p.then(() => x, () => Promise.reject(1)); >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >x : Symbol(x, Decl(promiseType.ts, 1, 11)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const p70 = p.then(() => undefined, undefined); @@ -671,7 +671,7 @@ const p78 = p.then(() => undefined, () => Promise.resolve(1)); >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >undefined : Symbol(undefined) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const p79 = p.then(() => undefined, () => Promise.reject(1)); @@ -681,7 +681,7 @@ const p79 = p.then(() => undefined, () => Promise.reject(1)); >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >undefined : Symbol(undefined) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const p80 = p.then(() => null, undefined); @@ -741,7 +741,7 @@ const p88 = p.then(() => null, () => Promise.resolve(1)); >p : Symbol(p, Decl(promiseType.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const p89 = p.then(() => null, () => Promise.reject(1)); @@ -750,7 +750,7 @@ const p89 = p.then(() => null, () => Promise.reject(1)); >p : Symbol(p, Decl(promiseType.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const p90 = p.then(() => {}, undefined); @@ -810,7 +810,7 @@ const p98 = p.then(() => {}, () => Promise.resolve(1)); >p : Symbol(p, Decl(promiseType.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const p99 = p.then(() => {}, () => Promise.reject(1)); @@ -819,7 +819,7 @@ const p99 = p.then(() => {}, () => Promise.reject(1)); >p : Symbol(p, Decl(promiseType.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const pa0 = p.then(() => {throw 1}, undefined); @@ -879,7 +879,7 @@ const pa8 = p.then(() => {throw 1}, () => Promise.resolve(1)); >p : Symbol(p, Decl(promiseType.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const pa9 = p.then(() => {throw 1}, () => Promise.reject(1)); @@ -888,7 +888,7 @@ const pa9 = p.then(() => {throw 1}, () => Promise.reject(1)); >p : Symbol(p, Decl(promiseType.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const pb0 = p.then(() => Promise.resolve("1"), undefined); @@ -897,7 +897,7 @@ const pb0 = p.then(() => Promise.resolve("1"), undefined); >p : Symbol(p, Decl(promiseType.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >undefined : Symbol(undefined) @@ -907,7 +907,7 @@ const pb1 = p.then(() => Promise.resolve("1"), null); >p : Symbol(p, Decl(promiseType.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const pb2 = p.then(() => Promise.resolve("1"), () => 1); @@ -916,7 +916,7 @@ const pb2 = p.then(() => Promise.resolve("1"), () => 1); >p : Symbol(p, Decl(promiseType.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const pb3 = p.then(() => Promise.resolve("1"), () => x); @@ -925,7 +925,7 @@ const pb3 = p.then(() => Promise.resolve("1"), () => x); >p : Symbol(p, Decl(promiseType.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >x : Symbol(x, Decl(promiseType.ts, 1, 11)) @@ -935,7 +935,7 @@ const pb4 = p.then(() => Promise.resolve("1"), () => undefined); >p : Symbol(p, Decl(promiseType.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >undefined : Symbol(undefined) @@ -945,7 +945,7 @@ const pb5 = p.then(() => Promise.resolve("1"), () => null); >p : Symbol(p, Decl(promiseType.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const pb6 = p.then(() => Promise.resolve("1"), () => {}); @@ -954,7 +954,7 @@ const pb6 = p.then(() => Promise.resolve("1"), () => {}); >p : Symbol(p, Decl(promiseType.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const pb7 = p.then(() => Promise.resolve("1"), () => {throw 1}); @@ -963,7 +963,7 @@ const pb7 = p.then(() => Promise.resolve("1"), () => {throw 1}); >p : Symbol(p, Decl(promiseType.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const pb8 = p.then(() => Promise.resolve("1"), () => Promise.resolve(1)); @@ -972,10 +972,10 @@ const pb8 = p.then(() => Promise.resolve("1"), () => Promise.resolve(1)); >p : Symbol(p, Decl(promiseType.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const pb9 = p.then(() => Promise.resolve("1"), () => Promise.reject(1)); @@ -984,10 +984,10 @@ const pb9 = p.then(() => Promise.resolve("1"), () => Promise.reject(1)); >p : Symbol(p, Decl(promiseType.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const pc0 = p.then(() => Promise.reject("1"), undefined); @@ -996,7 +996,7 @@ const pc0 = p.then(() => Promise.reject("1"), undefined); >p : Symbol(p, Decl(promiseType.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >undefined : Symbol(undefined) @@ -1006,7 +1006,7 @@ const pc1 = p.then(() => Promise.reject("1"), null); >p : Symbol(p, Decl(promiseType.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const pc2 = p.then(() => Promise.reject("1"), () => 1); @@ -1015,7 +1015,7 @@ const pc2 = p.then(() => Promise.reject("1"), () => 1); >p : Symbol(p, Decl(promiseType.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const pc3 = p.then(() => Promise.reject("1"), () => x); @@ -1024,7 +1024,7 @@ const pc3 = p.then(() => Promise.reject("1"), () => x); >p : Symbol(p, Decl(promiseType.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >x : Symbol(x, Decl(promiseType.ts, 1, 11)) @@ -1034,7 +1034,7 @@ const pc4 = p.then(() => Promise.reject("1"), () => undefined); >p : Symbol(p, Decl(promiseType.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >undefined : Symbol(undefined) @@ -1044,7 +1044,7 @@ const pc5 = p.then(() => Promise.reject("1"), () => null); >p : Symbol(p, Decl(promiseType.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const pc6 = p.then(() => Promise.reject("1"), () => {}); @@ -1053,7 +1053,7 @@ const pc6 = p.then(() => Promise.reject("1"), () => {}); >p : Symbol(p, Decl(promiseType.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const pc7 = p.then(() => Promise.reject("1"), () => {throw 1}); @@ -1062,7 +1062,7 @@ const pc7 = p.then(() => Promise.reject("1"), () => {throw 1}); >p : Symbol(p, Decl(promiseType.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const pc8 = p.then(() => Promise.reject("1"), () => Promise.resolve(1)); @@ -1071,10 +1071,10 @@ const pc8 = p.then(() => Promise.reject("1"), () => Promise.resolve(1)); >p : Symbol(p, Decl(promiseType.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const pc9 = p.then(() => Promise.reject("1"), () => Promise.reject(1)); @@ -1083,9 +1083,9 @@ const pc9 = p.then(() => Promise.reject("1"), () => Promise.reject(1)); >p : Symbol(p, Decl(promiseType.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) diff --git a/tests/baselines/reference/promiseTypeStrictNull.symbols b/tests/baselines/reference/promiseTypeStrictNull.symbols index 58acf184564..3fabb7f16b7 100644 --- a/tests/baselines/reference/promiseTypeStrictNull.symbols +++ b/tests/baselines/reference/promiseTypeStrictNull.symbols @@ -1,7 +1,7 @@ === tests/cases/compiler/promiseTypeStrictNull.ts === declare var p: Promise; >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) declare var x: any; >x : Symbol(x, Decl(promiseTypeStrictNull.ts, 1, 11)) @@ -92,7 +92,7 @@ async function F() { return Promise.reject(Error()); >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) } @@ -151,7 +151,7 @@ async function I() { return Promise.reject(Error()); >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) } @@ -228,7 +228,7 @@ const p18 = p.catch(() => Promise.reject(1)); >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) >catch : Symbol(Promise.catch, Decl(lib.es5.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const p19 = p.catch(() => Promise.resolve(1)); @@ -237,7 +237,7 @@ const p19 = p.catch(() => Promise.resolve(1)); >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) >catch : Symbol(Promise.catch, Decl(lib.es5.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const p20 = p.then(undefined); @@ -297,7 +297,7 @@ const p28 = p.then(() => Promise.resolve(1)); >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const p29 = p.then(() => Promise.reject(1)); @@ -306,7 +306,7 @@ const p29 = p.then(() => Promise.reject(1)); >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const p30 = p.then(undefined, undefined); @@ -375,7 +375,7 @@ const p38 = p.then(undefined, () => Promise.resolve(1)); >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >undefined : Symbol(undefined) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const p39 = p.then(undefined, () => Promise.reject(1)); @@ -385,7 +385,7 @@ const p39 = p.then(undefined, () => Promise.reject(1)); >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >undefined : Symbol(undefined) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const p40 = p.then(null, undefined); @@ -445,7 +445,7 @@ const p48 = p.then(null, () => Promise.resolve(1)); >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const p49 = p.then(null, () => Promise.reject(1)); @@ -454,7 +454,7 @@ const p49 = p.then(null, () => Promise.reject(1)); >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const p50 = p.then(() => "1", undefined); @@ -514,7 +514,7 @@ const p58 = p.then(() => "1", () => Promise.resolve(1)); >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const p59 = p.then(() => "1", () => Promise.reject(1)); @@ -523,7 +523,7 @@ const p59 = p.then(() => "1", () => Promise.reject(1)); >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const p60 = p.then(() => x, undefined); @@ -592,7 +592,7 @@ const p68 = p.then(() => x, () => Promise.resolve(1)); >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >x : Symbol(x, Decl(promiseTypeStrictNull.ts, 1, 11)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const p69 = p.then(() => x, () => Promise.reject(1)); @@ -602,7 +602,7 @@ const p69 = p.then(() => x, () => Promise.reject(1)); >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >x : Symbol(x, Decl(promiseTypeStrictNull.ts, 1, 11)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const p70 = p.then(() => undefined, undefined); @@ -671,7 +671,7 @@ const p78 = p.then(() => undefined, () => Promise.resolve(1)); >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >undefined : Symbol(undefined) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const p79 = p.then(() => undefined, () => Promise.reject(1)); @@ -681,7 +681,7 @@ const p79 = p.then(() => undefined, () => Promise.reject(1)); >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >undefined : Symbol(undefined) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const p80 = p.then(() => null, undefined); @@ -741,7 +741,7 @@ const p88 = p.then(() => null, () => Promise.resolve(1)); >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const p89 = p.then(() => null, () => Promise.reject(1)); @@ -750,7 +750,7 @@ const p89 = p.then(() => null, () => Promise.reject(1)); >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const p90 = p.then(() => {}, undefined); @@ -810,7 +810,7 @@ const p98 = p.then(() => {}, () => Promise.resolve(1)); >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const p99 = p.then(() => {}, () => Promise.reject(1)); @@ -819,7 +819,7 @@ const p99 = p.then(() => {}, () => Promise.reject(1)); >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const pa0 = p.then(() => {throw 1}, undefined); @@ -879,7 +879,7 @@ const pa8 = p.then(() => {throw 1}, () => Promise.resolve(1)); >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const pa9 = p.then(() => {throw 1}, () => Promise.reject(1)); @@ -888,7 +888,7 @@ const pa9 = p.then(() => {throw 1}, () => Promise.reject(1)); >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const pb0 = p.then(() => Promise.resolve("1"), undefined); @@ -897,7 +897,7 @@ const pb0 = p.then(() => Promise.resolve("1"), undefined); >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >undefined : Symbol(undefined) @@ -907,7 +907,7 @@ const pb1 = p.then(() => Promise.resolve("1"), null); >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const pb2 = p.then(() => Promise.resolve("1"), () => 1); @@ -916,7 +916,7 @@ const pb2 = p.then(() => Promise.resolve("1"), () => 1); >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const pb3 = p.then(() => Promise.resolve("1"), () => x); @@ -925,7 +925,7 @@ const pb3 = p.then(() => Promise.resolve("1"), () => x); >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >x : Symbol(x, Decl(promiseTypeStrictNull.ts, 1, 11)) @@ -935,7 +935,7 @@ const pb4 = p.then(() => Promise.resolve("1"), () => undefined); >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >undefined : Symbol(undefined) @@ -945,7 +945,7 @@ const pb5 = p.then(() => Promise.resolve("1"), () => null); >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const pb6 = p.then(() => Promise.resolve("1"), () => {}); @@ -954,7 +954,7 @@ const pb6 = p.then(() => Promise.resolve("1"), () => {}); >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const pb7 = p.then(() => Promise.resolve("1"), () => {throw 1}); @@ -963,7 +963,7 @@ const pb7 = p.then(() => Promise.resolve("1"), () => {throw 1}); >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const pb8 = p.then(() => Promise.resolve("1"), () => Promise.resolve(1)); @@ -972,10 +972,10 @@ const pb8 = p.then(() => Promise.resolve("1"), () => Promise.resolve(1)); >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const pb9 = p.then(() => Promise.resolve("1"), () => Promise.reject(1)); @@ -984,10 +984,10 @@ const pb9 = p.then(() => Promise.resolve("1"), () => Promise.reject(1)); >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const pc0 = p.then(() => Promise.reject("1"), undefined); @@ -996,7 +996,7 @@ const pc0 = p.then(() => Promise.reject("1"), undefined); >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >undefined : Symbol(undefined) @@ -1006,7 +1006,7 @@ const pc1 = p.then(() => Promise.reject("1"), null); >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const pc2 = p.then(() => Promise.reject("1"), () => 1); @@ -1015,7 +1015,7 @@ const pc2 = p.then(() => Promise.reject("1"), () => 1); >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const pc3 = p.then(() => Promise.reject("1"), () => x); @@ -1024,7 +1024,7 @@ const pc3 = p.then(() => Promise.reject("1"), () => x); >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >x : Symbol(x, Decl(promiseTypeStrictNull.ts, 1, 11)) @@ -1034,7 +1034,7 @@ const pc4 = p.then(() => Promise.reject("1"), () => undefined); >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >undefined : Symbol(undefined) @@ -1044,7 +1044,7 @@ const pc5 = p.then(() => Promise.reject("1"), () => null); >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const pc6 = p.then(() => Promise.reject("1"), () => {}); @@ -1053,7 +1053,7 @@ const pc6 = p.then(() => Promise.reject("1"), () => {}); >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const pc7 = p.then(() => Promise.reject("1"), () => {throw 1}); @@ -1062,7 +1062,7 @@ const pc7 = p.then(() => Promise.reject("1"), () => {throw 1}); >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const pc8 = p.then(() => Promise.reject("1"), () => Promise.resolve(1)); @@ -1071,10 +1071,10 @@ const pc8 = p.then(() => Promise.reject("1"), () => Promise.resolve(1)); >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) const pc9 = p.then(() => Promise.reject("1"), () => Promise.reject(1)); @@ -1083,9 +1083,9 @@ const pc9 = p.then(() => Promise.reject("1"), () => Promise.reject(1)); >p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) diff --git a/tests/baselines/reference/promiseVoidErrorCallback.symbols b/tests/baselines/reference/promiseVoidErrorCallback.symbols index 799fddc5616..184ffd32592 100644 --- a/tests/baselines/reference/promiseVoidErrorCallback.symbols +++ b/tests/baselines/reference/promiseVoidErrorCallback.symbols @@ -22,12 +22,12 @@ interface T3 { function f1(): Promise { >f1 : Symbol(f1, Decl(promiseVoidErrorCallback.ts, 10, 1)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >T1 : Symbol(T1, Decl(promiseVoidErrorCallback.ts, 0, 0)) return Promise.resolve({ __t1: "foo_t1" }); >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >__t1 : Symbol(__t1, Decl(promiseVoidErrorCallback.ts, 13, 28)) } diff --git a/tests/baselines/reference/transformNestedGeneratorsWithTry.symbols b/tests/baselines/reference/transformNestedGeneratorsWithTry.symbols index 88f62aa6273..d83f91f29d0 100644 --- a/tests/baselines/reference/transformNestedGeneratorsWithTry.symbols +++ b/tests/baselines/reference/transformNestedGeneratorsWithTry.symbols @@ -36,12 +36,12 @@ declare module "bluebird" { type Bluebird = Promise; >Bluebird : Symbol(Bluebird, Decl(bluebird.d.ts, 0, 27), Decl(bluebird.d.ts, 2, 9)) >T : Symbol(T, Decl(bluebird.d.ts, 1, 18)) ->Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >T : Symbol(T, Decl(bluebird.d.ts, 1, 18)) const Bluebird: typeof Promise; >Bluebird : Symbol(Bluebird, Decl(bluebird.d.ts, 0, 27), Decl(bluebird.d.ts, 2, 9)) ->Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) export = Bluebird; >Bluebird : Symbol(Bluebird, Decl(bluebird.d.ts, 0, 27), Decl(bluebird.d.ts, 2, 9)) diff --git a/tests/baselines/reference/types.asyncGenerators.esnext.1.symbols b/tests/baselines/reference/types.asyncGenerators.esnext.1.symbols index 1db808e4aed..b5707649fda 100644 --- a/tests/baselines/reference/types.asyncGenerators.esnext.1.symbols +++ b/tests/baselines/reference/types.asyncGenerators.esnext.1.symbols @@ -17,7 +17,7 @@ async function * inferReturnType4() { yield Promise.resolve(1); >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) } async function * inferReturnType5() { @@ -26,7 +26,7 @@ async function * inferReturnType5() { yield 1; yield Promise.resolve(2); >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) } async function * inferReturnType6() { @@ -39,7 +39,7 @@ async function * inferReturnType7() { yield* [Promise.resolve(1)]; >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) } async function * inferReturnType8() { @@ -59,7 +59,7 @@ const assignability2: () => AsyncIterableIterator = async function * () yield Promise.resolve(1); >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) }; @@ -75,7 +75,7 @@ const assignability4: () => AsyncIterableIterator = async function * () yield* [Promise.resolve(1)]; >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) }; @@ -97,7 +97,7 @@ const assignability7: () => AsyncIterable = async function * () { yield Promise.resolve(1); >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) }; @@ -113,7 +113,7 @@ const assignability9: () => AsyncIterable = async function * () { yield* [Promise.resolve(1)]; >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) }; @@ -135,7 +135,7 @@ const assignability12: () => AsyncIterator = async function * () { yield Promise.resolve(1); >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) }; @@ -151,7 +151,7 @@ const assignability14: () => AsyncIterator = async function * () { yield* [Promise.resolve(1)]; >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) }; @@ -173,7 +173,7 @@ async function * explicitReturnType2(): AsyncIterableIterator { yield Promise.resolve(1); >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) } async function * explicitReturnType3(): AsyncIterableIterator { @@ -188,7 +188,7 @@ async function * explicitReturnType4(): AsyncIterableIterator { yield* [Promise.resolve(1)]; >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) } async function * explicitReturnType5(): AsyncIterableIterator { @@ -209,7 +209,7 @@ async function * explicitReturnType7(): AsyncIterable { yield Promise.resolve(1); >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) } async function * explicitReturnType8(): AsyncIterable { @@ -224,7 +224,7 @@ async function * explicitReturnType9(): AsyncIterable { yield* [Promise.resolve(1)]; >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) } async function * explicitReturnType10(): AsyncIterable { @@ -245,7 +245,7 @@ async function * explicitReturnType12(): AsyncIterator { yield Promise.resolve(1); >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) } async function * explicitReturnType13(): AsyncIterator { @@ -260,7 +260,7 @@ async function * explicitReturnType14(): AsyncIterator { yield* [Promise.resolve(1)]; >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) } async function * explicitReturnType15(): AsyncIterator { @@ -286,6 +286,6 @@ async function * awaitedType2() { const x = await Promise.resolve(1); >x : Symbol(x, Decl(types.asyncGenerators.esnext.1.ts, 121, 9)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) } From 386454a255cc109cd3dffcb4f6398cb40165f532 Mon Sep 17 00:00:00 2001 From: Charles Pierce Date: Thu, 22 Jun 2017 20:20:41 -0700 Subject: [PATCH 22/62] #16300 #16301 Diagnostics for default export in namespace --- src/compiler/checker.ts | 7 +++ src/compiler/transformers/ts.ts | 2 +- .../exportDefaultClassInNamespace.errors.txt | 17 ++++++ .../exportDefaultClassInNamespace.js | 29 +++++++++ .../exportDefaultClassInNamespace.symbols | 13 ++++ .../exportDefaultClassInNamespace.types | 13 ++++ ...xportDefaultFunctionInNamespace.errors.txt | 17 ++++++ .../exportDefaultFunctionInNamespace.js | 60 +++++++++++++++++++ .../exportDefaultFunctionInNamespace.symbols | 13 ++++ .../exportDefaultFunctionInNamespace.types | 13 ++++ .../staticPropertyNameConflicts.errors.txt | 26 +++++++- .../compiler/exportDefaultClassInNamespace.ts | 7 +++ .../exportDefaultFunctionInNamespace.ts | 7 +++ 13 files changed, 222 insertions(+), 2 deletions(-) create mode 100644 tests/baselines/reference/exportDefaultClassInNamespace.errors.txt create mode 100644 tests/baselines/reference/exportDefaultClassInNamespace.js create mode 100644 tests/baselines/reference/exportDefaultClassInNamespace.symbols create mode 100644 tests/baselines/reference/exportDefaultClassInNamespace.types create mode 100644 tests/baselines/reference/exportDefaultFunctionInNamespace.errors.txt create mode 100644 tests/baselines/reference/exportDefaultFunctionInNamespace.js create mode 100644 tests/baselines/reference/exportDefaultFunctionInNamespace.symbols create mode 100644 tests/baselines/reference/exportDefaultFunctionInNamespace.types create mode 100644 tests/cases/compiler/exportDefaultClassInNamespace.ts create mode 100644 tests/cases/compiler/exportDefaultFunctionInNamespace.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index cc661ec869c..d4493c6e2a2 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -23624,7 +23624,14 @@ namespace ts { } flags |= ModifierFlags.Export; break; + case SyntaxKind.DefaultKeyword: + const container = node.parent.kind === SyntaxKind.SourceFile ? node.parent : node.parent.parent; + if (container.kind === SyntaxKind.ModuleDeclaration && !isAmbientModule(container)) { + return grammarErrorOnNode(modifier, Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module); + } + flags |= ModifierFlags.Default; + break; case SyntaxKind.DeclareKeyword: if (flags & ModifierFlags.Ambient) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "declare"); diff --git a/src/compiler/transformers/ts.ts b/src/compiler/transformers/ts.ts index bcfa5985b57..c40647521e6 100644 --- a/src/compiler/transformers/ts.ts +++ b/src/compiler/transformers/ts.ts @@ -3158,7 +3158,7 @@ namespace ts { getExternalModuleOrNamespaceExportName(currentNamespaceContainerName, node, /*allowComments*/ false, /*allowSourceMaps*/ true), getLocalName(node) ); - setSourceMapRange(expression, createRange(node.name.pos, node.end)); + setSourceMapRange(expression, createRange(node.name ? node.name.pos: node.pos, node.end)); const statement = createStatement(expression); setSourceMapRange(statement, createRange(-1, node.end)); diff --git a/tests/baselines/reference/exportDefaultClassInNamespace.errors.txt b/tests/baselines/reference/exportDefaultClassInNamespace.errors.txt new file mode 100644 index 00000000000..fbb2235e90d --- /dev/null +++ b/tests/baselines/reference/exportDefaultClassInNamespace.errors.txt @@ -0,0 +1,17 @@ +tests/cases/compiler/exportDefaultClassInNamespace.ts(2,12): error TS1319: A default export can only be used in an ECMAScript-style module. +tests/cases/compiler/exportDefaultClassInNamespace.ts(6,12): error TS1319: A default export can only be used in an ECMAScript-style module. + + +==== tests/cases/compiler/exportDefaultClassInNamespace.ts (2 errors) ==== + namespace ns_class { + export default class {} + ~~~~~~~ +!!! error TS1319: A default export can only be used in an ECMAScript-style module. + } + + namespace ns_abstract_class { + export default abstract class {} + ~~~~~~~ +!!! error TS1319: A default export can only be used in an ECMAScript-style module. + } + \ No newline at end of file diff --git a/tests/baselines/reference/exportDefaultClassInNamespace.js b/tests/baselines/reference/exportDefaultClassInNamespace.js new file mode 100644 index 00000000000..641e5ed61a5 --- /dev/null +++ b/tests/baselines/reference/exportDefaultClassInNamespace.js @@ -0,0 +1,29 @@ +//// [exportDefaultClassInNamespace.ts] +namespace ns_class { + export default class {} +} + +namespace ns_abstract_class { + export default abstract class {} +} + + +//// [exportDefaultClassInNamespace.js] +var ns_class; +(function (ns_class) { + var default_1 = (function () { + function default_1() { + } + return default_1; + }()); + ns_class.default_1 = default_1; +})(ns_class || (ns_class = {})); +var ns_abstract_class; +(function (ns_abstract_class) { + var default_2 = (function () { + function default_2() { + } + return default_2; + }()); + ns_abstract_class.default_2 = default_2; +})(ns_abstract_class || (ns_abstract_class = {})); diff --git a/tests/baselines/reference/exportDefaultClassInNamespace.symbols b/tests/baselines/reference/exportDefaultClassInNamespace.symbols new file mode 100644 index 00000000000..cc186c7f6a4 --- /dev/null +++ b/tests/baselines/reference/exportDefaultClassInNamespace.symbols @@ -0,0 +1,13 @@ +=== tests/cases/compiler/exportDefaultClassInNamespace.ts === +namespace ns_class { +>ns_class : Symbol(ns_class, Decl(exportDefaultClassInNamespace.ts, 0, 0)) + + export default class {} +} + +namespace ns_abstract_class { +>ns_abstract_class : Symbol(ns_abstract_class, Decl(exportDefaultClassInNamespace.ts, 2, 1)) + + export default abstract class {} +} + diff --git a/tests/baselines/reference/exportDefaultClassInNamespace.types b/tests/baselines/reference/exportDefaultClassInNamespace.types new file mode 100644 index 00000000000..aa7e0738eb7 --- /dev/null +++ b/tests/baselines/reference/exportDefaultClassInNamespace.types @@ -0,0 +1,13 @@ +=== tests/cases/compiler/exportDefaultClassInNamespace.ts === +namespace ns_class { +>ns_class : typeof ns_class + + export default class {} +} + +namespace ns_abstract_class { +>ns_abstract_class : typeof ns_abstract_class + + export default abstract class {} +} + diff --git a/tests/baselines/reference/exportDefaultFunctionInNamespace.errors.txt b/tests/baselines/reference/exportDefaultFunctionInNamespace.errors.txt new file mode 100644 index 00000000000..6e34850818a --- /dev/null +++ b/tests/baselines/reference/exportDefaultFunctionInNamespace.errors.txt @@ -0,0 +1,17 @@ +tests/cases/compiler/exportDefaultFunctionInNamespace.ts(2,12): error TS1319: A default export can only be used in an ECMAScript-style module. +tests/cases/compiler/exportDefaultFunctionInNamespace.ts(6,12): error TS1319: A default export can only be used in an ECMAScript-style module. + + +==== tests/cases/compiler/exportDefaultFunctionInNamespace.ts (2 errors) ==== + namespace ns_function { + export default function () {} + ~~~~~~~ +!!! error TS1319: A default export can only be used in an ECMAScript-style module. + } + + namespace ns_async_function { + export default async function () {} + ~~~~~~~ +!!! error TS1319: A default export can only be used in an ECMAScript-style module. + } + \ No newline at end of file diff --git a/tests/baselines/reference/exportDefaultFunctionInNamespace.js b/tests/baselines/reference/exportDefaultFunctionInNamespace.js new file mode 100644 index 00000000000..3d962d7f398 --- /dev/null +++ b/tests/baselines/reference/exportDefaultFunctionInNamespace.js @@ -0,0 +1,60 @@ +//// [exportDefaultFunctionInNamespace.ts] +namespace ns_function { + export default function () {} +} + +namespace ns_async_function { + export default async function () {} +} + + +//// [exportDefaultFunctionInNamespace.js] +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __generator = (this && this.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [0, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; +var ns_function; +(function (ns_function) { + default function () { } + ns_function.default_1 = default_1; +})(ns_function || (ns_function = {})); +var ns_async_function; +(function (ns_async_function) { + default function () { + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { + return [2 /*return*/]; + }); }); + } + ns_async_function.default_2 = default_2; +})(ns_async_function || (ns_async_function = {})); diff --git a/tests/baselines/reference/exportDefaultFunctionInNamespace.symbols b/tests/baselines/reference/exportDefaultFunctionInNamespace.symbols new file mode 100644 index 00000000000..a84a788602c --- /dev/null +++ b/tests/baselines/reference/exportDefaultFunctionInNamespace.symbols @@ -0,0 +1,13 @@ +=== tests/cases/compiler/exportDefaultFunctionInNamespace.ts === +namespace ns_function { +>ns_function : Symbol(ns_function, Decl(exportDefaultFunctionInNamespace.ts, 0, 0)) + + export default function () {} +} + +namespace ns_async_function { +>ns_async_function : Symbol(ns_async_function, Decl(exportDefaultFunctionInNamespace.ts, 2, 1)) + + export default async function () {} +} + diff --git a/tests/baselines/reference/exportDefaultFunctionInNamespace.types b/tests/baselines/reference/exportDefaultFunctionInNamespace.types new file mode 100644 index 00000000000..76b9c007ed6 --- /dev/null +++ b/tests/baselines/reference/exportDefaultFunctionInNamespace.types @@ -0,0 +1,13 @@ +=== tests/cases/compiler/exportDefaultFunctionInNamespace.ts === +namespace ns_function { +>ns_function : typeof ns_function + + export default function () {} +} + +namespace ns_async_function { +>ns_async_function : typeof ns_async_function + + export default async function () {} +} + diff --git a/tests/baselines/reference/staticPropertyNameConflicts.errors.txt b/tests/baselines/reference/staticPropertyNameConflicts.errors.txt index 1b22bbbf759..60519574649 100644 --- a/tests/baselines/reference/staticPropertyNameConflicts.errors.txt +++ b/tests/baselines/reference/staticPropertyNameConflicts.errors.txt @@ -22,18 +22,26 @@ tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameCon tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(111,12): error TS2699: Static property 'arguments' conflicts with built-in property 'Function.arguments' of constructor function 'StaticArgumentsFn_Anonymous'. tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(121,16): error TS2699: Static property 'name' conflicts with built-in property 'Function.name' of constructor function 'StaticName'. tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(128,16): error TS2699: Static property 'name' conflicts with built-in property 'Function.name' of constructor function 'StaticNameFn'. +tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(135,12): error TS1319: A default export can only be used in an ECMAScript-style module. tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(136,16): error TS2699: Static property 'length' conflicts with built-in property 'Function.length' of constructor function 'StaticLength'. +tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(142,12): error TS1319: A default export can only be used in an ECMAScript-style module. tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(143,16): error TS2699: Static property 'length' conflicts with built-in property 'Function.length' of constructor function 'StaticLengthFn'. +tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(150,12): error TS1319: A default export can only be used in an ECMAScript-style module. tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(151,16): error TS2699: Static property 'prototype' conflicts with built-in property 'Function.prototype' of constructor function 'StaticPrototype'. +tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(157,12): error TS1319: A default export can only be used in an ECMAScript-style module. tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(158,16): error TS2300: Duplicate identifier 'prototype'. tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(158,16): error TS2699: Static property 'prototype' conflicts with built-in property 'Function.prototype' of constructor function 'StaticPrototypeFn'. +tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(165,12): error TS1319: A default export can only be used in an ECMAScript-style module. tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(166,16): error TS2699: Static property 'caller' conflicts with built-in property 'Function.caller' of constructor function 'StaticCaller'. +tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(172,12): error TS1319: A default export can only be used in an ECMAScript-style module. tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(173,16): error TS2699: Static property 'caller' conflicts with built-in property 'Function.caller' of constructor function 'StaticCallerFn'. +tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(180,12): error TS1319: A default export can only be used in an ECMAScript-style module. tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(181,16): error TS2699: Static property 'arguments' conflicts with built-in property 'Function.arguments' of constructor function 'StaticArguments'. +tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(187,12): error TS1319: A default export can only be used in an ECMAScript-style module. tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(188,16): error TS2699: Static property 'arguments' conflicts with built-in property 'Function.arguments' of constructor function 'StaticArgumentsFn'. -==== tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts (33 errors) ==== +==== tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts (41 errors) ==== // name class StaticName { static name: number; // error @@ -217,6 +225,8 @@ tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameCon // length module TestOnDefaultExportedClass_3 { export default class StaticLength { + ~~~~~~~ +!!! error TS1319: A default export can only be used in an ECMAScript-style module. static length: number; // error ~~~~~~ !!! error TS2699: Static property 'length' conflicts with built-in property 'Function.length' of constructor function 'StaticLength'. @@ -226,6 +236,8 @@ tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameCon module TestOnDefaultExportedClass_4 { export default class StaticLengthFn { + ~~~~~~~ +!!! error TS1319: A default export can only be used in an ECMAScript-style module. static length() {} // error ~~~~~~ !!! error TS2699: Static property 'length' conflicts with built-in property 'Function.length' of constructor function 'StaticLengthFn'. @@ -236,6 +248,8 @@ tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameCon // prototype module TestOnDefaultExportedClass_5 { export default class StaticPrototype { + ~~~~~~~ +!!! error TS1319: A default export can only be used in an ECMAScript-style module. static prototype: number; // error ~~~~~~~~~ !!! error TS2699: Static property 'prototype' conflicts with built-in property 'Function.prototype' of constructor function 'StaticPrototype'. @@ -245,6 +259,8 @@ tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameCon module TestOnDefaultExportedClass_6 { export default class StaticPrototypeFn { + ~~~~~~~ +!!! error TS1319: A default export can only be used in an ECMAScript-style module. static prototype() {} // error ~~~~~~~~~ !!! error TS2300: Duplicate identifier 'prototype'. @@ -257,6 +273,8 @@ tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameCon // caller module TestOnDefaultExportedClass_7 { export default class StaticCaller { + ~~~~~~~ +!!! error TS1319: A default export can only be used in an ECMAScript-style module. static caller: number; // error ~~~~~~ !!! error TS2699: Static property 'caller' conflicts with built-in property 'Function.caller' of constructor function 'StaticCaller'. @@ -266,6 +284,8 @@ tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameCon module TestOnDefaultExportedClass_8 { export default class StaticCallerFn { + ~~~~~~~ +!!! error TS1319: A default export can only be used in an ECMAScript-style module. static caller() {} // error ~~~~~~ !!! error TS2699: Static property 'caller' conflicts with built-in property 'Function.caller' of constructor function 'StaticCallerFn'. @@ -276,6 +296,8 @@ tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameCon // arguments module TestOnDefaultExportedClass_9 { export default class StaticArguments { + ~~~~~~~ +!!! error TS1319: A default export can only be used in an ECMAScript-style module. static arguments: number; // error ~~~~~~~~~ !!! error TS2699: Static property 'arguments' conflicts with built-in property 'Function.arguments' of constructor function 'StaticArguments'. @@ -285,6 +307,8 @@ tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameCon module TestOnDefaultExportedClass_10 { export default class StaticArgumentsFn { + ~~~~~~~ +!!! error TS1319: A default export can only be used in an ECMAScript-style module. static arguments() {} // error ~~~~~~~~~ !!! error TS2699: Static property 'arguments' conflicts with built-in property 'Function.arguments' of constructor function 'StaticArgumentsFn'. diff --git a/tests/cases/compiler/exportDefaultClassInNamespace.ts b/tests/cases/compiler/exportDefaultClassInNamespace.ts new file mode 100644 index 00000000000..956ef2fa6b8 --- /dev/null +++ b/tests/cases/compiler/exportDefaultClassInNamespace.ts @@ -0,0 +1,7 @@ +namespace ns_class { + export default class {} +} + +namespace ns_abstract_class { + export default abstract class {} +} diff --git a/tests/cases/compiler/exportDefaultFunctionInNamespace.ts b/tests/cases/compiler/exportDefaultFunctionInNamespace.ts new file mode 100644 index 00000000000..f68efb938a9 --- /dev/null +++ b/tests/cases/compiler/exportDefaultFunctionInNamespace.ts @@ -0,0 +1,7 @@ +namespace ns_function { + export default function () {} +} + +namespace ns_async_function { + export default async function () {} +} From 8418d67ebbc8b5014f2bb613c3a9b57c8fbd6773 Mon Sep 17 00:00:00 2001 From: Charles Pierce Date: Thu, 22 Jun 2017 21:01:05 -0700 Subject: [PATCH 23/62] Fix missed lint error --- src/compiler/transformers/ts.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/transformers/ts.ts b/src/compiler/transformers/ts.ts index c40647521e6..acfd465ff99 100644 --- a/src/compiler/transformers/ts.ts +++ b/src/compiler/transformers/ts.ts @@ -3158,7 +3158,7 @@ namespace ts { getExternalModuleOrNamespaceExportName(currentNamespaceContainerName, node, /*allowComments*/ false, /*allowSourceMaps*/ true), getLocalName(node) ); - setSourceMapRange(expression, createRange(node.name ? node.name.pos: node.pos, node.end)); + setSourceMapRange(expression, createRange(node.name ? node.name.pos : node.pos, node.end)); const statement = createStatement(expression); setSourceMapRange(statement, createRange(-1, node.end)); From fd22a88abcbca57c3a2961955537904481c9c62b Mon Sep 17 00:00:00 2001 From: Andy Date: Fri, 23 Jun 2017 10:03:01 -0700 Subject: [PATCH 24/62] Code cleanup in jsTyping.ts (#16632) --- src/services/jsTyping.ts | 112 +++++++++++++++++++-------------------- 1 file changed, 54 insertions(+), 58 deletions(-) diff --git a/src/services/jsTyping.ts b/src/services/jsTyping.ts index d84ae01e0a0..41bb01c1ae7 100644 --- a/src/services/jsTyping.ts +++ b/src/services/jsTyping.ts @@ -61,17 +61,20 @@ namespace ts.JsTyping { unresolvedImports: ReadonlyArray): { cachedTypingPaths: string[], newTypingNames: string[], filesToWatch: string[] } { - // A typing name to typing file path mapping - const inferredTypings = createMap(); - if (!typeAcquisition || !typeAcquisition.enable) { return { cachedTypingPaths: [], newTypingNames: [], filesToWatch: [] }; } + // A typing name to typing file path mapping + const inferredTypings = createMap(); + // Only infer typings for .js and .jsx files - fileNames = filter(map(fileNames, normalizePath), f => { - const kind = ensureScriptKind(f, getScriptKindFromFileName(f)); - return kind === ScriptKind.JS || kind === ScriptKind.JSX; + fileNames = mapDefined(fileNames, fileName => { + const path = normalizePath(fileName); + const kind = ensureScriptKind(path, getScriptKindFromFileName(path)); + if (kind === ScriptKind.JS || kind === ScriptKind.JSX) { + return path; + } }); if (!safeList) { @@ -80,19 +83,17 @@ namespace ts.JsTyping { } const filesToWatch: string[] = []; + + forEach(typeAcquisition.include, addInferredTyping); + const exclude = typeAcquisition.exclude || []; + // Directories to search for package.json, bower.json and other typing information - let searchDirs: string[] = []; - let exclude: string[] = []; - - mergeTypings(typeAcquisition.include); - exclude = typeAcquisition.exclude || []; - - const possibleSearchDirs = map(fileNames, getDirectoryPath); - if (projectRootPath) { - possibleSearchDirs.push(projectRootPath); + const possibleSearchDirs = createMap(); + for (const f of fileNames) { + possibleSearchDirs.set(getDirectoryPath(f), true); } - searchDirs = deduplicate(possibleSearchDirs); - for (const searchDir of searchDirs) { + possibleSearchDirs.set(projectRootPath, true); + possibleSearchDirs.forEach((_true, searchDir) => { const packageJsonPath = combinePaths(searchDir, "package.json"); getTypingNamesFromJson(packageJsonPath, filesToWatch); @@ -100,11 +101,11 @@ namespace ts.JsTyping { getTypingNamesFromJson(bowerJsonPath, filesToWatch); const bowerComponentsPath = combinePaths(searchDir, "bower_components"); - getTypingNamesFromPackagesFolder(bowerComponentsPath); + getTypingNamesFromPackagesFolder(bowerComponentsPath, filesToWatch); const nodeModulesPath = combinePaths(searchDir, "node_modules"); - getTypingNamesFromPackagesFolder(nodeModulesPath); - } + getTypingNamesFromPackagesFolder(nodeModulesPath, filesToWatch); + }); getTypingNamesFromSourceFileNames(fileNames); // add typings for unresolved imports @@ -140,41 +141,33 @@ namespace ts.JsTyping { }); return { cachedTypingPaths, newTypingNames, filesToWatch }; - /** - * Merge a given list of typingNames to the inferredTypings map - */ - function mergeTypings(typingNames: ReadonlyArray) { - if (!typingNames) { - return; - } - - for (const typing of typingNames) { - if (!inferredTypings.has(typing)) { - inferredTypings.set(typing, undefined); - } + function addInferredTyping(typingName: string) { + if (!inferredTypings.has(typingName)) { + inferredTypings.set(typingName, undefined); } } /** * Get the typing info from common package manager json files like package.json or bower.json */ - function getTypingNamesFromJson(jsonPath: string, filesToWatch: string[]) { - if (host.fileExists(jsonPath)) { - filesToWatch.push(jsonPath); + function getTypingNamesFromJson(jsonPath: string, filesToWatch: Push) { + if (!host.fileExists(jsonPath)) { + return; } - const result = readConfigFile(jsonPath, (path: string) => host.readFile(path)); - const jsonConfig: PackageJson = result.config; - if (jsonConfig.dependencies) { - mergeTypings(getOwnKeys(jsonConfig.dependencies)); - } - if (jsonConfig.devDependencies) { - mergeTypings(getOwnKeys(jsonConfig.devDependencies)); - } - if (jsonConfig.optionalDependencies) { - mergeTypings(getOwnKeys(jsonConfig.optionalDependencies)); - } - if (jsonConfig.peerDependencies) { - mergeTypings(getOwnKeys(jsonConfig.peerDependencies)); + + filesToWatch.push(jsonPath); + const jsonConfig: PackageJson = readConfigFile(jsonPath, (path: string) => host.readFile(path)).config; + addInferredTypingsFromKeys(jsonConfig.dependencies); + addInferredTypingsFromKeys(jsonConfig.devDependencies); + addInferredTypingsFromKeys(jsonConfig.optionalDependencies); + addInferredTypingsFromKeys(jsonConfig.peerDependencies); + + function addInferredTypingsFromKeys(map: MapLike | undefined): void { + for (const key in map) { + if (ts.hasProperty(map, key)) { + addInferredTyping(key); + } + } } } @@ -185,17 +178,22 @@ namespace ts.JsTyping { * @param fileNames are the names for source files in the project */ function getTypingNamesFromSourceFileNames(fileNames: string[]) { - const jsFileNames = filter(fileNames, hasJavaScriptFileExtension); - const inferredTypingNames = map(jsFileNames, f => removeFileExtension(getBaseFileName(f.toLowerCase()))); - const cleanedTypingNames = map(inferredTypingNames, f => f.replace(/((?:\.|-)min(?=\.|$))|((?:-|\.)\d+)/g, "")); - if (safeList !== EmptySafeList) { - mergeTypings(ts.mapDefined(cleanedTypingNames, f => safeList.get(f))); + for (const j of fileNames) { + if (!hasJavaScriptFileExtension(j)) continue; + + const inferredTypingName = removeFileExtension(getBaseFileName(j.toLowerCase())); + const cleanedTypingName = inferredTypingName.replace(/((?:\.|-)min(?=\.|$))|((?:-|\.)\d+)/g, ""); + const safe = safeList.get(cleanedTypingName); + if (safe !== undefined) { + addInferredTyping(safe); + } + } } const hasJsxFile = forEach(fileNames, f => ensureScriptKind(f, getScriptKindFromFileName(f)) === ScriptKind.JSX); if (hasJsxFile) { - mergeTypings(["react"]); + addInferredTyping("react"); } } @@ -203,7 +201,7 @@ namespace ts.JsTyping { * Infer typing names from packages folder (ex: node_module, bower_components) * @param packagesFolderPath is the path to the packages folder */ - function getTypingNamesFromPackagesFolder(packagesFolderPath: string) { + function getTypingNamesFromPackagesFolder(packagesFolderPath: string, filesToWatch: Push) { filesToWatch.push(packagesFolderPath); // Todo: add support for ModuleResolutionHost too @@ -211,7 +209,6 @@ namespace ts.JsTyping { return; } - const typingNames: string[] = []; const fileNames = host.readDirectory(packagesFolderPath, [".json"], /*excludes*/ undefined, /*includes*/ undefined, /*depth*/ 2); for (const fileName of fileNames) { const normalizedFileName = normalizePath(fileName); @@ -240,10 +237,9 @@ namespace ts.JsTyping { inferredTypings.set(packageJson.name, absolutePath); } else { - typingNames.push(packageJson.name); + addInferredTyping(packageJson.name); } } - mergeTypings(typingNames); } } From 4f1ae1a40630aafba09e0e9b1c20d9d9b36f2aad Mon Sep 17 00:00:00 2001 From: Maxwell Paul Brickner Date: Fri, 23 Jun 2017 15:51:12 -0400 Subject: [PATCH 25/62] Updated links to use https and avoid redirects Howdy! I updated some links to use https instead of http. www.typescriptlang.org/playground/ now redirects to www.typescriptlang.org/play/ Thank you for your time! ^ _ ^ --- README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 053d036411e..23829a74d39 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [![Join the chat at https://gitter.im/Microsoft/TypeScript](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Microsoft/TypeScript?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) -[TypeScript](http://www.typescriptlang.org/) is a language for application-scale JavaScript. TypeScript adds optional types, classes, and modules to JavaScript. TypeScript supports tools for large-scale JavaScript applications for any browser, for any host, on any OS. TypeScript compiles to readable, standards-based JavaScript. Try it out at the [playground](http://www.typescriptlang.org/Playground), and stay up to date via [our blog](https://blogs.msdn.microsoft.com/typescript) and [Twitter account](https://twitter.com/typescriptlang). +[TypeScript](https://www.typescriptlang.org/) is a language for application-scale JavaScript. TypeScript adds optional types, classes, and modules to JavaScript. TypeScript supports tools for large-scale JavaScript applications for any browser, for any host, on any OS. TypeScript compiles to readable, standards-based JavaScript. Try it out at the [playground](https://www.typescriptlang.org/play/), and stay up to date via [our blog](https://blogs.msdn.microsoft.com/typescript) and [Twitter account](https://twitter.com/typescriptlang). ## Installing @@ -27,8 +27,8 @@ npm install -g typescript@next There are many ways to [contribute](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md) to TypeScript. * [Submit bugs](https://github.com/Microsoft/TypeScript/issues) and help us verify fixes as they are checked in. * Review the [source code changes](https://github.com/Microsoft/TypeScript/pulls). -* Engage with other TypeScript users and developers on [StackOverflow](http://stackoverflow.com/questions/tagged/typescript). -* Join the [#typescript](http://twitter.com/#!/search/realtime/%23typescript) discussion on Twitter. +* Engage with other TypeScript users and developers on [StackOverflow](https://stackoverflow.com/questions/tagged/typescript). +* Join the [#typescript](https://twitter.com/#!/search/realtime/%23typescript) discussion on Twitter. * [Contribute bug fixes](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md). * Read the language specification ([docx](https://github.com/Microsoft/TypeScript/blob/master/doc/TypeScript%20Language%20Specification.docx?raw=true), [pdf](https://github.com/Microsoft/TypeScript/blob/master/doc/TypeScript%20Language%20Specification.pdf?raw=true), [md](https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md)). @@ -39,14 +39,14 @@ with any additional questions or comments. ## Documentation -* [Quick tutorial](http://www.typescriptlang.org/docs/tutorial.html) -* [Programming handbook](http://www.typescriptlang.org/docs/handbook/basic-types.html) +* [Quick tutorial](https://www.typescriptlang.org/docs/tutorial.html) +* [Programming handbook](https://www.typescriptlang.org/docs/handbook/basic-types.html) * [Language specification](https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md) -* [Homepage](http://www.typescriptlang.org/) +* [Homepage](https://www.typescriptlang.org/) ## Building -In order to build the TypeScript compiler, ensure that you have [Git](http://git-scm.com/downloads) and [Node.js](http://nodejs.org/) installed. +In order to build the TypeScript compiler, ensure that you have [Git](https://git-scm.com/downloads) and [Node.js](https://nodejs.org/) installed. Clone a copy of the repo: From 962aee93cd5369cab3622c33c36b95e26392310b Mon Sep 17 00:00:00 2001 From: Herrington Darkholme Date: Mon, 26 Jun 2017 13:32:29 +0800 Subject: [PATCH 26/62] fix #16702: polish type predicate error message --- src/compiler/checker.ts | 2 +- src/compiler/diagnosticMessages.json | 4 ++-- tests/baselines/reference/typeGuardFunctionErrors.errors.txt | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index cc661ec869c..ac0ec995d79 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -8517,7 +8517,7 @@ namespace ts { } else if (isIdentifierTypePredicate(target.typePredicate)) { if (reportErrors) { - errorReporter(Diagnostics.Signature_0_must_have_a_type_predicate, signatureToString(source)); + errorReporter(Diagnostics.Signature_0_must_be_a_type_predicate, signatureToString(source)); } return Ternary.False; } diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index c5c90dc6278..1fd434abf4c 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -707,7 +707,7 @@ "category": "Error", "code": 1223 }, - "Signature '{0}' must have a type predicate.": { + "Signature '{0}' must be a type predicate.": { "category": "Error", "code": 1224 }, @@ -3637,7 +3637,7 @@ "category": "Message", "code": 90025 }, - + "Convert function to an ES2015 class": { "category": "Message", "code": 95001 diff --git a/tests/baselines/reference/typeGuardFunctionErrors.errors.txt b/tests/baselines/reference/typeGuardFunctionErrors.errors.txt index b9d884939bd..63442a93b6b 100644 --- a/tests/baselines/reference/typeGuardFunctionErrors.errors.txt +++ b/tests/baselines/reference/typeGuardFunctionErrors.errors.txt @@ -27,7 +27,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(74,46) Type 'C' is not assignable to type 'B'. Property 'propB' is missing in type 'C'. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(78,1): error TS2322: Type '(p1: any, p2: any) => boolean' is not assignable to type '(p1: any, p2: any) => p1 is A'. - Signature '(p1: any, p2: any): boolean' must have a type predicate. + Signature '(p1: any, p2: any): boolean' must be a type predicate. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(84,1): error TS2322: Type '(p1: any, p2: any) => p2 is A' is not assignable to type '(p1: any, p2: any) => p1 is A'. Type predicate 'p2 is A' is not assignable to 'p1 is A'. Parameter 'p2' is not in the same position as parameter 'p1'. @@ -194,7 +194,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(136,39 assign1 = function(p1, p2): boolean { ~~~~~~~ !!! error TS2322: Type '(p1: any, p2: any) => boolean' is not assignable to type '(p1: any, p2: any) => p1 is A'. -!!! error TS2322: Signature '(p1: any, p2: any): boolean' must have a type predicate. +!!! error TS2322: Signature '(p1: any, p2: any): boolean' must be a type predicate. return true; }; From b52747e12c7444512eb73a03737e83d8a92bc9ba Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Mon, 26 Jun 2017 10:54:18 -0700 Subject: [PATCH 27/62] Add property comments as well --- src/services/refactors/convertFunctionToEs6Class.ts | 4 +++- tests/cases/fourslash/convertFunctionToEs6ClassJsDoc.ts | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/services/refactors/convertFunctionToEs6Class.ts b/src/services/refactors/convertFunctionToEs6Class.ts index 925f0856a3f..745ba6d15bf 100644 --- a/src/services/refactors/convertFunctionToEs6Class.ts +++ b/src/services/refactors/convertFunctionToEs6Class.ts @@ -197,8 +197,10 @@ namespace ts.refactor { if (isSourceFileJavaScript(sourceFile)) { return; } - return createProperty(/*decorators*/ undefined, modifiers, memberDeclaration.name, /*questionToken*/ undefined, + const prop = createProperty(/*decorators*/ undefined, modifiers, memberDeclaration.name, /*questionToken*/ undefined, /*type*/ undefined, assignmentBinaryExpression.right); + copyComments(assignmentBinaryExpression.parent, prop); + return prop; } } } diff --git a/tests/cases/fourslash/convertFunctionToEs6ClassJsDoc.ts b/tests/cases/fourslash/convertFunctionToEs6ClassJsDoc.ts index afa4c6acf3e..87ee2a738c2 100644 --- a/tests/cases/fourslash/convertFunctionToEs6ClassJsDoc.ts +++ b/tests/cases/fourslash/convertFunctionToEs6ClassJsDoc.ts @@ -3,6 +3,7 @@ // @allowNonTsExtensions: true // @Filename: test123.js //// function fn() { +//// /** neat! */ //// this.x = 100; //// } //// @@ -16,6 +17,7 @@ verify.fileAfterApplyingRefactorAtMarker('1', `class fn { constructor() { + /** neat! */ this.x = 100; } /** From 61af3157789ada079f96f84031f0ca2524d5efae Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Mon, 26 Jun 2017 10:55:04 -0700 Subject: [PATCH 28/62] respond to comments --- src/services/formatting/formatting.ts | 78 +++++++++---------- src/services/formatting/formattingContext.ts | 8 ++ src/services/formatting/rules.ts | 2 +- src/services/textChanges.ts | 2 +- .../formatOnEnterOpenBraceAddNewLine.ts | 6 ++ .../semicolonFormattingNestedStatements.ts | 2 +- 6 files changed, 53 insertions(+), 45 deletions(-) diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index 4ede9da335b..86935fb3984 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -97,23 +97,21 @@ namespace ts.formatting { } export function formatOnSemicolon(position: number, sourceFile: SourceFile, rulesProvider: RulesProvider, options: FormatCodeSettings): TextChange[] { - const outermostParent = findOutermostParentWithinListLevelFromPosition(position, SyntaxKind.SemicolonToken, sourceFile); - return formatOutermostParent(outermostParent, sourceFile, options, rulesProvider, FormattingRequestKind.FormatOnSemicolon); + const semicolon = findImmediatelyPrecedingTokenOfKind(position, SyntaxKind.SemicolonToken, sourceFile); + return formatOutermostNodeWithinListLevel(semicolon, sourceFile, options, rulesProvider, FormattingRequestKind.FormatOnSemicolon); } export function formatOnOpeningCurly(position: number, sourceFile: SourceFile, rulesProvider: RulesProvider, options: FormatCodeSettings): TextChange[] { - const openingCurly = findPrecedingTokenOfKind(position, SyntaxKind.FirstPunctuation, sourceFile); - const block = openingCurly && openingCurly.parent; - if (!(block && isBlock(block))) { - return []; - } - const outermostParent = findOutermostParentWithinListLevel(block); - return formatOutermostParent(outermostParent, sourceFile, options, rulesProvider, FormattingRequestKind.FormatOnOpeningCurlyBrace); + const openingCurly = findImmediatelyPrecedingTokenOfKind(position, SyntaxKind.OpenBraceToken, sourceFile); + const curlyBraceRange = openingCurly && openingCurly.parent; + return curlyBraceRange ? + formatOutermostNodeWithinListLevel(curlyBraceRange, sourceFile, options, rulesProvider, FormattingRequestKind.FormatOnOpeningCurlyBrace) : + []; } export function formatOnClosingCurly(position: number, sourceFile: SourceFile, rulesProvider: RulesProvider, options: FormatCodeSettings): TextChange[] { - const outermostParent = findOutermostParentWithinListLevelFromPosition(position, SyntaxKind.CloseBraceToken, sourceFile); - return formatOutermostParent(outermostParent, sourceFile, options, rulesProvider, FormattingRequestKind.FormatOnClosingCurlyBrace); + const precedingToken = findImmediatelyPrecedingTokenOfKind(position, SyntaxKind.CloseBraceToken, sourceFile); + return formatOutermostNodeWithinListLevel(precedingToken, sourceFile, options, rulesProvider, FormattingRequestKind.FormatOnClosingCurlyBrace); } export function formatDocument(sourceFile: SourceFile, rulesProvider: RulesProvider, options: FormatCodeSettings): TextChange[] { @@ -133,38 +131,21 @@ namespace ts.formatting { return formatSpan(span, sourceFile, options, rulesProvider, FormattingRequestKind.FormatSelection); } - function formatOutermostParent(parent: Node | undefined, sourceFile: SourceFile, options: FormatCodeSettings, rulesProvider: RulesProvider, requestKind: FormattingRequestKind): TextChange[] { - if (!parent) { - return []; - } + /** + * Validating `expectedLastToken` ensures the token was typed in the context we expect (eg: not a comment). + * @param expectedLastToken The last token constituting the desired parent node. + */ + function findImmediatelyPrecedingTokenOfKind(end: number, expectedTokenKind: SyntaxKind, sourceFile: SourceFile): Node | undefined { + const precedingToken = findPrecedingToken(end, sourceFile); - const span = { - pos: getLineStartPositionForPosition(parent.getStart(sourceFile), sourceFile), - end: parent.end - }; - - return formatSpan(span, sourceFile, options, rulesProvider, requestKind); - } - - function findPrecedingTokenOfKind(position: number, expectedTokenKind: SyntaxKind, sourceFile: SourceFile): Node | undefined { - const precedingToken = findPrecedingToken(position, sourceFile); - - return precedingToken && precedingToken.kind === expectedTokenKind && position === precedingToken.getEnd() ? + return precedingToken && precedingToken.kind === expectedTokenKind && end === precedingToken.getEnd() ? precedingToken : undefined; } /** - * Validating `expectedLastToken` ensures the token was typed in the context we expect (eg: not a comment). - * @param expectedLastToken The last token constituting the desired parent node. - */ - function findOutermostParentWithinListLevelFromPosition(position: number, expectedLastToken: SyntaxKind, sourceFile: SourceFile) { - const precedingToken = findPrecedingTokenOfKind(position, expectedLastToken, sourceFile); - return precedingToken && findOutermostParentWithinListLevel(precedingToken); - } - - /** - * Finds the outermost parent within the same list level as the token at position. + * Finds and formats the highest node enclosing `position` whose end does not exceed the given position + * and is at the same list level as the token at `position`. * * Consider typing the following * ``` @@ -175,18 +156,18 @@ namespace ts.formatting { * Upon typing the closing curly, we want to format the entire `while`-statement, but not the preceding * variable declaration. */ - function findOutermostParentWithinListLevel(token: Node): Node { + function formatOutermostNodeWithinListLevel(node: Node, sourceFile: SourceFile, options: FormatCodeSettings, rulesProvider: RulesProvider, formattingRequestKind: FormattingRequestKind) { // If we walk upwards searching for the parent that has the same end value, we'll end up with the whole source file. // `isListElement` allows to stop on the list element level. - let current = token; + let current = node; while (current && current.parent && - current.parent.end === token.end && + current.parent.end === node.end && !isListElement(current.parent, current)) { current = current.parent; } - return current; + return formatNodeLines(current, sourceFile, options, rulesProvider, formattingRequestKind); } // Returns true if node is a element in some list in parent @@ -338,7 +319,7 @@ namespace ts.formatting { } /* @internal */ - export function formatNode(node: Node, sourceFileLike: SourceFileLike, languageVariant: LanguageVariant, initialIndentation: number, delta: number, rulesProvider: RulesProvider): TextChange[] { + export function formatNodeGivenIndentation(node: Node, sourceFileLike: SourceFileLike, languageVariant: LanguageVariant, initialIndentation: number, delta: number, rulesProvider: RulesProvider): TextChange[] { const range = { pos: 0, end: sourceFileLike.text.length }; return formatSpanWorker( range, @@ -353,6 +334,19 @@ namespace ts.formatting { sourceFileLike); } + function formatNodeLines(node: Node, sourceFile: SourceFile, options: FormatCodeSettings, rulesProvider: RulesProvider, requestKind: FormattingRequestKind): TextChange[] { + if (!node) { + return []; + } + + const span = { + pos: getLineStartPositionForPosition(node.getStart(sourceFile), sourceFile), + end: node.end + }; + + return formatSpan(span, sourceFile, options, rulesProvider, requestKind); + } + function formatSpan(originalRange: TextRange, sourceFile: SourceFile, options: FormatCodeSettings, diff --git a/src/services/formatting/formattingContext.ts b/src/services/formatting/formattingContext.ts index fd79481173e..043df72f434 100644 --- a/src/services/formatting/formattingContext.ts +++ b/src/services/formatting/formattingContext.ts @@ -47,6 +47,14 @@ namespace ts.formatting { return this.contextNodeAllOnSameLine; } + public NextNodeAllOnSameLine(): boolean { + if (this.nextNodeAllOnSameLine === undefined) { + this.nextNodeAllOnSameLine = this.NodeIsOnOneLine(this.nextTokenParent); + } + + return this.nextNodeAllOnSameLine; + } + public TokensAreOnSameLine(): boolean { if (this.tokensAreOnSameLine === undefined) { const startLine = this.sourceFile.getLineAndCharacterOfPosition(this.currentTokenSpan.pos).line; diff --git a/src/services/formatting/rules.ts b/src/services/formatting/rules.ts index d490741d27b..51d2c0a7f40 100644 --- a/src/services/formatting/rules.ts +++ b/src/services/formatting/rules.ts @@ -654,7 +654,7 @@ namespace ts.formatting { // This check is done before an open brace in a control construct, a function, or a typescript block declaration static IsBeforeMultilineBlockContext(context: FormattingContext): boolean { - return Rules.IsBeforeBlockContext(context) && !(context.NextNodeBlockIsOnOneLine()); + return Rules.IsBeforeBlockContext(context) && !(context.NextNodeAllOnSameLine() || context.NextNodeBlockIsOnOneLine()); } static IsMultilineBlockContext(context: FormattingContext): boolean { diff --git a/src/services/textChanges.ts b/src/services/textChanges.ts index 5aa4ebca7d0..1cd5580ec9d 100644 --- a/src/services/textChanges.ts +++ b/src/services/textChanges.ts @@ -512,7 +512,7 @@ namespace ts.textChanges { lineMap, getLineAndCharacterOfPosition: pos => computeLineAndCharacterOfPosition(lineMap, pos) }; - const changes = formatting.formatNode(nonFormattedText.node, file, sourceFile.languageVariant, initialIndentation, delta, rulesProvider); + const changes = formatting.formatNodeGivenIndentation(nonFormattedText.node, file, sourceFile.languageVariant, initialIndentation, delta, rulesProvider); return applyChanges(nonFormattedText.text, changes); } diff --git a/tests/cases/fourslash/formatOnEnterOpenBraceAddNewLine.ts b/tests/cases/fourslash/formatOnEnterOpenBraceAddNewLine.ts index 63276d3ce7c..c5045717df5 100644 --- a/tests/cases/fourslash/formatOnEnterOpenBraceAddNewLine.ts +++ b/tests/cases/fourslash/formatOnEnterOpenBraceAddNewLine.ts @@ -7,6 +7,12 @@ format.setOption("PlaceOpenBraceOnNewLineForControlBlocks", true); goTo.marker("0"); edit.insertLine(""); +verify.currentFileContentIs( +`if (true) +{ +} +if(false){ +}`); goTo.marker("1"); edit.insertLine(""); verify.currentFileContentIs( diff --git a/tests/cases/fourslash/semicolonFormattingNestedStatements.ts b/tests/cases/fourslash/semicolonFormattingNestedStatements.ts index 20d49a35f47..9e7d0643d08 100644 --- a/tests/cases/fourslash/semicolonFormattingNestedStatements.ts +++ b/tests/cases/fourslash/semicolonFormattingNestedStatements.ts @@ -11,7 +11,7 @@ goTo.marker("innermost"); edit.insert(";"); -// Adding smicolon should format the innermost statement +// Adding semicolon should format the innermost statement verify.currentLineContentIs(' var x = 0;'); // Also should format any parent statement that is terminated by the semicolon From aeb5264b74658c976165699db1489bdc65675533 Mon Sep 17 00:00:00 2001 From: Andy Date: Mon, 26 Jun 2017 11:10:57 -0700 Subject: [PATCH 29/62] Consistently use variable mangledScopedPackageSeparator instead of magic "__" string (#16713) --- src/compiler/moduleNameResolver.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/moduleNameResolver.ts b/src/compiler/moduleNameResolver.ts index 4ea590977e1..63cfc84b3d6 100644 --- a/src/compiler/moduleNameResolver.ts +++ b/src/compiler/moduleNameResolver.ts @@ -995,7 +995,7 @@ namespace ts { export function getPackageNameFromAtTypesDirectory(mangledName: string): string { const withoutAtTypePrefix = removePrefix(mangledName, "@types/"); if (withoutAtTypePrefix !== mangledName) { - return withoutAtTypePrefix.indexOf("__") !== -1 ? + return withoutAtTypePrefix.indexOf(mangledScopedPackageSeparator) !== -1 ? "@" + withoutAtTypePrefix.replace(mangledScopedPackageSeparator, ts.directorySeparator) : withoutAtTypePrefix; } From c5f6c4fac086bb73b8e277f9572bbb5b9684c0a5 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Mon, 26 Jun 2017 11:21:16 -0700 Subject: [PATCH 30/62] remove unecessary check --- src/services/formatting/formatting.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index 86935fb3984..f6eaa812f45 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -104,9 +104,7 @@ namespace ts.formatting { export function formatOnOpeningCurly(position: number, sourceFile: SourceFile, rulesProvider: RulesProvider, options: FormatCodeSettings): TextChange[] { const openingCurly = findImmediatelyPrecedingTokenOfKind(position, SyntaxKind.OpenBraceToken, sourceFile); const curlyBraceRange = openingCurly && openingCurly.parent; - return curlyBraceRange ? - formatOutermostNodeWithinListLevel(curlyBraceRange, sourceFile, options, rulesProvider, FormattingRequestKind.FormatOnOpeningCurlyBrace) : - []; + return formatOutermostNodeWithinListLevel(curlyBraceRange, sourceFile, options, rulesProvider, FormattingRequestKind.FormatOnOpeningCurlyBrace); } export function formatOnClosingCurly(position: number, sourceFile: SourceFile, rulesProvider: RulesProvider, options: FormatCodeSettings): TextChange[] { From 18357543c6651c28ec7428fe4e1de46bce0a78ca Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 27 Jun 2017 09:14:23 -0700 Subject: [PATCH 31/62] Provide better services for incomplete generic calls (#16535) * Provide better services for incomplete generic calls * Use clearer name * Remove `inferredAnyDefaultTypeArgument` and `getBestGuessSignature`; have `resolveSignature` always get the best signature if !produceDiagnostics * Update names and comments --- src/compiler/checker.ts | 104 +++++++++----- src/compiler/types.ts | 10 +- src/compiler/utilities.ts | 5 + src/services/completions.ts | 2 +- src/services/signatureHelp.ts | 134 +++++------------- src/services/utilities.ts | 4 +- .../fourslash/automaticConstructorToggling.ts | 4 +- ...nForQuotedPropertyInPropertyAssignment4.ts | 8 +- ...completionInfoWithExplicitTypeArguments.ts | 22 +++ .../genericFunctionSignatureHelp1.ts | 2 +- .../genericFunctionSignatureHelp2.ts | 2 +- .../genericFunctionSignatureHelp3.ts | 2 +- .../genericFunctionSignatureHelp3MultiFile.ts | 2 +- tests/cases/fourslash/genericParameterHelp.ts | 2 +- .../signatureHelpExplicitTypeArguments.ts | 21 +++ .../signatureHelpInCompleteGenericsCall.ts | 2 +- .../fourslash/staticGenericOverloads1.ts | 2 +- 17 files changed, 180 insertions(+), 148 deletions(-) create mode 100644 tests/cases/fourslash/completionInfoWithExplicitTypeArguments.ts create mode 100644 tests/cases/fourslash/signatureHelpExplicitTypeArguments.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index cc661ec869c..3fa4d7440b2 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -75,6 +75,9 @@ namespace ts { undefinedSymbol.declarations = []; const argumentsSymbol = createSymbol(SymbolFlags.Property, "arguments"); + /** This will be set during calls to `getResolvedSignature` where services determines an apparent number of arguments greater than what is actually provided. */ + let apparentArgumentCount: number | undefined; + // for public members that accept a Node or one of its subtypes, we must guard against // synthetic nodes created during transformations by calling `getParseTreeNode`. // for most of these, we perform the guard only on `checker` to avoid any possible @@ -160,9 +163,12 @@ namespace ts { return node ? getContextualType(node) : undefined; }, getFullyQualifiedName, - getResolvedSignature: (node, candidatesOutArray?) => { + getResolvedSignature: (node, candidatesOutArray, theArgumentCount) => { node = getParseTreeNode(node, isCallLikeExpression); - return node ? getResolvedSignature(node, candidatesOutArray) : undefined; + apparentArgumentCount = theArgumentCount; + const res = node ? getResolvedSignature(node, candidatesOutArray) : undefined; + apparentArgumentCount = undefined; + return res; }, getConstantValue: node => { node = getParseTreeNode(node, canHaveConstantValue); @@ -6313,12 +6319,12 @@ namespace ts { // If a type parameter does not have a default type, or if the default type // is a forward reference, the empty object type is used. for (let i = numTypeArguments; i < numTypeParameters; i++) { - typeArguments[i] = isJavaScript ? anyType : emptyObjectType; + typeArguments[i] = getDefaultTypeArgumentType(isJavaScript); } for (let i = numTypeArguments; i < numTypeParameters; i++) { const mapper = createTypeMapper(typeParameters, typeArguments); const defaultType = getDefaultFromTypeParameter(typeParameters[i]); - typeArguments[i] = defaultType ? instantiateType(defaultType, mapper) : isJavaScript ? anyType : emptyObjectType; + typeArguments[i] = defaultType ? instantiateType(defaultType, mapper) : getDefaultTypeArgumentType(isJavaScript); } } } @@ -7968,7 +7974,8 @@ namespace ts { }; } - function createTypeMapper(sources: Type[], targets: Type[]): TypeMapper { + function createTypeMapper(sources: TypeParameter[], targets: Type[]): TypeMapper { + Debug.assert(targets === undefined || sources.length === targets.length); const mapper: TypeMapper = sources.length === 1 ? makeUnaryTypeMapper(sources[0], targets ? targets[0] : anyType) : sources.length === 2 ? makeBinaryTypeMapper(sources[0], targets ? targets[0] : anyType, sources[1], targets ? targets[1] : anyType) : makeArrayTypeMapper(sources, targets); @@ -7976,7 +7983,7 @@ namespace ts { return mapper; } - function createTypeEraser(sources: Type[]): TypeMapper { + function createTypeEraser(sources: TypeParameter[]): TypeMapper { return createTypeMapper(sources, /*targets*/ undefined); } @@ -10628,7 +10635,7 @@ namespace ts { context)); } else { - inferredType = context.flags & InferenceFlags.AnyDefault ? anyType : emptyObjectType; + inferredType = getDefaultTypeArgumentType(!!(context.flags & InferenceFlags.AnyDefault)); } } inference.inferredType = inferredType; @@ -10644,6 +10651,10 @@ namespace ts { return inferredType; } + function getDefaultTypeArgumentType(isInJavaScriptFile: boolean): Type { + return isInJavaScriptFile ? anyType : emptyObjectType; + } + function getInferredTypes(context: InferenceContext): Type[] { const result: Type[] = []; for (let i = 0; i < context.inferences.length; i++) { @@ -12787,7 +12798,9 @@ namespace ts { const args = getEffectiveCallArguments(callTarget); const argIndex = indexOf(args, arg); if (argIndex >= 0) { - const signature = getResolvedOrAnySignature(callTarget); + // If we're already in the process of resolving the given signature, don't resolve again as + // that could cause infinite recursion. Instead, return anySignature. + const signature = getNodeLinks(callTarget).resolvedSignature === resolvingSignature ? resolvingSignature : getResolvedSignature(callTarget); return getTypeAtPosition(signature, argIndex); } return undefined; @@ -14962,16 +14975,14 @@ namespace ts { } function inferTypeArguments(node: CallLikeExpression, signature: Signature, args: Expression[], excludeArgument: boolean[], context: InferenceContext): Type[] { - const inferences = context.inferences; - // Clear out all the inference results from the last time inferTypeArguments was called on this context - for (let i = 0; i < inferences.length; i++) { + for (const inference of context.inferences) { // As an optimization, we don't have to clear (and later recompute) inferred types // for type parameters that have already been fixed on the previous call to inferTypeArguments. // It would be just as correct to reset all of them. But then we'd be repeating the same work // for the type parameters that were fixed, namely the work done by getInferredType. - if (!inferences[i].isFixed) { - inferences[i].inferredType = undefined; + if (!inference.isFixed) { + inference.inferredType = undefined; } } @@ -15640,19 +15651,34 @@ namespace ts { } // No signature was applicable. We have already reported the errors for the invalid signature. - // If this is a type resolution session, e.g. Language Service, try to get better information that anySignature. - // Pick the first candidate that matches the arity. This way we can get a contextual type for cases like: - // declare function f(a: { xa: number; xb: number; }); - // f({ | + // If this is a type resolution session, e.g. Language Service, try to get better information than anySignature. + // Pick the longest signature. This way we can get a contextual type for cases like: + // declare function f(a: { xa: number; xb: number; }, b: number); + // f({ | + // Also, use explicitly-supplied type arguments if they are provided, so we can get a contextual signature in cases like: + // declare function f(k: keyof T); + // f(" if (!produceDiagnostics) { - for (let candidate of candidates) { - if (hasCorrectArity(node, args, candidate)) { - if (candidate.typeParameters && typeArguments) { - candidate = getSignatureInstantiation(candidate, map(typeArguments, getTypeFromTypeNode)); - } - return candidate; + Debug.assert(candidates.length > 0); // Else would have exited above. + const bestIndex = getLongestCandidateIndex(candidates, apparentArgumentCount === undefined ? args.length : apparentArgumentCount); + const candidate = candidates[bestIndex]; + + const { typeParameters } = candidate; + if (typeParameters && callLikeExpressionMayHaveTypeArguments(node) && node.typeArguments) { + const typeArguments = node.typeArguments.map(getTypeOfNode); + while (typeArguments.length > typeParameters.length) { + typeArguments.pop(); } + while (typeArguments.length < typeParameters.length) { + typeArguments.push(getDefaultTypeArgumentType(isInJavaScriptFile(node))); + } + + const instantiated = createSignatureInstantiation(candidate, typeArguments); + candidates[bestIndex] = instantiated; + return instantiated; } + + return candidate; } return resolveErrorCall(node); @@ -15660,7 +15686,8 @@ namespace ts { function chooseOverload(candidates: Signature[], relation: Map, signatureHelpTrailingComma = false) { candidateForArgumentError = undefined; candidateForTypeArgumentError = undefined; - for (const originalCandidate of candidates) { + for (let candidateIndex = 0; candidateIndex < candidates.length; candidateIndex++) { + const originalCandidate = candidates[candidateIndex]; if (!hasCorrectArity(node, args, originalCandidate, signatureHelpTrailingComma)) { continue; } @@ -15692,6 +15719,7 @@ namespace ts { } const index = excludeArgument ? indexOf(excludeArgument, /*value*/ true) : -1; if (index < 0) { + candidates[candidateIndex] = candidate; return candidate; } excludeArgument[index] = false; @@ -15703,6 +15731,24 @@ namespace ts { } + function getLongestCandidateIndex(candidates: Signature[], argsCount: number): number { + let maxParamsIndex = -1; + let maxParams = -1; + + for (let i = 0; i < candidates.length; i++) { + const candidate = candidates[i]; + if (candidate.hasRestParameter || candidate.parameters.length >= argsCount) { + return i; + } + if (candidate.parameters.length > maxParams) { + maxParams = candidate.parameters.length; + maxParamsIndex = i; + } + } + + return maxParamsIndex; + } + function resolveCallExpression(node: CallExpression, candidatesOutArray: Signature[]): Signature { if (node.expression.kind === SyntaxKind.SuperKeyword) { const superType = checkSuperExpression(node.expression); @@ -16017,9 +16063,7 @@ namespace ts { const callSignatures = elementType && getSignaturesOfType(elementType, SignatureKind.Call); if (callSignatures && callSignatures.length > 0) { - let callSignature: Signature; - callSignature = resolveCall(openingLikeElement, callSignatures, candidatesOutArray); - return callSignature; + return resolveCall(openingLikeElement, callSignatures, candidatesOutArray); } return undefined; @@ -16069,12 +16113,6 @@ namespace ts { return result; } - function getResolvedOrAnySignature(node: CallLikeExpression) { - // If we're already in the process of resolving the given signature, don't resolve again as - // that could cause infinite recursion. Instead, return anySignature. - return getNodeLinks(node).resolvedSignature === resolvingSignature ? resolvingSignature : getResolvedSignature(node); - } - /** * Indicates whether a declaration can be treated as a constructor in a JavaScript * file. diff --git a/src/compiler/types.ts b/src/compiler/types.ts index ac64624e1a6..5c959d3736e 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -2587,7 +2587,11 @@ namespace ts { getAugmentedPropertiesOfType(type: Type): Symbol[]; getRootSymbols(symbol: Symbol): Symbol[]; getContextualType(node: Expression): Type | undefined; - getResolvedSignature(node: CallLikeExpression, candidatesOutArray?: Signature[]): Signature | undefined; + /** + * returns unknownSignature in the case of an error. Don't know when it returns undefined. + * @param argumentCount Apparent number of arguments, passed in case of a possibly incomplete call. This should come from an ArgumentListInfo. See `signatureHelp.ts`. + */ + getResolvedSignature(node: CallLikeExpression, candidatesOutArray?: Signature[], argumentCount?: number): Signature | undefined; getSignatureFromDeclaration(declaration: SignatureDeclaration): Signature | undefined; isImplementationOfOverload(node: FunctionLikeDeclaration): boolean | undefined; isUndefinedSymbol(symbol: Symbol): boolean; @@ -3382,8 +3386,8 @@ namespace ts { /* @internal */ export interface TypeMapper { (t: TypeParameter): Type; - mappedTypes?: Type[]; // Types mapped by this mapper - instantiations?: Type[]; // Cache of instantiations created using this type mapper. + mappedTypes?: TypeParameter[]; // Types mapped by this mapper + instantiations?: Type[]; // Cache of instantiations created using this type mapper. } export const enum InferencePriority { diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 77d1a0c6496..d9926204989 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -4688,6 +4688,11 @@ namespace ts { // All node tests in the following list should *not* reference parent pointers so that // they may be used with transformations. namespace ts { + /* @internal */ + export function isSyntaxList(n: Node): n is SyntaxList { + return n.kind === SyntaxKind.SyntaxList; + } + /* @internal */ export function isNode(node: Node) { return isNodeKind(node.kind); diff --git a/src/services/completions.ts b/src/services/completions.ts index 8492c2d8f40..410ba636d7b 100644 --- a/src/services/completions.ts +++ b/src/services/completions.ts @@ -234,7 +234,7 @@ namespace ts.Completions { const entries: CompletionEntry[] = []; const uniques = createMap(); - typeChecker.getResolvedSignature(argumentInfo.invocation, candidates); + typeChecker.getResolvedSignature(argumentInfo.invocation, candidates, argumentInfo.argumentCount); for (const candidate of candidates) { addStringLiteralCompletionsFromType(typeChecker.getParameterType(candidate, argumentInfo.argumentIndex), entries, typeChecker, uniques); diff --git a/src/services/signatureHelp.ts b/src/services/signatureHelp.ts index b250ad49467..785c5b0ab74 100644 --- a/src/services/signatureHelp.ts +++ b/src/services/signatureHelp.ts @@ -15,6 +15,7 @@ namespace ts.SignatureHelp { invocation: CallLikeExpression; argumentsSpan: TextSpan; argumentIndex?: number; + /** argumentCount is the *apparent* number of arguments. */ argumentCount: number; } @@ -29,17 +30,14 @@ namespace ts.SignatureHelp { } const argumentInfo = getContainingArgumentInfo(startingToken, position, sourceFile); + if (!argumentInfo) return undefined; cancellationToken.throwIfCancellationRequested(); // Semantic filtering of signature help - if (!argumentInfo) { - return undefined; - } - const call = argumentInfo.invocation; - const candidates = []; - const resolvedSignature = typeChecker.getResolvedSignature(call, candidates); + const candidates: Signature[] = []; + const resolvedSignature = typeChecker.getResolvedSignature(call, candidates, argumentInfo.argumentCount); cancellationToken.throwIfCancellationRequested(); if (!candidates.length) { @@ -101,7 +99,10 @@ namespace ts.SignatureHelp { */ export function getImmediatelyContainingArgumentInfo(node: Node, position: number, sourceFile: SourceFile): ArgumentListInfo { if (isCallOrNewExpression(node.parent)) { - const callExpression = node.parent; + const invocation = node.parent; + let list: Node; + let argumentIndex: number; + // There are 3 cases to handle: // 1. The token introduces a list, and should begin a signature help session // 2. The token is either not associated with a list, or ends a list, so the session should end @@ -116,48 +117,30 @@ namespace ts.SignatureHelp { // Case 3: // foo(a#, #b#) -> The token is buried inside a list, and should give signature help // Find out if 'node' is an argument, a type argument, or neither - if (node.kind === SyntaxKind.LessThanToken || - node.kind === SyntaxKind.OpenParenToken) { + if (node.kind === SyntaxKind.LessThanToken || node.kind === SyntaxKind.OpenParenToken) { // Find the list that starts right *after* the < or ( token. // If the user has just opened a list, consider this item 0. - const list = getChildListThatStartsWithOpenerToken(callExpression, node, sourceFile); - const isTypeArgList = callExpression.typeArguments && callExpression.typeArguments.pos === list.pos; + list = getChildListThatStartsWithOpenerToken(invocation, node, sourceFile); Debug.assert(list !== undefined); - return { - kind: isTypeArgList ? ArgumentListKind.TypeArguments : ArgumentListKind.CallArguments, - invocation: callExpression, - argumentsSpan: getApplicableSpanForArguments(list, sourceFile), - argumentIndex: 0, - argumentCount: getArgumentCount(list) - }; + argumentIndex = 0; + } + else { + // findListItemInfo can return undefined if we are not in parent's argument list + // or type argument list. This includes cases where the cursor is: + // - To the right of the closing parenthesis, non-substitution template, or template tail. + // - Between the type arguments and the arguments (greater than token) + // - On the target of the call (parent.func) + // - On the 'new' keyword in a 'new' expression + list = findContainingList(node); + if (!list) return undefined; + argumentIndex = getArgumentIndex(list, node); } - // findListItemInfo can return undefined if we are not in parent's argument list - // or type argument list. This includes cases where the cursor is: - // - To the right of the closing parenthesis, non-substitution template, or template tail. - // - Between the type arguments and the arguments (greater than token) - // - On the target of the call (parent.func) - // - On the 'new' keyword in a 'new' expression - const listItemInfo = findListItemInfo(node); - if (listItemInfo) { - const list = listItemInfo.list; - const isTypeArgList = callExpression.typeArguments && callExpression.typeArguments.pos === list.pos; - - const argumentIndex = getArgumentIndex(list, node); - const argumentCount = getArgumentCount(list); - - Debug.assert(argumentIndex === 0 || argumentIndex < argumentCount, - `argumentCount < argumentIndex, ${argumentCount} < ${argumentIndex}`); - - return { - kind: isTypeArgList ? ArgumentListKind.TypeArguments : ArgumentListKind.CallArguments, - invocation: callExpression, - argumentsSpan: getApplicableSpanForArguments(list, sourceFile), - argumentIndex: argumentIndex, - argumentCount: argumentCount - }; - } - return undefined; + const kind = invocation.typeArguments && invocation.typeArguments.pos === list.pos ? ArgumentListKind.TypeArguments : ArgumentListKind.CallArguments; + const argumentCount = getArgumentCount(list); + Debug.assert(argumentIndex === 0 || argumentIndex < argumentCount, `argumentCount < argumentIndex, ${argumentCount} < ${argumentIndex}`); + const argumentsSpan = getApplicableSpanForArguments(list, sourceFile); + return { kind, invocation, argumentsSpan, argumentIndex, argumentCount }; } else if (node.kind === SyntaxKind.NoSubstitutionTemplateLiteral && node.parent.kind === SyntaxKind.TaggedTemplateExpression) { // Check if we're actually inside the template; @@ -294,8 +277,8 @@ namespace ts.SignatureHelp { kind: ArgumentListKind.TaggedTemplateArguments, invocation: tagExpression, argumentsSpan: getApplicableSpanForTaggedTemplate(tagExpression, sourceFile), - argumentIndex: argumentIndex, - argumentCount: argumentCount + argumentIndex, + argumentCount }; } @@ -367,38 +350,10 @@ namespace ts.SignatureHelp { return children[indexOfOpenerToken + 1]; } - /** - * The selectedItemIndex could be negative for several reasons. - * 1. There are too many arguments for all of the overloads - * 2. None of the overloads were type compatible - * The solution here is to try to pick the best overload by picking - * either the first one that has an appropriate number of parameters, - * or the one with the most parameters. - */ - function selectBestInvalidOverloadIndex(candidates: Signature[], argumentCount: number): number { - let maxParamsSignatureIndex = -1; - let maxParams = -1; - for (let i = 0; i < candidates.length; i++) { - const candidate = candidates[i]; - - if (candidate.hasRestParameter || candidate.parameters.length >= argumentCount) { - return i; - } - - if (candidate.parameters.length > maxParams) { - maxParams = candidate.parameters.length; - maxParamsSignatureIndex = i; - } - } - - return maxParamsSignatureIndex; - } - - function createSignatureHelpItems(candidates: Signature[], bestSignature: Signature, argumentListInfo: ArgumentListInfo, typeChecker: TypeChecker): SignatureHelpItems { - const applicableSpan = argumentListInfo.argumentsSpan; + function createSignatureHelpItems(candidates: Signature[], resolvedSignature: Signature, argumentListInfo: ArgumentListInfo, typeChecker: TypeChecker): SignatureHelpItems { + const { argumentCount, argumentsSpan: applicableSpan, invocation, argumentIndex } = argumentListInfo; const isTypeParameterList = argumentListInfo.kind === ArgumentListKind.TypeArguments; - const invocation = argumentListInfo.invocation; const callTarget = getInvokedExpression(invocation); const callTargetSymbol = typeChecker.getSymbolAtLocation(callTarget); const callTargetDisplayParts = callTargetSymbol && symbolToDisplayParts(typeChecker, callTargetSymbol, /*enclosingDeclaration*/ undefined, /*meaning*/ undefined); @@ -415,7 +370,8 @@ namespace ts.SignatureHelp { if (isTypeParameterList) { isVariadic = false; // type parameter lists are not variadic prefixDisplayParts.push(punctuationPart(SyntaxKind.LessThanToken)); - const typeParameters = candidateSignature.typeParameters; + // Use `.mapper` to ensure we get the generic type arguments even if this is an instantiated version of the signature. + const typeParameters = candidateSignature.mapper ? candidateSignature.mapper.mappedTypes : candidateSignature.typeParameters; signatureHelpParameters = typeParameters && typeParameters.length > 0 ? map(typeParameters, createSignatureHelpParameterForTypeParameter) : emptyArray; suffixDisplayParts.push(punctuationPart(SyntaxKind.GreaterThanToken)); const parameterParts = mapToDisplayParts(writer => @@ -429,8 +385,7 @@ namespace ts.SignatureHelp { addRange(prefixDisplayParts, typeParameterParts); prefixDisplayParts.push(punctuationPart(SyntaxKind.OpenParenToken)); - const parameters = candidateSignature.parameters; - signatureHelpParameters = parameters.length > 0 ? map(parameters, createSignatureHelpParameterForParameter) : emptyArray; + signatureHelpParameters = map(candidateSignature.parameters, createSignatureHelpParameterForParameter); suffixDisplayParts.push(punctuationPart(SyntaxKind.CloseParenToken)); } @@ -449,25 +404,12 @@ namespace ts.SignatureHelp { }; }); - const argumentIndex = argumentListInfo.argumentIndex; - - // argumentCount is the *apparent* number of arguments. - const argumentCount = argumentListInfo.argumentCount; - - let selectedItemIndex = candidates.indexOf(bestSignature); - if (selectedItemIndex < 0) { - selectedItemIndex = selectBestInvalidOverloadIndex(candidates, argumentCount); - } - Debug.assert(argumentIndex === 0 || argumentIndex < argumentCount, `argumentCount < argumentIndex, ${argumentCount} < ${argumentIndex}`); - return { - items, - applicableSpan, - selectedItemIndex, - argumentIndex, - argumentCount - }; + const selectedItemIndex = candidates.indexOf(resolvedSignature); + Debug.assert(selectedItemIndex !== -1); // If candidates is non-empty it should always include bestSignature. We check for an empty candidates before calling this function. + + return { items, applicableSpan, selectedItemIndex, argumentIndex, argumentCount }; function createSignatureHelpParameterForParameter(parameter: Symbol): SignatureHelpParameter { const displayParts = mapToDisplayParts(writer => diff --git a/src/services/utilities.ts b/src/services/utilities.ts index d48caf6f36f..1f137e8d3cd 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -588,14 +588,14 @@ namespace ts { return forEach(n.getChildren(sourceFile), c => c.kind === kind && c); } - export function findContainingList(node: Node): Node { + export function findContainingList(node: Node): SyntaxList | undefined { // The node might be a list element (nonsynthetic) or a comma (synthetic). Either way, it will // be parented by the container of the SyntaxList, not the SyntaxList itself. // In order to find the list item index, we first need to locate SyntaxList itself and then search // for the position of the relevant node (or comma). const syntaxList = forEach(node.parent.getChildren(), c => { // find syntax list that covers the span of the node - if (c.kind === SyntaxKind.SyntaxList && c.pos <= node.pos && c.end >= node.end) { + if (isSyntaxList(c) && c.pos <= node.pos && c.end >= node.end) { return c; } }); diff --git a/tests/cases/fourslash/automaticConstructorToggling.ts b/tests/cases/fourslash/automaticConstructorToggling.ts index fd33b943fea..647a564c526 100644 --- a/tests/cases/fourslash/automaticConstructorToggling.ts +++ b/tests/cases/fourslash/automaticConstructorToggling.ts @@ -20,7 +20,7 @@ verify.quickInfos({ Asig: "constructor A(): A", Bsig: "constructor B(val: string): B", Csig: "constructor C(val: string): C", - Dsig: "constructor D(val: T): D" // Cannot resolve signature + Dsig: "constructor D(val: string): D" // Cannot resolve signature. Still fill in generics based on explicit type arguments. }); goTo.marker(C); @@ -29,7 +29,7 @@ verify.quickInfos({ Asig: "constructor A(): A", Bsig: "constructor B(val: string): B", Csig: "constructor C(): C", // Cannot resolve signature - Dsig: "constructor D(val: T): D" // Cannot resolve signature + Dsig: "constructor D(val: string): D" // Cannot resolve signature }); goTo.marker(D); diff --git a/tests/cases/fourslash/completionForQuotedPropertyInPropertyAssignment4.ts b/tests/cases/fourslash/completionForQuotedPropertyInPropertyAssignment4.ts index e785a1a7657..703e6738098 100644 --- a/tests/cases/fourslash/completionForQuotedPropertyInPropertyAssignment4.ts +++ b/tests/cases/fourslash/completionForQuotedPropertyInPropertyAssignment4.ts @@ -15,10 +15,10 @@ goTo.marker('0'); verify.completionListContains("jspm"); -verify.completionListAllowsNewIdentifier(); -verify.completionListCount(1); +//verify.completionListAllowsNewIdentifier(); +//verify.completionListCount(1); -goTo.marker('1'); +/*goTo.marker('1'); verify.completionListContains("jspm:dev"); verify.completionListAllowsNewIdentifier(); -verify.completionListCount(4); +verify.completionListCount(4);*/ diff --git a/tests/cases/fourslash/completionInfoWithExplicitTypeArguments.ts b/tests/cases/fourslash/completionInfoWithExplicitTypeArguments.ts new file mode 100644 index 00000000000..6951614298e --- /dev/null +++ b/tests/cases/fourslash/completionInfoWithExplicitTypeArguments.ts @@ -0,0 +1,22 @@ +/// + +// Note: Giving the functions two parameters means that the checker cannot resolve their signatures normally, +// so it makes a best guess. + +////interface I { x: number; y: number; } +//// +////declare function f(x: T, y: number): void; +////f({ /*f*/ }); +//// +////declare function g(x: keyof T, y: number): void; +////g("/*g*/"); + +goTo.marker("f"); +verify.completionListCount(2); +verify.completionListContains("x"); +verify.completionListContains("y"); + +goTo.marker("g"); +verify.completionListContains("x"); +verify.completionListContains("y"); +verify.completionListCount(2); diff --git a/tests/cases/fourslash/genericFunctionSignatureHelp1.ts b/tests/cases/fourslash/genericFunctionSignatureHelp1.ts index fc1e45d7e6b..202f56adc0a 100644 --- a/tests/cases/fourslash/genericFunctionSignatureHelp1.ts +++ b/tests/cases/fourslash/genericFunctionSignatureHelp1.ts @@ -4,4 +4,4 @@ ////f(/**/ goTo.marker(); -verify.currentSignatureHelpIs('f(a: T): T'); +verify.currentSignatureHelpIs('f(a: {}): {}'); diff --git a/tests/cases/fourslash/genericFunctionSignatureHelp2.ts b/tests/cases/fourslash/genericFunctionSignatureHelp2.ts index 77511677588..1486983a2e9 100644 --- a/tests/cases/fourslash/genericFunctionSignatureHelp2.ts +++ b/tests/cases/fourslash/genericFunctionSignatureHelp2.ts @@ -4,4 +4,4 @@ ////f(/**/ goTo.marker(); -verify.currentSignatureHelpIs('f(a: T): T'); +verify.currentSignatureHelpIs('f(a: {}): {}'); diff --git a/tests/cases/fourslash/genericFunctionSignatureHelp3.ts b/tests/cases/fourslash/genericFunctionSignatureHelp3.ts index c5a5f62a0a9..5d4275d6ef9 100644 --- a/tests/cases/fourslash/genericFunctionSignatureHelp3.ts +++ b/tests/cases/fourslash/genericFunctionSignatureHelp3.ts @@ -29,7 +29,7 @@ verify.currentSignatureHelpIs('foo3(x: number, callback: (y3: T) => number): // verify.currentSignatureHelpIs('foo4(x: number, callback: (y4: string) => number): void'); goTo.marker('5'); -verify.currentSignatureHelpIs('foo5(x: number, callback: (y5: T) => number): void'); +verify.currentSignatureHelpIs('foo5(x: number, callback: (y5: string) => number): void'); goTo.marker('6'); // verify.currentSignatureHelpIs('foo6(x: number, callback: (y6: {}) => number): void'); diff --git a/tests/cases/fourslash/genericFunctionSignatureHelp3MultiFile.ts b/tests/cases/fourslash/genericFunctionSignatureHelp3MultiFile.ts index 6eadb92f47d..b82d5e10664 100644 --- a/tests/cases/fourslash/genericFunctionSignatureHelp3MultiFile.ts +++ b/tests/cases/fourslash/genericFunctionSignatureHelp3MultiFile.ts @@ -36,7 +36,7 @@ verify.currentSignatureHelpIs('foo3(x: number, callback: (y3: T) => number): // verify.currentSignatureHelpIs('foo4(x: number, callback: (y4: string) => number): void'); goTo.marker('5'); -verify.currentSignatureHelpIs('foo5(x: number, callback: (y5: T) => number): void'); +verify.currentSignatureHelpIs('foo5(x: number, callback: (y5: string) => number): void'); goTo.marker('6'); // verify.currentSignatureHelpIs('foo6(x: number, callback: (y6: {}) => number): void'); diff --git a/tests/cases/fourslash/genericParameterHelp.ts b/tests/cases/fourslash/genericParameterHelp.ts index 6bbb957f0f9..6a0b8a19bfd 100644 --- a/tests/cases/fourslash/genericParameterHelp.ts +++ b/tests/cases/fourslash/genericParameterHelp.ts @@ -26,7 +26,7 @@ goTo.marker("3"); verify.currentParameterHelpArgumentNameIs("a"); -verify.currentParameterSpanIs("a: T"); +verify.currentParameterSpanIs("a: any"); goTo.marker("4"); verify.currentParameterHelpArgumentNameIs("M"); diff --git a/tests/cases/fourslash/signatureHelpExplicitTypeArguments.ts b/tests/cases/fourslash/signatureHelpExplicitTypeArguments.ts new file mode 100644 index 00000000000..d5c68e41354 --- /dev/null +++ b/tests/cases/fourslash/signatureHelpExplicitTypeArguments.ts @@ -0,0 +1,21 @@ +/// + +////declare function f(x: T, y: U): T; +////f(/*1*/); +////f(/*2*/); +////f(/*3*/); +////f(/*4*/); + +goTo.marker("1"); +verify.currentSignatureHelpIs("f(x: number, y: string): number"); + +goTo.marker("2"); +verify.currentSignatureHelpIs("f(x: T, y: U): T"); + +goTo.marker("3"); +// too few -- fill in rest with {} +verify.currentSignatureHelpIs("f(x: number, y: {}): number"); + +goTo.marker("4"); +// too many -- ignore extra type arguments +verify.currentSignatureHelpIs("f(x: number, y: string): number"); diff --git a/tests/cases/fourslash/signatureHelpInCompleteGenericsCall.ts b/tests/cases/fourslash/signatureHelpInCompleteGenericsCall.ts index 12036cd6db6..0bcde9a2aa1 100644 --- a/tests/cases/fourslash/signatureHelpInCompleteGenericsCall.ts +++ b/tests/cases/fourslash/signatureHelpInCompleteGenericsCall.ts @@ -5,4 +5,4 @@ ////foo(/*1*/ goTo.marker('1'); -verify.currentSignatureHelpIs("foo(x: number, callback: (x: T) => number): void"); \ No newline at end of file +verify.currentSignatureHelpIs("foo(x: number, callback: (x: {}) => number): void"); \ No newline at end of file diff --git a/tests/cases/fourslash/staticGenericOverloads1.ts b/tests/cases/fourslash/staticGenericOverloads1.ts index 56f358dd951..547e8d5d2bf 100644 --- a/tests/cases/fourslash/staticGenericOverloads1.ts +++ b/tests/cases/fourslash/staticGenericOverloads1.ts @@ -17,6 +17,6 @@ edit.insert('a'); verify.signatureHelpCountIs(2); // verify.currentSignatureHelpIs('B(v: A): A') edit.insert('); A.B('); -verify.currentSignatureHelpIs('B(v: A): A'); +verify.currentSignatureHelpIs('B(v: A<{}>): A<{}>'); edit.insert('a'); // verify.currentSignatureHelpIs('B(v: A): A') From e52b996484770dc2c051e9735f33dac8b0697713 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Tue, 27 Jun 2017 13:45:41 -0700 Subject: [PATCH 32/62] Fix gulp & types for gulp to 3 (#16771) --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 5b11935992f..5a3bc7ad58c 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "@types/convert-source-map": "latest", "@types/del": "latest", "@types/glob": "latest", - "@types/gulp": "latest", + "@types/gulp": "3.X", "@types/gulp-concat": "latest", "@types/gulp-help": "latest", "@types/gulp-newer": "latest", @@ -52,7 +52,7 @@ "chai": "latest", "convert-source-map": "latest", "del": "latest", - "gulp": "latest", + "gulp": "3.X", "gulp-clone": "latest", "gulp-concat": "latest", "gulp-help": "latest", From a5c8a29fa4a64854d4f497c6152f74598487f723 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Wed, 28 Jun 2017 12:48:14 -0700 Subject: [PATCH 33/62] only format opencurly if no intervening tokens --- src/services/formatting/formatting.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index f6eaa812f45..aa127621b58 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -104,7 +104,10 @@ namespace ts.formatting { export function formatOnOpeningCurly(position: number, sourceFile: SourceFile, rulesProvider: RulesProvider, options: FormatCodeSettings): TextChange[] { const openingCurly = findImmediatelyPrecedingTokenOfKind(position, SyntaxKind.OpenBraceToken, sourceFile); const curlyBraceRange = openingCurly && openingCurly.parent; - return formatOutermostNodeWithinListLevel(curlyBraceRange, sourceFile, options, rulesProvider, FormattingRequestKind.FormatOnOpeningCurlyBrace); + const nextToken = curlyBraceRange && findNextToken(openingCurly, curlyBraceRange); + return nextToken && nextToken.kind === SyntaxKind.CloseBraceToken ? + formatOutermostNodeWithinListLevel(curlyBraceRange, sourceFile, options, rulesProvider, FormattingRequestKind.FormatOnOpeningCurlyBrace) : + []; } export function formatOnClosingCurly(position: number, sourceFile: SourceFile, rulesProvider: RulesProvider, options: FormatCodeSettings): TextChange[] { @@ -130,8 +133,8 @@ namespace ts.formatting { } /** - * Validating `expectedLastToken` ensures the token was typed in the context we expect (eg: not a comment). - * @param expectedLastToken The last token constituting the desired parent node. + * Validating `expectedTokenKind` ensures the token was typed in the context we expect (eg: not a comment). + * @param expectedTokenKind The kind of the last token constituting the desired parent node. */ function findImmediatelyPrecedingTokenOfKind(end: number, expectedTokenKind: SyntaxKind, sourceFile: SourceFile): Node | undefined { const precedingToken = findPrecedingToken(end, sourceFile); @@ -142,8 +145,8 @@ namespace ts.formatting { } /** - * Finds and formats the highest node enclosing `position` whose end does not exceed the given position - * and is at the same list level as the token at `position`. + * Finds and formats the highest node enclosing `node` whose end does not exceed the `node.end` + * and is at the same list level as the token at `node`. * * Consider typing the following * ``` From 42e08f5578012b5eaa3875f81250d2eff1aad406 Mon Sep 17 00:00:00 2001 From: Andy Date: Wed, 28 Jun 2017 12:53:12 -0700 Subject: [PATCH 34/62] findAllRefs: Find string references inside of template strings (#16723) --- src/compiler/utilities.ts | 13 +++++++++++++ src/services/utilities.ts | 2 +- tests/cases/fourslash/renameCommentsAndStrings4.ts | 9 +++++++-- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index d9926204989..5f87dc7487f 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -4743,6 +4743,19 @@ namespace ts { || kind === SyntaxKind.TemplateTail; } + export function isStringTextContainingNode(node: Node) { + switch (node.kind) { + case SyntaxKind.StringLiteral: + case SyntaxKind.TemplateHead: + case SyntaxKind.TemplateMiddle: + case SyntaxKind.TemplateTail: + case SyntaxKind.NoSubstitutionTemplateLiteral: + return true; + default: + return false; + } + } + // Identifiers /* @internal */ diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 1f137e8d3cd..089e2de2b29 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -787,7 +787,7 @@ namespace ts { export function isInString(sourceFile: SourceFile, position: number): boolean { const previousToken = findPrecedingToken(position, sourceFile); - if (previousToken && previousToken.kind === SyntaxKind.StringLiteral) { + if (previousToken && isStringTextContainingNode(previousToken)) { const start = previousToken.getStart(); const end = previousToken.getEnd(); diff --git a/tests/cases/fourslash/renameCommentsAndStrings4.ts b/tests/cases/fourslash/renameCommentsAndStrings4.ts index b3975209fc4..eab53149d6d 100644 --- a/tests/cases/fourslash/renameCommentsAndStrings4.ts +++ b/tests/cases/fourslash/renameCommentsAndStrings4.ts @@ -2,9 +2,14 @@ /////// -////function /**/[|Bar|]() { +////function [|Bar|]() { //// // This is a reference to [|Bar|] in a comment. -//// "this is a reference to [|Bar|] in a string" +//// "this is a reference to [|Bar|] in a string"; +//// `Foo [|Bar|] Baz.`; +//// { +//// const Bar = 0; +//// `[|Bar|] ba ${Bar} bara [|Bar|] berbobo ${Bar} araura [|Bar|] ara!`; +//// } ////} const ranges = test.ranges(); From 9260a399a32ffde33c0e774dd5f129866c241ab2 Mon Sep 17 00:00:00 2001 From: Andy Date: Wed, 28 Jun 2017 12:53:43 -0700 Subject: [PATCH 35/62] Remove duplicate switch cases (#16721) --- src/compiler/program.ts | 2 -- src/compiler/utilities.ts | 2 -- src/compiler/visitor.ts | 4 ---- src/services/services.ts | 1 - 4 files changed, 9 deletions(-) diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 2f6b0539872..46c4cd3aab4 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -1137,7 +1137,6 @@ namespace ts { case SyntaxKind.FunctionExpression: case SyntaxKind.FunctionDeclaration: case SyntaxKind.ArrowFunction: - case SyntaxKind.FunctionDeclaration: case SyntaxKind.VariableDeclaration: // type annotation if ((parent).type === node) { @@ -1202,7 +1201,6 @@ namespace ts { case SyntaxKind.FunctionExpression: case SyntaxKind.FunctionDeclaration: case SyntaxKind.ArrowFunction: - case SyntaxKind.FunctionDeclaration: // Check type parameters if (nodes === (parent).typeParameters) { diagnostics.push(createDiagnosticForNodeArray(nodes, Diagnostics.type_parameter_declarations_can_only_be_used_in_a_ts_file)); diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 5f87dc7487f..3d7e8c529b8 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -1155,7 +1155,6 @@ namespace ts { export function isPartOfExpression(node: Node): boolean { switch (node.kind) { - case SyntaxKind.ThisKeyword: case SyntaxKind.SuperKeyword: case SyntaxKind.NullKeyword: case SyntaxKind.TrueKeyword: @@ -1224,7 +1223,6 @@ namespace ts { case SyntaxKind.SwitchStatement: case SyntaxKind.CaseClause: case SyntaxKind.ThrowStatement: - case SyntaxKind.SwitchStatement: return (parent).expression === node; case SyntaxKind.ForStatement: const forStatement = parent; diff --git a/src/compiler/visitor.ts b/src/compiler/visitor.ts index 391fa88c79d..7a476c098cf 100644 --- a/src/compiler/visitor.ts +++ b/src/compiler/visitor.ts @@ -1148,10 +1148,6 @@ namespace ts { result = reduceNode((node).type, cbNode, result); break; - case SyntaxKind.NonNullExpression: - result = reduceNode((node).expression, cbNode, result); - break; - // Misc case SyntaxKind.TemplateSpan: result = reduceNode((node).expression, cbNode, result); diff --git a/src/services/services.ts b/src/services/services.ts index b508285b182..ed84967719b 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -657,7 +657,6 @@ namespace ts { case SyntaxKind.ImportEqualsDeclaration: case SyntaxKind.ExportSpecifier: case SyntaxKind.ImportSpecifier: - case SyntaxKind.ImportEqualsDeclaration: case SyntaxKind.ImportClause: case SyntaxKind.NamespaceImport: case SyntaxKind.GetAccessor: From eae234cab2c8f18f4b296c1483eb5366bb036721 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Wed, 28 Jun 2017 12:48:57 -0700 Subject: [PATCH 36/62] disable spaceBeforeOpenCurly if newline rule is enabled --- src/services/formatting/rules.ts | 10 +++++++--- ...wLine.ts => formatOnOpenCurlyBraceRemoveNewLine.ts} | 4 ++-- 2 files changed, 9 insertions(+), 5 deletions(-) rename tests/cases/fourslash/{formatOnEnterOpenBraceRemoveNewLine.ts => formatOnOpenCurlyBraceRemoveNewLine.ts} (84%) diff --git a/src/services/formatting/rules.ts b/src/services/formatting/rules.ts index 51d2c0a7f40..15bbf5041d3 100644 --- a/src/services/formatting/rules.ts +++ b/src/services/formatting/rules.ts @@ -290,15 +290,15 @@ namespace ts.formatting { // Place a space before open brace in a function declaration this.FunctionOpenBraceLeftTokenRange = Shared.TokenRange.AnyIncludingMultilineComments; - this.SpaceBeforeOpenBraceInFunction = new Rule(RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, SyntaxKind.OpenBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsBeforeBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeBlockContext), RuleAction.Space), RuleFlags.CanDeleteNewLines); + this.SpaceBeforeOpenBraceInFunction = new Rule(RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, SyntaxKind.OpenBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.isOptionDisabledOrUndefinedOrTokensOnSameLine("placeOpenBraceOnNewLineForFunctions"), Rules.IsFunctionDeclContext, Rules.IsBeforeBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeBlockContext), RuleAction.Space), RuleFlags.CanDeleteNewLines); // Place a space before open brace in a TypeScript declaration that has braces as children (class, module, enum, etc) this.TypeScriptOpenBraceLeftTokenRange = Shared.TokenRange.FromTokens([SyntaxKind.Identifier, SyntaxKind.MultiLineCommentTrivia, SyntaxKind.ClassKeyword, SyntaxKind.ExportKeyword, SyntaxKind.ImportKeyword]); - this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock = new Rule(RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, SyntaxKind.OpenBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeBlockContext), RuleAction.Space), RuleFlags.CanDeleteNewLines); + this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock = new Rule(RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, SyntaxKind.OpenBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.isOptionDisabledOrUndefinedOrTokensOnSameLine("placeOpenBraceOnNewLineForFunctions"), Rules.IsTypeScriptDeclWithBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeBlockContext), RuleAction.Space), RuleFlags.CanDeleteNewLines); // Place a space before open brace in a control flow construct this.ControlOpenBraceLeftTokenRange = Shared.TokenRange.FromTokens([SyntaxKind.CloseParenToken, SyntaxKind.MultiLineCommentTrivia, SyntaxKind.DoKeyword, SyntaxKind.TryKeyword, SyntaxKind.FinallyKeyword, SyntaxKind.ElseKeyword]); - this.SpaceBeforeOpenBraceInControl = new Rule(RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, SyntaxKind.OpenBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsControlDeclContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeBlockContext), RuleAction.Space), RuleFlags.CanDeleteNewLines); + this.SpaceBeforeOpenBraceInControl = new Rule(RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, SyntaxKind.OpenBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.isOptionDisabledOrUndefinedOrTokensOnSameLine("placeOpenBraceOnNewLineForControlBlocks"), Rules.IsControlDeclContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeBlockContext), RuleAction.Space), RuleFlags.CanDeleteNewLines); // Insert a space after { and before } in single-line contexts, but remove space from empty object literals {}. this.SpaceAfterOpenBrace = new Rule(RuleDescriptor.create3(SyntaxKind.OpenBraceToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsOptionEnabledOrUndefined("insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces"), Rules.IsBraceWrappedContext), RuleAction.Space)); @@ -585,6 +585,10 @@ namespace ts.formatting { return (context) => !context.options || !context.options.hasOwnProperty(optionName) || !context.options[optionName]; } + static isOptionDisabledOrUndefinedOrTokensOnSameLine(optionName: keyof FormatCodeSettings): (context: FormattingContext) => boolean { + return (context) => !context.options || !context.options.hasOwnProperty(optionName) || !context.options[optionName] || context.TokensAreOnSameLine(); + } + static IsOptionEnabledOrUndefined(optionName: keyof FormatCodeSettings): (context: FormattingContext) => boolean { return (context) => !context.options || !context.options.hasOwnProperty(optionName) || !!context.options[optionName]; } diff --git a/tests/cases/fourslash/formatOnEnterOpenBraceRemoveNewLine.ts b/tests/cases/fourslash/formatOnOpenCurlyBraceRemoveNewLine.ts similarity index 84% rename from tests/cases/fourslash/formatOnEnterOpenBraceRemoveNewLine.ts rename to tests/cases/fourslash/formatOnOpenCurlyBraceRemoveNewLine.ts index 262a96daa42..ad6aa4da1db 100644 --- a/tests/cases/fourslash/formatOnEnterOpenBraceRemoveNewLine.ts +++ b/tests/cases/fourslash/formatOnOpenCurlyBraceRemoveNewLine.ts @@ -1,10 +1,10 @@ /// //// if(true) -//// /**/ +//// /**/ } format.setOption("PlaceOpenBraceOnNewLineForControlBlocks", false); goTo.marker(""); edit.insert("{"); verify.currentFileContentIs( - `if (true) {`); + `if (true) { }`); From 9013665e22821384107f837b864f8090ff34589b Mon Sep 17 00:00:00 2001 From: Andy Date: Wed, 28 Jun 2017 13:15:34 -0700 Subject: [PATCH 37/62] Replace FileMap with Map where there is no keyMapper (#16724) * Replace FileMap with Map where there is no keyMapper * Remove `toKey` and use `keyMapper` directly --- src/compiler/checker.ts | 6 +++--- src/compiler/core.ts | 14 +++++--------- src/compiler/moduleNameResolver.ts | 8 ++++---- src/compiler/program.ts | 12 ++++++------ src/harness/harness.ts | 12 ++++++------ src/harness/unittests/tsserverProjectSystem.ts | 16 ++++++++-------- src/server/builder.ts | 10 +++++----- src/server/editorServices.ts | 13 ++++++------- src/server/lsHost.ts | 10 +++++----- src/server/project.ts | 10 +++++----- src/services/documentRegistry.ts | 12 ++++++------ src/services/services.ts | 8 ++++---- src/services/textChanges.ts | 5 ++--- 13 files changed, 65 insertions(+), 71 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 4ce9d668412..64e61e15dfd 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -23266,10 +23266,10 @@ namespace ts { // this variable and functions that use it are deliberately moved here from the outer scope // to avoid scope pollution const resolvedTypeReferenceDirectives = host.getResolvedTypeReferenceDirectives(); - let fileToDirective: FileMap; + let fileToDirective: Map; if (resolvedTypeReferenceDirectives) { // populate reverse mapping: file path -> type reference directive that was resolved to this file - fileToDirective = createFileMap(); + fileToDirective = createMap(); resolvedTypeReferenceDirectives.forEach((resolvedDirective, key) => { if (!resolvedDirective) { return; @@ -23397,7 +23397,7 @@ namespace ts { // check that at least one declaration of top level symbol originates from type declaration file for (const decl of symbol.declarations) { const file = getSourceFileOfNode(decl); - if (fileToDirective.contains(file.path)) { + if (fileToDirective.has(file.path)) { return true; } } diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 7c9811c41c8..b51a6ef95e4 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -145,7 +145,7 @@ namespace ts { }; } - export function createFileMap(keyMapper?: (key: string) => string): FileMap { + export function createFileMap(keyMapper: (key: string) => string): FileMap { const files = createMap(); return { get, @@ -169,28 +169,24 @@ namespace ts { // path should already be well-formed so it does not need to be normalized function get(path: Path): T { - return files.get(toKey(path)); + return files.get(keyMapper(path)); } function set(path: Path, value: T) { - files.set(toKey(path), value); + files.set(keyMapper(path), value); } function contains(path: Path) { - return files.has(toKey(path)); + return files.has(keyMapper(path)); } function remove(path: Path) { - files.delete(toKey(path)); + files.delete(keyMapper(path)); } function clear() { files.clear(); } - - function toKey(path: Path): string { - return keyMapper ? keyMapper(path) : path; - } } export function toPath(fileName: string, basePath: string, getCanonicalFileName: (path: string) => string): Path { diff --git a/src/compiler/moduleNameResolver.ts b/src/compiler/moduleNameResolver.ts index 63cfc84b3d6..1d8eeba3565 100644 --- a/src/compiler/moduleNameResolver.ts +++ b/src/compiler/moduleNameResolver.ts @@ -306,7 +306,7 @@ namespace ts { } export function createModuleResolutionCache(currentDirectory: string, getCanonicalFileName: (s: string) => string): ModuleResolutionCache { - const directoryToModuleNameMap = createFileMap>(); + const directoryToModuleNameMap = createMap>(); const moduleNameToDirectoryMap = createMap(); return { getOrCreateCacheForDirectory, getOrCreateCacheForModuleName }; @@ -334,7 +334,7 @@ namespace ts { } function createPerModuleNameCache(): PerModuleNameCache { - const directoryPathMap = createFileMap(); + const directoryPathMap = createMap(); return { get, set }; @@ -356,7 +356,7 @@ namespace ts { function set(directory: string, result: ResolvedModuleWithFailedLookupLocations): void { const path = toPath(directory, currentDirectory, getCanonicalFileName); // if entry is already in cache do nothing - if (directoryPathMap.contains(path)) { + if (directoryPathMap.has(path)) { return; } directoryPathMap.set(path, result); @@ -370,7 +370,7 @@ namespace ts { let current = path; while (true) { const parent = getDirectoryPath(current); - if (parent === current || directoryPathMap.contains(parent)) { + if (parent === current || directoryPathMap.has(parent)) { break; } directoryPathMap.set(parent, result); diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 46c4cd3aab4..1d66eeaf34a 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -382,7 +382,7 @@ namespace ts { } interface DiagnosticCache { - perFile?: FileMap; + perFile?: Map; allDiagnostics?: Diagnostic[]; } @@ -472,7 +472,7 @@ namespace ts { resolveTypeReferenceDirectiveNamesWorker = (typeReferenceDirectiveNames, containingFile) => loadWithLocalCache(typeReferenceDirectiveNames, containingFile, loader); } - const filesByName = createFileMap(); + const filesByName = createMap(); // stores 'filename -> file association' ignoring case // used to track cases when two file names differ only in casing const filesByNameIgnoreCase = host.useCaseSensitiveFileNames() ? createFileMap(fileName => fileName.toLowerCase()) : undefined; @@ -1314,7 +1314,7 @@ namespace ts { const result = getDiagnostics(sourceFile, cancellationToken) || emptyArray; if (sourceFile) { if (!cache.perFile) { - cache.perFile = createFileMap(); + cache.perFile = createMap(); } cache.perFile.set(sourceFile.path, result); } @@ -1531,7 +1531,7 @@ namespace ts { // Get source file from normalized fileName function findSourceFile(fileName: string, path: Path, isDefaultLib: boolean, refFile?: SourceFile, refPos?: number, refEnd?: number): SourceFile { - if (filesByName.contains(path)) { + if (filesByName.has(path)) { const file = filesByName.get(path); // try to check if we've already seen this file but with a different casing in path // NOTE: this only makes sense for case-insensitive file systems @@ -1951,7 +1951,7 @@ namespace ts { // If the emit is enabled make sure that every output file is unique and not overwriting any of the input files if (!options.noEmit && !options.suppressOutputPathCheck) { const emitHost = getEmitHost(); - const emitFilesSeen = createFileMap(!host.useCaseSensitiveFileNames() ? key => key.toLocaleLowerCase() : undefined); + const emitFilesSeen = createFileMap(!host.useCaseSensitiveFileNames() ? key => key.toLocaleLowerCase() : key => key); forEachEmittedFile(emitHost, (emitFileNames) => { verifyEmitFilePath(emitFileNames.jsFilePath, emitFilesSeen); verifyEmitFilePath(emitFileNames.declarationFilePath, emitFilesSeen); @@ -1963,7 +1963,7 @@ namespace ts { if (emitFileName) { const emitFilePath = toPath(emitFileName, currentDirectory, getCanonicalFileName); // Report error if the output overwrites input file - if (filesByName.contains(emitFilePath)) { + if (filesByName.has(emitFilePath)) { let chain: DiagnosticMessageChain; if (!options.configFilePath) { // The program is from either an inferred project or an external project diff --git a/src/harness/harness.ts b/src/harness/harness.ts index d73290f961f..97d49ca134d 100644 --- a/src/harness/harness.ts +++ b/src/harness/harness.ts @@ -893,13 +893,13 @@ namespace Harness { const getCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitiveFileNames); /** Maps a symlink name to a realpath. Used only for exposing `realpath`. */ - const realPathMap = ts.createFileMap(); + const realPathMap = ts.createMap(); /** * Maps a file name to a source file. * This will have a different SourceFile for every symlink pointing to that file; * if the program resolves realpaths then symlink entries will be ignored. */ - const fileMap = ts.createFileMap(); + const fileMap = ts.createMap(); for (const file of inputFiles) { if (file.content !== undefined) { const fileName = ts.normalizePath(file.unitName); @@ -975,7 +975,7 @@ namespace Harness { getCanonicalFileName, useCaseSensitiveFileNames: () => useCaseSensitiveFileNames, getNewLine: () => newLine, - fileExists: fileName => fileMap.contains(toPath(fileName)), + fileExists: fileName => fileMap.has(toPath(fileName)), readFile: (fileName: string): string => { const file = fileMap.get(toPath(fileName)); if (ts.endsWith(fileName, "json")) { @@ -999,7 +999,7 @@ namespace Harness { getDirectories: d => { const path = ts.toPath(d, currentDirectory, getCanonicalFileName); const result: string[] = []; - fileMap.forEachValue(key => { + ts.forEachKey(fileMap, key => { if (key.indexOf(path) === 0 && key.lastIndexOf("/") > path.length) { let dirName = key.substr(path.length, key.indexOf("/", path.length + 1) - path.length); if (dirName[0] === "/") { @@ -1015,12 +1015,12 @@ namespace Harness { }; } - function mapHasFileInDirectory(directoryPath: ts.Path, map: ts.FileMap): boolean { + function mapHasFileInDirectory(directoryPath: ts.Path, map: ts.Map<{}>): boolean { if (!map) { return false; } let exists = false; - map.forEachValue(fileName => { + ts.forEachKey(map, fileName => { if (!exists && ts.startsWith(fileName, directoryPath) && fileName[directoryPath.length] === "/") { exists = true; } diff --git a/src/harness/unittests/tsserverProjectSystem.ts b/src/harness/unittests/tsserverProjectSystem.ts index 3284c131bae..2f6ba7aa3bb 100644 --- a/src/harness/unittests/tsserverProjectSystem.ts +++ b/src/harness/unittests/tsserverProjectSystem.ts @@ -261,9 +261,9 @@ namespace ts.projectSystem { return typeof (s).content === "string"; } - export function addFolder(fullPath: string, toPath: (s: string) => Path, fs: FileMap): Folder { + export function addFolder(fullPath: string, toPath: (s: string) => Path, fs: Map): Folder { const path = toPath(fullPath); - if (fs.contains(path)) { + if (fs.has(path)) { Debug.assert(isFolder(fs.get(path))); return (fs.get(path)); } @@ -370,7 +370,7 @@ namespace ts.projectSystem { private readonly output: string[] = []; - private fs: ts.FileMap; + private fs: Map; private getCanonicalFileName: (s: string) => string; private toPath: (f: string) => Path; private timeoutCallbacks = new Callbacks(); @@ -390,7 +390,7 @@ namespace ts.projectSystem { reloadFS(filesOrFolders: FileOrFolder[]) { this.filesOrFolders = filesOrFolders; - this.fs = createFileMap(); + this.fs = createMap(); // always inject safelist file in the list of files for (const fileOrFolder of filesOrFolders.concat(safeList)) { const path = this.toPath(fileOrFolder.path); @@ -408,12 +408,12 @@ namespace ts.projectSystem { fileExists(s: string) { const path = this.toPath(s); - return this.fs.contains(path) && isFile(this.fs.get(path)); + return this.fs.has(path) && isFile(this.fs.get(path)); } getFileSize(s: string) { const path = this.toPath(s); - if (this.fs.contains(path)) { + if (this.fs.has(path)) { const entry = this.fs.get(path); if (isFile(entry)) { return entry.fileSize ? entry.fileSize : entry.content.length; @@ -424,12 +424,12 @@ namespace ts.projectSystem { directoryExists(s: string) { const path = this.toPath(s); - return this.fs.contains(path) && isFolder(this.fs.get(path)); + return this.fs.has(path) && isFolder(this.fs.get(path)); } getDirectories(s: string) { const path = this.toPath(s); - if (!this.fs.contains(path)) { + if (!this.fs.has(path)) { return []; } else { diff --git a/src/server/builder.ts b/src/server/builder.ts index 895732ebece..7d35247e974 100644 --- a/src/server/builder.ts +++ b/src/server/builder.ts @@ -84,13 +84,13 @@ namespace ts.server { * NOTE: this field is created on demand and should not be accessed directly. * Use 'getFileInfos' instead. */ - private fileInfos_doNotAccessDirectly: FileMap; + private fileInfos_doNotAccessDirectly: Map; constructor(public readonly project: Project, private ctor: { new (scriptInfo: ScriptInfo, project: Project): T }) { } private getFileInfos() { - return this.fileInfos_doNotAccessDirectly || (this.fileInfos_doNotAccessDirectly = createFileMap()); + return this.fileInfos_doNotAccessDirectly || (this.fileInfos_doNotAccessDirectly = createMap()); } protected hasFileInfos() { @@ -117,7 +117,7 @@ namespace ts.server { } protected getFileInfoPaths(): Path[] { - return this.getFileInfos().getKeys(); + return arrayFrom(this.getFileInfos().keys() as Iterator); } protected setFileInfo(path: Path, info: T) { @@ -125,11 +125,11 @@ namespace ts.server { } protected removeFileInfo(path: Path) { - this.getFileInfos().remove(path); + this.getFileInfos().delete(path); } protected forEachFileInfo(action: (fileInfo: T) => any) { - this.getFileInfos().forEachValue((_path, value) => action(value)); + this.getFileInfos().forEach(action); } abstract getFilesAffectedBy(scriptInfo: ScriptInfo): string[]; diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index 649b5fd5a77..3edb880f620 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -343,7 +343,7 @@ namespace ts.server { /** * Container of all known scripts */ - private readonly filenameToScriptInfo = createFileMap(); + private readonly filenameToScriptInfo = createMap(); /** * maps external project file name to list of config files that were the part of this project */ @@ -568,7 +568,7 @@ namespace ts.server { if (info.containingProjects.length === 0) { // Orphan script info, remove it as we can always reload it on next open info.stopWatcher(); - this.filenameToScriptInfo.remove(info.path); + this.filenameToScriptInfo.delete(info.path); } else { // file has been changed which might affect the set of referenced files in projects that include @@ -588,7 +588,7 @@ namespace ts.server { // TODO: handle isOpen = true case if (!info.isScriptOpen()) { - this.filenameToScriptInfo.remove(info.path); + this.filenameToScriptInfo.delete(info.path); this.lastDeletedFile = info; // capture list of projects since detachAllProjects will wipe out original list @@ -852,14 +852,13 @@ namespace ts.server { } private deleteOrphanScriptInfoNotInAnyProject() { - for (const path of this.filenameToScriptInfo.getKeys()) { - const info = this.filenameToScriptInfo.get(path); + this.filenameToScriptInfo.forEach(info => { if (!info.isScriptOpen() && info.containingProjects.length === 0) { // if there are not projects that include this script info - delete it info.stopWatcher(); - this.filenameToScriptInfo.remove(info.path); + this.filenameToScriptInfo.delete(info.path); } - } + }); } /** diff --git a/src/server/lsHost.ts b/src/server/lsHost.ts index 79429737240..b8f9807139f 100644 --- a/src/server/lsHost.ts +++ b/src/server/lsHost.ts @@ -5,8 +5,8 @@ namespace ts.server { export class LSHost implements ts.LanguageServiceHost, ModuleResolutionHost { private compilationSettings: ts.CompilerOptions; - private readonly resolvedModuleNames = createFileMap>(); - private readonly resolvedTypeReferenceDirectives = createFileMap>(); + private readonly resolvedModuleNames = createMap>(); + private readonly resolvedTypeReferenceDirectives = createMap>(); private readonly getCanonicalFileName: (fileName: string) => string; private filesWithChangedSetOfUnresolvedImports: Path[]; @@ -65,7 +65,7 @@ namespace ts.server { private resolveNamesWithLocalCache( names: string[], containingFile: string, - cache: ts.FileMap>, + cache: Map>, loader: (name: string, containingFile: string, options: CompilerOptions, host: ModuleResolutionHost) => T, getResult: (s: T) => R, getResultFileName: (result: R) => string | undefined, @@ -231,8 +231,8 @@ namespace ts.server { } notifyFileRemoved(info: ScriptInfo) { - this.resolvedModuleNames.remove(info.path); - this.resolvedTypeReferenceDirectives.remove(info.path); + this.resolvedModuleNames.delete(info.path); + this.resolvedTypeReferenceDirectives.delete(info.path); } setCompilationSettings(opt: ts.CompilerOptions) { diff --git a/src/server/project.ts b/src/server/project.ts index ac040a77ace..d4544af5e59 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -58,7 +58,7 @@ namespace ts.server { } export class UnresolvedImportsMap { - readonly perFileMap = createFileMap>(); + readonly perFileMap = createMap>(); private version = 0; public clear() { @@ -71,7 +71,7 @@ namespace ts.server { } public remove(path: Path) { - this.perFileMap.remove(path); + this.perFileMap.delete(path); this.version++; } @@ -104,7 +104,7 @@ namespace ts.server { export abstract class Project { private rootFiles: ScriptInfo[] = []; - private rootFilesMap: FileMap = createFileMap(); + private rootFilesMap: Map = createMap(); private program: ts.Program; private externalFiles: SortedReadonlyArray; @@ -453,7 +453,7 @@ namespace ts.server { } isRoot(info: ScriptInfo) { - return this.rootFilesMap && this.rootFilesMap.contains(info.path); + return this.rootFilesMap && this.rootFilesMap.has(info.path); } // add a root file to project @@ -789,7 +789,7 @@ namespace ts.server { // remove a root file from project protected removeRoot(info: ScriptInfo): void { orderedRemoveItem(this.rootFiles, info); - this.rootFilesMap.remove(info.path); + this.rootFilesMap.delete(info.path); } } diff --git a/src/services/documentRegistry.ts b/src/services/documentRegistry.ts index fa1b50a6662..da9deb81468 100644 --- a/src/services/documentRegistry.ts +++ b/src/services/documentRegistry.ts @@ -105,17 +105,17 @@ namespace ts { export function createDocumentRegistry(useCaseSensitiveFileNames?: boolean, currentDirectory = ""): DocumentRegistry { // Maps from compiler setting target (ES3, ES5, etc.) to all the cached documents we have // for those settings. - const buckets = createMap>(); + const buckets = createMap>(); const getCanonicalFileName = createGetCanonicalFileName(!!useCaseSensitiveFileNames); function getKeyForCompilationSettings(settings: CompilerOptions): DocumentRegistryBucketKey { return `_${settings.target}|${settings.module}|${settings.noResolve}|${settings.jsx}|${settings.allowJs}|${settings.baseUrl}|${JSON.stringify(settings.typeRoots)}|${JSON.stringify(settings.rootDirs)}|${JSON.stringify(settings.paths)}`; } - function getBucketForCompilationSettings(key: DocumentRegistryBucketKey, createIfMissing: boolean): FileMap { + function getBucketForCompilationSettings(key: DocumentRegistryBucketKey, createIfMissing: boolean): Map { let bucket = buckets.get(key); if (!bucket && createIfMissing) { - buckets.set(key, bucket = createFileMap()); + buckets.set(key, bucket = createMap()); } return bucket; } @@ -124,9 +124,9 @@ namespace ts { const bucketInfoArray = arrayFrom(buckets.keys()).filter(name => name && name.charAt(0) === "_").map(name => { const entries = buckets.get(name); const sourceFiles: { name: string; refCount: number; references: string[]; }[] = []; - entries.forEachValue((key, entry) => { + entries.forEach((entry, name) => { sourceFiles.push({ - name: key, + name, refCount: entry.languageServiceRefCount, references: entry.owners.slice(0) }); @@ -222,7 +222,7 @@ namespace ts { Debug.assert(entry.languageServiceRefCount >= 0); if (entry.languageServiceRefCount === 0) { - bucket.remove(path); + bucket.delete(path); } } diff --git a/src/services/services.ts b/src/services/services.ts index ed84967719b..985107a2172 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -817,14 +817,14 @@ namespace ts { // at each language service public entry point, since we don't know when // the set of scripts handled by the host changes. class HostCache { - private fileNameToEntry: FileMap; + private fileNameToEntry: Map; private _compilationSettings: CompilerOptions; private currentDirectory: string; constructor(private host: LanguageServiceHost, getCanonicalFileName: (fileName: string) => string) { // script id => script index this.currentDirectory = host.getCurrentDirectory(); - this.fileNameToEntry = createFileMap(); + this.fileNameToEntry = createMap(); // Initialize the list with the root file names const rootFileNames = host.getScriptFileNames(); @@ -861,7 +861,7 @@ namespace ts { } public containsEntryByPath(path: Path): boolean { - return this.fileNameToEntry.contains(path); + return this.fileNameToEntry.has(path); } public getOrCreateEntryByPath(fileName: string, path: Path): HostFileInformation { @@ -873,7 +873,7 @@ namespace ts { public getRootFileNames(): string[] { const fileNames: string[] = []; - this.fileNameToEntry.forEachValue((_path, value) => { + this.fileNameToEntry.forEach(value => { if (value) { fileNames.push(value.hostFileName); } diff --git a/src/services/textChanges.ts b/src/services/textChanges.ts index 5aa4ebca7d0..0faccb19b9c 100644 --- a/src/services/textChanges.ts +++ b/src/services/textChanges.ts @@ -415,7 +415,7 @@ namespace ts.textChanges { } public getChanges(): FileTextChanges[] { - const changesPerFile = createFileMap(); + const changesPerFile = createMap(); // group changes per file for (const c of this.changes) { let changesInFile = changesPerFile.get(c.sourceFile.path); @@ -426,8 +426,7 @@ namespace ts.textChanges { } // convert changes const fileChangesList: FileTextChanges[] = []; - changesPerFile.forEachValue(path => { - const changesInFile = changesPerFile.get(path); + changesPerFile.forEach(changesInFile => { const sourceFile = changesInFile[0].sourceFile; const fileTextChanges: FileTextChanges = { fileName: sourceFile.fileName, textChanges: [] }; for (const c of ChangeTracker.normalize(changesInFile)) { From 2ccfe502f7b8697e83cd44a6cdd8f4c5d334c2ed Mon Sep 17 00:00:00 2001 From: Andy Date: Wed, 28 Jun 2017 13:30:23 -0700 Subject: [PATCH 38/62] Fix scope of @typedef references (#16718) * Fix scope of @typedef references * Remove unused variables --- src/services/utilities.ts | 7 +++++++ .../fourslash/findAllRefsJsDocTypeDef_js.ts | 20 +++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 tests/cases/fourslash/findAllRefsJsDocTypeDef_js.ts diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 089e2de2b29..851ad4905fb 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -275,6 +275,13 @@ namespace ts { } export function getContainerNode(node: Node): Declaration { + if (node.kind === SyntaxKind.JSDocTypedefTag) { + // This doesn't just apply to the node immediately under the comment, but to everything in its parent's scope. + // node.parent = the JSDoc comment, node.parent.parent = the node having the comment. + // Then we get parent again in the loop. + node = node.parent.parent; + } + while (true) { node = node.parent; if (!node) { diff --git a/tests/cases/fourslash/findAllRefsJsDocTypeDef_js.ts b/tests/cases/fourslash/findAllRefsJsDocTypeDef_js.ts new file mode 100644 index 00000000000..a2d0cad3886 --- /dev/null +++ b/tests/cases/fourslash/findAllRefsJsDocTypeDef_js.ts @@ -0,0 +1,20 @@ +/// + +// Tests that the scope of @typedef is not just the node immediately below it. + +// @allowJs: true + +// @Filename: /a.js +/////** @typedef {number} [|{| "isWriteAccess": true, "isDefinition": true |}T|] */ +//// +/////** +//// * @return {[|T|]} +//// */ +////function f(obj) { return 0; } +//// +/////** +//// * @return {[|T|]} +//// */ +////function f2(obj) { return 0; } + +verify.singleReferenceGroup("type T = number"); From c4319e3b9486b40e3e4926502aadf23a548be718 Mon Sep 17 00:00:00 2001 From: Andy Date: Wed, 28 Jun 2017 14:29:16 -0700 Subject: [PATCH 39/62] Clean up uses of ensureScriptKind (#16714) * Clean up uses of ensureScriptKind * Remove unneeded parentheses --- src/compiler/core.ts | 4 ++-- src/services/jsTyping.ts | 5 ++--- src/services/utilities.ts | 9 +-------- 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/src/compiler/core.ts b/src/compiler/core.ts index b51a6ef95e4..86ad483ccc3 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -2114,14 +2114,14 @@ namespace ts { return absolute.substring(0, absolute.lastIndexOf(directorySeparator, wildcardOffset)); } - export function ensureScriptKind(fileName: string, scriptKind?: ScriptKind): ScriptKind { + export function ensureScriptKind(fileName: string, scriptKind: ScriptKind | undefined): ScriptKind { // Using scriptKind as a condition handles both: // - 'scriptKind' is unspecified and thus it is `undefined` // - 'scriptKind' is set and it is `Unknown` (0) // If the 'scriptKind' is 'undefined' or 'Unknown' then we attempt // to get the ScriptKind from the file name. If it cannot be resolved // from the file name then the default 'TS' script kind is returned. - return (scriptKind || getScriptKindFromFileName(fileName)) || ScriptKind.TS; + return scriptKind || getScriptKindFromFileName(fileName) || ScriptKind.TS; } export function getScriptKindFromFileName(fileName: string): ScriptKind { diff --git a/src/services/jsTyping.ts b/src/services/jsTyping.ts index 41bb01c1ae7..008fe357ec5 100644 --- a/src/services/jsTyping.ts +++ b/src/services/jsTyping.ts @@ -71,8 +71,7 @@ namespace ts.JsTyping { // Only infer typings for .js and .jsx files fileNames = mapDefined(fileNames, fileName => { const path = normalizePath(fileName); - const kind = ensureScriptKind(path, getScriptKindFromFileName(path)); - if (kind === ScriptKind.JS || kind === ScriptKind.JSX) { + if (hasJavaScriptFileExtension(path)) { return path; } }); @@ -191,7 +190,7 @@ namespace ts.JsTyping { } } - const hasJsxFile = forEach(fileNames, f => ensureScriptKind(f, getScriptKindFromFileName(f)) === ScriptKind.JSX); + const hasJsxFile = some(fileNames, f => fileExtensionIs(f, Extension.Jsx)); if (hasJsxFile) { addInferredTyping("react"); } diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 851ad4905fb..a3e44f00d1a 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -1310,14 +1310,7 @@ namespace ts { export function getScriptKind(fileName: string, host?: LanguageServiceHost): ScriptKind { // First check to see if the script kind was specified by the host. Chances are the host // may override the default script kind for the file extension. - let scriptKind: ScriptKind; - if (host && host.getScriptKind) { - scriptKind = host.getScriptKind(fileName); - } - if (!scriptKind) { - scriptKind = getScriptKindFromFileName(fileName); - } - return ensureScriptKind(fileName, scriptKind); + return ensureScriptKind(fileName, host && host.getScriptKind && host.getScriptKind(fileName)); } export function getFirstNonSpaceCharacterPosition(text: string, position: number) { From 51fb7e9a81a8821f2219cf68591faf36c66e01fa Mon Sep 17 00:00:00 2001 From: t_ Date: Thu, 29 Jun 2017 11:44:15 +0900 Subject: [PATCH 40/62] Add alwaysStrict option (#16562) * Add alwaysStrict option * Enable alwaysStrict * Fix for strict mode * keep whitespace --- Jakefile.js | 2 +- src/harness/unittests/moduleResolution.ts | 20 +++++++------- src/harness/unittests/textChanges.ts | 26 ++++++++++--------- src/harness/unittests/typingsInstaller.ts | 12 ++++----- src/server/tsconfig.library.json | 1 + .../fixClassSuperMustPrecedeThisAccess.ts | 8 +++--- src/tsconfig-base.json | 1 + 7 files changed, 37 insertions(+), 33 deletions(-) diff --git a/Jakefile.js b/Jakefile.js index 730754f4256..e425a8767c4 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -286,7 +286,7 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, opts var startCompileTime = mark(); opts = opts || {}; var compilerPath = useBuiltCompiler ? builtLocalCompiler : LKGCompiler; - var options = "--noImplicitAny --noImplicitThis --noEmitOnError --types " + var options = "--noImplicitAny --noImplicitThis --alwaysStrict --noEmitOnError --types " if (opts.types) { options += opts.types.join(","); } diff --git a/src/harness/unittests/moduleResolution.ts b/src/harness/unittests/moduleResolution.ts index 87ec4ea8149..3923e4b2755 100644 --- a/src/harness/unittests/moduleResolution.ts +++ b/src/harness/unittests/moduleResolution.ts @@ -950,8 +950,8 @@ import b = require("./moduleB"); { const f1 = { name: "/root/src/app.ts" }; const f2 = { name: "/root/src/types/lib/typings/lib.d.ts" }; - const package = { name: "/root/src/types/lib/package.json", content: JSON.stringify({ types: "typings/lib.d.ts" }) }; - test(/*typesRoot*/"/root/src/types", /* typeDirective */"lib", /*primary*/ true, f1, f2, package); + const packageFile = { name: "/root/src/types/lib/package.json", content: JSON.stringify({ types: "typings/lib.d.ts" }) }; + test(/*typesRoot*/"/root/src/types", /* typeDirective */"lib", /*primary*/ true, f1, f2, packageFile); } { const f1 = { name: "/root/src/app.ts" }; @@ -961,8 +961,8 @@ import b = require("./moduleB"); { const f1 = { name: "/root/src/app.ts" }; const f2 = { name: "/root/src/node_modules/lib/typings/lib.d.ts" }; - const package = { name: "/root/src/node_modules/lib/package.json", content: JSON.stringify({ types: "typings/lib.d.ts" }) }; - test(/*typesRoot*/"/root/src/types", /* typeDirective */"lib", /*primary*/ false, f1, f2, package); + const packageFile = { name: "/root/src/node_modules/lib/package.json", content: JSON.stringify({ types: "typings/lib.d.ts" }) }; + test(/*typesRoot*/"/root/src/types", /* typeDirective */"lib", /*primary*/ false, f1, f2, packageFile); } { const f1 = { name: "/root/src/app.ts" }; @@ -972,8 +972,8 @@ import b = require("./moduleB"); { const f1 = { name: "/root/src/app.ts" }; const f2 = { name: "/root/src/node_modules/@types/lib/typings/lib.d.ts" }; - const package = { name: "/root/src/node_modules/@types/lib/package.json", content: JSON.stringify({ types: "typings/lib.d.ts" }) }; - test(/*typesRoot*/"/root/src/types", /* typeDirective */"lib", /*primary*/ false, f1, f2, package); + const packageFile = { name: "/root/src/node_modules/@types/lib/package.json", content: JSON.stringify({ types: "typings/lib.d.ts" }) }; + test(/*typesRoot*/"/root/src/types", /* typeDirective */"lib", /*primary*/ false, f1, f2, packageFile); } }); it("Can be resolved from secondary location", () => { @@ -990,8 +990,8 @@ import b = require("./moduleB"); { const f1 = { name: "/root/src/app.ts" }; const f2 = { name: "/root/node_modules/lib/typings/lib.d.ts" }; - const package = { name: "/root/node_modules/lib/package.json", content: JSON.stringify({ typings: "typings/lib.d.ts" }) }; - test(/*typesRoot*/"/root/src/types", /* typeDirective */"lib", /*primary*/ false, f1, f2, package); + const packageFile = { name: "/root/node_modules/lib/package.json", content: JSON.stringify({ typings: "typings/lib.d.ts" }) }; + test(/*typesRoot*/"/root/src/types", /* typeDirective */"lib", /*primary*/ false, f1, f2, packageFile); } { const f1 = { name: "/root/src/app.ts" }; @@ -1001,8 +1001,8 @@ import b = require("./moduleB"); { const f1 = { name: "/root/src/app.ts" }; const f2 = { name: "/root/node_modules/@types/lib/typings/lib.d.ts" }; - const package = { name: "/root/node_modules/@types/lib/package.json", content: JSON.stringify({ typings: "typings/lib.d.ts" }) }; - test(/*typesRoot*/"/root/src/types", /* typeDirective */"lib", /*primary*/ false, f1, f2, package); + const packageFile = { name: "/root/node_modules/@types/lib/package.json", content: JSON.stringify({ typings: "typings/lib.d.ts" }) }; + test(/*typesRoot*/"/root/src/types", /* typeDirective */"lib", /*primary*/ false, f1, f2, packageFile); } }); it("Primary resolution overrides secondary resolutions", () => { diff --git a/src/harness/unittests/textChanges.ts b/src/harness/unittests/textChanges.ts index 3625b30a009..8ac74668023 100644 --- a/src/harness/unittests/textChanges.ts +++ b/src/harness/unittests/textChanges.ts @@ -367,20 +367,22 @@ namespace M { changeTracker.insertNodeAfter(sourceFile, findChild("M", sourceFile), createTestClass(), { prefix: newLineCharacter }); }); } - { - function findOpenBraceForConstructor(sourceFile: SourceFile) { - const classDecl = sourceFile.statements[0]; - const constructorDecl = forEach(classDecl.members, m => m.kind === SyntaxKind.Constructor && (m).body && m); - return constructorDecl.body.getFirstToken(); - } - function createTestSuperCall() { - const superCall = createCall( - createSuper(), + + function findOpenBraceForConstructor(sourceFile: SourceFile) { + const classDecl = sourceFile.statements[0]; + const constructorDecl = forEach(classDecl.members, m => m.kind === SyntaxKind.Constructor && (m).body && m); + return constructorDecl.body.getFirstToken(); + } + function createTestSuperCall() { + const superCall = createCall( + createSuper(), /*typeArguments*/ undefined, /*argumentsArray*/ emptyArray - ); - return createStatement(superCall); - } + ); + return createStatement(superCall); + } + + { const text1 = ` class A { constructor() { diff --git a/src/harness/unittests/typingsInstaller.ts b/src/harness/unittests/typingsInstaller.ts index 6cbef411ebf..9483308287f 100644 --- a/src/harness/unittests/typingsInstaller.ts +++ b/src/harness/unittests/typingsInstaller.ts @@ -1066,7 +1066,7 @@ namespace ts.projectSystem { path: "/a/app.js", content: "" }; - const package = { + const packageFile = { path: "/a/package.json", content: JSON.stringify({ dependencies: { "commander": "1.0.0" } }) }; @@ -1075,7 +1075,7 @@ namespace ts.projectSystem { path: cachePath + "node_modules/@types/commander/index.d.ts", content: "export let x: number" }; - const host = createServerHost([f1, package]); + const host = createServerHost([f1, packageFile]); let seenTelemetryEvent = false; const installer = new (class extends Installer { constructor() { @@ -1115,7 +1115,7 @@ namespace ts.projectSystem { path: "/a/app.js", content: "" }; - const package = { + const packageFile = { path: "/a/package.json", content: JSON.stringify({ dependencies: { "commander": "1.0.0" } }) }; @@ -1124,7 +1124,7 @@ namespace ts.projectSystem { path: cachePath + "node_modules/@types/commander/index.d.ts", content: "export let x: number" }; - const host = createServerHost([f1, package]); + const host = createServerHost([f1, packageFile]); let beginEvent: server.BeginInstallTypes; let endEvent: server.EndInstallTypes; const installer = new (class extends Installer { @@ -1166,12 +1166,12 @@ namespace ts.projectSystem { path: "/a/app.js", content: "" }; - const package = { + const packageFile = { path: "/a/package.json", content: JSON.stringify({ dependencies: { "commander": "1.0.0" } }) }; const cachePath = "/a/cache/"; - const host = createServerHost([f1, package]); + const host = createServerHost([f1, packageFile]); let beginEvent: server.BeginInstallTypes; let endEvent: server.EndInstallTypes; const installer = new (class extends Installer { diff --git a/src/server/tsconfig.library.json b/src/server/tsconfig.library.json index e47600f9f52..b59395fda27 100644 --- a/src/server/tsconfig.library.json +++ b/src/server/tsconfig.library.json @@ -2,6 +2,7 @@ "compilerOptions": { "noImplicitAny": true, "noImplicitThis": true, + "alwaysStrict": true, "preserveConstEnums": true, "pretty": true, "outFile": "../../built/local/tsserverlibrary.js", diff --git a/src/services/codefixes/fixClassSuperMustPrecedeThisAccess.ts b/src/services/codefixes/fixClassSuperMustPrecedeThisAccess.ts index 56128be9d07..937afee340e 100644 --- a/src/services/codefixes/fixClassSuperMustPrecedeThisAccess.ts +++ b/src/services/codefixes/fixClassSuperMustPrecedeThisAccess.ts @@ -19,9 +19,9 @@ namespace ts.codefix { // figure out if the `this` access is actually inside the supercall // i.e. super(this.a), since in that case we won't suggest a fix if (superCall.expression && superCall.expression.kind === SyntaxKind.CallExpression) { - const arguments = (superCall.expression).arguments; - for (let i = 0; i < arguments.length; i++) { - if ((arguments[i]).expression === token) { + const expressionArguments = (superCall.expression).arguments; + for (let i = 0; i < expressionArguments.length; i++) { + if ((expressionArguments[i]).expression === token) { return undefined; } } @@ -46,4 +46,4 @@ namespace ts.codefix { } } }); -} \ No newline at end of file +} diff --git a/src/tsconfig-base.json b/src/tsconfig-base.json index caf8e880fad..e4b99632907 100644 --- a/src/tsconfig-base.json +++ b/src/tsconfig-base.json @@ -6,6 +6,7 @@ "noImplicitThis": true, "noUnusedLocals": true, "noUnusedParameters": true, + "alwaysStrict": true, "pretty": true, "preserveConstEnums": true, "stripInternal": true, From 9ccf8ca6b0e72ec6e4090ad0914c4e97f293eb4f Mon Sep 17 00:00:00 2001 From: Arnaud Tournier Date: Thu, 29 Jun 2017 17:54:34 +0200 Subject: [PATCH 41/62] Comments incorrectly read 'TypeFlags' instead of 'ObjectFlags' at some places --- src/compiler/types.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 5c959d3736e..85ab8a65d5d 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -3179,7 +3179,7 @@ namespace ts { objectFlags: ObjectFlags; } - /** Class and interface types (TypeFlags.Class and TypeFlags.Interface). */ + /** Class and interface types (ObjectFlags.Class and ObjectFlags.Interface). */ export interface InterfaceType extends ObjectType { typeParameters: TypeParameter[]; // Type parameters (undefined if non-generic) outerTypeParameters: TypeParameter[]; // Outer type parameters (undefined if none) @@ -3203,7 +3203,7 @@ namespace ts { } /** - * Type references (TypeFlags.Reference). When a class or interface has type parameters or + * Type references (ObjectFlags.Reference). When a class or interface has type parameters or * a "this" type, references to the class or interface are made using type references. The * typeArguments property specifies the types to substitute for the type parameters of the * class or interface and optionally includes an extra element that specifies the type to From d73b05cc6360892428497fed0959dc2adb6a8607 Mon Sep 17 00:00:00 2001 From: Andy Date: Thu, 29 Jun 2017 10:06:35 -0700 Subject: [PATCH 42/62] Fix typo (#16826) --- src/compiler/binder.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 59dd061b395..e99db4f1914 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -2321,16 +2321,16 @@ namespace ts { if (symbol && symbol.valueDeclaration && symbol.valueDeclaration.kind === SyntaxKind.VariableDeclaration) { const declaration = symbol.valueDeclaration as VariableDeclaration; if (declaration.initializer) { - return isExportsOrModuleExportsOrAliasOrAssignemnt(declaration.initializer); + return isExportsOrModuleExportsOrAliasOrAssignment(declaration.initializer); } } } return false; } - function isExportsOrModuleExportsOrAliasOrAssignemnt(node: Node): boolean { + function isExportsOrModuleExportsOrAliasOrAssignment(node: Node): boolean { return isExportsOrModuleExportsOrAlias(node) || - (isAssignmentExpression(node, /*excludeCompoundAssignements*/ true) && (isExportsOrModuleExportsOrAliasOrAssignemnt(node.left) || isExportsOrModuleExportsOrAliasOrAssignemnt(node.right))); + (isAssignmentExpression(node, /*excludeCompoundAssignements*/ true) && (isExportsOrModuleExportsOrAliasOrAssignment(node.left) || isExportsOrModuleExportsOrAliasOrAssignment(node.right))); } function bindModuleExportsAssignment(node: BinaryExpression) { From 977525b37ea7648e87044be8d72c8fdffa78c373 Mon Sep 17 00:00:00 2001 From: Andy Date: Thu, 29 Jun 2017 10:07:08 -0700 Subject: [PATCH 43/62] getSymbolOfEntityNameOrPropertyAccessExpression: combine common code from PropertyAccessExpression and QualifiedName cases (#16827) --- src/compiler/checker.ts | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 7cb9902b831..514e8f401a9 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -22500,25 +22500,25 @@ namespace ts { } if (entityName.kind === SyntaxKind.Identifier) { - if (isJSXTagName(entityName) && isJsxIntrinsicIdentifier(entityName)) { + if (isJSXTagName(entityName) && isJsxIntrinsicIdentifier(entityName)) { return getIntrinsicTagSymbol(entityName.parent); } - return resolveEntityName(entityName, SymbolFlags.Value, /*ignoreErrors*/ false, /*dontResolveAlias*/ true); + return resolveEntityName(entityName, SymbolFlags.Value, /*ignoreErrors*/ false, /*dontResolveAlias*/ true); } - else if (entityName.kind === SyntaxKind.PropertyAccessExpression) { - const symbol = getNodeLinks(entityName).resolvedSymbol; - if (!symbol) { - checkPropertyAccessExpression(entityName); + else if (entityName.kind === SyntaxKind.PropertyAccessExpression || entityName.kind === SyntaxKind.QualifiedName) { + const links = getNodeLinks(entityName); + if (links.resolvedSymbol) { + return links.resolvedSymbol; } - return getNodeLinks(entityName).resolvedSymbol; - } - else if (entityName.kind === SyntaxKind.QualifiedName) { - const symbol = getNodeLinks(entityName).resolvedSymbol; - if (!symbol) { - checkQualifiedName(entityName); + + if (entityName.kind === SyntaxKind.PropertyAccessExpression) { + checkPropertyAccessExpression(entityName); } - return getNodeLinks(entityName).resolvedSymbol; + else { + checkQualifiedName(entityName); + } + return links.resolvedSymbol; } } else if (isTypeReferenceIdentifier(entityName)) { From 587309d029964d17398bf74de99a49e5451957d3 Mon Sep 17 00:00:00 2001 From: Andrew Casey Date: Mon, 19 Jun 2017 15:45:47 -0700 Subject: [PATCH 44/62] Update error case check `getTouchingWord` indicates failure by returning the sourceFile node, rather than `undefined`. --- src/services/documentHighlights.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/services/documentHighlights.ts b/src/services/documentHighlights.ts index 7ea8c519646..fc84b60cc1f 100644 --- a/src/services/documentHighlights.ts +++ b/src/services/documentHighlights.ts @@ -2,7 +2,10 @@ namespace ts.DocumentHighlights { export function getDocumentHighlights(program: Program, cancellationToken: CancellationToken, sourceFile: SourceFile, position: number, sourceFilesToSearch: SourceFile[]): DocumentHighlights[] | undefined { const node = getTouchingWord(sourceFile, position, /*includeJsDocComment*/ true); - if (!node) return undefined; + // Note that getTouchingWord indicates failure by returning the sourceFile node. + if (node === sourceFile) return undefined; + + Debug.assert(node.parent !== undefined); if (isJsxOpeningElement(node.parent) && node.parent.tagName === node || isJsxClosingElement(node.parent)) { // For a JSX element, just highlight the matching tag, not all references. From 4863ada22cdbf7278bcf5a6013b637db85d7d87c Mon Sep 17 00:00:00 2001 From: Andrew Casey Date: Tue, 20 Jun 2017 15:54:43 -0700 Subject: [PATCH 45/62] Track missing files 1. Expose missing files from the `Program`. 2. In `tsc --watch` and `tsserver`, add file watchers to missing files. 3. When missing files are created, schedule compilation (tsc) or refresh the containing projects (tsserver). --- src/compiler/program.ts | 23 +++++++++++++++++++++++ src/compiler/sys.ts | 13 +++++++++++-- src/compiler/tsc.ts | 13 +++++++++++++ src/compiler/types.ts | 6 ++++++ src/server/lsHost.ts | 7 +++++-- src/server/project.ts | 38 ++++++++++++++++++++++++++++++++++++++ src/server/server.ts | 7 ++++++- 7 files changed, 102 insertions(+), 5 deletions(-) diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 1d66eeaf34a..b292ff3965a 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -513,6 +513,8 @@ namespace ts { } } + const missingFilePaths = filesByName.getKeys().filter(p => !filesByName.get(p)); + // unconditionally set moduleResolutionCache to undefined to avoid unnecessary leaks moduleResolutionCache = undefined; @@ -524,6 +526,7 @@ namespace ts { getSourceFile, getSourceFileByPath, getSourceFiles: () => files, + getMissingFilePaths: () => missingFilePaths, getCompilerOptions: () => options, getSyntacticDiagnostics, getOptionsDiagnostics, @@ -862,11 +865,31 @@ namespace ts { return oldProgram.structureIsReused; } + // If a file has ceased to be missing, then we need to discard some of the old + // structure in order to pick it up. + // Caution: if the file has created and then deleted between since it was discovered to + // be missing, then the corresponding file watcher will have been closed and no new one + // will be created until we encounter a change that prevents complete structure reuse. + // During this interval, creation of the file will go unnoticed. We expect this to be + // both rare and low-impact. + if (oldProgram.getMissingFilePaths) { + const missingFilePaths: Path[] = oldProgram.getMissingFilePaths() || emptyArray; + for (const missingFilePath of missingFilePaths) { + if (host.fileExists(missingFilePath)) { + return oldProgram.structureIsReused = StructureIsReused.SafeModules; + } + } + } + // update fileName -> file mapping for (let i = 0; i < newSourceFiles.length; i++) { filesByName.set(filePaths[i], newSourceFiles[i]); } + for (const p of oldProgram.getMissingFilePaths()) { + filesByName.set(p, undefined); + } + files = newSourceFiles; fileProcessingDiagnostics = oldProgram.getFileProcessingDiagnostics(); diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts index cd14f3b2801..8448c9b3615 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -340,11 +340,20 @@ namespace ts { } function fileChanged(curr: any, prev: any) { - if (+curr.mtime <= +prev.mtime) { + const isCurrZero = +curr.mtime === 0; + const isPrevZero = +prev.mtime === 0; + const added = !isCurrZero && isPrevZero; + const deleted = isCurrZero && !isPrevZero; + + // This value is consistent with poll() in createPollingWatchedFileSet() + // and depended upon by the file watchers created in Project.updateGraphWorker. + const removed = deleted ? true : (added ? false : undefined); + + if (!added && !deleted && +curr.mtime <= +prev.mtime) { return; } - callback(fileName); + callback(fileName, removed); } }, watchDirectory: (directoryName, callback, recursive) => { diff --git a/src/compiler/tsc.ts b/src/compiler/tsc.ts index 3b2422bfe08..8264282cba9 100644 --- a/src/compiler/tsc.ts +++ b/src/compiler/tsc.ts @@ -285,6 +285,19 @@ namespace ts { setCachedProgram(compileResult.program); reportWatchDiagnostic(createCompilerDiagnostic(Diagnostics.Compilation_complete_Watching_for_file_changes)); + + if (compileResult.program.getMissingFilePaths) { + const missingPaths = compileResult.program.getMissingFilePaths() || []; + missingPaths.forEach((path: Path): void => { + const fileWatcher = sys.watchFile(path, (_fileName: string, removed?: boolean) => { + // removed = deleted ? true : (added ? false : undefined) + if (removed === false) { + fileWatcher.close(); + startTimerForRecompilation(); + } + }); + }); + } } function cachedFileExists(fileName: string): boolean { diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 5c959d3736e..99d62091ed5 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -2426,6 +2426,12 @@ namespace ts { */ getSourceFiles(): SourceFile[]; + /** + * Get a list of file names that were passed to 'createProgram' or referenced in a + * program source file but could not be located. + */ + getMissingFilePaths?(): Path[]; + /** * Emits the JavaScript and declaration files. If targetSourceFile is not specified, then * the JavaScript and declaration files will be produced for all the files in this program. diff --git a/src/server/lsHost.ts b/src/server/lsHost.ts index b8f9807139f..1cccaf979cf 100644 --- a/src/server/lsHost.ts +++ b/src/server/lsHost.ts @@ -210,8 +210,11 @@ namespace ts.server { return this.host.resolvePath(path); } - fileExists(path: string): boolean { - return this.host.fileExists(path); + fileExists(file: string): boolean { + // As an optimization, don't hit the disks for files we already know don't exist + // (because we're watching for their creation). + const path = toPath(file, this.host.getCurrentDirectory(), this.getCanonicalFileName); + return !this.project.isWatchedMissingFile(path) && this.host.fileExists(file); } readFile(fileName: string): string { diff --git a/src/server/project.ts b/src/server/project.ts index d4544af5e59..d1b4a627fac 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -107,6 +107,7 @@ namespace ts.server { private rootFilesMap: Map = createMap(); private program: ts.Program; private externalFiles: SortedReadonlyArray; + private missingFilesMap: FileMap = createFileMap(); private cachedUnresolvedImportsPerFile = new UnresolvedImportsMap(); private lastCachedUnresolvedImportsList: SortedReadonlyArray; @@ -606,6 +607,39 @@ namespace ts.server { } } + if (hasChanges && this.program.getMissingFilePaths) { + const missingFilePaths = this.program.getMissingFilePaths() || emptyArray; + const missingFilePathsSet = createMap(); + missingFilePaths.forEach(p => missingFilePathsSet.set(p, true)); + + // Files that are no longer missing (e.g. because they are no longer required) + // should no longer be watched. + this.missingFilesMap.getKeys().forEach(p => { + if (!missingFilePathsSet.has(p)) { + this.missingFilesMap.get(p).close(); + this.missingFilesMap.remove(p); + } + }); + + // Missing files that are not yet watched should be added to the map. + missingFilePaths.forEach(p => { + if (!this.missingFilesMap.contains(p)) { + const fileWatcher = ts.sys.watchFile(p, (_filename: string, removed?: boolean) => { + // removed = deleted ? true : (added ? false : undefined) + if (removed === false && this.missingFilesMap.contains(p)) { + fileWatcher.close(); + this.missingFilesMap.remove(p); + + // When a missing file is created, we should update the graph. + this.markAsDirty(); + this.updateGraph(); + } + }); + this.missingFilesMap.set(p, fileWatcher); + } + }); + } + const oldExternalFiles = this.externalFiles || emptyArray as SortedReadonlyArray; this.externalFiles = this.getExternalFiles(); enumerateInsertsAndDeletes(this.externalFiles, oldExternalFiles, @@ -626,6 +660,10 @@ namespace ts.server { return hasChanges; } + isWatchedMissingFile(path: Path) { + return this.missingFilesMap.contains(path); + } + getScriptInfoLSHost(fileName: string) { const scriptInfo = this.projectService.getOrCreateScriptInfo(fileName, /*openedByClient*/ false); if (scriptInfo) { diff --git a/src/server/server.ts b/src/server/server.ts index 5f2b7054755..9874969064e 100644 --- a/src/server/server.ts +++ b/src/server/server.ts @@ -522,6 +522,9 @@ namespace ts.server { return; } + // removed = deleted ? true : (added ? false : undefined) + // This value is consistent with sys.watchFile() + // and depended upon by the file watchers created in performCompilation() in tsc's executeCommandLine(). fs.stat(watchedFile.fileName, (err: any, stats: any) => { if (err) { watchedFile.callback(watchedFile.fileName); @@ -560,7 +563,9 @@ namespace ts.server { const file: WatchedFile = { fileName, callback, - mtime: getModifiedTime(fileName) + mtime: sys.fileExists(fileName) + ? getModifiedTime(fileName) + : new Date(0) // Any subsequent modification will occur after this time }; watchedFiles.push(file); From a39e969338801423f79aa7263f8b86d8997e4a79 Mon Sep 17 00:00:00 2001 From: Andrew Casey Date: Tue, 20 Jun 2017 16:30:33 -0700 Subject: [PATCH 46/62] Clean up file watchers on project close --- src/server/project.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/server/project.ts b/src/server/project.ts index d1b4a627fac..18c203c194e 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -311,6 +311,13 @@ namespace ts.server { this.lsHost.dispose(); this.lsHost = undefined; + // Clean up file watchers waiting for missing files + for (const p of this.missingFilesMap.getKeys()) { + this.missingFilesMap.get(p).close(); + this.missingFilesMap.remove(p); + } + this.missingFilesMap = undefined; + // signal language service to release source files acquired from document registry this.languageService.dispose(); this.languageService = undefined; From 4652fc491f692bac282365e5e165ed2da646006d Mon Sep 17 00:00:00 2001 From: Andrew Casey Date: Tue, 20 Jun 2017 16:31:47 -0700 Subject: [PATCH 47/62] Confirm method is defined before calling --- src/compiler/program.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/compiler/program.ts b/src/compiler/program.ts index b292ff3965a..ac82fbba02c 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -879,6 +879,10 @@ namespace ts { return oldProgram.structureIsReused = StructureIsReused.SafeModules; } } + + for (const p of oldProgram.getMissingFilePaths()) { + filesByName.set(p, undefined); + } } // update fileName -> file mapping @@ -886,10 +890,6 @@ namespace ts { filesByName.set(filePaths[i], newSourceFiles[i]); } - for (const p of oldProgram.getMissingFilePaths()) { - filesByName.set(p, undefined); - } - files = newSourceFiles; fileProcessingDiagnostics = oldProgram.getFileProcessingDiagnostics(); From 6d200bffbd36bf10dcc009135a4e3ec775e6e888 Mon Sep 17 00:00:00 2001 From: Andrew Casey Date: Wed, 21 Jun 2017 10:49:17 -0700 Subject: [PATCH 48/62] Watch files through the host Call `this.projectService.host.watchFile`, rather than `ts.sys.watchFile` so that it gets mocked correctly in the unit tests. Repair two failing tests. --- src/harness/unittests/tsserverProjectSystem.ts | 2 +- src/harness/unittests/typingsInstaller.ts | 2 +- src/server/project.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/harness/unittests/tsserverProjectSystem.ts b/src/harness/unittests/tsserverProjectSystem.ts index 2f6ba7aa3bb..d098c91eecf 100644 --- a/src/harness/unittests/tsserverProjectSystem.ts +++ b/src/harness/unittests/tsserverProjectSystem.ts @@ -2028,7 +2028,7 @@ namespace ts.projectSystem { projectService.openExternalProject({ projectFileName, options: {}, rootFiles: [{ fileName: file1.path, scriptKind: ScriptKind.JS, hasMixedContent: true }] }); checkNumberOfProjects(projectService, { externalProjects: 1 }); - checkWatchedFiles(host, []); + checkWatchedFiles(host, [libFile.path]); // watching the "missing" lib file const project = projectService.externalProjects[0]; diff --git a/src/harness/unittests/typingsInstaller.ts b/src/harness/unittests/typingsInstaller.ts index 9483308287f..6c43ea1c034 100644 --- a/src/harness/unittests/typingsInstaller.ts +++ b/src/harness/unittests/typingsInstaller.ts @@ -731,7 +731,7 @@ namespace ts.projectSystem { checkNumberOfProjects(projectService, { configuredProjects: 1 }); const p = projectService.configuredProjects[0]; checkProjectActualFiles(p, [app.path, jsconfig.path]); - checkWatchedFiles(host, [jsconfig.path, "/bower_components", "/node_modules"]); + checkWatchedFiles(host, [jsconfig.path, "/bower_components", "/node_modules", libFile.path]); installer.installAll(/*expectedCount*/ 1); diff --git a/src/server/project.ts b/src/server/project.ts index 18c203c194e..163510bad27 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -631,7 +631,7 @@ namespace ts.server { // Missing files that are not yet watched should be added to the map. missingFilePaths.forEach(p => { if (!this.missingFilesMap.contains(p)) { - const fileWatcher = ts.sys.watchFile(p, (_filename: string, removed?: boolean) => { + const fileWatcher = this.projectService.host.watchFile(p, (_filename: string, removed?: boolean) => { // removed = deleted ? true : (added ? false : undefined) if (removed === false && this.missingFilesMap.contains(p)) { fileWatcher.close(); From 0f683ac2adafc657256029a2268262cbc35e0a20 Mon Sep 17 00:00:00 2001 From: Andrew Casey Date: Tue, 6 Jun 2017 16:39:41 -0700 Subject: [PATCH 49/62] Add missing file unit tests 1. Test `Program.getMissingFilePaths` 2. Test program structure reuse (i.e. that the appearance of a missing file prevents complete reuse) --- Jakefile.js | 1 + src/harness/tsconfig.json | 3 +- .../unittests/cachingInServerLSHost.ts | 2 +- src/harness/unittests/programMissingFiles.ts | 109 ++++++++++++++++++ .../unittests/reuseProgramStructure.ts | 25 ++++ 5 files changed, 138 insertions(+), 2 deletions(-) create mode 100644 src/harness/unittests/programMissingFiles.ts diff --git a/Jakefile.js b/Jakefile.js index e425a8767c4..58779a3d8dc 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -138,6 +138,7 @@ var harnessSources = harnessCoreSources.concat([ "telemetry.ts", "transform.ts", "customTransforms.ts", + "programMissingFiles.ts", ].map(function (f) { return path.join(unittestsDirectory, f); })).concat([ diff --git a/src/harness/tsconfig.json b/src/harness/tsconfig.json index eee6473f77f..8d52791f539 100644 --- a/src/harness/tsconfig.json +++ b/src/harness/tsconfig.json @@ -129,6 +129,7 @@ "./unittests/transform.ts", "./unittests/customTransforms.ts", "./unittests/textChanges.ts", - "./unittests/telemetry.ts" + "./unittests/telemetry.ts", + "./unittests/programMissingFiles.ts" ] } diff --git a/src/harness/unittests/cachingInServerLSHost.ts b/src/harness/unittests/cachingInServerLSHost.ts index 46d9aa462ce..eb2907e89de 100644 --- a/src/harness/unittests/cachingInServerLSHost.ts +++ b/src/harness/unittests/cachingInServerLSHost.ts @@ -75,7 +75,7 @@ namespace ts { const rootScriptInfo = projectService.getOrCreateScriptInfo(rootFile, /* openedByClient */ true, /*containingProject*/ undefined); const project = projectService.createInferredProjectWithRootFileIfNecessary(rootScriptInfo); - project.setCompilerOptions({ module: ts.ModuleKind.AMD } ); + project.setCompilerOptions({ module: ts.ModuleKind.AMD, noLib: true } ); return { project, rootScriptInfo diff --git a/src/harness/unittests/programMissingFiles.ts b/src/harness/unittests/programMissingFiles.ts new file mode 100644 index 00000000000..26cc63590bd --- /dev/null +++ b/src/harness/unittests/programMissingFiles.ts @@ -0,0 +1,109 @@ +/// + +namespace ts { + describe("Program.getMissingFilePaths", () => { + + const options: CompilerOptions = { + noLib: true, + }; + + const emptyFileName = "empty.ts"; + const emptyFileRelativePath = "./" + emptyFileName; + + const emptyFile: Harness.Compiler.TestFile = { + unitName: emptyFileName, + content: "" + }; + + const referenceFileName = "reference.ts"; + const referenceFileRelativePath = "./" + referenceFileName; + + const referenceFile: Harness.Compiler.TestFile = { + unitName: referenceFileName, + content: + "/// \n" + // Absolute + "/// \n" + // Relative + "/// \n" + // Unqualified + "/// \n" // No extension + }; + + const testCompilerHost = Harness.Compiler.createCompilerHost( + /*inputFiles*/ [emptyFile, referenceFile], + /*writeFile*/ undefined, + /*scriptTarget*/ undefined, + /*useCaseSensitiveFileNames*/ false, + /*currentDirectory*/ "d:\\pretend\\", + /*newLineKind*/ NewLineKind.LineFeed, + /*libFiles*/ undefined + ); + + it("handles no missing root files", () => { + const program = createProgram([emptyFileRelativePath], options, testCompilerHost); + const missing = program.getMissingFilePaths(); + assert.isDefined(missing); + assert.equal(missing.length, 0); + }); + + it("handles missing root file", () => { + const program = createProgram(["./nonexistent.ts"], options, testCompilerHost); + const missing = program.getMissingFilePaths(); + assert.isDefined(missing); + assert.equal(missing.length, 1); + assert.equal(missing[0].toString(), "d:/pretend/nonexistent.ts"); // Absolute path + }); + + it("handles multiple missing root files", () => { + const program = createProgram(["./nonexistent0.ts", "./nonexistent1.ts"], options, testCompilerHost); + const missing = program.getMissingFilePaths().sort(); + assert.equal(missing.length, 2); + assert.equal(missing[0].toString(), "d:/pretend/nonexistent0.ts"); + assert.equal(missing[1].toString(), "d:/pretend/nonexistent1.ts"); + }); + + it("handles a mix of present and missing root files", () => { + const program = createProgram(["./nonexistent0.ts", emptyFileRelativePath, "./nonexistent1.ts"], options, testCompilerHost); + const missing = program.getMissingFilePaths().sort(); + assert.equal(missing.length, 2); + assert.equal(missing[0].toString(), "d:/pretend/nonexistent0.ts"); + assert.equal(missing[1].toString(), "d:/pretend/nonexistent1.ts"); + }); + + it("handles repeatedly specified root files", () => { + const program = createProgram(["./nonexistent.ts", "./nonexistent.ts"], options, testCompilerHost); + const missing = program.getMissingFilePaths(); + assert.isDefined(missing); + assert.equal(missing.length, 1); + assert.equal(missing[0].toString(), "d:/pretend/nonexistent.ts"); + }); + + it("normalizes file paths", () => { + const program0 = createProgram(["./nonexistent.ts", "./NONEXISTENT.ts"], options, testCompilerHost); + const program1 = createProgram(["./NONEXISTENT.ts", "./nonexistent.ts"], options, testCompilerHost); + const missing0 = program0.getMissingFilePaths(); + const missing1 = program1.getMissingFilePaths(); + assert.equal(missing0.length, 1); + assert.deepEqual(missing0, missing1); + }); + + it("handles missing triple slash references", () => { + const program = createProgram([referenceFileRelativePath], options, testCompilerHost); + const missing = program.getMissingFilePaths().sort(); + assert.isDefined(missing); + assert.equal(missing.length, 6); + + // From absolute reference + assert.equal(missing[0].toString(), "d:/imaginary/nonexistent1.ts"); + + // From relative reference + assert.equal(missing[1].toString(), "d:/pretend/nonexistent2.ts"); + + // From unqualified reference + assert.equal(missing[2].toString(), "d:/pretend/nonexistent3.ts"); + + // From no-extension reference + assert.equal(missing[3].toString(), "d:/pretend/nonexistent4.d.ts"); + assert.equal(missing[4].toString(), "d:/pretend/nonexistent4.ts"); + assert.equal(missing[5].toString(), "d:/pretend/nonexistent4.tsx"); + }); + }); +} \ No newline at end of file diff --git a/src/harness/unittests/reuseProgramStructure.ts b/src/harness/unittests/reuseProgramStructure.ts index 2eb3d1f0890..de5f5a756d8 100644 --- a/src/harness/unittests/reuseProgramStructure.ts +++ b/src/harness/unittests/reuseProgramStructure.ts @@ -316,6 +316,31 @@ namespace ts { assert.isTrue(program_1.structureIsReused === StructureIsReused.Not); }); + it("succeeds if missing files remain missing", () => { + const options: CompilerOptions = { target, noLib: true }; + + const program_1 = newProgram(files, ["a.ts"], options); + assert.notDeepEqual(emptyArray, program_1.getMissingFilePaths()); + + const program_2 = updateProgram(program_1, ["a.ts"], options, noop); + assert.deepEqual(program_1.getMissingFilePaths(), program_2.getMissingFilePaths()); + + assert.equal(StructureIsReused.Completely, program_1.structureIsReused); + }); + + it("fails if missing file is created", () => { + const options: CompilerOptions = { target, noLib: true }; + + const program_1 = newProgram(files, ["a.ts"], options); + assert.notDeepEqual(emptyArray, program_1.getMissingFilePaths()); + + const newTexts: NamedSourceText[] = files.concat([{ name: "non-existing-file.ts", text: SourceText.New("", "", `var x = 1`) }]); + const program_2 = updateProgram(program_1, ["a.ts"], options, noop, newTexts); + assert.deepEqual(emptyArray, program_2.getMissingFilePaths()); + + assert.equal(StructureIsReused.SafeModules, program_1.structureIsReused); + }); + it("resolution cache follows imports", () => { (Error).stackTraceLimit = Infinity; From 179a3e10b55ce9c15ed881e25d54e94e9748deae Mon Sep 17 00:00:00 2001 From: Andy Date: Thu, 29 Jun 2017 11:04:33 -0700 Subject: [PATCH 50/62] Handle `depth` in all readDirectory implementations (#16646) --- src/compiler/commandLineParser.ts | 2 +- src/compiler/core.ts | 20 ++++++--- src/compiler/sys.ts | 8 ++-- src/compiler/types.ts | 2 +- src/harness/harness.ts | 8 ++-- src/harness/harnessLanguageService.ts | 11 ++--- src/harness/loggedIO.ts | 8 ++-- src/harness/projectsRunner.ts | 4 +- src/harness/unittests/session.ts | 2 +- .../unittests/tsserverProjectSystem.ts | 7 ++- src/harness/unittests/typingsInstaller.ts | 35 +++++++++++++-- src/harness/virtualFileSystem.ts | 4 +- src/server/lsHost.ts | 4 +- src/server/server.ts | 1 - .../typingsInstaller/typingsInstaller.ts | 1 - src/services/jsTyping.ts | 1 + src/services/shims.ts | 44 +++++-------------- src/services/types.ts | 2 +- 18 files changed, 88 insertions(+), 76 deletions(-) diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 0bea9468432..178578ec452 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -1992,7 +1992,7 @@ namespace ts { } if (include && include.length > 0) { - for (const file of host.readDirectory(basePath, supportedExtensions, exclude, include)) { + for (const file of host.readDirectory(basePath, supportedExtensions, exclude, include, /*depth*/ undefined)) { // If we have already included a literal or wildcard path with a // higher priority extension, we should skip this file. // diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 86ad483ccc3..48e16ab16b4 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -2,8 +2,9 @@ /// namespace ts { + export const versionMajorMinor = "2.5"; /** The version of the TypeScript compiler release */ - export const version = "2.5.0"; + export const version = `${versionMajorMinor}.0`; } /* @internal */ @@ -2016,7 +2017,7 @@ namespace ts { }; } - export function matchFiles(path: string, extensions: string[], excludes: string[], includes: string[], useCaseSensitiveFileNames: boolean, currentDirectory: string, getFileSystemEntries: (path: string) => FileSystemEntries): string[] { + export function matchFiles(path: string, extensions: string[], excludes: string[], includes: string[], useCaseSensitiveFileNames: boolean, currentDirectory: string, depth: number | undefined, getFileSystemEntries: (path: string) => FileSystemEntries): string[] { path = normalizePath(path); currentDirectory = normalizePath(currentDirectory); @@ -2033,15 +2034,14 @@ namespace ts { const comparer = useCaseSensitiveFileNames ? compareStrings : compareStringsCaseInsensitive; for (const basePath of patterns.basePaths) { - visitDirectory(basePath, combinePaths(currentDirectory, basePath)); + visitDirectory(basePath, combinePaths(currentDirectory, basePath), depth); } return flatten(results); - function visitDirectory(path: string, absolutePath: string) { + function visitDirectory(path: string, absolutePath: string, depth: number | undefined) { let { files, directories } = getFileSystemEntries(path); files = files.slice().sort(comparer); - directories = directories.slice().sort(comparer); for (const current of files) { const name = combinePaths(path, current); @@ -2059,12 +2059,20 @@ namespace ts { } } + if (depth !== undefined) { + depth--; + if (depth === 0) { + return; + } + } + + directories = directories.slice().sort(comparer); for (const current of directories) { const name = combinePaths(path, current); const absoluteName = combinePaths(absolutePath, current); if ((!includeDirectoryRegex || includeDirectoryRegex.test(absoluteName)) && (!excludeRegex || !excludeRegex.test(absoluteName))) { - visitDirectory(name, absoluteName); + visitDirectory(name, absoluteName, depth); } } } diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts index cd14f3b2801..18ddba9c917 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -33,7 +33,7 @@ namespace ts { getExecutingFilePath(): string; getCurrentDirectory(): string; getDirectories(path: string): string[]; - readDirectory(path: string, extensions?: string[], exclude?: string[], include?: string[]): string[]; + readDirectory(path: string, extensions?: string[], exclude?: string[], include?: string[], depth?: number): string[]; getModifiedTime?(path: string): Date; /** * This should be cryptographically secure. @@ -281,8 +281,8 @@ namespace ts { } } - function readDirectory(path: string, extensions?: string[], excludes?: string[], includes?: string[]): string[] { - return matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, process.cwd(), getAccessibleFileSystemEntries); + function readDirectory(path: string, extensions?: string[], excludes?: string[], includes?: string[], depth?: number): string[] { + return matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, process.cwd(), depth, getAccessibleFileSystemEntries); } const enum FileSystemEntryKind { @@ -475,7 +475,7 @@ namespace ts { getCurrentDirectory: () => ChakraHost.currentDirectory, getDirectories: ChakraHost.getDirectories, getEnvironmentVariable: ChakraHost.getEnvironmentVariable || (() => ""), - readDirectory: (path: string, extensions?: string[], excludes?: string[], includes?: string[]) => { + readDirectory(path, extensions, excludes, includes, _depth) { const pattern = getFileMatcherPatterns(path, excludes, includes, !!ChakraHost.useCaseSensitiveFileNames, ChakraHost.currentDirectory); return ChakraHost.readDirectory(path, extensions, pattern.basePaths, pattern.excludePattern, pattern.includeFilePattern, pattern.includeDirectoryPattern); }, diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 85ab8a65d5d..4b79c4e99ed 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -2390,7 +2390,7 @@ namespace ts { export interface ParseConfigHost { useCaseSensitiveFileNames: boolean; - readDirectory(rootDir: string, extensions: string[], excludes: string[], includes: string[]): string[]; + readDirectory(rootDir: string, extensions: string[], excludes: string[], includes: string[], depth: number): string[]; /** * Gets a value indicating whether the specified path exists and is a file. diff --git a/src/harness/harness.ts b/src/harness/harness.ts index 97d49ca134d..026ff2de85f 100644 --- a/src/harness/harness.ts +++ b/src/harness/harness.ts @@ -493,7 +493,7 @@ namespace Harness { args(): string[]; getExecutingFilePath(): string; exit(exitCode?: number): void; - readDirectory(path: string, extension?: string[], exclude?: string[], include?: string[]): string[]; + readDirectory(path: string, extension?: string[], exclude?: string[], include?: string[], depth?: number): string[]; tryEnableSourceMapsForHost?(): void; getEnvironmentVariable?(name: string): string; } @@ -537,7 +537,7 @@ namespace Harness { ts.sys.tryEnableSourceMapsForHost(); } } - export const readDirectory: typeof IO.readDirectory = (path, extension, exclude, include) => ts.sys.readDirectory(path, extension, exclude, include); + export const readDirectory: typeof IO.readDirectory = (path, extension, exclude, include, depth) => ts.sys.readDirectory(path, extension, exclude, include, depth); export function createDirectory(path: string) { if (!directoryExists(path)) { @@ -733,12 +733,12 @@ namespace Harness { Http.writeToServerSync(serverRoot + path, "WRITE", contents); } - export function readDirectory(path: string, extension?: string[], exclude?: string[], include?: string[]) { + export function readDirectory(path: string, extension?: string[], exclude?: string[], include?: string[], depth?: number) { const fs = new Utils.VirtualFileSystem(path, useCaseSensitiveFileNames()); for (const file of listFiles(path)) { fs.addFile(file); } - return ts.matchFiles(path, extension, exclude, include, useCaseSensitiveFileNames(), getCurrentDirectory(), path => { + return ts.matchFiles(path, extension, exclude, include, useCaseSensitiveFileNames(), getCurrentDirectory(), depth, path => { const entry = fs.traversePath(path); if (entry && entry.isDirectory()) { const directory = entry; diff --git a/src/harness/harnessLanguageService.ts b/src/harness/harnessLanguageService.ts index 774c43556ca..82f0b87be94 100644 --- a/src/harness/harnessLanguageService.ts +++ b/src/harness/harnessLanguageService.ts @@ -208,10 +208,11 @@ namespace Harness.LanguageService { const script = this.getScriptSnapshot(fileName); return script !== undefined; } - readDirectory(path: string, extensions?: string[], exclude?: string[], include?: string[]): string[] { + readDirectory(path: string, extensions?: string[], exclude?: string[], include?: string[], depth?: number): string[] { return ts.matchFiles(path, extensions, exclude, include, /*useCaseSensitiveFileNames*/ false, this.getCurrentDirectory(), + depth, (p) => this.virtualFileSystem.getAccessibleFileSystemEntries(p)); } readFile(path: string): string { @@ -312,9 +313,7 @@ namespace Harness.LanguageService { getScriptVersion(fileName: string): string { return this.nativeHost.getScriptVersion(fileName); } getLocalizedDiagnosticMessages(): string { return JSON.stringify({}); } - readDirectory(_rootDir: string, _extension: string): string { - return ts.notImplemented(); - } + readDirectory = ts.notImplemented; readDirectoryNames = ts.notImplemented; readFileNames = ts.notImplemented; fileExists(fileName: string) { return this.getScriptInfo(fileName) !== undefined; } @@ -668,9 +667,7 @@ namespace Harness.LanguageService { return ts.sys.getEnvironmentVariable(name); } - readDirectory(_path: string, _extension?: string[], _exclude?: string[], _include?: string[]): string[] { - return ts.notImplemented(); - } + readDirectory() { return ts.notImplemented(); } watchFile(): ts.FileWatcher { return { close: ts.noop }; diff --git a/src/harness/loggedIO.ts b/src/harness/loggedIO.ts index 76f585b623a..d4a1e2e2bd0 100644 --- a/src/harness/loggedIO.ts +++ b/src/harness/loggedIO.ts @@ -67,6 +67,7 @@ interface IOLog { extensions: string[], exclude: string[], include: string[], + depth: number, result: string[] }[]; } @@ -220,10 +221,9 @@ namespace Playback { memoize(path => findFileByPath(replayLog.filesRead, path, /*throwFileNotFoundError*/ true).contents)); wrapper.readDirectory = recordReplay(wrapper.readDirectory, underlying)( - (path, extensions, exclude, include) => { - const result = (underlying).readDirectory(path, extensions, exclude, include); - const logEntry = { path, extensions, exclude, include, result }; - recordLog.directoriesRead.push(logEntry); + (path, extensions, exclude, include, depth) => { + const result = (underlying).readDirectory(path, extensions, exclude, include, depth); + recordLog.directoriesRead.push({ path, extensions, exclude, include, depth, result }); return result; }, path => { diff --git a/src/harness/projectsRunner.ts b/src/harness/projectsRunner.ts index b02164034fa..169d2ef539b 100644 --- a/src/harness/projectsRunner.ts +++ b/src/harness/projectsRunner.ts @@ -275,8 +275,8 @@ class ProjectRunner extends RunnerBase { : ts.normalizeSlashes(testCase.projectRoot) + "/" + ts.normalizeSlashes(fileName); } - function readDirectory(rootDir: string, extension: string[], exclude: string[], include: string[]): string[] { - const harnessReadDirectoryResult = Harness.IO.readDirectory(getFileNameInTheProjectTest(rootDir), extension, exclude, include); + function readDirectory(rootDir: string, extension: string[], exclude: string[], include: string[], depth: number): string[] { + const harnessReadDirectoryResult = Harness.IO.readDirectory(getFileNameInTheProjectTest(rootDir), extension, exclude, include, depth); const result: string[] = []; for (let i = 0; i < harnessReadDirectoryResult.length; i++) { result[i] = ts.getRelativePathToDirectoryOrUrl(testCase.projectRoot, harnessReadDirectoryResult[i], diff --git a/src/harness/unittests/session.ts b/src/harness/unittests/session.ts index 067cd351ec7..e8e54a0d6d0 100644 --- a/src/harness/unittests/session.ts +++ b/src/harness/unittests/session.ts @@ -19,7 +19,7 @@ namespace ts.server { getExecutingFilePath(): string { return void 0; }, getCurrentDirectory(): string { return void 0; }, getEnvironmentVariable(): string { return ""; }, - readDirectory(): string[] { return []; }, + readDirectory() { return []; }, exit: noop, setTimeout() { return 0; }, clearTimeout: noop, diff --git a/src/harness/unittests/tsserverProjectSystem.ts b/src/harness/unittests/tsserverProjectSystem.ts index 2f6ba7aa3bb..c0a0d21f854 100644 --- a/src/harness/unittests/tsserverProjectSystem.ts +++ b/src/harness/unittests/tsserverProjectSystem.ts @@ -438,14 +438,13 @@ namespace ts.projectSystem { } } - readDirectory(path: string, extensions?: string[], exclude?: string[], include?: string[]): string[] { - const that = this; - return ts.matchFiles(path, extensions, exclude, include, this.useCaseSensitiveFileNames, this.getCurrentDirectory(), (dir) => { + readDirectory(path: string, extensions?: string[], exclude?: string[], include?: string[], depth?: number): string[] { + return ts.matchFiles(path, extensions, exclude, include, this.useCaseSensitiveFileNames, this.getCurrentDirectory(), depth, (dir) => { const result: FileSystemEntries = { directories: [], files: [] }; - const dirEntry = that.fs.get(that.toPath(dir)); + const dirEntry = this.fs.get(this.toPath(dir)); if (isFolder(dirEntry)) { dirEntry.entries.forEach((entry) => { if (isFolder(entry)) { diff --git a/src/harness/unittests/typingsInstaller.ts b/src/harness/unittests/typingsInstaller.ts index 9483308287f..7479c532c08 100644 --- a/src/harness/unittests/typingsInstaller.ts +++ b/src/harness/unittests/typingsInstaller.ts @@ -663,16 +663,22 @@ namespace ts.projectSystem { path: "/node_modules/jquery/package.json", content: JSON.stringify({ name: "jquery" }) }; + // Should not search deeply in node_modules. + const nestedPackage = { + path: "/node_modules/jquery/nested/package.json", + content: JSON.stringify({ name: "nested" }), + }; const jqueryDTS = { path: "/tmp/node_modules/@types/jquery/index.d.ts", content: "" }; - const host = createServerHost([app, jsconfig, jquery, jqueryPackage]); + const host = createServerHost([app, jsconfig, jquery, jqueryPackage, nestedPackage]); const installer = new (class extends Installer { constructor() { - super(host, { globalTypingsCacheLocation: "/tmp", typesRegistry: createTypesRegistry("jquery") }); + super(host, { globalTypingsCacheLocation: "/tmp", typesRegistry: createTypesRegistry("jquery", "nested") }); } - installWorker(_requestId: number, _args: string[], _cwd: string, cb: TI.RequestCompletedAction) { + installWorker(_requestId: number, args: string[], _cwd: string, cb: TI.RequestCompletedAction) { + assert.deepEqual(args, [`@types/jquery@ts${versionMajorMinor}`]); const installedTypings = ["@types/jquery"]; const typingFiles = [jqueryDTS]; executeCommand(this, host, installedTypings, typingFiles, cb); @@ -1058,6 +1064,29 @@ namespace ts.projectSystem { assert.deepEqual(result.cachedTypingPaths, [node.path]); assert.deepEqual(result.newTypingNames, ["bar"]); }); + + it("should search only 2 levels deep", () => { + const app = { + path: "/app.js", + content: "", + }; + const a = { + path: "/node_modules/a/package.json", + content: JSON.stringify({ name: "a" }), + }; + const b = { + path: "/node_modules/a/b/package.json", + content: JSON.stringify({ name: "b" }), + }; + const host = createServerHost([app, a, b]); + const cache = createMap(); + const result = JsTyping.discoverTypings(host, [app.path], getDirectoryPath(app.path), /*safeListPath*/ undefined, cache, { enable: true }, /*unresolvedImports*/ []); + assert.deepEqual(result, { + cachedTypingPaths: [], + newTypingNames: ["a"], // But not "b" + filesToWatch: ["/bower_components", "/node_modules"], + }); + }); }); describe("telemetry events", () => { diff --git a/src/harness/virtualFileSystem.ts b/src/harness/virtualFileSystem.ts index b89f4c7232d..3904a27bb1c 100644 --- a/src/harness/virtualFileSystem.ts +++ b/src/harness/virtualFileSystem.ts @@ -216,8 +216,8 @@ namespace Utils { } } - readDirectory(path: string, extensions: string[], excludes: string[], includes: string[]) { - return ts.matchFiles(path, extensions, excludes, includes, this.useCaseSensitiveFileNames, this.currentDirectory, (path: string) => this.getAccessibleFileSystemEntries(path)); + readDirectory(path: string, extensions: string[], excludes: string[], includes: string[], depth: number) { + return ts.matchFiles(path, extensions, excludes, includes, this.useCaseSensitiveFileNames, this.currentDirectory, depth, (path: string) => this.getAccessibleFileSystemEntries(path)); } } } \ No newline at end of file diff --git a/src/server/lsHost.ts b/src/server/lsHost.ts index b8f9807139f..fa972a0c930 100644 --- a/src/server/lsHost.ts +++ b/src/server/lsHost.ts @@ -222,8 +222,8 @@ namespace ts.server { return this.host.directoryExists(path); } - readDirectory(path: string, extensions?: string[], exclude?: string[], include?: string[]): string[] { - return this.host.readDirectory(path, extensions, exclude, include); + readDirectory(path: string, extensions?: string[], exclude?: string[], include?: string[], depth?: number): string[] { + return this.host.readDirectory(path, extensions, exclude, include, depth); } getDirectories(path: string): string[] { diff --git a/src/server/server.ts b/src/server/server.ts index 5f2b7054755..a7063fb1ad3 100644 --- a/src/server/server.ts +++ b/src/server/server.ts @@ -35,7 +35,6 @@ namespace ts.server { } = require("os"); function getGlobalTypingsCacheLocation() { - const versionMajorMinor = ts.version.match(/\d+\.\d+/)[0]; switch (process.platform) { case "win32": { const basePath = process.env.LOCALAPPDATA || diff --git a/src/server/typingsInstaller/typingsInstaller.ts b/src/server/typingsInstaller/typingsInstaller.ts index fa533450b26..cf1e1a836a0 100644 --- a/src/server/typingsInstaller/typingsInstaller.ts +++ b/src/server/typingsInstaller/typingsInstaller.ts @@ -434,5 +434,4 @@ namespace ts.server.typingsInstaller { export function typingsName(packageName: string): string { return `@types/${packageName}@ts${versionMajorMinor}`; } - const versionMajorMinor = version.split(".").slice(0, 2).join("."); } \ No newline at end of file diff --git a/src/services/jsTyping.ts b/src/services/jsTyping.ts index 008fe357ec5..f3ee1e007cc 100644 --- a/src/services/jsTyping.ts +++ b/src/services/jsTyping.ts @@ -208,6 +208,7 @@ namespace ts.JsTyping { return; } + // depth of 2, so we access `node_modules/foo` but not `node_modules/foo/bar` const fileNames = host.readDirectory(packagesFolderPath, [".json"], /*excludes*/ undefined, /*includes*/ undefined, /*depth*/ 2); for (const fileName of fileNames) { const normalizedFileName = normalizePath(fileName); diff --git a/src/services/shims.ts b/src/services/shims.ts index 1c37f598021..0a0b2c82c5b 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -467,7 +467,7 @@ namespace ts { } } - export class CoreServicesShimHostAdapter implements ParseConfigHost, ModuleResolutionHost { + export class CoreServicesShimHostAdapter implements ParseConfigHost, ModuleResolutionHost, JsTyping.TypingResolutionHost { public directoryExists: (directoryName: string) => boolean; public realpath: (path: string) => string; @@ -484,33 +484,17 @@ namespace ts { } public readDirectory(rootDir: string, extensions: string[], exclude: string[], include: string[], depth?: number): string[] { - // Wrap the API changes for 2.0 release. This try/catch - // should be removed once TypeScript 2.0 has shipped. - try { - const pattern = getFileMatcherPatterns(rootDir, exclude, include, - this.shimHost.useCaseSensitiveFileNames(), this.shimHost.getCurrentDirectory()); - return JSON.parse(this.shimHost.readDirectory( - rootDir, - JSON.stringify(extensions), - JSON.stringify(pattern.basePaths), - pattern.excludePattern, - pattern.includeFilePattern, - pattern.includeDirectoryPattern, - depth - )); - } - catch (e) { - const results: string[] = []; - for (const extension of extensions) { - for (const file of this.readDirectoryFallback(rootDir, extension, exclude)) - { - if (!contains(results, file)) { - results.push(file); - } - } - } - return results; - } + const pattern = getFileMatcherPatterns(rootDir, exclude, include, + this.shimHost.useCaseSensitiveFileNames(), this.shimHost.getCurrentDirectory()); + return JSON.parse(this.shimHost.readDirectory( + rootDir, + JSON.stringify(extensions), + JSON.stringify(pattern.basePaths), + pattern.excludePattern, + pattern.includeFilePattern, + pattern.includeDirectoryPattern, + depth + )); } public fileExists(fileName: string): boolean { @@ -521,10 +505,6 @@ namespace ts { return this.shimHost.readFile(fileName); } - private readDirectoryFallback(rootDir: string, extension: string, exclude: string[]) { - return JSON.parse(this.shimHost.readDirectory(rootDir, extension, JSON.stringify(exclude))); - } - public getDirectories(path: string): string[] { return JSON.parse(this.shimHost.getDirectories(path)); } diff --git a/src/services/types.ts b/src/services/types.ts index 2d47da2fd1d..447029a2f66 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -163,7 +163,7 @@ namespace ts { * LS host can optionally implement these methods to support completions for module specifiers. * Without these methods, only completions for ambient modules will be provided. */ - readDirectory?(path: string, extensions?: string[], exclude?: string[], include?: string[]): string[]; + readDirectory?(path: string, extensions?: string[], exclude?: string[], include?: string[], depth?: number): string[]; readFile?(path: string, encoding?: string): string; fileExists?(path: string): boolean; From 60b78c618f2c65d90dfc15145faee3723c66dd77 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Thu, 29 Jun 2017 11:13:44 -0700 Subject: [PATCH 51/62] only format open curly up to the open curly --- src/services/formatting/formatting.ts | 31 ++++++++++++++++----------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index aa127621b58..809d2103e2f 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -98,21 +98,28 @@ namespace ts.formatting { export function formatOnSemicolon(position: number, sourceFile: SourceFile, rulesProvider: RulesProvider, options: FormatCodeSettings): TextChange[] { const semicolon = findImmediatelyPrecedingTokenOfKind(position, SyntaxKind.SemicolonToken, sourceFile); - return formatOutermostNodeWithinListLevel(semicolon, sourceFile, options, rulesProvider, FormattingRequestKind.FormatOnSemicolon); + return formatNodeLines(findOutermostNodeWithinListLevel(semicolon), sourceFile, options, rulesProvider, FormattingRequestKind.FormatOnSemicolon); } export function formatOnOpeningCurly(position: number, sourceFile: SourceFile, rulesProvider: RulesProvider, options: FormatCodeSettings): TextChange[] { const openingCurly = findImmediatelyPrecedingTokenOfKind(position, SyntaxKind.OpenBraceToken, sourceFile); - const curlyBraceRange = openingCurly && openingCurly.parent; - const nextToken = curlyBraceRange && findNextToken(openingCurly, curlyBraceRange); - return nextToken && nextToken.kind === SyntaxKind.CloseBraceToken ? - formatOutermostNodeWithinListLevel(curlyBraceRange, sourceFile, options, rulesProvider, FormattingRequestKind.FormatOnOpeningCurlyBrace) : - []; + if (openingCurly) { + const curlyBraceRange = openingCurly.parent; + const outermostNode = findOutermostNodeWithinListLevel(curlyBraceRange); + + const textRange: TextRange = { + pos: getLineStartPositionForPosition(outermostNode.getStart(sourceFile), sourceFile), + end: position + }; + + return formatSpan(textRange, sourceFile, options, rulesProvider, FormattingRequestKind.FormatOnOpeningCurlyBrace); + } + return []; } export function formatOnClosingCurly(position: number, sourceFile: SourceFile, rulesProvider: RulesProvider, options: FormatCodeSettings): TextChange[] { const precedingToken = findImmediatelyPrecedingTokenOfKind(position, SyntaxKind.CloseBraceToken, sourceFile); - return formatOutermostNodeWithinListLevel(precedingToken, sourceFile, options, rulesProvider, FormattingRequestKind.FormatOnClosingCurlyBrace); + return formatNodeLines(findOutermostNodeWithinListLevel(precedingToken), sourceFile, options, rulesProvider, FormattingRequestKind.FormatOnClosingCurlyBrace); } export function formatDocument(sourceFile: SourceFile, rulesProvider: RulesProvider, options: FormatCodeSettings): TextChange[] { @@ -145,8 +152,8 @@ namespace ts.formatting { } /** - * Finds and formats the highest node enclosing `node` whose end does not exceed the `node.end` - * and is at the same list level as the token at `node`. + * Finds the highest node enclosing `node` at the same list level as `node` + * and whose end does not exceed `node.end`. * * Consider typing the following * ``` @@ -157,9 +164,7 @@ namespace ts.formatting { * Upon typing the closing curly, we want to format the entire `while`-statement, but not the preceding * variable declaration. */ - function formatOutermostNodeWithinListLevel(node: Node, sourceFile: SourceFile, options: FormatCodeSettings, rulesProvider: RulesProvider, formattingRequestKind: FormattingRequestKind) { - // If we walk upwards searching for the parent that has the same end value, we'll end up with the whole source file. - // `isListElement` allows to stop on the list element level. + function findOutermostNodeWithinListLevel(node: Node) { let current = node; while (current && current.parent && @@ -168,7 +173,7 @@ namespace ts.formatting { current = current.parent; } - return formatNodeLines(current, sourceFile, options, rulesProvider, formattingRequestKind); + return current; } // Returns true if node is a element in some list in parent From 569ecabb0a6c83f8c0eb9249dd79cfa3e4e91231 Mon Sep 17 00:00:00 2001 From: Andrew Casey Date: Thu, 22 Jun 2017 13:47:54 -0700 Subject: [PATCH 52/62] Address PR feedback Make Program.getMissingFilePaths required Assume getMissingFilePaths always returns a defined value Make getMissingFilePaths internal Replace nullable-bool with enum Update type to reflect possibility of undefined Use deepEqual to simplify tests Make condition const Don't bother cleaning up map before freeing it Switch from foreach to for-of to simplify debugging Use a Map, rather than a FileMap, to track open FileWatchers Fix compilation errors Introduce and consume arrayToSet Fix lint warnings about misplaced braces Delete incorrect comment Delete from map during iteration Eliminate unnecessary type annotations --- src/compiler/core.ts | 9 ++++ src/compiler/program.ts | 19 +++----- src/compiler/sys.ts | 24 ++++++---- src/compiler/tsc.ts | 25 +++++------ src/compiler/types.ts | 3 +- src/harness/unittests/compileOnSave.ts | 6 +-- src/harness/unittests/programMissingFiles.ts | 40 +++++++---------- src/harness/unittests/projectErrors.ts | 4 +- .../unittests/tsserverProjectSystem.ts | 40 ++++++++--------- src/harness/unittests/typingsInstaller.ts | 2 +- src/server/project.ts | 45 ++++++++----------- src/server/server.ts | 10 ++--- 12 files changed, 112 insertions(+), 115 deletions(-) diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 86ad483ccc3..93c7eed7aca 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -1097,6 +1097,15 @@ namespace ts { return result; } + /** + * Creates a set from the elements of an array. + * + * @param array the array of input elements. + */ + export function arrayToSet(array: T[], makeKey: (value: T) => string): Map { + return arrayToMap(array, makeKey, () => true); + } + export function cloneMap(map: Map) { const clone = createMap(); copyEntries(map, clone); diff --git a/src/compiler/program.ts b/src/compiler/program.ts index ac82fbba02c..7b62fde8570 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -472,7 +472,7 @@ namespace ts { resolveTypeReferenceDirectiveNamesWorker = (typeReferenceDirectiveNames, containingFile) => loadWithLocalCache(typeReferenceDirectiveNames, containingFile, loader); } - const filesByName = createMap(); + const filesByName = createMap(); // stores 'filename -> file association' ignoring case // used to track cases when two file names differ only in casing const filesByNameIgnoreCase = host.useCaseSensitiveFileNames() ? createFileMap(fileName => fileName.toLowerCase()) : undefined; @@ -513,7 +513,7 @@ namespace ts { } } - const missingFilePaths = filesByName.getKeys().filter(p => !filesByName.get(p)); + const missingFilePaths = arrayFrom(filesByName.keys(), p => p).filter(p => !filesByName.get(p)); // unconditionally set moduleResolutionCache to undefined to avoid unnecessary leaks moduleResolutionCache = undefined; @@ -872,17 +872,12 @@ namespace ts { // will be created until we encounter a change that prevents complete structure reuse. // During this interval, creation of the file will go unnoticed. We expect this to be // both rare and low-impact. - if (oldProgram.getMissingFilePaths) { - const missingFilePaths: Path[] = oldProgram.getMissingFilePaths() || emptyArray; - for (const missingFilePath of missingFilePaths) { - if (host.fileExists(missingFilePath)) { - return oldProgram.structureIsReused = StructureIsReused.SafeModules; - } - } + if (oldProgram.getMissingFilePaths().some(missingFilePath => host.fileExists(missingFilePath))) { + return oldProgram.structureIsReused = StructureIsReused.SafeModules; + } - for (const p of oldProgram.getMissingFilePaths()) { - filesByName.set(p, undefined); - } + for (const p of oldProgram.getMissingFilePaths()) { + filesByName.set(p, undefined); } // update fileName -> file mapping diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts index 8448c9b3615..ca6f85cf0dd 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -4,7 +4,13 @@ declare function setTimeout(handler: (...args: any[]) => void, timeout: number): declare function clearTimeout(handle: any): void; namespace ts { - export type FileWatcherCallback = (fileName: string, removed?: boolean) => void; + export enum FileWatcherEventKind { + Created, + Changed, + Deleted + } + + export type FileWatcherCallback = (fileName: string, eventKind: FileWatcherEventKind) => void; export type DirectoryWatcherCallback = (fileName: string) => void; export interface WatchedFile { fileName: string; @@ -174,7 +180,7 @@ namespace ts { const callbacks = fileWatcherCallbacks.get(fileName); if (callbacks) { for (const fileCallback of callbacks) { - fileCallback(fileName); + fileCallback(fileName, FileWatcherEventKind.Changed); } } } @@ -342,18 +348,20 @@ namespace ts { function fileChanged(curr: any, prev: any) { const isCurrZero = +curr.mtime === 0; const isPrevZero = +prev.mtime === 0; - const added = !isCurrZero && isPrevZero; + const created = !isCurrZero && isPrevZero; const deleted = isCurrZero && !isPrevZero; - // This value is consistent with poll() in createPollingWatchedFileSet() - // and depended upon by the file watchers created in Project.updateGraphWorker. - const removed = deleted ? true : (added ? false : undefined); + const eventKind = created + ? FileWatcherEventKind.Created + : deleted + ? FileWatcherEventKind.Deleted + : FileWatcherEventKind.Changed; - if (!added && !deleted && +curr.mtime <= +prev.mtime) { + if (eventKind === FileWatcherEventKind.Changed && +curr.mtime <= +prev.mtime) { return; } - callback(fileName, removed); + callback(fileName, eventKind); } }, watchDirectory: (directoryName, callback, recursive) => { diff --git a/src/compiler/tsc.ts b/src/compiler/tsc.ts index 8264282cba9..6e0aefd99a0 100644 --- a/src/compiler/tsc.ts +++ b/src/compiler/tsc.ts @@ -286,18 +286,15 @@ namespace ts { setCachedProgram(compileResult.program); reportWatchDiagnostic(createCompilerDiagnostic(Diagnostics.Compilation_complete_Watching_for_file_changes)); - if (compileResult.program.getMissingFilePaths) { - const missingPaths = compileResult.program.getMissingFilePaths() || []; - missingPaths.forEach((path: Path): void => { - const fileWatcher = sys.watchFile(path, (_fileName: string, removed?: boolean) => { - // removed = deleted ? true : (added ? false : undefined) - if (removed === false) { - fileWatcher.close(); - startTimerForRecompilation(); - } - }); + const missingPaths = compileResult.program.getMissingFilePaths(); + missingPaths.forEach(path => { + const fileWatcher = sys.watchFile(path, (_fileName, eventKind) => { + if (eventKind === FileWatcherEventKind.Created) { + fileWatcher.close(); + startTimerForRecompilation(); + } }); - } + }); } function cachedFileExists(fileName: string): boolean { @@ -321,7 +318,7 @@ namespace ts { const sourceFile = hostGetSourceFile(fileName, languageVersion, onError); if (sourceFile && isWatchSet(compilerOptions) && sys.watchFile) { // Attach a file watcher - sourceFile.fileWatcher = sys.watchFile(sourceFile.fileName, (_fileName: string, removed?: boolean) => sourceFileChanged(sourceFile, removed)); + sourceFile.fileWatcher = sys.watchFile(sourceFile.fileName, (_fileName, eventKind) => sourceFileChanged(sourceFile, eventKind)); } return sourceFile; } @@ -343,10 +340,10 @@ namespace ts { } // If a source file changes, mark it as unwatched and start the recompilation timer - function sourceFileChanged(sourceFile: SourceFile, removed?: boolean) { + function sourceFileChanged(sourceFile: SourceFile, eventKind: FileWatcherEventKind) { sourceFile.fileWatcher.close(); sourceFile.fileWatcher = undefined; - if (removed) { + if (eventKind === FileWatcherEventKind.Deleted) { unorderedRemoveItem(rootFileNames, sourceFile.fileName); } startTimerForRecompilation(); diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 99d62091ed5..bb2994a487f 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -2430,7 +2430,8 @@ namespace ts { * Get a list of file names that were passed to 'createProgram' or referenced in a * program source file but could not be located. */ - getMissingFilePaths?(): Path[]; + /* @internal */ + getMissingFilePaths(): Path[]; /** * Emits the JavaScript and declaration files. If targetSourceFile is not specified, then diff --git a/src/harness/unittests/compileOnSave.ts b/src/harness/unittests/compileOnSave.ts index 7e262a1b257..79e1f921dcb 100644 --- a/src/harness/unittests/compileOnSave.ts +++ b/src/harness/unittests/compileOnSave.ts @@ -208,7 +208,7 @@ namespace ts.projectSystem { file1Consumer1.content = `let y = 10;`; host.reloadFS([moduleFile1, file1Consumer1, file1Consumer2, configFile, libFile]); - host.triggerFileWatcherCallback(file1Consumer1.path, /*removed*/ false); + host.triggerFileWatcherCallback(file1Consumer1.path, FileWatcherEventKind.Changed); session.executeCommand(changeModuleFile1ShapeRequest1); sendAffectedFileRequestAndCheckResult(session, moduleFile1FileListRequest, [{ projectFileName: configFile.path, files: [moduleFile1, file1Consumer2] }]); @@ -225,7 +225,7 @@ namespace ts.projectSystem { session.executeCommand(changeModuleFile1ShapeRequest1); // Delete file1Consumer2 host.reloadFS([moduleFile1, file1Consumer1, configFile, libFile]); - host.triggerFileWatcherCallback(file1Consumer2.path, /*removed*/ true); + host.triggerFileWatcherCallback(file1Consumer2.path, FileWatcherEventKind.Deleted); sendAffectedFileRequestAndCheckResult(session, moduleFile1FileListRequest, [{ projectFileName: configFile.path, files: [moduleFile1, file1Consumer1] }]); }); @@ -475,7 +475,7 @@ namespace ts.projectSystem { openFilesForSession([referenceFile1], session); host.reloadFS([referenceFile1, configFile]); - host.triggerFileWatcherCallback(moduleFile1.path, /*removed*/ true); + host.triggerFileWatcherCallback(moduleFile1.path, FileWatcherEventKind.Deleted); const request = makeSessionRequest(CommandNames.CompileOnSaveAffectedFileList, { file: referenceFile1.path }); sendAffectedFileRequestAndCheckResult(session, request, [ diff --git a/src/harness/unittests/programMissingFiles.ts b/src/harness/unittests/programMissingFiles.ts index 26cc63590bd..668b684a250 100644 --- a/src/harness/unittests/programMissingFiles.ts +++ b/src/harness/unittests/programMissingFiles.ts @@ -41,39 +41,33 @@ namespace ts { const program = createProgram([emptyFileRelativePath], options, testCompilerHost); const missing = program.getMissingFilePaths(); assert.isDefined(missing); - assert.equal(missing.length, 0); + assert.deepEqual(missing, []); }); it("handles missing root file", () => { const program = createProgram(["./nonexistent.ts"], options, testCompilerHost); const missing = program.getMissingFilePaths(); assert.isDefined(missing); - assert.equal(missing.length, 1); - assert.equal(missing[0].toString(), "d:/pretend/nonexistent.ts"); // Absolute path + assert.deepEqual(missing, ["d:/pretend/nonexistent.ts"]); // Absolute path }); it("handles multiple missing root files", () => { const program = createProgram(["./nonexistent0.ts", "./nonexistent1.ts"], options, testCompilerHost); const missing = program.getMissingFilePaths().sort(); - assert.equal(missing.length, 2); - assert.equal(missing[0].toString(), "d:/pretend/nonexistent0.ts"); - assert.equal(missing[1].toString(), "d:/pretend/nonexistent1.ts"); + assert.deepEqual(missing, ["d:/pretend/nonexistent0.ts", "d:/pretend/nonexistent1.ts"]); }); it("handles a mix of present and missing root files", () => { const program = createProgram(["./nonexistent0.ts", emptyFileRelativePath, "./nonexistent1.ts"], options, testCompilerHost); const missing = program.getMissingFilePaths().sort(); - assert.equal(missing.length, 2); - assert.equal(missing[0].toString(), "d:/pretend/nonexistent0.ts"); - assert.equal(missing[1].toString(), "d:/pretend/nonexistent1.ts"); + assert.deepEqual(missing, ["d:/pretend/nonexistent0.ts", "d:/pretend/nonexistent1.ts"]); }); it("handles repeatedly specified root files", () => { const program = createProgram(["./nonexistent.ts", "./nonexistent.ts"], options, testCompilerHost); const missing = program.getMissingFilePaths(); assert.isDefined(missing); - assert.equal(missing.length, 1); - assert.equal(missing[0].toString(), "d:/pretend/nonexistent.ts"); + assert.deepEqual(missing, ["d:/pretend/nonexistent.ts"]); }); it("normalizes file paths", () => { @@ -89,21 +83,21 @@ namespace ts { const program = createProgram([referenceFileRelativePath], options, testCompilerHost); const missing = program.getMissingFilePaths().sort(); assert.isDefined(missing); - assert.equal(missing.length, 6); + assert.deepEqual(missing, [ + // From absolute reference + "d:/imaginary/nonexistent1.ts", - // From absolute reference - assert.equal(missing[0].toString(), "d:/imaginary/nonexistent1.ts"); + // From relative reference + "d:/pretend/nonexistent2.ts", - // From relative reference - assert.equal(missing[1].toString(), "d:/pretend/nonexistent2.ts"); + // From unqualified reference + "d:/pretend/nonexistent3.ts", - // From unqualified reference - assert.equal(missing[2].toString(), "d:/pretend/nonexistent3.ts"); - - // From no-extension reference - assert.equal(missing[3].toString(), "d:/pretend/nonexistent4.d.ts"); - assert.equal(missing[4].toString(), "d:/pretend/nonexistent4.ts"); - assert.equal(missing[5].toString(), "d:/pretend/nonexistent4.tsx"); + // From no-extension reference + "d:/pretend/nonexistent4.d.ts", + "d:/pretend/nonexistent4.ts", + "d:/pretend/nonexistent4.tsx" + ]); }); }); } \ No newline at end of file diff --git a/src/harness/unittests/projectErrors.ts b/src/harness/unittests/projectErrors.ts index 30942fb2fdc..f250d4d9b36 100644 --- a/src/harness/unittests/projectErrors.ts +++ b/src/harness/unittests/projectErrors.ts @@ -135,7 +135,7 @@ namespace ts.projectSystem { } // fix config and trigger watcher host.reloadFS([file1, file2, correctConfig]); - host.triggerFileWatcherCallback(correctConfig.path, /*false*/); + host.triggerFileWatcherCallback(correctConfig.path, FileWatcherEventKind.Changed); { projectService.checkNumberOfProjects({ configuredProjects: 1 }); const configuredProject = forEach(projectService.synchronizeProjectList([]), f => f.info.projectName === corruptedConfig.path && f); @@ -177,7 +177,7 @@ namespace ts.projectSystem { } // break config and trigger watcher host.reloadFS([file1, file2, corruptedConfig]); - host.triggerFileWatcherCallback(corruptedConfig.path, /*false*/); + host.triggerFileWatcherCallback(corruptedConfig.path, FileWatcherEventKind.Changed); { projectService.checkNumberOfProjects({ configuredProjects: 1 }); const configuredProject = forEach(projectService.synchronizeProjectList([]), f => f.info.projectName === corruptedConfig.path && f); diff --git a/src/harness/unittests/tsserverProjectSystem.ts b/src/harness/unittests/tsserverProjectSystem.ts index d098c91eecf..66873ee2411 100644 --- a/src/harness/unittests/tsserverProjectSystem.ts +++ b/src/harness/unittests/tsserverProjectSystem.ts @@ -485,12 +485,12 @@ namespace ts.projectSystem { } } - triggerFileWatcherCallback(fileName: string, removed?: boolean): void { + triggerFileWatcherCallback(fileName: string, eventKind: FileWatcherEventKind): void { const path = this.toPath(fileName); const callbacks = this.watchedFiles.get(path); if (callbacks) { for (const callback of callbacks) { - callback(path, removed); + callback(path, eventKind); } } } @@ -771,7 +771,7 @@ namespace ts.projectSystem { // remove the tsconfig file host.reloadFS(filesWithoutConfig); - host.triggerFileWatcherCallback(configFile.path); + host.triggerFileWatcherCallback(configFile.path, FileWatcherEventKind.Changed); checkNumberOfInferredProjects(projectService, 2); checkNumberOfConfiguredProjects(projectService, 0); @@ -928,7 +928,7 @@ namespace ts.projectSystem { "files": ["${commonFile1.path}"] }`; host.reloadFS(files); - host.triggerFileWatcherCallback(configFile.path); + host.triggerFileWatcherCallback(configFile.path, FileWatcherEventKind.Changed); checkNumberOfConfiguredProjects(projectService, 1); checkProjectRootFiles(project, [commonFile1.path]); @@ -1002,7 +1002,7 @@ namespace ts.projectSystem { "files": ["${file1.path}"] }`; host.reloadFS(files); - host.triggerFileWatcherCallback(configFile.path); + host.triggerFileWatcherCallback(configFile.path, FileWatcherEventKind.Changed); checkProjectActualFiles(project, [file1.path, classicModuleFile.path, configFile.path]); checkNumberOfInferredProjects(projectService, 1); }); @@ -1433,7 +1433,7 @@ namespace ts.projectSystem { }; host.reloadFS([file1, modifiedFile2, file3]); - host.triggerFileWatcherCallback(modifiedFile2.path, /*removed*/ false); + host.triggerFileWatcherCallback(modifiedFile2.path, FileWatcherEventKind.Changed); checkNumberOfInferredProjects(projectService, 1); checkProjectActualFiles(projectService.inferredProjects[0], [file1.path, modifiedFile2.path, file3.path]); @@ -1465,7 +1465,7 @@ namespace ts.projectSystem { checkNumberOfProjects(projectService, { inferredProjects: 1 }); host.reloadFS([file1, file3]); - host.triggerFileWatcherCallback(file2.path, /*removed*/ true); + host.triggerFileWatcherCallback(file2.path, FileWatcherEventKind.Deleted); checkNumberOfProjects(projectService, { inferredProjects: 2 }); @@ -1663,7 +1663,7 @@ namespace ts.projectSystem { }; host.reloadFS([file1, file2, modifiedConfigFile]); - host.triggerFileWatcherCallback(configFile.path, /*removed*/ false); + host.triggerFileWatcherCallback(configFile.path, FileWatcherEventKind.Changed); checkNumberOfProjects(projectService, { configuredProjects: 1 }); checkProjectRootFiles(projectService.configuredProjects[0], [file1.path, file2.path]); @@ -1696,7 +1696,7 @@ namespace ts.projectSystem { }; host.reloadFS([file1, file2, modifiedConfigFile]); - host.triggerFileWatcherCallback(configFile.path, /*removed*/ false); + host.triggerFileWatcherCallback(configFile.path, FileWatcherEventKind.Changed); checkNumberOfProjects(projectService, { configuredProjects: 1 }); checkProjectRootFiles(projectService.configuredProjects[0], [file1.path, file2.path]); @@ -1776,7 +1776,7 @@ namespace ts.projectSystem { checkProjectActualFiles(projectService.configuredProjects[0], [file1.path, file2.path, config.path]); host.reloadFS([file1, file2]); - host.triggerFileWatcherCallback(config.path, /*removed*/ true); + host.triggerFileWatcherCallback(config.path, FileWatcherEventKind.Deleted); checkNumberOfProjects(projectService, { inferredProjects: 2 }); checkProjectActualFiles(projectService.inferredProjects[0], [file1.path]); @@ -2258,7 +2258,7 @@ namespace ts.projectSystem { assert.isFalse(lastEvent.data.languageServiceEnabled, "Language service state"); host.reloadFS([f1, f2, configWithExclude]); - host.triggerFileWatcherCallback(config.path, /*removed*/ false); + host.triggerFileWatcherCallback(config.path, FileWatcherEventKind.Changed); checkNumberOfProjects(projectService, { configuredProjects: 1 }); assert.isTrue(project.languageServiceEnabled, "Language service enabled"); @@ -2492,7 +2492,7 @@ namespace ts.projectSystem { // rename tsconfig.json back to lib.ts host.reloadFS([f1, f2]); - host.triggerFileWatcherCallback(tsconfig.path, /*removed*/ true); + host.triggerFileWatcherCallback(tsconfig.path, FileWatcherEventKind.Deleted); projectService.openExternalProject({ projectFileName: projectName, rootFiles: toExternalFiles([f1.path, f2.path]), @@ -2637,7 +2637,7 @@ namespace ts.projectSystem { checkProjectActualFiles(projectService.configuredProjects[0], [libES5.path, app.path, config1.path]); host.reloadFS([libES5, libES2015Promise, app, config2]); - host.triggerFileWatcherCallback(config1.path); + host.triggerFileWatcherCallback(config1.path, FileWatcherEventKind.Changed); projectService.checkNumberOfProjects({ configuredProjects: 1 }); checkProjectActualFiles(projectService.configuredProjects[0], [libES5.path, libES2015Promise.path, app.path, config2.path]); @@ -2860,7 +2860,7 @@ namespace ts.projectSystem { const moduleFileNewPath = "/a/b/moduleFile1.ts"; moduleFile.path = moduleFileNewPath; host.reloadFS([moduleFile, file1]); - host.triggerFileWatcherCallback(moduleFileOldPath); + host.triggerFileWatcherCallback(moduleFileOldPath, FileWatcherEventKind.Changed); host.triggerDirectoryWatcherCallback("/a/b", moduleFile.path); host.runQueuedTimeoutCallbacks(); diags = session.executeCommand(getErrRequest).response; @@ -2868,7 +2868,7 @@ namespace ts.projectSystem { moduleFile.path = moduleFileOldPath; host.reloadFS([moduleFile, file1]); - host.triggerFileWatcherCallback(moduleFileNewPath); + host.triggerFileWatcherCallback(moduleFileNewPath, FileWatcherEventKind.Changed); host.triggerDirectoryWatcherCallback("/a/b", moduleFile.path); host.runQueuedTimeoutCallbacks(); @@ -2912,7 +2912,7 @@ namespace ts.projectSystem { const moduleFileNewPath = "/a/b/moduleFile1.ts"; moduleFile.path = moduleFileNewPath; host.reloadFS([moduleFile, file1, configFile]); - host.triggerFileWatcherCallback(moduleFileOldPath); + host.triggerFileWatcherCallback(moduleFileOldPath, FileWatcherEventKind.Changed); host.triggerDirectoryWatcherCallback("/a/b", moduleFile.path); host.runQueuedTimeoutCallbacks(); diags = session.executeCommand(getErrRequest).response; @@ -2920,7 +2920,7 @@ namespace ts.projectSystem { moduleFile.path = moduleFileOldPath; host.reloadFS([moduleFile, file1, configFile]); - host.triggerFileWatcherCallback(moduleFileNewPath); + host.triggerFileWatcherCallback(moduleFileNewPath, FileWatcherEventKind.Changed); host.triggerDirectoryWatcherCallback("/a/b", moduleFile.path); host.runQueuedTimeoutCallbacks(); diags = session.executeCommand(getErrRequest).response; @@ -3085,7 +3085,7 @@ namespace ts.projectSystem { } }`; host.reloadFS([file, configFile]); - host.triggerFileWatcherCallback(configFile.path); + host.triggerFileWatcherCallback(configFile.path, FileWatcherEventKind.Changed); host.runQueuedTimeoutCallbacks(); serverEventManager.checkEventCountOfType("configFileDiag", 2); @@ -3093,7 +3093,7 @@ namespace ts.projectSystem { "compilerOptions": {} }`; host.reloadFS([file, configFile]); - host.triggerFileWatcherCallback(configFile.path); + host.triggerFileWatcherCallback(configFile.path, FileWatcherEventKind.Changed); host.runQueuedTimeoutCallbacks(); serverEventManager.checkEventCountOfType("configFileDiag", 3); }); @@ -4021,7 +4021,7 @@ namespace ts.projectSystem { configFile.content = configFileContentWithoutCommentLine; host.reloadFS([file, configFile]); - host.triggerFileWatcherCallback(configFile.path); + host.triggerFileWatcherCallback(configFile.path, FileWatcherEventKind.Changed); const diagsAfterEdit = session.executeCommand({ type: "request", diff --git a/src/harness/unittests/typingsInstaller.ts b/src/harness/unittests/typingsInstaller.ts index 6c43ea1c034..728eb057fc3 100644 --- a/src/harness/unittests/typingsInstaller.ts +++ b/src/harness/unittests/typingsInstaller.ts @@ -820,7 +820,7 @@ namespace ts.projectSystem { installer.checkPendingCommands(/*expectedCount*/ 0); host.reloadFS([f, fixedPackageJson]); - host.triggerFileWatcherCallback(fixedPackageJson.path, /*removed*/ false); + host.triggerFileWatcherCallback(fixedPackageJson.path, FileWatcherEventKind.Changed); // expected install request installer.installAll(/*expectedCount*/ 1); diff --git a/src/server/project.ts b/src/server/project.ts index 163510bad27..25573216b1c 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -107,7 +107,7 @@ namespace ts.server { private rootFilesMap: Map = createMap(); private program: ts.Program; private externalFiles: SortedReadonlyArray; - private missingFilesMap: FileMap = createFileMap(); + private missingFilesMap: Map = createMap(); private cachedUnresolvedImportsPerFile = new UnresolvedImportsMap(); private lastCachedUnresolvedImportsList: SortedReadonlyArray; @@ -312,10 +312,7 @@ namespace ts.server { this.lsHost = undefined; // Clean up file watchers waiting for missing files - for (const p of this.missingFilesMap.getKeys()) { - this.missingFilesMap.get(p).close(); - this.missingFilesMap.remove(p); - } + this.missingFilesMap.forEach(fileWatcher => fileWatcher.close()); this.missingFilesMap = undefined; // signal language service to release source files acquired from document registry @@ -594,12 +591,12 @@ namespace ts.server { const oldProgram = this.program; this.program = this.languageService.getProgram(); - let hasChanges = false; // bump up the version if // - oldProgram is not set - this is a first time updateGraph is called // - newProgram is different from the old program and structure of the old program was not reused. - if (!oldProgram || (this.program !== oldProgram && !(oldProgram.structureIsReused & StructureIsReused.Completely))) { - hasChanges = true; + const hasChanges = !oldProgram || (this.program !== oldProgram && !(oldProgram.structureIsReused & StructureIsReused.Completely)); + + if (hasChanges) { if (oldProgram) { for (const f of oldProgram.getSourceFiles()) { if (this.program.getSourceFileByPath(f.path)) { @@ -612,39 +609,35 @@ namespace ts.server { } } } - } - if (hasChanges && this.program.getMissingFilePaths) { - const missingFilePaths = this.program.getMissingFilePaths() || emptyArray; - const missingFilePathsSet = createMap(); - missingFilePaths.forEach(p => missingFilePathsSet.set(p, true)); + const missingFilePaths = this.program.getMissingFilePaths(); + const missingFilePathsSet = arrayToSet(missingFilePaths, p => p); // Files that are no longer missing (e.g. because they are no longer required) // should no longer be watched. - this.missingFilesMap.getKeys().forEach(p => { - if (!missingFilePathsSet.has(p)) { - this.missingFilesMap.get(p).close(); - this.missingFilesMap.remove(p); + this.missingFilesMap.forEach((fileWatcher, missingFilePath) => { + if (!missingFilePathsSet.has(missingFilePath)) { + this.missingFilesMap.delete(missingFilePath); + fileWatcher.close(); } }); // Missing files that are not yet watched should be added to the map. - missingFilePaths.forEach(p => { - if (!this.missingFilesMap.contains(p)) { - const fileWatcher = this.projectService.host.watchFile(p, (_filename: string, removed?: boolean) => { - // removed = deleted ? true : (added ? false : undefined) - if (removed === false && this.missingFilesMap.contains(p)) { + for (const missingFilePath of missingFilePaths) { + if (!this.missingFilesMap.has(missingFilePath)) { + const fileWatcher = this.projectService.host.watchFile(missingFilePath, (_filename: string, eventKind: FileWatcherEventKind) => { + if (eventKind === FileWatcherEventKind.Created && this.missingFilesMap.has(missingFilePath)) { fileWatcher.close(); - this.missingFilesMap.remove(p); + this.missingFilesMap.delete(missingFilePath); // When a missing file is created, we should update the graph. this.markAsDirty(); this.updateGraph(); } }); - this.missingFilesMap.set(p, fileWatcher); + this.missingFilesMap.set(missingFilePath, fileWatcher); } - }); + } } const oldExternalFiles = this.externalFiles || emptyArray as SortedReadonlyArray; @@ -668,7 +661,7 @@ namespace ts.server { } isWatchedMissingFile(path: Path) { - return this.missingFilesMap.contains(path); + return this.missingFilesMap.has(path); } getScriptInfoLSHost(fileName: string) { diff --git a/src/server/server.ts b/src/server/server.ts index 9874969064e..dda87d16b6a 100644 --- a/src/server/server.ts +++ b/src/server/server.ts @@ -522,16 +522,16 @@ namespace ts.server { return; } - // removed = deleted ? true : (added ? false : undefined) - // This value is consistent with sys.watchFile() - // and depended upon by the file watchers created in performCompilation() in tsc's executeCommandLine(). fs.stat(watchedFile.fileName, (err: any, stats: any) => { if (err) { - watchedFile.callback(watchedFile.fileName); + watchedFile.callback(watchedFile.fileName, FileWatcherEventKind.Changed); } else if (watchedFile.mtime.getTime() !== stats.mtime.getTime()) { watchedFile.mtime = stats.mtime; - watchedFile.callback(watchedFile.fileName, watchedFile.mtime.getTime() === 0); + const eventKind = watchedFile.mtime.getTime() === 0 + ? FileWatcherEventKind.Deleted + : FileWatcherEventKind.Changed; + watchedFile.callback(watchedFile.fileName, eventKind); } }); } From 277f4592c1674d4ca5c7314ed08e189210206d54 Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Thu, 29 Jun 2017 15:14:09 -0700 Subject: [PATCH 53/62] Add tests --- .../fourslash/convertFunctionToEs6ClassJsDoc.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/cases/fourslash/convertFunctionToEs6ClassJsDoc.ts b/tests/cases/fourslash/convertFunctionToEs6ClassJsDoc.ts index 87ee2a738c2..e9f6449c8fd 100644 --- a/tests/cases/fourslash/convertFunctionToEs6ClassJsDoc.ts +++ b/tests/cases/fourslash/convertFunctionToEs6ClassJsDoc.ts @@ -6,6 +6,13 @@ //// /** neat! */ //// this.x = 100; //// } +//// +//// /** awesome +//// * stuff +//// */ +//// fn.prototype.arr = () => { return ""; } +//// /** great */ +//// fn.prototype.arr2 = () => []; //// //// /** //// * This is a cool function! @@ -20,6 +27,12 @@ verify.fileAfterApplyingRefactorAtMarker('1', /** neat! */ this.x = 100; } + /** awesome + * stuff + */ + arr() { return ""; } + /** great */ + arr2() { return []; } /** * This is a cool function! */ @@ -28,4 +41,5 @@ verify.fileAfterApplyingRefactorAtMarker('1', } } + `, 'Convert to ES2015 class', 'convert'); From f45df8fb69aacc2d5a4065ca1de53dcea115dd09 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Thu, 29 Jun 2017 16:21:00 -0700 Subject: [PATCH 54/62] Spelling code fix:suggestions from apparent type The code fix for spelling correction needs to provide suggestions based on the apparent type since sometimes the type at a location will be a type parameter. One such example is `this`. Fixes #16744 --- src/services/codefixes/fixSpelling.ts | 2 +- tests/cases/fourslash/codeFixCorrectSpelling.ts | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 tests/cases/fourslash/codeFixCorrectSpelling.ts diff --git a/src/services/codefixes/fixSpelling.ts b/src/services/codefixes/fixSpelling.ts index c8f539e8d34..d632671f6ee 100644 --- a/src/services/codefixes/fixSpelling.ts +++ b/src/services/codefixes/fixSpelling.ts @@ -16,7 +16,7 @@ namespace ts.codefix { const checker = context.program.getTypeChecker(); let suggestion: string; if (node.kind === SyntaxKind.Identifier && isPropertyAccessExpression(node.parent)) { - const containingType = checker.getTypeAtLocation(node.parent.expression); + const containingType = checker.getApparentType(checker.getTypeAtLocation(node.parent.expression)); suggestion = checker.getSuggestionForNonexistentProperty(node as Identifier, containingType); } else { diff --git a/tests/cases/fourslash/codeFixCorrectSpelling.ts b/tests/cases/fourslash/codeFixCorrectSpelling.ts new file mode 100644 index 00000000000..4294e6e44df --- /dev/null +++ b/tests/cases/fourslash/codeFixCorrectSpelling.ts @@ -0,0 +1,15 @@ +/// + +////[|class C { +//// state = 'hi' +//// doStuff() { +//// this.start; +//// } +////}|] + +verify.rangeAfterCodeFix(`class C { + state = 'hi' + doStuff() { + this.state; + } +}`, /*includeWhiteSpace*/false, /*errorCode*/ undefined, /*index*/ 2); From b1af566396b0e9dfe648ee107f43f411b1a7a44e Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Thu, 29 Jun 2017 16:30:44 -0700 Subject: [PATCH 55/62] Remove unused code in bindWorker --- src/compiler/binder.ts | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index e99db4f1914..6975d431a11 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -2080,22 +2080,6 @@ namespace ts { case SyntaxKind.EnumMember: return bindPropertyOrMethodOrAccessor(node, SymbolFlags.EnumMember, SymbolFlags.EnumMemberExcludes); - case SyntaxKind.SpreadAssignment: - case SyntaxKind.JsxSpreadAttribute: - let root = container; - let hasRest = false; - while (root.parent) { - if (root.kind === SyntaxKind.ObjectLiteralExpression && - root.parent.kind === SyntaxKind.BinaryExpression && - (root.parent as BinaryExpression).operatorToken.kind === SyntaxKind.EqualsToken && - (root.parent as BinaryExpression).left === root) { - hasRest = true; - break; - } - root = root.parent; - } - return; - case SyntaxKind.CallSignature: case SyntaxKind.ConstructSignature: case SyntaxKind.IndexSignature: @@ -3613,4 +3597,4 @@ namespace ts { child.parent = parent; forEachChild(child, (childsChild) => setParentPointers(child, childsChild)); } -} \ No newline at end of file +} From 0ffbb75503f541953fb0a59a1fc81a11ef01ad1b Mon Sep 17 00:00:00 2001 From: Kanchalai Tanglertsampan Date: Thu, 29 Jun 2017 16:53:37 -0700 Subject: [PATCH 56/62] check error early and return null to indicate that everything is going well --- src/harness/rwcRunner.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/harness/rwcRunner.ts b/src/harness/rwcRunner.ts index 128acb1005d..9a490d7be8c 100644 --- a/src/harness/rwcRunner.ts +++ b/src/harness/rwcRunner.ts @@ -22,8 +22,7 @@ namespace RWC { } function isTsConfigFile(file: { path: string }): boolean { - const tsConfigFileName = "tsconfig.json"; - return file.path.substr(file.path.length - tsConfigFileName.length).toLowerCase() === tsConfigFileName; + return file.path.indexOf("tsconfig") !== -1 && file.path.indexOf("json") !== -1; } export function runRWCTest(jsonPath: string) { @@ -213,12 +212,11 @@ namespace RWC { it("has the expected errors in generated declaration files", () => { if (compilerOptions.declaration && !compilerResult.errors.length) { Harness.Baseline.runBaseline(`${baseName}.dts.errors.txt`, () => { - const declFileCompilationResult = Harness.Compiler.compileDeclarationFiles( - inputFiles, otherFiles, compilerResult, /*harnessSettings*/ undefined, compilerOptions, currentDirectory); - - if (declFileCompilationResult.declResult.errors.length === 0) { + if (compilerResult.errors.length === 0) { return null; } + const declFileCompilationResult = Harness.Compiler.compileDeclarationFiles( + inputFiles, otherFiles, compilerResult, /*harnessSettings*/ undefined, compilerOptions, currentDirectory); return Harness.Compiler.minimalDiagnosticsToString(declFileCompilationResult.declResult.errors) + Harness.IO.newLine() + Harness.IO.newLine() + From 2e13c3a7a62b5d03c20347807f48f7e51aa42118 Mon Sep 17 00:00:00 2001 From: Kanchalai Tanglertsampan Date: Thu, 29 Jun 2017 16:55:46 -0700 Subject: [PATCH 57/62] Update RWC runner --- src/harness/rwcRunner.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/harness/rwcRunner.ts b/src/harness/rwcRunner.ts index 9a490d7be8c..97e1fd36722 100644 --- a/src/harness/rwcRunner.ts +++ b/src/harness/rwcRunner.ts @@ -1,4 +1,4 @@ -/// +/// /// /// /// @@ -215,6 +215,7 @@ namespace RWC { if (compilerResult.errors.length === 0) { return null; } + const declFileCompilationResult = Harness.Compiler.compileDeclarationFiles( inputFiles, otherFiles, compilerResult, /*harnessSettings*/ undefined, compilerOptions, currentDirectory); From 25abf8a9e8fecd7a0364cfc03d2c3b54bb231777 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Thu, 29 Jun 2017 17:31:41 -0700 Subject: [PATCH 58/62] respond ot comments --- src/services/formatting/formatting.ts | 34 ++++++++++++++++++--------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index 809d2103e2f..c55672229ba 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -103,18 +103,30 @@ namespace ts.formatting { export function formatOnOpeningCurly(position: number, sourceFile: SourceFile, rulesProvider: RulesProvider, options: FormatCodeSettings): TextChange[] { const openingCurly = findImmediatelyPrecedingTokenOfKind(position, SyntaxKind.OpenBraceToken, sourceFile); - if (openingCurly) { - const curlyBraceRange = openingCurly.parent; - const outermostNode = findOutermostNodeWithinListLevel(curlyBraceRange); - - const textRange: TextRange = { - pos: getLineStartPositionForPosition(outermostNode.getStart(sourceFile), sourceFile), - end: position - }; - - return formatSpan(textRange, sourceFile, options, rulesProvider, FormattingRequestKind.FormatOnOpeningCurlyBrace); + if (!openingCurly) { + return []; } - return []; + const curlyBraceRange = openingCurly.parent; + const outermostNode = findOutermostNodeWithinListLevel(curlyBraceRange); + + /** + * We limit the span to end at the opening curly to handle the case where + * the brace matched to that just typed will be incorrect after further edits. + * For example, we could type the opening curly for the following method + * body without brace-matching activated: + * ``` + * class C { + * foo() + * } + * ``` + * and we wouldn't want to move the closing brace. + */ + const textRange: TextRange = { + pos: getLineStartPositionForPosition(outermostNode.getStart(sourceFile), sourceFile), + end: position + }; + + return formatSpan(textRange, sourceFile, options, rulesProvider, FormattingRequestKind.FormatOnOpeningCurlyBrace); } export function formatOnClosingCurly(position: number, sourceFile: SourceFile, rulesProvider: RulesProvider, options: FormatCodeSettings): TextChange[] { From 2eec7f3565e234fe466f01f2a933d800e80d1950 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Fri, 30 Jun 2017 09:23:00 -0700 Subject: [PATCH 59/62] Dedupe some utility code 1. convertToArray is a duplicate of arrayFrom 2. inferFromParameterTypes delegates immediately to inferFromTypes 3. One usage of arrayFrom instantiated a whole iterator only to take the first element, which is the same as calling `next`. --- src/compiler/checker.ts | 8 ++------ src/compiler/commandLineParser.ts | 2 +- src/compiler/core.ts | 10 +--------- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 514e8f401a9..bc2f859f8ec 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1930,7 +1930,7 @@ namespace ts { } function createTypeofType() { - return getUnionType(convertToArray(typeofEQFacts.keys(), getLiteralType)); + return getUnionType(arrayFrom(typeofEQFacts.keys(), getLiteralType)); } // A reserved member name starts with two underscores, but the third character cannot be an underscore @@ -10531,12 +10531,8 @@ namespace ts { } } - function inferFromParameterTypes(source: Type, target: Type) { - return inferFromTypes(source, target); - } - function inferFromSignature(source: Signature, target: Signature) { - forEachMatchingParameterType(source, target, inferFromParameterTypes); + forEachMatchingParameterType(source, target, inferFromTypes); if (source.typePredicate && target.typePredicate && source.typePredicate.kind === target.typePredicate.kind) { inferFromTypes(source.typePredicate.type, target.typePredicate.type); diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 178578ec452..5da7e83655f 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -1290,7 +1290,7 @@ namespace ts { case "object": return {}; default: - return arrayFrom((option).type.keys())[0]; + return (option as CommandLineOptionOfCustomType).type.keys().next().value; } } diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 2eae414db66..5c7536a825e 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -996,14 +996,6 @@ namespace ts { return result; } - export function convertToArray(iterator: Iterator, f: (value: T) => U) { - const result: U[] = []; - for (let { value, done } = iterator.next(); !done; { value, done } = iterator.next()) { - result.push(f(value)); - } - return result; - } - /** * Calls `callback` for each entry in the map, returning the first truthy result. * Use `map.forEach` instead for normal iteration. @@ -2527,4 +2519,4 @@ namespace ts { export function isCheckJsEnabledForFile(sourceFile: SourceFile, compilerOptions: CompilerOptions) { return sourceFile.checkJsDirective ? sourceFile.checkJsDirective.enabled : compilerOptions.checkJs; } -} \ No newline at end of file +} From e0bf2670294944eb7f9af1498f10cd346e1b333b Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Fri, 30 Jun 2017 10:11:00 -0700 Subject: [PATCH 60/62] spelling:getPropertiesOfType instead of objectType This provides suggestions for more types based on their apparent type: unions, type parameters with constraints, primitives. --- src/compiler/checker.ts | 2 +- src/services/codefixes/fixSpelling.ts | 2 +- .../{codeFixCorrectSpelling.ts => codeFixCorrectSpelling1.ts} | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename tests/cases/fourslash/{codeFixCorrectSpelling.ts => codeFixCorrectSpelling1.ts} (100%) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 64e61e15dfd..aebdad4822f 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -14504,7 +14504,7 @@ namespace ts { } function getSuggestionForNonexistentProperty(node: Identifier, containingType: Type): string | undefined { - const suggestion = getSpellingSuggestionForName(node.text, getPropertiesOfObjectType(containingType), SymbolFlags.Value); + const suggestion = getSpellingSuggestionForName(node.text, getPropertiesOfType(containingType), SymbolFlags.Value); return suggestion && suggestion.name; } diff --git a/src/services/codefixes/fixSpelling.ts b/src/services/codefixes/fixSpelling.ts index d632671f6ee..c8f539e8d34 100644 --- a/src/services/codefixes/fixSpelling.ts +++ b/src/services/codefixes/fixSpelling.ts @@ -16,7 +16,7 @@ namespace ts.codefix { const checker = context.program.getTypeChecker(); let suggestion: string; if (node.kind === SyntaxKind.Identifier && isPropertyAccessExpression(node.parent)) { - const containingType = checker.getApparentType(checker.getTypeAtLocation(node.parent.expression)); + const containingType = checker.getTypeAtLocation(node.parent.expression); suggestion = checker.getSuggestionForNonexistentProperty(node as Identifier, containingType); } else { diff --git a/tests/cases/fourslash/codeFixCorrectSpelling.ts b/tests/cases/fourslash/codeFixCorrectSpelling1.ts similarity index 100% rename from tests/cases/fourslash/codeFixCorrectSpelling.ts rename to tests/cases/fourslash/codeFixCorrectSpelling1.ts From abec46ce4828568db9b513e9e9e4e79dfab026ea Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Fri, 30 Jun 2017 10:12:02 -0700 Subject: [PATCH 61/62] Test:spelling suggestions for more types Test spelling suggestions for primitives, unions/intersections and type parameters with constraints. --- ...StringsWithOverloadResolution3_ES6.errors.txt | 4 ++-- .../tsxStatelessFunctionComponents2.errors.txt | 4 ++-- .../reference/unionPropertyExistence.errors.txt | 6 +++--- tests/cases/fourslash/codeFixCorrectSpelling1.ts | 16 +++++----------- tests/cases/fourslash/codeFixCorrectSpelling2.ts | 9 +++++++++ tests/cases/fourslash/codeFixCorrectSpelling3.ts | 15 +++++++++++++++ 6 files changed, 36 insertions(+), 18 deletions(-) create mode 100644 tests/cases/fourslash/codeFixCorrectSpelling2.ts create mode 100644 tests/cases/fourslash/codeFixCorrectSpelling3.ts diff --git a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3_ES6.errors.txt b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3_ES6.errors.txt index d41d64c5a28..24be0fa24f4 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3_ES6.errors.txt +++ b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3_ES6.errors.txt @@ -3,7 +3,7 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3_ES6.ts(44,1): error TS2554: Expected 2-4 arguments, but got 1. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3_ES6.ts(62,9): error TS2345: Argument of type 'true' is not assignable to parameter of type 'number'. tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3_ES6.ts(63,18): error TS2345: Argument of type 'true' is not assignable to parameter of type 'string'. -tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3_ES6.ts(69,18): error TS2339: Property 'toFixed' does not exist on type 'string'. +tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3_ES6.ts(69,18): error TS2551: Property 'toFixed' does not exist on type 'string'. Did you mean 'fixed'? ==== tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3_ES6.ts (6 errors) ==== @@ -87,7 +87,7 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio function fn5() { return undefined; } fn5 `${ (n) => n.toFixed() }`; // will error; 'n' should have type 'string'. ~~~~~~~ -!!! error TS2339: Property 'toFixed' does not exist on type 'string'. +!!! error TS2551: Property 'toFixed' does not exist on type 'string'. Did you mean 'fixed'? fn5 `${ (n) => n.substr(0) }`; \ No newline at end of file diff --git a/tests/baselines/reference/tsxStatelessFunctionComponents2.errors.txt b/tests/baselines/reference/tsxStatelessFunctionComponents2.errors.txt index 1e7a29c3378..78844382f61 100644 --- a/tests/baselines/reference/tsxStatelessFunctionComponents2.errors.txt +++ b/tests/baselines/reference/tsxStatelessFunctionComponents2.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/jsx/file.tsx(19,16): error TS2559: Type '{ ref: "myRef"; }' has no properties in common with type 'IntrinsicAttributes & { name?: string; }'. -tests/cases/conformance/jsx/file.tsx(25,42): error TS2339: Property 'subtr' does not exist on type 'string'. +tests/cases/conformance/jsx/file.tsx(25,42): error TS2551: Property 'subtr' does not exist on type 'string'. Did you mean 'substr'? tests/cases/conformance/jsx/file.tsx(27,33): error TS2339: Property 'notARealProperty' does not exist on type 'BigGreeter'. tests/cases/conformance/jsx/file.tsx(35,26): error TS2339: Property 'propertyNotOnHtmlDivElement' does not exist on type 'HTMLDivElement'. @@ -33,7 +33,7 @@ tests/cases/conformance/jsx/file.tsx(35,26): error TS2339: Property 'propertyNot // Error ('subtr' not on string) let e = x.greeting.subtr(10)} />; ~~~~~ -!!! error TS2339: Property 'subtr' does not exist on type 'string'. +!!! error TS2551: Property 'subtr' does not exist on type 'string'. Did you mean 'substr'? // Error (ref callback is contextually typed) let f = x.notARealProperty} />; ~~~~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/unionPropertyExistence.errors.txt b/tests/baselines/reference/unionPropertyExistence.errors.txt index c13aa7d4d15..2ac1f2fafef 100644 --- a/tests/baselines/reference/unionPropertyExistence.errors.txt +++ b/tests/baselines/reference/unionPropertyExistence.errors.txt @@ -8,7 +8,7 @@ tests/cases/compiler/unionPropertyExistence.ts(32,4): error TS2339: Property 'on Property 'onlyInB' does not exist on type 'A'. tests/cases/compiler/unionPropertyExistence.ts(35,5): error TS2339: Property 'notInC' does not exist on type 'ABC'. Property 'notInC' does not exist on type 'C'. -tests/cases/compiler/unionPropertyExistence.ts(36,4): error TS2339: Property 'notInB' does not exist on type 'AB'. +tests/cases/compiler/unionPropertyExistence.ts(36,4): error TS2551: Property 'notInB' does not exist on type 'AB'. Did you mean 'notInC'? Property 'notInB' does not exist on type 'B'. tests/cases/compiler/unionPropertyExistence.ts(37,5): error TS2339: Property 'notInB' does not exist on type 'ABC'. Property 'notInB' does not exist on type 'B'. @@ -69,8 +69,8 @@ tests/cases/compiler/unionPropertyExistence.ts(40,5): error TS2339: Property 'in !!! error TS2339: Property 'notInC' does not exist on type 'C'. ab.notInB; ~~~~~~ -!!! error TS2339: Property 'notInB' does not exist on type 'AB'. -!!! error TS2339: Property 'notInB' does not exist on type 'B'. +!!! error TS2551: Property 'notInB' does not exist on type 'AB'. Did you mean 'notInC'? +!!! error TS2551: Property 'notInB' does not exist on type 'B'. abc.notInB; ~~~~~~ !!! error TS2339: Property 'notInB' does not exist on type 'ABC'. diff --git a/tests/cases/fourslash/codeFixCorrectSpelling1.ts b/tests/cases/fourslash/codeFixCorrectSpelling1.ts index 4294e6e44df..7f8739c80ae 100644 --- a/tests/cases/fourslash/codeFixCorrectSpelling1.ts +++ b/tests/cases/fourslash/codeFixCorrectSpelling1.ts @@ -1,15 +1,9 @@ /// -////[|class C { -//// state = 'hi' -//// doStuff() { -//// this.start; -//// } +////[|function foo(s: string) { +//// return s.toStrang(); ////}|] -verify.rangeAfterCodeFix(`class C { - state = 'hi' - doStuff() { - this.state; - } -}`, /*includeWhiteSpace*/false, /*errorCode*/ undefined, /*index*/ 2); +verify.rangeAfterCodeFix(`function foo(s: string) { + return s.toString(); +}`, /*includeWhiteSpace*/false, /*errorCode*/ undefined, /*index*/ 0); diff --git a/tests/cases/fourslash/codeFixCorrectSpelling2.ts b/tests/cases/fourslash/codeFixCorrectSpelling2.ts new file mode 100644 index 00000000000..b927eca0cad --- /dev/null +++ b/tests/cases/fourslash/codeFixCorrectSpelling2.ts @@ -0,0 +1,9 @@ +/// + +////[|function foo(x: T) { +//// return x.toStrang(); +////}|] + +verify.rangeAfterCodeFix(`function foo(x: T) { + return x.toString(); +}`, /*includeWhiteSpace*/false, /*errorCode*/ undefined, /*index*/ 0); diff --git a/tests/cases/fourslash/codeFixCorrectSpelling3.ts b/tests/cases/fourslash/codeFixCorrectSpelling3.ts new file mode 100644 index 00000000000..4294e6e44df --- /dev/null +++ b/tests/cases/fourslash/codeFixCorrectSpelling3.ts @@ -0,0 +1,15 @@ +/// + +////[|class C { +//// state = 'hi' +//// doStuff() { +//// this.start; +//// } +////}|] + +verify.rangeAfterCodeFix(`class C { + state = 'hi' + doStuff() { + this.state; + } +}`, /*includeWhiteSpace*/false, /*errorCode*/ undefined, /*index*/ 2); From 67faecc32ce54b10fe102d747226f358a8804ee8 Mon Sep 17 00:00:00 2001 From: Kanchalai Tanglertsampan Date: Fri, 30 Jun 2017 11:52:00 -0700 Subject: [PATCH 62/62] remove BOM --- src/harness/rwcRunner.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/harness/rwcRunner.ts b/src/harness/rwcRunner.ts index 97e1fd36722..1b7d54595e0 100644 --- a/src/harness/rwcRunner.ts +++ b/src/harness/rwcRunner.ts @@ -1,4 +1,4 @@ -/// +/// /// /// ///