mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 04:43:37 -05:00
Merge branch 'master' into completionListWithLocalName
Conflicts: src/compiler/checker.ts
This commit is contained in:
@@ -75,26 +75,26 @@ function delint(sourceFile) {
|
||||
delintNode(sourceFile);
|
||||
function delintNode(node) {
|
||||
switch (node.kind) {
|
||||
case 191 /* ForStatement */:
|
||||
case 192 /* ForInStatement */:
|
||||
case 190 /* WhileStatement */:
|
||||
case 189 /* DoStatement */:
|
||||
if (node.statement.kind !== 184 /* Block */) {
|
||||
case 196 /* ForStatement */:
|
||||
case 197 /* ForInStatement */:
|
||||
case 195 /* WhileStatement */:
|
||||
case 194 /* DoStatement */:
|
||||
if (node.statement.kind !== 189 /* Block */) {
|
||||
report(node, "A looping statement's contents should be wrapped in a block body.");
|
||||
}
|
||||
break;
|
||||
case 188 /* IfStatement */:
|
||||
case 193 /* IfStatement */:
|
||||
var ifStatement = node;
|
||||
if (ifStatement.thenStatement.kind !== 184 /* Block */) {
|
||||
if (ifStatement.thenStatement.kind !== 189 /* Block */) {
|
||||
report(ifStatement.thenStatement, "An if statement's contents should be wrapped in a block body.");
|
||||
}
|
||||
if (ifStatement.elseStatement &&
|
||||
ifStatement.elseStatement.kind !== 184 /* Block */ &&
|
||||
ifStatement.elseStatement.kind !== 188 /* IfStatement */) {
|
||||
ifStatement.elseStatement.kind !== 189 /* Block */ &&
|
||||
ifStatement.elseStatement.kind !== 193 /* IfStatement */) {
|
||||
report(ifStatement.elseStatement, "An else statement's contents should be wrapped in a block body.");
|
||||
}
|
||||
break;
|
||||
case 173 /* BinaryExpression */:
|
||||
case 178 /* BinaryExpression */:
|
||||
var op = node.operatorToken.kind;
|
||||
if (op === 29 /* EqualsEqualsToken */ || op == 30 /* ExclamationEqualsToken */) {
|
||||
report(node, "Use '===' and '!=='.");
|
||||
|
||||
@@ -1,8 +1,20 @@
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration10_es6.ts(1,10): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration10_es6.ts(1,16): error TS2371: A parameter initializer is only allowed in a function or constructor implementation.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration10_es6.ts(1,26): error TS1005: ',' expected.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration10_es6.ts(1,29): error TS1138: Parameter declaration expected.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration10_es6.ts(1,29): error TS2304: Cannot find name 'yield'.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration10_es6.ts(1,34): error TS1005: ';' expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration10_es6.ts (1 errors) ====
|
||||
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration10_es6.ts (5 errors) ====
|
||||
function * foo(a = yield => yield) {
|
||||
~
|
||||
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
~~~~~~~~~
|
||||
!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation.
|
||||
~~
|
||||
!!! error TS1005: ',' expected.
|
||||
~~~~~
|
||||
!!! error TS1138: Parameter declaration expected.
|
||||
~~~~~
|
||||
!!! error TS2304: Cannot find name 'yield'.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
}
|
||||
@@ -3,6 +3,6 @@ function * foo(a = yield => yield) {
|
||||
}
|
||||
|
||||
//// [FunctionDeclaration10_es6.js]
|
||||
function foo(a) {
|
||||
if (a === void 0) { a = function (yield) { return yield; }; }
|
||||
yield;
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration6_es6.ts(1,9): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration6_es6.ts(1,18): error TS2304: Cannot find name 'yield'.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration6_es6.ts(1,18): error TS2523: 'yield' expressions cannot be used in a parameter initializer.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration6_es6.ts (2 errors) ====
|
||||
@@ -7,5 +7,5 @@ tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration6_es6.ts(1,1
|
||||
~
|
||||
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
~~~~~
|
||||
!!! error TS2304: Cannot find name 'yield'.
|
||||
!!! error TS2523: 'yield' expressions cannot be used in a parameter initializer.
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts(1,9): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts(3,11): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts(3,20): error TS2304: Cannot find name 'yield'.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts(3,20): error TS2523: 'yield' expressions cannot be used in a parameter initializer.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts (3 errors) ====
|
||||
@@ -12,6 +12,6 @@ tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts(3,2
|
||||
~
|
||||
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
~~~~~
|
||||
!!! error TS2304: Cannot find name 'yield'.
|
||||
!!! error TS2523: 'yield' expressions cannot be used in a parameter initializer.
|
||||
}
|
||||
}
|
||||
14
tests/baselines/reference/abstractIdentifierNameStrict.js
Normal file
14
tests/baselines/reference/abstractIdentifierNameStrict.js
Normal file
@@ -0,0 +1,14 @@
|
||||
//// [abstractIdentifierNameStrict.ts]
|
||||
var abstract = true;
|
||||
|
||||
function foo() {
|
||||
"use strict";
|
||||
var abstract = true;
|
||||
}
|
||||
|
||||
//// [abstractIdentifierNameStrict.js]
|
||||
var abstract = true;
|
||||
function foo() {
|
||||
"use strict";
|
||||
var abstract = true;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
=== tests/cases/compiler/abstractIdentifierNameStrict.ts ===
|
||||
var abstract = true;
|
||||
>abstract : Symbol(abstract, Decl(abstractIdentifierNameStrict.ts, 0, 3))
|
||||
|
||||
function foo() {
|
||||
>foo : Symbol(foo, Decl(abstractIdentifierNameStrict.ts, 0, 20))
|
||||
|
||||
"use strict";
|
||||
var abstract = true;
|
||||
>abstract : Symbol(abstract, Decl(abstractIdentifierNameStrict.ts, 4, 7))
|
||||
}
|
||||
15
tests/baselines/reference/abstractIdentifierNameStrict.types
Normal file
15
tests/baselines/reference/abstractIdentifierNameStrict.types
Normal file
@@ -0,0 +1,15 @@
|
||||
=== tests/cases/compiler/abstractIdentifierNameStrict.ts ===
|
||||
var abstract = true;
|
||||
>abstract : boolean
|
||||
>true : boolean
|
||||
|
||||
function foo() {
|
||||
>foo : () => void
|
||||
|
||||
"use strict";
|
||||
>"use strict" : string
|
||||
|
||||
var abstract = true;
|
||||
>abstract : boolean
|
||||
>true : boolean
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
//// [abstractInterfaceIdentifierName.ts]
|
||||
|
||||
interface abstract {
|
||||
abstract(): void;
|
||||
}
|
||||
|
||||
|
||||
//// [abstractInterfaceIdentifierName.js]
|
||||
@@ -0,0 +1,9 @@
|
||||
=== tests/cases/compiler/abstractInterfaceIdentifierName.ts ===
|
||||
|
||||
interface abstract {
|
||||
>abstract : Symbol(abstract, Decl(abstractInterfaceIdentifierName.ts, 0, 0))
|
||||
|
||||
abstract(): void;
|
||||
>abstract : Symbol(abstract, Decl(abstractInterfaceIdentifierName.ts, 1, 20))
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
=== tests/cases/compiler/abstractInterfaceIdentifierName.ts ===
|
||||
|
||||
interface abstract {
|
||||
>abstract : abstract
|
||||
|
||||
abstract(): void;
|
||||
>abstract : () => void
|
||||
}
|
||||
|
||||
@@ -9,9 +9,9 @@ function doubleAndReturnAsArray(x: number, y: number, z: number): [number, numbe
|
||||
let blah = arguments[Symbol.iterator];
|
||||
>blah : Symbol(blah, Decl(argumentsObjectIterator02_ES6.ts, 2, 7))
|
||||
>arguments : Symbol(arguments)
|
||||
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31))
|
||||
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11))
|
||||
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31))
|
||||
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31))
|
||||
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11))
|
||||
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31))
|
||||
|
||||
let result = [];
|
||||
>result : Symbol(result, Decl(argumentsObjectIterator02_ES6.ts, 4, 7))
|
||||
|
||||
@@ -72,14 +72,14 @@ var temp2: [number[], string[]] = [[1, 2, 3], ["hello", "string"]];
|
||||
|
||||
interface myArray extends Array<Number> { }
|
||||
>myArray : Symbol(myArray, Decl(arrayLiterals2ES6.ts, 40, 67))
|
||||
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 1439, 1))
|
||||
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 1452, 1))
|
||||
>Number : Symbol(Number, Decl(lib.d.ts, 456, 40), Decl(lib.d.ts, 518, 11))
|
||||
|
||||
interface myArray2 extends Array<Number|String> { }
|
||||
>myArray2 : Symbol(myArray2, Decl(arrayLiterals2ES6.ts, 42, 43))
|
||||
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 1439, 1))
|
||||
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 1452, 1))
|
||||
>Number : Symbol(Number, Decl(lib.d.ts, 456, 40), Decl(lib.d.ts, 518, 11))
|
||||
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1543, 1))
|
||||
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1556, 1))
|
||||
|
||||
var d0 = [1, true, ...temp, ]; // has type (string|number|boolean)[]
|
||||
>d0 : Symbol(d0, Decl(arrayLiterals2ES6.ts, 44, 3))
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction10_es6.ts(2,11): error TS2304: Cannot find name 'async'.
|
||||
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction10_es6.ts(2,17): error TS1005: ',' expected.
|
||||
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction10_es6.ts(2,20): error TS1005: '=' expected.
|
||||
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction10_es6.ts(2,24): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement.
|
||||
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction10_es6.ts(4,11): error TS2304: Cannot find name 'await'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction10_es6.ts (5 errors) ====
|
||||
|
||||
var foo = async foo(): Promise<void> => {
|
||||
~~~~~
|
||||
!!! error TS2304: Cannot find name 'async'.
|
||||
~~~
|
||||
!!! error TS1005: ',' expected.
|
||||
~
|
||||
!!! error TS1005: '=' expected.
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement.
|
||||
// Legal to use 'await' in a type context.
|
||||
var v: await;
|
||||
~~~~~
|
||||
!!! error TS2304: Cannot find name 'await'.
|
||||
}
|
||||
|
||||
13
tests/baselines/reference/asyncArrowFunction10_es6.js
Normal file
13
tests/baselines/reference/asyncArrowFunction10_es6.js
Normal file
@@ -0,0 +1,13 @@
|
||||
//// [asyncArrowFunction10_es6.ts]
|
||||
|
||||
var foo = async foo(): Promise<void> => {
|
||||
// Legal to use 'await' in a type context.
|
||||
var v: await;
|
||||
}
|
||||
|
||||
|
||||
//// [asyncArrowFunction10_es6.js]
|
||||
var foo = async, foo = () => {
|
||||
// Legal to use 'await' in a type context.
|
||||
var v;
|
||||
};
|
||||
8
tests/baselines/reference/asyncArrowFunction1_es6.js
Normal file
8
tests/baselines/reference/asyncArrowFunction1_es6.js
Normal file
@@ -0,0 +1,8 @@
|
||||
//// [asyncArrowFunction1_es6.ts]
|
||||
|
||||
var foo = async (): Promise<void> => {
|
||||
};
|
||||
|
||||
//// [asyncArrowFunction1_es6.js]
|
||||
var foo = () => __awaiter(this, void 0, Promise, function* () {
|
||||
});
|
||||
@@ -0,0 +1,7 @@
|
||||
=== tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction1_es6.ts ===
|
||||
|
||||
var foo = async (): Promise<void> => {
|
||||
>foo : Symbol(foo, Decl(asyncArrowFunction1_es6.ts, 1, 3))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
|
||||
};
|
||||
8
tests/baselines/reference/asyncArrowFunction1_es6.types
Normal file
8
tests/baselines/reference/asyncArrowFunction1_es6.types
Normal file
@@ -0,0 +1,8 @@
|
||||
=== tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction1_es6.ts ===
|
||||
|
||||
var foo = async (): Promise<void> => {
|
||||
>foo : () => Promise<void>
|
||||
>async (): Promise<void> => {} : () => Promise<void>
|
||||
>Promise : Promise<T>
|
||||
|
||||
};
|
||||
7
tests/baselines/reference/asyncArrowFunction2_es6.js
Normal file
7
tests/baselines/reference/asyncArrowFunction2_es6.js
Normal file
@@ -0,0 +1,7 @@
|
||||
//// [asyncArrowFunction2_es6.ts]
|
||||
var f = (await) => {
|
||||
}
|
||||
|
||||
//// [asyncArrowFunction2_es6.js]
|
||||
var f = (await) => {
|
||||
};
|
||||
@@ -0,0 +1,5 @@
|
||||
=== tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction2_es6.ts ===
|
||||
var f = (await) => {
|
||||
>f : Symbol(f, Decl(asyncArrowFunction2_es6.ts, 0, 3))
|
||||
>await : Symbol(await, Decl(asyncArrowFunction2_es6.ts, 0, 9))
|
||||
}
|
||||
6
tests/baselines/reference/asyncArrowFunction2_es6.types
Normal file
6
tests/baselines/reference/asyncArrowFunction2_es6.types
Normal file
@@ -0,0 +1,6 @@
|
||||
=== tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction2_es6.ts ===
|
||||
var f = (await) => {
|
||||
>f : (await: any) => void
|
||||
>(await) => {} : (await: any) => void
|
||||
>await : any
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction3_es6.ts(1,20): error TS2372: Parameter 'await' cannot be referenced in its initializer.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction3_es6.ts (1 errors) ====
|
||||
function f(await = await) {
|
||||
~~~~~
|
||||
!!! error TS2372: Parameter 'await' cannot be referenced in its initializer.
|
||||
}
|
||||
7
tests/baselines/reference/asyncArrowFunction3_es6.js
Normal file
7
tests/baselines/reference/asyncArrowFunction3_es6.js
Normal file
@@ -0,0 +1,7 @@
|
||||
//// [asyncArrowFunction3_es6.ts]
|
||||
function f(await = await) {
|
||||
}
|
||||
|
||||
//// [asyncArrowFunction3_es6.js]
|
||||
function f(await = await) {
|
||||
}
|
||||
7
tests/baselines/reference/asyncArrowFunction4_es6.js
Normal file
7
tests/baselines/reference/asyncArrowFunction4_es6.js
Normal file
@@ -0,0 +1,7 @@
|
||||
//// [asyncArrowFunction4_es6.ts]
|
||||
var await = () => {
|
||||
}
|
||||
|
||||
//// [asyncArrowFunction4_es6.js]
|
||||
var await = () => {
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
=== tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction4_es6.ts ===
|
||||
var await = () => {
|
||||
>await : Symbol(await, Decl(asyncArrowFunction4_es6.ts, 0, 3))
|
||||
}
|
||||
5
tests/baselines/reference/asyncArrowFunction4_es6.types
Normal file
5
tests/baselines/reference/asyncArrowFunction4_es6.types
Normal file
@@ -0,0 +1,5 @@
|
||||
=== tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction4_es6.ts ===
|
||||
var await = () => {
|
||||
>await : () => void
|
||||
>() => {} : () => void
|
||||
}
|
||||
24
tests/baselines/reference/asyncArrowFunction5_es6.errors.txt
Normal file
24
tests/baselines/reference/asyncArrowFunction5_es6.errors.txt
Normal file
@@ -0,0 +1,24 @@
|
||||
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction5_es6.ts(2,11): error TS2304: Cannot find name 'async'.
|
||||
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction5_es6.ts(2,18): error TS2304: Cannot find name 'await'.
|
||||
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction5_es6.ts(2,24): error TS1005: ',' expected.
|
||||
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction5_es6.ts(2,26): error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' must be of type 'PromiseConstructor', but here has type 'void'.
|
||||
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction5_es6.ts(2,33): error TS1005: '=' expected.
|
||||
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction5_es6.ts(2,40): error TS1109: Expression expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction5_es6.ts (6 errors) ====
|
||||
|
||||
var foo = async (await): Promise<void> => {
|
||||
~~~~~
|
||||
!!! error TS2304: Cannot find name 'async'.
|
||||
~~~~~
|
||||
!!! error TS2304: Cannot find name 'await'.
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
~~~~~~~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' must be of type 'PromiseConstructor', but here has type 'void'.
|
||||
~
|
||||
!!! error TS1005: '=' expected.
|
||||
~~
|
||||
!!! error TS1109: Expression expected.
|
||||
}
|
||||
9
tests/baselines/reference/asyncArrowFunction5_es6.js
Normal file
9
tests/baselines/reference/asyncArrowFunction5_es6.js
Normal file
@@ -0,0 +1,9 @@
|
||||
//// [asyncArrowFunction5_es6.ts]
|
||||
|
||||
var foo = async (await): Promise<void> => {
|
||||
}
|
||||
|
||||
//// [asyncArrowFunction5_es6.js]
|
||||
var foo = async(await), Promise = ;
|
||||
{
|
||||
}
|
||||
12
tests/baselines/reference/asyncArrowFunction6_es6.errors.txt
Normal file
12
tests/baselines/reference/asyncArrowFunction6_es6.errors.txt
Normal file
@@ -0,0 +1,12 @@
|
||||
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction6_es6.ts(2,22): error TS2524: 'await' expressions cannot be used in a parameter initializer.
|
||||
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction6_es6.ts(2,27): error TS1109: Expression expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction6_es6.ts (2 errors) ====
|
||||
|
||||
var foo = async (a = await): Promise<void> => {
|
||||
~~~~~
|
||||
!!! error TS2524: 'await' expressions cannot be used in a parameter initializer.
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
}
|
||||
8
tests/baselines/reference/asyncArrowFunction6_es6.js
Normal file
8
tests/baselines/reference/asyncArrowFunction6_es6.js
Normal file
@@ -0,0 +1,8 @@
|
||||
//// [asyncArrowFunction6_es6.ts]
|
||||
|
||||
var foo = async (a = await): Promise<void> => {
|
||||
}
|
||||
|
||||
//// [asyncArrowFunction6_es6.js]
|
||||
var foo = (a = yield ) => __awaiter(this, void 0, Promise, function* () {
|
||||
});
|
||||
15
tests/baselines/reference/asyncArrowFunction7_es6.errors.txt
Normal file
15
tests/baselines/reference/asyncArrowFunction7_es6.errors.txt
Normal file
@@ -0,0 +1,15 @@
|
||||
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction7_es6.ts(4,24): error TS2524: 'await' expressions cannot be used in a parameter initializer.
|
||||
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction7_es6.ts(4,29): error TS1109: Expression expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction7_es6.ts (2 errors) ====
|
||||
|
||||
var bar = async (): Promise<void> => {
|
||||
// 'await' here is an identifier, and not an await expression.
|
||||
var foo = async (a = await): Promise<void> => {
|
||||
~~~~~
|
||||
!!! error TS2524: 'await' expressions cannot be used in a parameter initializer.
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
}
|
||||
}
|
||||
14
tests/baselines/reference/asyncArrowFunction7_es6.js
Normal file
14
tests/baselines/reference/asyncArrowFunction7_es6.js
Normal file
@@ -0,0 +1,14 @@
|
||||
//// [asyncArrowFunction7_es6.ts]
|
||||
|
||||
var bar = async (): Promise<void> => {
|
||||
// 'await' here is an identifier, and not an await expression.
|
||||
var foo = async (a = await): Promise<void> => {
|
||||
}
|
||||
}
|
||||
|
||||
//// [asyncArrowFunction7_es6.js]
|
||||
var bar = () => __awaiter(this, void 0, Promise, function* () {
|
||||
// 'await' here is an identifier, and not an await expression.
|
||||
var foo = (a = yield ) => __awaiter(this, void 0, Promise, function* () {
|
||||
});
|
||||
});
|
||||
10
tests/baselines/reference/asyncArrowFunction8_es6.errors.txt
Normal file
10
tests/baselines/reference/asyncArrowFunction8_es6.errors.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction8_es6.ts(3,19): error TS1109: Expression expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction8_es6.ts (1 errors) ====
|
||||
|
||||
var foo = async (): Promise<void> => {
|
||||
var v = { [await]: foo }
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
}
|
||||
10
tests/baselines/reference/asyncArrowFunction8_es6.js
Normal file
10
tests/baselines/reference/asyncArrowFunction8_es6.js
Normal file
@@ -0,0 +1,10 @@
|
||||
//// [asyncArrowFunction8_es6.ts]
|
||||
|
||||
var foo = async (): Promise<void> => {
|
||||
var v = { [await]: foo }
|
||||
}
|
||||
|
||||
//// [asyncArrowFunction8_es6.js]
|
||||
var foo = () => __awaiter(this, void 0, Promise, function* () {
|
||||
var v = { [yield ]: foo };
|
||||
});
|
||||
23
tests/baselines/reference/asyncArrowFunction9_es6.errors.txt
Normal file
23
tests/baselines/reference/asyncArrowFunction9_es6.errors.txt
Normal file
@@ -0,0 +1,23 @@
|
||||
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction9_es6.ts(1,11): error TS2304: Cannot find name 'async'.
|
||||
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction9_es6.ts(1,18): error TS2304: Cannot find name 'a'.
|
||||
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction9_es6.ts(1,37): error TS1005: ',' expected.
|
||||
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction9_es6.ts(1,39): error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' must be of type 'PromiseConstructor', but here has type 'void'.
|
||||
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction9_es6.ts(1,46): error TS1005: '=' expected.
|
||||
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction9_es6.ts(1,53): error TS1109: Expression expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction9_es6.ts (6 errors) ====
|
||||
var foo = async (a = await => await): Promise<void> => {
|
||||
~~~~~
|
||||
!!! error TS2304: Cannot find name 'async'.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'a'.
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
~~~~~~~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' must be of type 'PromiseConstructor', but here has type 'void'.
|
||||
~
|
||||
!!! error TS1005: '=' expected.
|
||||
~~
|
||||
!!! error TS1109: Expression expected.
|
||||
}
|
||||
8
tests/baselines/reference/asyncArrowFunction9_es6.js
Normal file
8
tests/baselines/reference/asyncArrowFunction9_es6.js
Normal file
@@ -0,0 +1,8 @@
|
||||
//// [asyncArrowFunction9_es6.ts]
|
||||
var foo = async (a = await => await): Promise<void> => {
|
||||
}
|
||||
|
||||
//// [asyncArrowFunction9_es6.js]
|
||||
var foo = async(a = await => await), Promise = ;
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
//// [asyncArrowFunctionCapturesArguments_es6.ts]
|
||||
class C {
|
||||
method() {
|
||||
function other() {}
|
||||
var fn = async () => await other.apply(this, arguments);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//// [asyncArrowFunctionCapturesArguments_es6.js]
|
||||
class C {
|
||||
method() {
|
||||
function other() { }
|
||||
var fn = () => __awaiter(this, arguments, Promise, function* (_arguments) { return yield other.apply(this, _arguments); });
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
=== tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunctionCapturesArguments_es6.ts ===
|
||||
class C {
|
||||
>C : Symbol(C, Decl(asyncArrowFunctionCapturesArguments_es6.ts, 0, 0))
|
||||
|
||||
method() {
|
||||
>method : Symbol(method, Decl(asyncArrowFunctionCapturesArguments_es6.ts, 0, 9))
|
||||
|
||||
function other() {}
|
||||
>other : Symbol(other, Decl(asyncArrowFunctionCapturesArguments_es6.ts, 1, 13))
|
||||
|
||||
var fn = async () => await other.apply(this, arguments);
|
||||
>fn : Symbol(fn, Decl(asyncArrowFunctionCapturesArguments_es6.ts, 3, 9))
|
||||
>other.apply : Symbol(Function.apply, Decl(lib.d.ts, 228, 20))
|
||||
>other : Symbol(other, Decl(asyncArrowFunctionCapturesArguments_es6.ts, 1, 13))
|
||||
>apply : Symbol(Function.apply, Decl(lib.d.ts, 228, 20))
|
||||
>this : Symbol(C, Decl(asyncArrowFunctionCapturesArguments_es6.ts, 0, 0))
|
||||
>arguments : Symbol(arguments)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
=== tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunctionCapturesArguments_es6.ts ===
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
method() {
|
||||
>method : () => void
|
||||
|
||||
function other() {}
|
||||
>other : () => void
|
||||
|
||||
var fn = async () => await other.apply(this, arguments);
|
||||
>fn : () => Promise<any>
|
||||
>async () => await other.apply(this, arguments) : () => Promise<any>
|
||||
>other.apply(this, arguments) : any
|
||||
>other.apply : (thisArg: any, argArray?: any) => any
|
||||
>other : () => void
|
||||
>apply : (thisArg: any, argArray?: any) => any
|
||||
>this : C
|
||||
>arguments : IArguments
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
//// [asyncArrowFunctionCapturesThis_es6.ts]
|
||||
class C {
|
||||
method() {
|
||||
var fn = async () => await this;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//// [asyncArrowFunctionCapturesThis_es6.js]
|
||||
class C {
|
||||
method() {
|
||||
var fn = () => __awaiter(this, void 0, Promise, function* () { return yield this; });
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
=== tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunctionCapturesThis_es6.ts ===
|
||||
class C {
|
||||
>C : Symbol(C, Decl(asyncArrowFunctionCapturesThis_es6.ts, 0, 0))
|
||||
|
||||
method() {
|
||||
>method : Symbol(method, Decl(asyncArrowFunctionCapturesThis_es6.ts, 0, 9))
|
||||
|
||||
var fn = async () => await this;
|
||||
>fn : Symbol(fn, Decl(asyncArrowFunctionCapturesThis_es6.ts, 2, 9))
|
||||
>this : Symbol(C, Decl(asyncArrowFunctionCapturesThis_es6.ts, 0, 0))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
=== tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunctionCapturesThis_es6.ts ===
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
method() {
|
||||
>method : () => void
|
||||
|
||||
var fn = async () => await this;
|
||||
>fn : () => Promise<C>
|
||||
>async () => await this : () => Promise<C>
|
||||
>this : C
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
tests/cases/conformance/async/es6/asyncAwaitIsolatedModules_es6.ts(1,27): error TS2307: Cannot find module 'missing'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es6/asyncAwaitIsolatedModules_es6.ts (1 errors) ====
|
||||
import { MyPromise } from "missing";
|
||||
~~~~~~~~~
|
||||
!!! error TS2307: Cannot find module 'missing'.
|
||||
|
||||
declare var p: Promise<number>;
|
||||
declare var mp: MyPromise<number>;
|
||||
|
||||
async function f0() { }
|
||||
async function f1(): Promise<void> { }
|
||||
async function f3(): MyPromise<void> { }
|
||||
|
||||
let f4 = async function() { }
|
||||
let f5 = async function(): Promise<void> { }
|
||||
let f6 = async function(): MyPromise<void> { }
|
||||
|
||||
let f7 = async () => { };
|
||||
let f8 = async (): Promise<void> => { };
|
||||
let f9 = async (): MyPromise<void> => { };
|
||||
let f10 = async () => p;
|
||||
let f11 = async () => mp;
|
||||
let f12 = async (): Promise<number> => mp;
|
||||
let f13 = async (): MyPromise<number> => p;
|
||||
|
||||
let o = {
|
||||
async m1() { },
|
||||
async m2(): Promise<void> { },
|
||||
async m3(): MyPromise<void> { }
|
||||
};
|
||||
|
||||
class C {
|
||||
async m1() { }
|
||||
async m2(): Promise<void> { }
|
||||
async m3(): MyPromise<void> { }
|
||||
static async m4() { }
|
||||
static async m5(): Promise<void> { }
|
||||
static async m6(): MyPromise<void> { }
|
||||
}
|
||||
|
||||
module M {
|
||||
export async function f1() { }
|
||||
}
|
||||
118
tests/baselines/reference/asyncAwaitIsolatedModules_es6.js
Normal file
118
tests/baselines/reference/asyncAwaitIsolatedModules_es6.js
Normal file
@@ -0,0 +1,118 @@
|
||||
//// [asyncAwaitIsolatedModules_es6.ts]
|
||||
import { MyPromise } from "missing";
|
||||
|
||||
declare var p: Promise<number>;
|
||||
declare var mp: MyPromise<number>;
|
||||
|
||||
async function f0() { }
|
||||
async function f1(): Promise<void> { }
|
||||
async function f3(): MyPromise<void> { }
|
||||
|
||||
let f4 = async function() { }
|
||||
let f5 = async function(): Promise<void> { }
|
||||
let f6 = async function(): MyPromise<void> { }
|
||||
|
||||
let f7 = async () => { };
|
||||
let f8 = async (): Promise<void> => { };
|
||||
let f9 = async (): MyPromise<void> => { };
|
||||
let f10 = async () => p;
|
||||
let f11 = async () => mp;
|
||||
let f12 = async (): Promise<number> => mp;
|
||||
let f13 = async (): MyPromise<number> => p;
|
||||
|
||||
let o = {
|
||||
async m1() { },
|
||||
async m2(): Promise<void> { },
|
||||
async m3(): MyPromise<void> { }
|
||||
};
|
||||
|
||||
class C {
|
||||
async m1() { }
|
||||
async m2(): Promise<void> { }
|
||||
async m3(): MyPromise<void> { }
|
||||
static async m4() { }
|
||||
static async m5(): Promise<void> { }
|
||||
static async m6(): MyPromise<void> { }
|
||||
}
|
||||
|
||||
module M {
|
||||
export async function f1() { }
|
||||
}
|
||||
|
||||
//// [asyncAwaitIsolatedModules_es6.js]
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promise, generator) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
generator = generator.call(thisArg, _arguments);
|
||||
function cast(value) { return value instanceof Promise && value.constructor === Promise ? value : new Promise(function (resolve) { resolve(value); }); }
|
||||
function onfulfill(value) { try { step("next", value); } catch (e) { reject(e); } }
|
||||
function onreject(value) { try { step("throw", value); } catch (e) { reject(e); } }
|
||||
function step(verb, value) {
|
||||
var result = generator[verb](value);
|
||||
result.done ? resolve(result.value) : cast(result.value).then(onfulfill, onreject);
|
||||
}
|
||||
step("next", void 0);
|
||||
});
|
||||
};
|
||||
function f0() {
|
||||
return __awaiter(this, void 0, Promise, function* () { });
|
||||
}
|
||||
function f1() {
|
||||
return __awaiter(this, void 0, Promise, function* () { });
|
||||
}
|
||||
function f3() {
|
||||
return __awaiter(this, void 0, MyPromise, function* () { });
|
||||
}
|
||||
let f4 = function () {
|
||||
return __awaiter(this, void 0, Promise, function* () { });
|
||||
};
|
||||
let f5 = function () {
|
||||
return __awaiter(this, void 0, Promise, function* () { });
|
||||
};
|
||||
let f6 = function () {
|
||||
return __awaiter(this, void 0, MyPromise, function* () { });
|
||||
};
|
||||
let f7 = () => __awaiter(this, void 0, Promise, function* () { });
|
||||
let f8 = () => __awaiter(this, void 0, Promise, function* () { });
|
||||
let f9 = () => __awaiter(this, void 0, MyPromise, function* () { });
|
||||
let f10 = () => __awaiter(this, void 0, Promise, function* () { return p; });
|
||||
let f11 = () => __awaiter(this, void 0, Promise, function* () { return mp; });
|
||||
let f12 = () => __awaiter(this, void 0, Promise, function* () { return mp; });
|
||||
let f13 = () => __awaiter(this, void 0, MyPromise, function* () { return p; });
|
||||
let o = {
|
||||
m1() {
|
||||
return __awaiter(this, void 0, Promise, function* () { });
|
||||
},
|
||||
m2() {
|
||||
return __awaiter(this, void 0, Promise, function* () { });
|
||||
},
|
||||
m3() {
|
||||
return __awaiter(this, void 0, MyPromise, function* () { });
|
||||
}
|
||||
};
|
||||
class C {
|
||||
m1() {
|
||||
return __awaiter(this, void 0, Promise, function* () { });
|
||||
}
|
||||
m2() {
|
||||
return __awaiter(this, void 0, Promise, function* () { });
|
||||
}
|
||||
m3() {
|
||||
return __awaiter(this, void 0, MyPromise, function* () { });
|
||||
}
|
||||
static m4() {
|
||||
return __awaiter(this, void 0, Promise, function* () { });
|
||||
}
|
||||
static m5() {
|
||||
return __awaiter(this, void 0, Promise, function* () { });
|
||||
}
|
||||
static m6() {
|
||||
return __awaiter(this, void 0, MyPromise, function* () { });
|
||||
}
|
||||
}
|
||||
var M;
|
||||
(function (M) {
|
||||
function f1() {
|
||||
return __awaiter(this, void 0, Promise, function* () { });
|
||||
}
|
||||
M.f1 = f1;
|
||||
})(M || (M = {}));
|
||||
118
tests/baselines/reference/asyncAwait_es6.js
Normal file
118
tests/baselines/reference/asyncAwait_es6.js
Normal file
@@ -0,0 +1,118 @@
|
||||
//// [asyncAwait_es6.ts]
|
||||
type MyPromise<T> = Promise<T>;
|
||||
declare var MyPromise: typeof Promise;
|
||||
declare var p: Promise<number>;
|
||||
declare var mp: MyPromise<number>;
|
||||
|
||||
async function f0() { }
|
||||
async function f1(): Promise<void> { }
|
||||
async function f3(): MyPromise<void> { }
|
||||
|
||||
let f4 = async function() { }
|
||||
let f5 = async function(): Promise<void> { }
|
||||
let f6 = async function(): MyPromise<void> { }
|
||||
|
||||
let f7 = async () => { };
|
||||
let f8 = async (): Promise<void> => { };
|
||||
let f9 = async (): MyPromise<void> => { };
|
||||
let f10 = async () => p;
|
||||
let f11 = async () => mp;
|
||||
let f12 = async (): Promise<number> => mp;
|
||||
let f13 = async (): MyPromise<number> => p;
|
||||
|
||||
let o = {
|
||||
async m1() { },
|
||||
async m2(): Promise<void> { },
|
||||
async m3(): MyPromise<void> { }
|
||||
};
|
||||
|
||||
class C {
|
||||
async m1() { }
|
||||
async m2(): Promise<void> { }
|
||||
async m3(): MyPromise<void> { }
|
||||
static async m4() { }
|
||||
static async m5(): Promise<void> { }
|
||||
static async m6(): MyPromise<void> { }
|
||||
}
|
||||
|
||||
module M {
|
||||
export async function f1() { }
|
||||
}
|
||||
|
||||
//// [asyncAwait_es6.js]
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promise, generator) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
generator = generator.call(thisArg, _arguments);
|
||||
function cast(value) { return value instanceof Promise && value.constructor === Promise ? value : new Promise(function (resolve) { resolve(value); }); }
|
||||
function onfulfill(value) { try { step("next", value); } catch (e) { reject(e); } }
|
||||
function onreject(value) { try { step("throw", value); } catch (e) { reject(e); } }
|
||||
function step(verb, value) {
|
||||
var result = generator[verb](value);
|
||||
result.done ? resolve(result.value) : cast(result.value).then(onfulfill, onreject);
|
||||
}
|
||||
step("next", void 0);
|
||||
});
|
||||
};
|
||||
function f0() {
|
||||
return __awaiter(this, void 0, Promise, function* () { });
|
||||
}
|
||||
function f1() {
|
||||
return __awaiter(this, void 0, Promise, function* () { });
|
||||
}
|
||||
function f3() {
|
||||
return __awaiter(this, void 0, MyPromise, function* () { });
|
||||
}
|
||||
let f4 = function () {
|
||||
return __awaiter(this, void 0, Promise, function* () { });
|
||||
};
|
||||
let f5 = function () {
|
||||
return __awaiter(this, void 0, Promise, function* () { });
|
||||
};
|
||||
let f6 = function () {
|
||||
return __awaiter(this, void 0, MyPromise, function* () { });
|
||||
};
|
||||
let f7 = () => __awaiter(this, void 0, Promise, function* () { });
|
||||
let f8 = () => __awaiter(this, void 0, Promise, function* () { });
|
||||
let f9 = () => __awaiter(this, void 0, MyPromise, function* () { });
|
||||
let f10 = () => __awaiter(this, void 0, Promise, function* () { return p; });
|
||||
let f11 = () => __awaiter(this, void 0, Promise, function* () { return mp; });
|
||||
let f12 = () => __awaiter(this, void 0, Promise, function* () { return mp; });
|
||||
let f13 = () => __awaiter(this, void 0, MyPromise, function* () { return p; });
|
||||
let o = {
|
||||
m1() {
|
||||
return __awaiter(this, void 0, Promise, function* () { });
|
||||
},
|
||||
m2() {
|
||||
return __awaiter(this, void 0, Promise, function* () { });
|
||||
},
|
||||
m3() {
|
||||
return __awaiter(this, void 0, MyPromise, function* () { });
|
||||
}
|
||||
};
|
||||
class C {
|
||||
m1() {
|
||||
return __awaiter(this, void 0, Promise, function* () { });
|
||||
}
|
||||
m2() {
|
||||
return __awaiter(this, void 0, Promise, function* () { });
|
||||
}
|
||||
m3() {
|
||||
return __awaiter(this, void 0, MyPromise, function* () { });
|
||||
}
|
||||
static m4() {
|
||||
return __awaiter(this, void 0, Promise, function* () { });
|
||||
}
|
||||
static m5() {
|
||||
return __awaiter(this, void 0, Promise, function* () { });
|
||||
}
|
||||
static m6() {
|
||||
return __awaiter(this, void 0, MyPromise, function* () { });
|
||||
}
|
||||
}
|
||||
var M;
|
||||
(function (M) {
|
||||
function f1() {
|
||||
return __awaiter(this, void 0, Promise, function* () { });
|
||||
}
|
||||
M.f1 = f1;
|
||||
})(M || (M = {}));
|
||||
118
tests/baselines/reference/asyncAwait_es6.symbols
Normal file
118
tests/baselines/reference/asyncAwait_es6.symbols
Normal file
@@ -0,0 +1,118 @@
|
||||
=== tests/cases/conformance/async/es6/asyncAwait_es6.ts ===
|
||||
type MyPromise<T> = Promise<T>;
|
||||
>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.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>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.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
|
||||
declare var p: Promise<number>;
|
||||
>p : Symbol(p, Decl(asyncAwait_es6.ts, 2, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
|
||||
declare var mp: MyPromise<number>;
|
||||
>mp : Symbol(mp, Decl(asyncAwait_es6.ts, 3, 11))
|
||||
>MyPromise : Symbol(MyPromise, Decl(asyncAwait_es6.ts, 0, 0), Decl(asyncAwait_es6.ts, 1, 11))
|
||||
|
||||
async function f0() { }
|
||||
>f0 : Symbol(f0, Decl(asyncAwait_es6.ts, 3, 34))
|
||||
|
||||
async function f1(): Promise<void> { }
|
||||
>f1 : Symbol(f1, Decl(asyncAwait_es6.ts, 5, 23))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
|
||||
async function f3(): MyPromise<void> { }
|
||||
>f3 : Symbol(f3, Decl(asyncAwait_es6.ts, 6, 38))
|
||||
>MyPromise : Symbol(MyPromise, Decl(asyncAwait_es6.ts, 0, 0), Decl(asyncAwait_es6.ts, 1, 11))
|
||||
|
||||
let f4 = async function() { }
|
||||
>f4 : Symbol(f4, Decl(asyncAwait_es6.ts, 9, 3))
|
||||
|
||||
let f5 = async function(): Promise<void> { }
|
||||
>f5 : Symbol(f5, Decl(asyncAwait_es6.ts, 10, 3))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
|
||||
let f6 = async function(): MyPromise<void> { }
|
||||
>f6 : Symbol(f6, Decl(asyncAwait_es6.ts, 11, 3))
|
||||
>MyPromise : Symbol(MyPromise, Decl(asyncAwait_es6.ts, 0, 0), Decl(asyncAwait_es6.ts, 1, 11))
|
||||
|
||||
let f7 = async () => { };
|
||||
>f7 : Symbol(f7, Decl(asyncAwait_es6.ts, 13, 3))
|
||||
|
||||
let f8 = async (): Promise<void> => { };
|
||||
>f8 : Symbol(f8, Decl(asyncAwait_es6.ts, 14, 3))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
|
||||
let f9 = async (): MyPromise<void> => { };
|
||||
>f9 : Symbol(f9, Decl(asyncAwait_es6.ts, 15, 3))
|
||||
>MyPromise : Symbol(MyPromise, Decl(asyncAwait_es6.ts, 0, 0), Decl(asyncAwait_es6.ts, 1, 11))
|
||||
|
||||
let f10 = async () => p;
|
||||
>f10 : Symbol(f10, Decl(asyncAwait_es6.ts, 16, 3))
|
||||
>p : Symbol(p, Decl(asyncAwait_es6.ts, 2, 11))
|
||||
|
||||
let f11 = async () => mp;
|
||||
>f11 : Symbol(f11, Decl(asyncAwait_es6.ts, 17, 3))
|
||||
>mp : Symbol(mp, Decl(asyncAwait_es6.ts, 3, 11))
|
||||
|
||||
let f12 = async (): Promise<number> => mp;
|
||||
>f12 : Symbol(f12, Decl(asyncAwait_es6.ts, 18, 3))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
>mp : Symbol(mp, Decl(asyncAwait_es6.ts, 3, 11))
|
||||
|
||||
let f13 = async (): MyPromise<number> => p;
|
||||
>f13 : Symbol(f13, Decl(asyncAwait_es6.ts, 19, 3))
|
||||
>MyPromise : Symbol(MyPromise, Decl(asyncAwait_es6.ts, 0, 0), Decl(asyncAwait_es6.ts, 1, 11))
|
||||
>p : Symbol(p, Decl(asyncAwait_es6.ts, 2, 11))
|
||||
|
||||
let o = {
|
||||
>o : Symbol(o, Decl(asyncAwait_es6.ts, 21, 3))
|
||||
|
||||
async m1() { },
|
||||
>m1 : Symbol(m1, Decl(asyncAwait_es6.ts, 21, 9))
|
||||
|
||||
async m2(): Promise<void> { },
|
||||
>m2 : Symbol(m2, Decl(asyncAwait_es6.ts, 22, 16))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
|
||||
async m3(): MyPromise<void> { }
|
||||
>m3 : Symbol(m3, Decl(asyncAwait_es6.ts, 23, 31))
|
||||
>MyPromise : Symbol(MyPromise, Decl(asyncAwait_es6.ts, 0, 0), Decl(asyncAwait_es6.ts, 1, 11))
|
||||
|
||||
};
|
||||
|
||||
class C {
|
||||
>C : Symbol(C, Decl(asyncAwait_es6.ts, 25, 2))
|
||||
|
||||
async m1() { }
|
||||
>m1 : Symbol(m1, Decl(asyncAwait_es6.ts, 27, 9))
|
||||
|
||||
async m2(): Promise<void> { }
|
||||
>m2 : Symbol(m2, Decl(asyncAwait_es6.ts, 28, 15))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
|
||||
async m3(): MyPromise<void> { }
|
||||
>m3 : Symbol(m3, Decl(asyncAwait_es6.ts, 29, 30))
|
||||
>MyPromise : Symbol(MyPromise, Decl(asyncAwait_es6.ts, 0, 0), Decl(asyncAwait_es6.ts, 1, 11))
|
||||
|
||||
static async m4() { }
|
||||
>m4 : Symbol(C.m4, Decl(asyncAwait_es6.ts, 30, 32))
|
||||
|
||||
static async m5(): Promise<void> { }
|
||||
>m5 : Symbol(C.m5, Decl(asyncAwait_es6.ts, 31, 22))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
|
||||
static async m6(): MyPromise<void> { }
|
||||
>m6 : Symbol(C.m6, Decl(asyncAwait_es6.ts, 32, 37))
|
||||
>MyPromise : Symbol(MyPromise, Decl(asyncAwait_es6.ts, 0, 0), Decl(asyncAwait_es6.ts, 1, 11))
|
||||
}
|
||||
|
||||
module M {
|
||||
>M : Symbol(M, Decl(asyncAwait_es6.ts, 34, 1))
|
||||
|
||||
export async function f1() { }
|
||||
>f1 : Symbol(f1, Decl(asyncAwait_es6.ts, 36, 10))
|
||||
}
|
||||
129
tests/baselines/reference/asyncAwait_es6.types
Normal file
129
tests/baselines/reference/asyncAwait_es6.types
Normal file
@@ -0,0 +1,129 @@
|
||||
=== tests/cases/conformance/async/es6/asyncAwait_es6.ts ===
|
||||
type MyPromise<T> = Promise<T>;
|
||||
>MyPromise : Promise<T>
|
||||
>T : T
|
||||
>Promise : Promise<T>
|
||||
>T : T
|
||||
|
||||
declare var MyPromise: typeof Promise;
|
||||
>MyPromise : PromiseConstructor
|
||||
>Promise : PromiseConstructor
|
||||
|
||||
declare var p: Promise<number>;
|
||||
>p : Promise<number>
|
||||
>Promise : Promise<T>
|
||||
|
||||
declare var mp: MyPromise<number>;
|
||||
>mp : Promise<number>
|
||||
>MyPromise : Promise<T>
|
||||
|
||||
async function f0() { }
|
||||
>f0 : () => Promise<void>
|
||||
|
||||
async function f1(): Promise<void> { }
|
||||
>f1 : () => Promise<void>
|
||||
>Promise : Promise<T>
|
||||
|
||||
async function f3(): MyPromise<void> { }
|
||||
>f3 : () => Promise<void>
|
||||
>MyPromise : Promise<T>
|
||||
|
||||
let f4 = async function() { }
|
||||
>f4 : () => Promise<void>
|
||||
>async function() { } : () => Promise<void>
|
||||
|
||||
let f5 = async function(): Promise<void> { }
|
||||
>f5 : () => Promise<void>
|
||||
>async function(): Promise<void> { } : () => Promise<void>
|
||||
>Promise : Promise<T>
|
||||
|
||||
let f6 = async function(): MyPromise<void> { }
|
||||
>f6 : () => Promise<void>
|
||||
>async function(): MyPromise<void> { } : () => Promise<void>
|
||||
>MyPromise : Promise<T>
|
||||
|
||||
let f7 = async () => { };
|
||||
>f7 : () => Promise<void>
|
||||
>async () => { } : () => Promise<void>
|
||||
|
||||
let f8 = async (): Promise<void> => { };
|
||||
>f8 : () => Promise<void>
|
||||
>async (): Promise<void> => { } : () => Promise<void>
|
||||
>Promise : Promise<T>
|
||||
|
||||
let f9 = async (): MyPromise<void> => { };
|
||||
>f9 : () => Promise<void>
|
||||
>async (): MyPromise<void> => { } : () => Promise<void>
|
||||
>MyPromise : Promise<T>
|
||||
|
||||
let f10 = async () => p;
|
||||
>f10 : () => Promise<number>
|
||||
>async () => p : () => Promise<number>
|
||||
>p : Promise<number>
|
||||
|
||||
let f11 = async () => mp;
|
||||
>f11 : () => Promise<number>
|
||||
>async () => mp : () => Promise<number>
|
||||
>mp : Promise<number>
|
||||
|
||||
let f12 = async (): Promise<number> => mp;
|
||||
>f12 : () => Promise<number>
|
||||
>async (): Promise<number> => mp : () => Promise<number>
|
||||
>Promise : Promise<T>
|
||||
>mp : Promise<number>
|
||||
|
||||
let f13 = async (): MyPromise<number> => p;
|
||||
>f13 : () => Promise<number>
|
||||
>async (): MyPromise<number> => p : () => Promise<number>
|
||||
>MyPromise : Promise<T>
|
||||
>p : Promise<number>
|
||||
|
||||
let o = {
|
||||
>o : { m1(): Promise<void>; m2(): Promise<void>; m3(): Promise<void>; }
|
||||
>{ async m1() { }, async m2(): Promise<void> { }, async m3(): MyPromise<void> { }} : { m1(): Promise<void>; m2(): Promise<void>; m3(): Promise<void>; }
|
||||
|
||||
async m1() { },
|
||||
>m1 : () => Promise<void>
|
||||
|
||||
async m2(): Promise<void> { },
|
||||
>m2 : () => Promise<void>
|
||||
>Promise : Promise<T>
|
||||
|
||||
async m3(): MyPromise<void> { }
|
||||
>m3 : () => Promise<void>
|
||||
>MyPromise : Promise<T>
|
||||
|
||||
};
|
||||
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
async m1() { }
|
||||
>m1 : () => Promise<void>
|
||||
|
||||
async m2(): Promise<void> { }
|
||||
>m2 : () => Promise<void>
|
||||
>Promise : Promise<T>
|
||||
|
||||
async m3(): MyPromise<void> { }
|
||||
>m3 : () => Promise<void>
|
||||
>MyPromise : Promise<T>
|
||||
|
||||
static async m4() { }
|
||||
>m4 : () => Promise<void>
|
||||
|
||||
static async m5(): Promise<void> { }
|
||||
>m5 : () => Promise<void>
|
||||
>Promise : Promise<T>
|
||||
|
||||
static async m6(): MyPromise<void> { }
|
||||
>m6 : () => Promise<void>
|
||||
>MyPromise : Promise<T>
|
||||
}
|
||||
|
||||
module M {
|
||||
>M : typeof M
|
||||
|
||||
export async function f1() { }
|
||||
>f1 : () => Promise<void>
|
||||
}
|
||||
8
tests/baselines/reference/asyncClass_es6.errors.txt
Normal file
8
tests/baselines/reference/asyncClass_es6.errors.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
tests/cases/conformance/async/es6/asyncClass_es6.ts(1,1): error TS1042: 'async' modifier cannot be used here.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es6/asyncClass_es6.ts (1 errors) ====
|
||||
async class C {
|
||||
~~~~~
|
||||
!!! error TS1042: 'async' modifier cannot be used here.
|
||||
}
|
||||
7
tests/baselines/reference/asyncClass_es6.js
Normal file
7
tests/baselines/reference/asyncClass_es6.js
Normal file
@@ -0,0 +1,7 @@
|
||||
//// [asyncClass_es6.ts]
|
||||
async class C {
|
||||
}
|
||||
|
||||
//// [asyncClass_es6.js]
|
||||
class C {
|
||||
}
|
||||
10
tests/baselines/reference/asyncConstructor_es6.errors.txt
Normal file
10
tests/baselines/reference/asyncConstructor_es6.errors.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
tests/cases/conformance/async/es6/asyncConstructor_es6.ts(2,3): error TS1089: 'async' modifier cannot appear on a constructor declaration.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es6/asyncConstructor_es6.ts (1 errors) ====
|
||||
class C {
|
||||
async constructor() {
|
||||
~~~~~
|
||||
!!! error TS1089: 'async' modifier cannot appear on a constructor declaration.
|
||||
}
|
||||
}
|
||||
11
tests/baselines/reference/asyncConstructor_es6.js
Normal file
11
tests/baselines/reference/asyncConstructor_es6.js
Normal file
@@ -0,0 +1,11 @@
|
||||
//// [asyncConstructor_es6.ts]
|
||||
class C {
|
||||
async constructor() {
|
||||
}
|
||||
}
|
||||
|
||||
//// [asyncConstructor_es6.js]
|
||||
class C {
|
||||
constructor() {
|
||||
}
|
||||
}
|
||||
7
tests/baselines/reference/asyncDeclare_es6.errors.txt
Normal file
7
tests/baselines/reference/asyncDeclare_es6.errors.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
tests/cases/conformance/async/es6/asyncDeclare_es6.ts(1,9): error TS1040: 'async' modifier cannot be used in an ambient context.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es6/asyncDeclare_es6.ts (1 errors) ====
|
||||
declare async function foo(): Promise<void>;
|
||||
~~~~~
|
||||
!!! error TS1040: 'async' modifier cannot be used in an ambient context.
|
||||
4
tests/baselines/reference/asyncDeclare_es6.js
Normal file
4
tests/baselines/reference/asyncDeclare_es6.js
Normal file
@@ -0,0 +1,4 @@
|
||||
//// [asyncDeclare_es6.ts]
|
||||
declare async function foo(): Promise<void>;
|
||||
|
||||
//// [asyncDeclare_es6.js]
|
||||
9
tests/baselines/reference/asyncEnum_es6.errors.txt
Normal file
9
tests/baselines/reference/asyncEnum_es6.errors.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
tests/cases/conformance/async/es6/asyncEnum_es6.ts(1,1): error TS1042: 'async' modifier cannot be used here.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es6/asyncEnum_es6.ts (1 errors) ====
|
||||
async enum E {
|
||||
~~~~~
|
||||
!!! error TS1042: 'async' modifier cannot be used here.
|
||||
Value
|
||||
}
|
||||
10
tests/baselines/reference/asyncEnum_es6.js
Normal file
10
tests/baselines/reference/asyncEnum_es6.js
Normal file
@@ -0,0 +1,10 @@
|
||||
//// [asyncEnum_es6.ts]
|
||||
async enum E {
|
||||
Value
|
||||
}
|
||||
|
||||
//// [asyncEnum_es6.js]
|
||||
var E;
|
||||
(function (E) {
|
||||
E[E["Value"] = 0] = "Value";
|
||||
})(E || (E = {}));
|
||||
@@ -0,0 +1,26 @@
|
||||
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration10_es6.ts(1,20): error TS2371: A parameter initializer is only allowed in a function or constructor implementation.
|
||||
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration10_es6.ts(1,30): error TS1109: Expression expected.
|
||||
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration10_es6.ts(1,33): error TS1138: Parameter declaration expected.
|
||||
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration10_es6.ts(1,33): error TS2304: Cannot find name 'await'.
|
||||
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration10_es6.ts(1,38): error TS1005: ';' expected.
|
||||
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration10_es6.ts(1,39): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration10_es6.ts(1,53): error TS1109: Expression expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration10_es6.ts (7 errors) ====
|
||||
async function foo(a = await => await): Promise<void> {
|
||||
~~~~~~~~~
|
||||
!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation.
|
||||
~~
|
||||
!!! error TS1109: Expression expected.
|
||||
~~~~~
|
||||
!!! error TS1138: Parameter declaration expected.
|
||||
~~~~~
|
||||
!!! error TS2304: Cannot find name 'await'.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
//// [asyncFunctionDeclaration10_es6.ts]
|
||||
async function foo(a = await => await): Promise<void> {
|
||||
}
|
||||
|
||||
//// [asyncFunctionDeclaration10_es6.js]
|
||||
await;
|
||||
Promise < void > {};
|
||||
@@ -0,0 +1,9 @@
|
||||
//// [asyncFunctionDeclaration11_es6.ts]
|
||||
async function await(): Promise<void> {
|
||||
}
|
||||
|
||||
//// [asyncFunctionDeclaration11_es6.js]
|
||||
function await() {
|
||||
return __awaiter(this, void 0, Promise, function* () {
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
=== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration11_es6.ts ===
|
||||
async function await(): Promise<void> {
|
||||
>await : Symbol(await, Decl(asyncFunctionDeclaration11_es6.ts, 0, 0))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
=== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration11_es6.ts ===
|
||||
async function await(): Promise<void> {
|
||||
>await : () => Promise<void>
|
||||
>Promise : Promise<T>
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration12_es6.ts(1,24): error TS1005: '(' expected.
|
||||
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration12_es6.ts(1,29): error TS1005: '=' expected.
|
||||
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration12_es6.ts(1,33): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement.
|
||||
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration12_es6.ts(1,47): error TS1005: '=>' expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration12_es6.ts (4 errors) ====
|
||||
var v = async function await(): Promise<void> { }
|
||||
~~~~~
|
||||
!!! error TS1005: '(' expected.
|
||||
~
|
||||
!!! error TS1005: '=' expected.
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement.
|
||||
~
|
||||
!!! error TS1005: '=>' expected.
|
||||
@@ -0,0 +1,5 @@
|
||||
//// [asyncFunctionDeclaration12_es6.ts]
|
||||
var v = async function await(): Promise<void> { }
|
||||
|
||||
//// [asyncFunctionDeclaration12_es6.js]
|
||||
var v = , await = () => { };
|
||||
@@ -0,0 +1,11 @@
|
||||
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration13_es6.ts(3,11): error TS2304: Cannot find name 'await'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration13_es6.ts (1 errors) ====
|
||||
async function foo(): Promise<void> {
|
||||
// Legal to use 'await' in a type context.
|
||||
var v: await;
|
||||
~~~~~
|
||||
!!! error TS2304: Cannot find name 'await'.
|
||||
}
|
||||
|
||||
14
tests/baselines/reference/asyncFunctionDeclaration13_es6.js
Normal file
14
tests/baselines/reference/asyncFunctionDeclaration13_es6.js
Normal file
@@ -0,0 +1,14 @@
|
||||
//// [asyncFunctionDeclaration13_es6.ts]
|
||||
async function foo(): Promise<void> {
|
||||
// Legal to use 'await' in a type context.
|
||||
var v: await;
|
||||
}
|
||||
|
||||
|
||||
//// [asyncFunctionDeclaration13_es6.js]
|
||||
function foo() {
|
||||
return __awaiter(this, void 0, Promise, function* () {
|
||||
// Legal to use 'await' in a type context.
|
||||
var v;
|
||||
});
|
||||
}
|
||||
11
tests/baselines/reference/asyncFunctionDeclaration14_es6.js
Normal file
11
tests/baselines/reference/asyncFunctionDeclaration14_es6.js
Normal file
@@ -0,0 +1,11 @@
|
||||
//// [asyncFunctionDeclaration14_es6.ts]
|
||||
async function foo(): Promise<void> {
|
||||
return;
|
||||
}
|
||||
|
||||
//// [asyncFunctionDeclaration14_es6.js]
|
||||
function foo() {
|
||||
return __awaiter(this, void 0, Promise, function* () {
|
||||
return;
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
=== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration14_es6.ts ===
|
||||
async function foo(): Promise<void> {
|
||||
>foo : Symbol(foo, Decl(asyncFunctionDeclaration14_es6.ts, 0, 0))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
=== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration14_es6.ts ===
|
||||
async function foo(): Promise<void> {
|
||||
>foo : () => Promise<void>
|
||||
>Promise : Promise<T>
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
//// [asyncFunctionDeclaration1_es6.ts]
|
||||
async function foo(): Promise<void> {
|
||||
}
|
||||
|
||||
//// [asyncFunctionDeclaration1_es6.js]
|
||||
function foo() {
|
||||
return __awaiter(this, void 0, Promise, function* () {
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
=== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration1_es6.ts ===
|
||||
async function foo(): Promise<void> {
|
||||
>foo : Symbol(foo, Decl(asyncFunctionDeclaration1_es6.ts, 0, 0))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
=== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration1_es6.ts ===
|
||||
async function foo(): Promise<void> {
|
||||
>foo : () => Promise<void>
|
||||
>Promise : Promise<T>
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
//// [asyncFunctionDeclaration2_es6.ts]
|
||||
function f(await) {
|
||||
}
|
||||
|
||||
//// [asyncFunctionDeclaration2_es6.js]
|
||||
function f(await) {
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
=== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration2_es6.ts ===
|
||||
function f(await) {
|
||||
>f : Symbol(f, Decl(asyncFunctionDeclaration2_es6.ts, 0, 0))
|
||||
>await : Symbol(await, Decl(asyncFunctionDeclaration2_es6.ts, 0, 11))
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
=== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration2_es6.ts ===
|
||||
function f(await) {
|
||||
>f : (await: any) => void
|
||||
>await : any
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration3_es6.ts(1,20): error TS2372: Parameter 'await' cannot be referenced in its initializer.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration3_es6.ts (1 errors) ====
|
||||
function f(await = await) {
|
||||
~~~~~
|
||||
!!! error TS2372: Parameter 'await' cannot be referenced in its initializer.
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
//// [asyncFunctionDeclaration3_es6.ts]
|
||||
function f(await = await) {
|
||||
}
|
||||
|
||||
//// [asyncFunctionDeclaration3_es6.js]
|
||||
function f(await = await) {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
//// [asyncFunctionDeclaration4_es6.ts]
|
||||
function await() {
|
||||
}
|
||||
|
||||
//// [asyncFunctionDeclaration4_es6.js]
|
||||
function await() {
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
=== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration4_es6.ts ===
|
||||
function await() {
|
||||
>await : Symbol(await, Decl(asyncFunctionDeclaration4_es6.ts, 0, 0))
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
=== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration4_es6.ts ===
|
||||
function await() {
|
||||
>await : () => void
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration5_es6.ts(1,20): error TS1138: Parameter declaration expected.
|
||||
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration5_es6.ts(1,20): error TS2304: Cannot find name 'await'.
|
||||
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration5_es6.ts(1,25): error TS1005: ';' expected.
|
||||
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration5_es6.ts(1,26): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration5_es6.ts(1,40): error TS1109: Expression expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration5_es6.ts (5 errors) ====
|
||||
async function foo(await): Promise<void> {
|
||||
~~~~~
|
||||
!!! error TS1138: Parameter declaration expected.
|
||||
~~~~~
|
||||
!!! error TS2304: Cannot find name 'await'.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
//// [asyncFunctionDeclaration5_es6.ts]
|
||||
async function foo(await): Promise<void> {
|
||||
}
|
||||
|
||||
//// [asyncFunctionDeclaration5_es6.js]
|
||||
await;
|
||||
Promise < void > {};
|
||||
@@ -0,0 +1,11 @@
|
||||
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration6_es6.ts(1,24): error TS2524: 'await' expressions cannot be used in a parameter initializer.
|
||||
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration6_es6.ts(1,29): error TS1109: Expression expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration6_es6.ts (2 errors) ====
|
||||
async function foo(a = await): Promise<void> {
|
||||
~~~~~
|
||||
!!! error TS2524: 'await' expressions cannot be used in a parameter initializer.
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
//// [asyncFunctionDeclaration6_es6.ts]
|
||||
async function foo(a = await): Promise<void> {
|
||||
}
|
||||
|
||||
//// [asyncFunctionDeclaration6_es6.js]
|
||||
function foo(a = yield ) {
|
||||
return __awaiter(this, void 0, Promise, function* () {
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration7_es6.ts(3,26): error TS2524: 'await' expressions cannot be used in a parameter initializer.
|
||||
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration7_es6.ts(3,31): error TS1109: Expression expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration7_es6.ts (2 errors) ====
|
||||
async function bar(): Promise<void> {
|
||||
// 'await' here is an identifier, and not a yield expression.
|
||||
async function foo(a = await): Promise<void> {
|
||||
~~~~~
|
||||
!!! error TS2524: 'await' expressions cannot be used in a parameter initializer.
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
}
|
||||
}
|
||||
17
tests/baselines/reference/asyncFunctionDeclaration7_es6.js
Normal file
17
tests/baselines/reference/asyncFunctionDeclaration7_es6.js
Normal file
@@ -0,0 +1,17 @@
|
||||
//// [asyncFunctionDeclaration7_es6.ts]
|
||||
async function bar(): Promise<void> {
|
||||
// 'await' here is an identifier, and not a yield expression.
|
||||
async function foo(a = await): Promise<void> {
|
||||
}
|
||||
}
|
||||
|
||||
//// [asyncFunctionDeclaration7_es6.js]
|
||||
function bar() {
|
||||
return __awaiter(this, void 0, Promise, function* () {
|
||||
// 'await' here is an identifier, and not a yield expression.
|
||||
function foo(a = yield ) {
|
||||
return __awaiter(this, void 0, Promise, function* () {
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration8_es6.ts(1,12): error TS2304: Cannot find name 'await'.
|
||||
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration8_es6.ts(1,20): error TS2304: Cannot find name 'foo'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration8_es6.ts (2 errors) ====
|
||||
var v = { [await]: foo }
|
||||
~~~~~
|
||||
!!! error TS2304: Cannot find name 'await'.
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'foo'.
|
||||
@@ -0,0 +1,5 @@
|
||||
//// [asyncFunctionDeclaration8_es6.ts]
|
||||
var v = { [await]: foo }
|
||||
|
||||
//// [asyncFunctionDeclaration8_es6.js]
|
||||
var v = { [await]: foo };
|
||||
@@ -0,0 +1,9 @@
|
||||
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration9_es6.ts(2,19): error TS1109: Expression expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration9_es6.ts (1 errors) ====
|
||||
async function foo(): Promise<void> {
|
||||
var v = { [await]: foo }
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
}
|
||||
11
tests/baselines/reference/asyncFunctionDeclaration9_es6.js
Normal file
11
tests/baselines/reference/asyncFunctionDeclaration9_es6.js
Normal file
@@ -0,0 +1,11 @@
|
||||
//// [asyncFunctionDeclaration9_es6.ts]
|
||||
async function foo(): Promise<void> {
|
||||
var v = { [await]: foo }
|
||||
}
|
||||
|
||||
//// [asyncFunctionDeclaration9_es6.js]
|
||||
function foo() {
|
||||
return __awaiter(this, void 0, Promise, function* () {
|
||||
var v = { [yield ]: foo };
|
||||
});
|
||||
}
|
||||
13
tests/baselines/reference/asyncGetter_es6.errors.txt
Normal file
13
tests/baselines/reference/asyncGetter_es6.errors.txt
Normal file
@@ -0,0 +1,13 @@
|
||||
tests/cases/conformance/async/es6/asyncGetter_es6.ts(2,3): error TS1042: 'async' modifier cannot be used here.
|
||||
tests/cases/conformance/async/es6/asyncGetter_es6.ts(2,13): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es6/asyncGetter_es6.ts (2 errors) ====
|
||||
class C {
|
||||
async get foo() {
|
||||
~~~~~
|
||||
!!! error TS1042: 'async' modifier cannot be used here.
|
||||
~~~
|
||||
!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
|
||||
}
|
||||
}
|
||||
11
tests/baselines/reference/asyncGetter_es6.js
Normal file
11
tests/baselines/reference/asyncGetter_es6.js
Normal file
@@ -0,0 +1,11 @@
|
||||
//// [asyncGetter_es6.ts]
|
||||
class C {
|
||||
async get foo() {
|
||||
}
|
||||
}
|
||||
|
||||
//// [asyncGetter_es6.js]
|
||||
class C {
|
||||
get foo() {
|
||||
}
|
||||
}
|
||||
8
tests/baselines/reference/asyncInterface_es6.errors.txt
Normal file
8
tests/baselines/reference/asyncInterface_es6.errors.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
tests/cases/conformance/async/es6/asyncInterface_es6.ts(1,1): error TS1042: 'async' modifier cannot be used here.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es6/asyncInterface_es6.ts (1 errors) ====
|
||||
async interface I {
|
||||
~~~~~
|
||||
!!! error TS1042: 'async' modifier cannot be used here.
|
||||
}
|
||||
5
tests/baselines/reference/asyncInterface_es6.js
Normal file
5
tests/baselines/reference/asyncInterface_es6.js
Normal file
@@ -0,0 +1,5 @@
|
||||
//// [asyncInterface_es6.ts]
|
||||
async interface I {
|
||||
}
|
||||
|
||||
//// [asyncInterface_es6.js]
|
||||
8
tests/baselines/reference/asyncModule_es6.errors.txt
Normal file
8
tests/baselines/reference/asyncModule_es6.errors.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
tests/cases/conformance/async/es6/asyncModule_es6.ts(1,1): error TS1042: 'async' modifier cannot be used here.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es6/asyncModule_es6.ts (1 errors) ====
|
||||
async module M {
|
||||
~~~~~
|
||||
!!! error TS1042: 'async' modifier cannot be used here.
|
||||
}
|
||||
5
tests/baselines/reference/asyncModule_es6.js
Normal file
5
tests/baselines/reference/asyncModule_es6.js
Normal file
@@ -0,0 +1,5 @@
|
||||
//// [asyncModule_es6.ts]
|
||||
async module M {
|
||||
}
|
||||
|
||||
//// [asyncModule_es6.js]
|
||||
10
tests/baselines/reference/asyncSetter_es6.errors.txt
Normal file
10
tests/baselines/reference/asyncSetter_es6.errors.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
tests/cases/conformance/async/es6/asyncSetter_es6.ts(2,3): error TS1042: 'async' modifier cannot be used here.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es6/asyncSetter_es6.ts (1 errors) ====
|
||||
class C {
|
||||
async set foo(value) {
|
||||
~~~~~
|
||||
!!! error TS1042: 'async' modifier cannot be used here.
|
||||
}
|
||||
}
|
||||
11
tests/baselines/reference/asyncSetter_es6.js
Normal file
11
tests/baselines/reference/asyncSetter_es6.js
Normal file
@@ -0,0 +1,11 @@
|
||||
//// [asyncSetter_es6.ts]
|
||||
class C {
|
||||
async set foo(value) {
|
||||
}
|
||||
}
|
||||
|
||||
//// [asyncSetter_es6.js]
|
||||
class C {
|
||||
set foo(value) {
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/augmentedTypesClass2.ts(4,7): error TS2300: Duplicate identifier 'c11'.
|
||||
tests/cases/compiler/augmentedTypesClass2.ts(10,11): error TS2300: Duplicate identifier 'c11'.
|
||||
tests/cases/compiler/augmentedTypesClass2.ts(4,7): error TS2518: Only an ambient class can be merged with an interface.
|
||||
tests/cases/compiler/augmentedTypesClass2.ts(10,11): error TS2518: Only an ambient class can be merged with an interface.
|
||||
tests/cases/compiler/augmentedTypesClass2.ts(16,7): error TS2300: Duplicate identifier 'c33'.
|
||||
tests/cases/compiler/augmentedTypesClass2.ts(21,6): error TS2300: Duplicate identifier 'c33'.
|
||||
|
||||
@@ -10,7 +10,7 @@ tests/cases/compiler/augmentedTypesClass2.ts(21,6): error TS2300: Duplicate iden
|
||||
// class then interface
|
||||
class c11 { // error
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'c11'.
|
||||
!!! error TS2518: Only an ambient class can be merged with an interface.
|
||||
foo() {
|
||||
return 1;
|
||||
}
|
||||
@@ -18,7 +18,7 @@ tests/cases/compiler/augmentedTypesClass2.ts(21,6): error TS2300: Duplicate iden
|
||||
|
||||
interface c11 { // error
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'c11'.
|
||||
!!! error TS2518: Only an ambient class can be merged with an interface.
|
||||
bar(): void;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/augmentedTypesInterface.ts(12,11): error TS2300: Duplicate identifier 'i2'.
|
||||
tests/cases/compiler/augmentedTypesInterface.ts(16,7): error TS2300: Duplicate identifier 'i2'.
|
||||
tests/cases/compiler/augmentedTypesInterface.ts(12,11): error TS2518: Only an ambient class can be merged with an interface.
|
||||
tests/cases/compiler/augmentedTypesInterface.ts(16,7): error TS2518: Only an ambient class can be merged with an interface.
|
||||
tests/cases/compiler/augmentedTypesInterface.ts(23,11): error TS2300: Duplicate identifier 'i3'.
|
||||
tests/cases/compiler/augmentedTypesInterface.ts(26,6): error TS2300: Duplicate identifier 'i3'.
|
||||
|
||||
@@ -18,13 +18,13 @@ tests/cases/compiler/augmentedTypesInterface.ts(26,6): error TS2300: Duplicate i
|
||||
// interface then class
|
||||
interface i2 { // error
|
||||
~~
|
||||
!!! error TS2300: Duplicate identifier 'i2'.
|
||||
!!! error TS2518: Only an ambient class can be merged with an interface.
|
||||
foo(): void;
|
||||
}
|
||||
|
||||
class i2 { // error
|
||||
~~
|
||||
!!! error TS2300: Duplicate identifier 'i2'.
|
||||
!!! error TS2518: Only an ambient class can be merged with an interface.
|
||||
bar() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
17
tests/baselines/reference/awaitBinaryExpression1_es6.js
Normal file
17
tests/baselines/reference/awaitBinaryExpression1_es6.js
Normal file
@@ -0,0 +1,17 @@
|
||||
//// [awaitBinaryExpression1_es6.ts]
|
||||
declare var a: boolean;
|
||||
declare var p: Promise<boolean>;
|
||||
async function func(): Promise<void> {
|
||||
"before";
|
||||
var b = await p || a;
|
||||
"after";
|
||||
}
|
||||
|
||||
//// [awaitBinaryExpression1_es6.js]
|
||||
function func() {
|
||||
return __awaiter(this, void 0, Promise, function* () {
|
||||
"before";
|
||||
var b = (yield p) || a;
|
||||
"after";
|
||||
});
|
||||
}
|
||||
19
tests/baselines/reference/awaitBinaryExpression1_es6.symbols
Normal file
19
tests/baselines/reference/awaitBinaryExpression1_es6.symbols
Normal file
@@ -0,0 +1,19 @@
|
||||
=== tests/cases/conformance/async/es6/awaitBinaryExpression/awaitBinaryExpression1_es6.ts ===
|
||||
declare var a: boolean;
|
||||
>a : Symbol(a, Decl(awaitBinaryExpression1_es6.ts, 0, 11))
|
||||
|
||||
declare var p: Promise<boolean>;
|
||||
>p : Symbol(p, Decl(awaitBinaryExpression1_es6.ts, 1, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
|
||||
async function func(): Promise<void> {
|
||||
>func : Symbol(func, Decl(awaitBinaryExpression1_es6.ts, 1, 32))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11))
|
||||
|
||||
"before";
|
||||
var b = await p || a;
|
||||
>b : Symbol(b, Decl(awaitBinaryExpression1_es6.ts, 4, 7))
|
||||
>a : Symbol(a, Decl(awaitBinaryExpression1_es6.ts, 0, 11))
|
||||
|
||||
"after";
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user