Add es2017 async conformance

This commit is contained in:
Andrej Baran
2016-10-12 21:58:25 +02:00
parent 5d52c9fd3b
commit 1b4c0e331e
230 changed files with 4602 additions and 14 deletions
@@ -0,0 +1,6 @@
//// [arrowFunctionWithParameterNameAsync_es2017.ts]
const x = async => async;
//// [arrowFunctionWithParameterNameAsync_es2017.js]
var x = function (async) { return async; };
@@ -0,0 +1,7 @@
=== tests/cases/conformance/async/es2017/asyncArrowFunction/arrowFunctionWithParameterNameAsync_es2017.ts ===
const x = async => async;
>x : Symbol(x, Decl(arrowFunctionWithParameterNameAsync_es2017.ts, 1, 5))
>async : Symbol(async, Decl(arrowFunctionWithParameterNameAsync_es2017.ts, 1, 9))
>async : Symbol(async, Decl(arrowFunctionWithParameterNameAsync_es2017.ts, 1, 9))
@@ -0,0 +1,8 @@
=== tests/cases/conformance/async/es2017/asyncArrowFunction/arrowFunctionWithParameterNameAsync_es2017.ts ===
const x = async => async;
>x : (async: any) => any
>async => async : (async: any) => any
>async : any
>async : any
@@ -0,0 +1,9 @@
//// [asyncAliasReturnType_es2017.ts]
type PromiseAlias<T> = Promise<T>;
async function f(): PromiseAlias<void> {
}
//// [asyncAliasReturnType_es2017.js]
async function f() {
}
@@ -0,0 +1,11 @@
=== tests/cases/conformance/async/es2017/asyncAliasReturnType_es2017.ts ===
type PromiseAlias<T> = Promise<T>;
>PromiseAlias : Symbol(PromiseAlias, Decl(asyncAliasReturnType_es2017.ts, 0, 0))
>T : Symbol(T, Decl(asyncAliasReturnType_es2017.ts, 0, 18))
>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
>T : Symbol(T, Decl(asyncAliasReturnType_es2017.ts, 0, 18))
async function f(): PromiseAlias<void> {
>f : Symbol(f, Decl(asyncAliasReturnType_es2017.ts, 0, 34))
>PromiseAlias : Symbol(PromiseAlias, Decl(asyncAliasReturnType_es2017.ts, 0, 0))
}
@@ -0,0 +1,11 @@
=== tests/cases/conformance/async/es2017/asyncAliasReturnType_es2017.ts ===
type PromiseAlias<T> = Promise<T>;
>PromiseAlias : Promise<T>
>T : T
>Promise : Promise<T>
>T : T
async function f(): PromiseAlias<void> {
>f : () => Promise<void>
>PromiseAlias : Promise<T>
}
@@ -0,0 +1,12 @@
tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction10_es2017.ts(4,11): error TS2304: Cannot find name 'await'.
==== tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction10_es2017.ts (1 errors) ====
var foo = async (): Promise<void> => {
// Legal to use 'await' in a type context.
var v: await;
~~~~~
!!! error TS2304: Cannot find name 'await'.
}
@@ -0,0 +1,13 @@
//// [asyncArrowFunction10_es2017.ts]
var foo = async (): Promise<void> => {
// Legal to use 'await' in a type context.
var v: await;
}
//// [asyncArrowFunction10_es2017.js]
var foo = async () => {
// Legal to use 'await' in a type context.
var v;
};
@@ -0,0 +1,8 @@
//// [asyncArrowFunction1_es2017.ts]
var foo = async (): Promise<void> => {
};
//// [asyncArrowFunction1_es2017.js]
var foo = async () => {
};
@@ -0,0 +1,7 @@
=== tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction1_es2017.ts ===
var foo = async (): Promise<void> => {
>foo : Symbol(foo, Decl(asyncArrowFunction1_es2017.ts, 1, 3))
>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
};
@@ -0,0 +1,8 @@
=== tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction1_es2017.ts ===
var foo = async (): Promise<void> => {
>foo : () => Promise<void>
>async (): Promise<void> => {} : () => Promise<void>
>Promise : Promise<T>
};
@@ -0,0 +1,7 @@
//// [asyncArrowFunction2_es2017.ts]
var f = (await) => {
}
//// [asyncArrowFunction2_es2017.js]
var f = (await) => {
};
@@ -0,0 +1,5 @@
=== tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction2_es2017.ts ===
var f = (await) => {
>f : Symbol(f, Decl(asyncArrowFunction2_es2017.ts, 0, 3))
>await : Symbol(await, Decl(asyncArrowFunction2_es2017.ts, 0, 9))
}
@@ -0,0 +1,6 @@
=== tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction2_es2017.ts ===
var f = (await) => {
>f : (await: any) => void
>(await) => {} : (await: any) => void
>await : any
}
@@ -0,0 +1,8 @@
tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction3_es2017.ts(1,20): error TS2372: Parameter 'await' cannot be referenced in its initializer.
==== tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction3_es2017.ts (1 errors) ====
function f(await = await) {
~~~~~
!!! error TS2372: Parameter 'await' cannot be referenced in its initializer.
}
@@ -0,0 +1,7 @@
//// [asyncArrowFunction3_es2017.ts]
function f(await = await) {
}
//// [asyncArrowFunction3_es2017.js]
function f(await = await) {
}
@@ -0,0 +1,7 @@
//// [asyncArrowFunction4_es2017.ts]
var await = () => {
}
//// [asyncArrowFunction4_es2017.js]
var await = () => {
};
@@ -0,0 +1,4 @@
=== tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction4_es2017.ts ===
var await = () => {
>await : Symbol(await, Decl(asyncArrowFunction4_es2017.ts, 0, 3))
}
@@ -0,0 +1,5 @@
=== tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction4_es2017.ts ===
var await = () => {
>await : () => void
>() => {} : () => void
}
@@ -0,0 +1,24 @@
tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction5_es2017.ts(2,11): error TS2304: Cannot find name 'async'.
tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction5_es2017.ts(2,18): error TS2304: Cannot find name 'await'.
tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction5_es2017.ts(2,24): error TS1005: ',' expected.
tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction5_es2017.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/es2017/asyncArrowFunction/asyncArrowFunction5_es2017.ts(2,33): error TS1005: '=' expected.
tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction5_es2017.ts(2,40): error TS1109: Expression expected.
==== tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction5_es2017.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.
}
@@ -0,0 +1,9 @@
//// [asyncArrowFunction5_es2017.ts]
var foo = async (await): Promise<void> => {
}
//// [asyncArrowFunction5_es2017.js]
var foo = async(await), Promise = ;
{
}
@@ -0,0 +1,12 @@
tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction6_es2017.ts(2,22): error TS2524: 'await' expressions cannot be used in a parameter initializer.
tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction6_es2017.ts(2,27): error TS1109: Expression expected.
==== tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction6_es2017.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.
}
@@ -0,0 +1,8 @@
//// [asyncArrowFunction6_es2017.ts]
var foo = async (a = await): Promise<void> => {
}
//// [asyncArrowFunction6_es2017.js]
var foo = async (a = await ) => {
};
@@ -0,0 +1,15 @@
tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction7_es2017.ts(4,24): error TS2524: 'await' expressions cannot be used in a parameter initializer.
tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction7_es2017.ts(4,29): error TS1109: Expression expected.
==== tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction7_es2017.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.
}
}
@@ -0,0 +1,14 @@
//// [asyncArrowFunction7_es2017.ts]
var bar = async (): Promise<void> => {
// 'await' here is an identifier, and not an await expression.
var foo = async (a = await): Promise<void> => {
}
}
//// [asyncArrowFunction7_es2017.js]
var bar = async () => {
// 'await' here is an identifier, and not an await expression.
var foo = async (a = await ) => {
};
};
@@ -0,0 +1,10 @@
tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction8_es2017.ts(3,19): error TS1109: Expression expected.
==== tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction8_es2017.ts (1 errors) ====
var foo = async (): Promise<void> => {
var v = { [await]: foo }
~
!!! error TS1109: Expression expected.
}
@@ -0,0 +1,10 @@
//// [asyncArrowFunction8_es2017.ts]
var foo = async (): Promise<void> => {
var v = { [await]: foo }
}
//// [asyncArrowFunction8_es2017.js]
var foo = async () => {
var v = { [await ]: foo };
};
@@ -0,0 +1,23 @@
tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction9_es2017.ts(1,11): error TS2304: Cannot find name 'async'.
tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction9_es2017.ts(1,18): error TS2304: Cannot find name 'a'.
tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction9_es2017.ts(1,37): error TS1005: ',' expected.
tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction9_es2017.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/es2017/asyncArrowFunction/asyncArrowFunction9_es2017.ts(1,46): error TS1005: '=' expected.
tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction9_es2017.ts(1,53): error TS1109: Expression expected.
==== tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction9_es2017.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.
}
@@ -0,0 +1,8 @@
//// [asyncArrowFunction9_es2017.ts]
var foo = async (a = await => await): Promise<void> => {
}
//// [asyncArrowFunction9_es2017.js]
var foo = async(a = await => await), Promise = ;
{
}
@@ -0,0 +1,16 @@
//// [asyncArrowFunctionCapturesArguments_es2017.ts]
class C {
method() {
function other() {}
var fn = async () => await other.apply(this, arguments);
}
}
//// [asyncArrowFunctionCapturesArguments_es2017.js]
class C {
method() {
function other() { }
var fn = async () => await other.apply(this, arguments);
}
}
@@ -0,0 +1,20 @@
=== tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunctionCapturesArguments_es2017.ts ===
class C {
>C : Symbol(C, Decl(asyncArrowFunctionCapturesArguments_es2017.ts, 0, 0))
method() {
>method : Symbol(C.method, Decl(asyncArrowFunctionCapturesArguments_es2017.ts, 0, 9))
function other() {}
>other : Symbol(other, Decl(asyncArrowFunctionCapturesArguments_es2017.ts, 1, 13))
var fn = async () => await other.apply(this, arguments);
>fn : Symbol(fn, Decl(asyncArrowFunctionCapturesArguments_es2017.ts, 3, 9))
>other.apply : Symbol(Function.apply, Decl(lib.es5.d.ts, --, --))
>other : Symbol(other, Decl(asyncArrowFunctionCapturesArguments_es2017.ts, 1, 13))
>apply : Symbol(Function.apply, Decl(lib.es5.d.ts, --, --))
>this : Symbol(C, Decl(asyncArrowFunctionCapturesArguments_es2017.ts, 0, 0))
>arguments : Symbol(arguments)
}
}
@@ -0,0 +1,23 @@
=== tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunctionCapturesArguments_es2017.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>
>await other.apply(this, arguments) : any
>other.apply(this, arguments) : any
>other.apply : (this: Function, thisArg: any, argArray?: any) => any
>other : () => void
>apply : (this: Function, thisArg: any, argArray?: any) => any
>this : this
>arguments : IArguments
}
}
@@ -0,0 +1,14 @@
//// [asyncArrowFunctionCapturesThis_es2017.ts]
class C {
method() {
var fn = async () => await this;
}
}
//// [asyncArrowFunctionCapturesThis_es2017.js]
class C {
method() {
var fn = async () => await this;
}
}
@@ -0,0 +1,13 @@
=== tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunctionCapturesThis_es2017.ts ===
class C {
>C : Symbol(C, Decl(asyncArrowFunctionCapturesThis_es2017.ts, 0, 0))
method() {
>method : Symbol(C.method, Decl(asyncArrowFunctionCapturesThis_es2017.ts, 0, 9))
var fn = async () => await this;
>fn : Symbol(fn, Decl(asyncArrowFunctionCapturesThis_es2017.ts, 2, 9))
>this : Symbol(C, Decl(asyncArrowFunctionCapturesThis_es2017.ts, 0, 0))
}
}
@@ -0,0 +1,15 @@
=== tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunctionCapturesThis_es2017.ts ===
class C {
>C : C
method() {
>method : () => void
var fn = async () => await this;
>fn : () => Promise<this>
>async () => await this : () => Promise<this>
>await this : this
>this : this
}
}
@@ -0,0 +1,45 @@
tests/cases/conformance/async/es2017/asyncAwaitIsolatedModules_es2017.ts(1,27): error TS2307: Cannot find module 'missing'.
==== tests/cases/conformance/async/es2017/asyncAwaitIsolatedModules_es2017.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() { }
}
@@ -0,0 +1,73 @@
//// [asyncAwaitIsolatedModules_es2017.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_es2017.js]
async function f0() { }
async function f1() { }
async function f3() { }
let f4 = async function () { };
let f5 = async function () { };
let f6 = async function () { };
let f7 = async () => { };
let f8 = async () => { };
let f9 = async () => { };
let f10 = async () => p;
let f11 = async () => mp;
let f12 = async () => mp;
let f13 = async () => p;
let o = {
async m1() { },
async m2() { },
async m3() { }
};
class C {
async m1() { }
async m2() { }
async m3() { }
static async m4() { }
static async m5() { }
static async m6() { }
}
var M;
(function (M) {
async function f1() { }
M.f1 = f1;
})(M || (M = {}));
@@ -0,0 +1,73 @@
//// [asyncAwait_es2017.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_es2017.js]
async function f0() { }
async function f1() { }
async function f3() { }
let f4 = async function () { };
let f5 = async function () { };
let f6 = async function () { };
let f7 = async () => { };
let f8 = async () => { };
let f9 = async () => { };
let f10 = async () => p;
let f11 = async () => mp;
let f12 = async () => mp;
let f13 = async () => p;
let o = {
async m1() { },
async m2() { },
async m3() { }
};
class C {
async m1() { }
async m2() { }
async m3() { }
static async m4() { }
static async m5() { }
static async m6() { }
}
var M;
(function (M) {
async function f1() { }
M.f1 = f1;
})(M || (M = {}));
@@ -0,0 +1,118 @@
=== tests/cases/conformance/async/es2017/asyncAwait_es2017.ts ===
type MyPromise<T> = Promise<T>;
>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.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.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.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
declare var p: Promise<number>;
>p : Symbol(p, Decl(asyncAwait_es2017.ts, 2, 11))
>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
declare var mp: MyPromise<number>;
>mp : Symbol(mp, Decl(asyncAwait_es2017.ts, 3, 11))
>MyPromise : Symbol(MyPromise, Decl(asyncAwait_es2017.ts, 0, 0), Decl(asyncAwait_es2017.ts, 1, 11))
async function f0() { }
>f0 : Symbol(f0, Decl(asyncAwait_es2017.ts, 3, 34))
async function f1(): Promise<void> { }
>f1 : Symbol(f1, Decl(asyncAwait_es2017.ts, 5, 23))
>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
async function f3(): MyPromise<void> { }
>f3 : Symbol(f3, Decl(asyncAwait_es2017.ts, 6, 38))
>MyPromise : Symbol(MyPromise, Decl(asyncAwait_es2017.ts, 0, 0), Decl(asyncAwait_es2017.ts, 1, 11))
let f4 = async function() { }
>f4 : Symbol(f4, Decl(asyncAwait_es2017.ts, 9, 3))
let f5 = async function(): Promise<void> { }
>f5 : Symbol(f5, Decl(asyncAwait_es2017.ts, 10, 3))
>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
let f6 = async function(): MyPromise<void> { }
>f6 : Symbol(f6, Decl(asyncAwait_es2017.ts, 11, 3))
>MyPromise : Symbol(MyPromise, Decl(asyncAwait_es2017.ts, 0, 0), Decl(asyncAwait_es2017.ts, 1, 11))
let f7 = async () => { };
>f7 : Symbol(f7, Decl(asyncAwait_es2017.ts, 13, 3))
let f8 = async (): Promise<void> => { };
>f8 : Symbol(f8, Decl(asyncAwait_es2017.ts, 14, 3))
>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
let f9 = async (): MyPromise<void> => { };
>f9 : Symbol(f9, Decl(asyncAwait_es2017.ts, 15, 3))
>MyPromise : Symbol(MyPromise, Decl(asyncAwait_es2017.ts, 0, 0), Decl(asyncAwait_es2017.ts, 1, 11))
let f10 = async () => p;
>f10 : Symbol(f10, Decl(asyncAwait_es2017.ts, 16, 3))
>p : Symbol(p, Decl(asyncAwait_es2017.ts, 2, 11))
let f11 = async () => mp;
>f11 : Symbol(f11, Decl(asyncAwait_es2017.ts, 17, 3))
>mp : Symbol(mp, Decl(asyncAwait_es2017.ts, 3, 11))
let f12 = async (): Promise<number> => mp;
>f12 : Symbol(f12, Decl(asyncAwait_es2017.ts, 18, 3))
>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
>mp : Symbol(mp, Decl(asyncAwait_es2017.ts, 3, 11))
let f13 = async (): MyPromise<number> => p;
>f13 : Symbol(f13, Decl(asyncAwait_es2017.ts, 19, 3))
>MyPromise : Symbol(MyPromise, Decl(asyncAwait_es2017.ts, 0, 0), Decl(asyncAwait_es2017.ts, 1, 11))
>p : Symbol(p, Decl(asyncAwait_es2017.ts, 2, 11))
let o = {
>o : Symbol(o, Decl(asyncAwait_es2017.ts, 21, 3))
async m1() { },
>m1 : Symbol(m1, Decl(asyncAwait_es2017.ts, 21, 9))
async m2(): Promise<void> { },
>m2 : Symbol(m2, Decl(asyncAwait_es2017.ts, 22, 16))
>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
async m3(): MyPromise<void> { }
>m3 : Symbol(m3, Decl(asyncAwait_es2017.ts, 23, 31))
>MyPromise : Symbol(MyPromise, Decl(asyncAwait_es2017.ts, 0, 0), Decl(asyncAwait_es2017.ts, 1, 11))
};
class C {
>C : Symbol(C, Decl(asyncAwait_es2017.ts, 25, 2))
async m1() { }
>m1 : Symbol(C.m1, Decl(asyncAwait_es2017.ts, 27, 9))
async m2(): Promise<void> { }
>m2 : Symbol(C.m2, Decl(asyncAwait_es2017.ts, 28, 15))
>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
async m3(): MyPromise<void> { }
>m3 : Symbol(C.m3, Decl(asyncAwait_es2017.ts, 29, 30))
>MyPromise : Symbol(MyPromise, Decl(asyncAwait_es2017.ts, 0, 0), Decl(asyncAwait_es2017.ts, 1, 11))
static async m4() { }
>m4 : Symbol(C.m4, Decl(asyncAwait_es2017.ts, 30, 32))
static async m5(): Promise<void> { }
>m5 : Symbol(C.m5, Decl(asyncAwait_es2017.ts, 31, 22))
>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
static async m6(): MyPromise<void> { }
>m6 : Symbol(C.m6, Decl(asyncAwait_es2017.ts, 32, 37))
>MyPromise : Symbol(MyPromise, Decl(asyncAwait_es2017.ts, 0, 0), Decl(asyncAwait_es2017.ts, 1, 11))
}
module M {
>M : Symbol(M, Decl(asyncAwait_es2017.ts, 34, 1))
export async function f1() { }
>f1 : Symbol(f1, Decl(asyncAwait_es2017.ts, 36, 10))
}
@@ -0,0 +1,129 @@
=== tests/cases/conformance/async/es2017/asyncAwait_es2017.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>
}
@@ -0,0 +1,8 @@
tests/cases/conformance/async/es2017/asyncClass_es2017.ts(1,1): error TS1042: 'async' modifier cannot be used here.
==== tests/cases/conformance/async/es2017/asyncClass_es2017.ts (1 errors) ====
async class C {
~~~~~
!!! error TS1042: 'async' modifier cannot be used here.
}
@@ -0,0 +1,7 @@
//// [asyncClass_es2017.ts]
async class C {
}
//// [asyncClass_es2017.js]
async class C {
}
@@ -0,0 +1,10 @@
tests/cases/conformance/async/es2017/asyncConstructor_es2017.ts(2,3): error TS1089: 'async' modifier cannot appear on a constructor declaration.
==== tests/cases/conformance/async/es2017/asyncConstructor_es2017.ts (1 errors) ====
class C {
async constructor() {
~~~~~
!!! error TS1089: 'async' modifier cannot appear on a constructor declaration.
}
}
@@ -0,0 +1,11 @@
//// [asyncConstructor_es2017.ts]
class C {
async constructor() {
}
}
//// [asyncConstructor_es2017.js]
class C {
async constructor() {
}
}
@@ -0,0 +1,7 @@
tests/cases/conformance/async/es2017/asyncDeclare_es2017.ts(1,9): error TS1040: 'async' modifier cannot be used in an ambient context.
==== tests/cases/conformance/async/es2017/asyncDeclare_es2017.ts (1 errors) ====
declare async function foo(): Promise<void>;
~~~~~
!!! error TS1040: 'async' modifier cannot be used in an ambient context.
@@ -0,0 +1,4 @@
//// [asyncDeclare_es2017.ts]
declare async function foo(): Promise<void>;
//// [asyncDeclare_es2017.js]
@@ -0,0 +1,9 @@
tests/cases/conformance/async/es2017/asyncEnum_es2017.ts(1,1): error TS1042: 'async' modifier cannot be used here.
==== tests/cases/conformance/async/es2017/asyncEnum_es2017.ts (1 errors) ====
async enum E {
~~~~~
!!! error TS1042: 'async' modifier cannot be used here.
Value
}
@@ -0,0 +1,10 @@
//// [asyncEnum_es2017.ts]
async enum E {
Value
}
//// [asyncEnum_es2017.js]
var E;
(function (E) {
E[E["Value"] = 0] = "Value";
})(E || (E = {}));
@@ -0,0 +1,26 @@
tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration10_es2017.ts(1,20): error TS2371: A parameter initializer is only allowed in a function or constructor implementation.
tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration10_es2017.ts(1,30): error TS1109: Expression expected.
tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration10_es2017.ts(1,33): error TS1138: Parameter declaration expected.
tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration10_es2017.ts(1,33): error TS2304: Cannot find name 'await'.
tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration10_es2017.ts(1,38): error TS1005: ';' expected.
tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration10_es2017.ts(1,39): error TS1128: Declaration or statement expected.
tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration10_es2017.ts(1,53): error TS1109: Expression expected.
==== tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration10_es2017.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_es2017.ts]
async function foo(a = await => await): Promise<void> {
}
//// [asyncFunctionDeclaration10_es2017.js]
await;
Promise < void > {};
@@ -0,0 +1,7 @@
//// [asyncFunctionDeclaration11_es2017.ts]
async function await(): Promise<void> {
}
//// [asyncFunctionDeclaration11_es2017.js]
async function await() {
}
@@ -0,0 +1,5 @@
=== tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration11_es2017.ts ===
async function await(): Promise<void> {
>await : Symbol(await, Decl(asyncFunctionDeclaration11_es2017.ts, 0, 0))
>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
}
@@ -0,0 +1,5 @@
=== tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration11_es2017.ts ===
async function await(): Promise<void> {
>await : () => Promise<void>
>Promise : Promise<T>
}
@@ -0,0 +1,16 @@
tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration12_es2017.ts(1,24): error TS1005: '(' expected.
tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration12_es2017.ts(1,29): error TS1005: '=' expected.
tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration12_es2017.ts(1,33): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value.
tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration12_es2017.ts(1,47): error TS1005: '=>' expected.
==== tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration12_es2017.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.
~
!!! error TS1005: '=>' expected.
@@ -0,0 +1,5 @@
//// [asyncFunctionDeclaration12_es2017.ts]
var v = async function await(): Promise<void> { }
//// [asyncFunctionDeclaration12_es2017.js]
var v = , await = () => { };
@@ -0,0 +1,11 @@
tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration13_es2017.ts(3,11): error TS2304: Cannot find name 'await'.
==== tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration13_es2017.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'.
}
@@ -0,0 +1,12 @@
//// [asyncFunctionDeclaration13_es2017.ts]
async function foo(): Promise<void> {
// Legal to use 'await' in a type context.
var v: await;
}
//// [asyncFunctionDeclaration13_es2017.js]
async function foo() {
// Legal to use 'await' in a type context.
var v;
}
@@ -0,0 +1,9 @@
//// [asyncFunctionDeclaration14_es2017.ts]
async function foo(): Promise<void> {
return;
}
//// [asyncFunctionDeclaration14_es2017.js]
async function foo() {
return;
}
@@ -0,0 +1,7 @@
=== tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration14_es2017.ts ===
async function foo(): Promise<void> {
>foo : Symbol(foo, Decl(asyncFunctionDeclaration14_es2017.ts, 0, 0))
>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
return;
}
@@ -0,0 +1,7 @@
=== tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration14_es2017.ts ===
async function foo(): Promise<void> {
>foo : () => Promise<void>
>Promise : Promise<T>
return;
}
@@ -0,0 +1,48 @@
tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration15_es2017.ts(6,23): error TS1064: The return type of an async function or method must be the global Promise<T> type.
tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration15_es2017.ts(7,23): error TS1064: The return type of an async function or method must be the global Promise<T> type.
tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration15_es2017.ts(8,23): error TS1064: The return type of an async function or method must be the global Promise<T> type.
tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration15_es2017.ts(9,23): error TS1064: The return type of an async function or method must be the global Promise<T> type.
tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration15_es2017.ts(10,23): error TS1064: The return type of an async function or method must be the global Promise<T> type.
tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration15_es2017.ts(17,16): error TS1059: Return expression in async function does not have a valid callable 'then' member.
tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration15_es2017.ts(23,25): error TS1058: Operand for 'await' does not have a valid callable 'then' member.
==== tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration15_es2017.ts (7 errors) ====
declare class Thenable { then(): void; }
declare let a: any;
declare let obj: { then: string; };
declare let thenable: Thenable;
async function fn1() { } // valid: Promise<void>
async function fn2(): { } { } // error
~~~
!!! error TS1064: The return type of an async function or method must be the global Promise<T> type.
async function fn3(): any { } // error
~~~
!!! error TS1064: The return type of an async function or method must be the global Promise<T> type.
async function fn4(): number { } // error
~~~~~~
!!! error TS1064: The return type of an async function or method must be the global Promise<T> type.
async function fn5(): PromiseLike<void> { } // error
~~~~~~~~~~~~~~~~~
!!! error TS1064: The return type of an async function or method must be the global Promise<T> type.
async function fn6(): Thenable { } // error
~~~~~~~~
!!! error TS1064: The return type of an async function or method must be the global Promise<T> type.
async function fn7() { return; } // valid: Promise<void>
async function fn8() { return 1; } // valid: Promise<number>
async function fn9() { return null; } // valid: Promise<any>
async function fn10() { return undefined; } // valid: Promise<any>
async function fn11() { return a; } // valid: Promise<any>
async function fn12() { return obj; } // valid: Promise<{ then: string; }>
async function fn13() { return thenable; } // error
~~~~
!!! error TS1059: Return expression in async function does not have a valid callable 'then' member.
async function fn14() { await 1; } // valid: Promise<void>
async function fn15() { await null; } // valid: Promise<void>
async function fn16() { await undefined; } // valid: Promise<void>
async function fn17() { await a; } // valid: Promise<void>
async function fn18() { await obj; } // valid: Promise<void>
async function fn19() { await thenable; } // error
~~~~~~~~~~~~~~
!!! error TS1058: Operand for 'await' does not have a valid callable 'then' member.
@@ -0,0 +1,64 @@
//// [asyncFunctionDeclaration15_es2017.ts]
declare class Thenable { then(): void; }
declare let a: any;
declare let obj: { then: string; };
declare let thenable: Thenable;
async function fn1() { } // valid: Promise<void>
async function fn2(): { } { } // error
async function fn3(): any { } // error
async function fn4(): number { } // error
async function fn5(): PromiseLike<void> { } // error
async function fn6(): Thenable { } // error
async function fn7() { return; } // valid: Promise<void>
async function fn8() { return 1; } // valid: Promise<number>
async function fn9() { return null; } // valid: Promise<any>
async function fn10() { return undefined; } // valid: Promise<any>
async function fn11() { return a; } // valid: Promise<any>
async function fn12() { return obj; } // valid: Promise<{ then: string; }>
async function fn13() { return thenable; } // error
async function fn14() { await 1; } // valid: Promise<void>
async function fn15() { await null; } // valid: Promise<void>
async function fn16() { await undefined; } // valid: Promise<void>
async function fn17() { await a; } // valid: Promise<void>
async function fn18() { await obj; } // valid: Promise<void>
async function fn19() { await thenable; } // error
//// [asyncFunctionDeclaration15_es2017.js]
async function fn1() { } // valid: Promise<void>
// valid: Promise<void>
async function fn2() { } // error
// error
async function fn3() { } // error
// error
async function fn4() { } // error
// error
async function fn5() { } // error
// error
async function fn6() { } // error
// error
async function fn7() { return; } // valid: Promise<void>
// valid: Promise<void>
async function fn8() { return 1; } // valid: Promise<number>
// valid: Promise<number>
async function fn9() { return null; } // valid: Promise<any>
// valid: Promise<any>
async function fn10() { return undefined; } // valid: Promise<any>
// valid: Promise<any>
async function fn11() { return a; } // valid: Promise<any>
// valid: Promise<any>
async function fn12() { return obj; } // valid: Promise<{ then: string; }>
// valid: Promise<{ then: string; }>
async function fn13() { return thenable; } // error
// error
async function fn14() { await 1; } // valid: Promise<void>
// valid: Promise<void>
async function fn15() { await null; } // valid: Promise<void>
// valid: Promise<void>
async function fn16() { await undefined; } // valid: Promise<void>
// valid: Promise<void>
async function fn17() { await a; } // valid: Promise<void>
// valid: Promise<void>
async function fn18() { await obj; } // valid: Promise<void>
// valid: Promise<void>
async function fn19() { await thenable; } // error
@@ -0,0 +1,7 @@
//// [asyncFunctionDeclaration1_es2017.ts]
async function foo(): Promise<void> {
}
//// [asyncFunctionDeclaration1_es2017.js]
async function foo() {
}
@@ -0,0 +1,5 @@
=== tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration1_es2017.ts ===
async function foo(): Promise<void> {
>foo : Symbol(foo, Decl(asyncFunctionDeclaration1_es2017.ts, 0, 0))
>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
}
@@ -0,0 +1,5 @@
=== tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration1_es2017.ts ===
async function foo(): Promise<void> {
>foo : () => Promise<void>
>Promise : Promise<T>
}
@@ -0,0 +1,7 @@
//// [asyncFunctionDeclaration2_es2017.ts]
function f(await) {
}
//// [asyncFunctionDeclaration2_es2017.js]
function f(await) {
}
@@ -0,0 +1,5 @@
=== tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration2_es2017.ts ===
function f(await) {
>f : Symbol(f, Decl(asyncFunctionDeclaration2_es2017.ts, 0, 0))
>await : Symbol(await, Decl(asyncFunctionDeclaration2_es2017.ts, 0, 11))
}
@@ -0,0 +1,5 @@
=== tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration2_es2017.ts ===
function f(await) {
>f : (await: any) => void
>await : any
}
@@ -0,0 +1,8 @@
tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration3_es2017.ts(1,20): error TS2372: Parameter 'await' cannot be referenced in its initializer.
==== tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration3_es2017.ts (1 errors) ====
function f(await = await) {
~~~~~
!!! error TS2372: Parameter 'await' cannot be referenced in its initializer.
}
@@ -0,0 +1,7 @@
//// [asyncFunctionDeclaration3_es2017.ts]
function f(await = await) {
}
//// [asyncFunctionDeclaration3_es2017.js]
function f(await = await) {
}
@@ -0,0 +1,7 @@
//// [asyncFunctionDeclaration4_es2017.ts]
function await() {
}
//// [asyncFunctionDeclaration4_es2017.js]
function await() {
}
@@ -0,0 +1,4 @@
=== tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration4_es2017.ts ===
function await() {
>await : Symbol(await, Decl(asyncFunctionDeclaration4_es2017.ts, 0, 0))
}
@@ -0,0 +1,4 @@
=== tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration4_es2017.ts ===
function await() {
>await : () => void
}
@@ -0,0 +1,20 @@
tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration5_es2017.ts(1,20): error TS1138: Parameter declaration expected.
tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration5_es2017.ts(1,20): error TS2304: Cannot find name 'await'.
tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration5_es2017.ts(1,25): error TS1005: ';' expected.
tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration5_es2017.ts(1,26): error TS1128: Declaration or statement expected.
tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration5_es2017.ts(1,40): error TS1109: Expression expected.
==== tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration5_es2017.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_es2017.ts]
async function foo(await): Promise<void> {
}
//// [asyncFunctionDeclaration5_es2017.js]
await;
Promise < void > {};
@@ -0,0 +1,11 @@
tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration6_es2017.ts(1,24): error TS2524: 'await' expressions cannot be used in a parameter initializer.
tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration6_es2017.ts(1,29): error TS1109: Expression expected.
==== tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration6_es2017.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,7 @@
//// [asyncFunctionDeclaration6_es2017.ts]
async function foo(a = await): Promise<void> {
}
//// [asyncFunctionDeclaration6_es2017.js]
async function foo(a = await ) {
}
@@ -0,0 +1,14 @@
tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration7_es2017.ts(3,26): error TS2524: 'await' expressions cannot be used in a parameter initializer.
tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration7_es2017.ts(3,31): error TS1109: Expression expected.
==== tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration7_es2017.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.
}
}
@@ -0,0 +1,13 @@
//// [asyncFunctionDeclaration7_es2017.ts]
async function bar(): Promise<void> {
// 'await' here is an identifier, and not a yield expression.
async function foo(a = await): Promise<void> {
}
}
//// [asyncFunctionDeclaration7_es2017.js]
async function bar() {
// 'await' here is an identifier, and not a yield expression.
async function foo(a = await ) {
}
}
@@ -0,0 +1,10 @@
tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration8_es2017.ts(1,12): error TS2304: Cannot find name 'await'.
tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration8_es2017.ts(1,20): error TS2304: Cannot find name 'foo'.
==== tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration8_es2017.ts (2 errors) ====
var v = { [await]: foo }
~~~~~
!!! error TS2304: Cannot find name 'await'.
~~~
!!! error TS2304: Cannot find name 'foo'.
@@ -0,0 +1,5 @@
//// [asyncFunctionDeclaration8_es2017.ts]
var v = { [await]: foo }
//// [asyncFunctionDeclaration8_es2017.js]
var v = { [await]: foo };
@@ -0,0 +1,9 @@
tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration9_es2017.ts(2,19): error TS1109: Expression expected.
==== tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration9_es2017.ts (1 errors) ====
async function foo(): Promise<void> {
var v = { [await]: foo }
~
!!! error TS1109: Expression expected.
}
@@ -0,0 +1,9 @@
//// [asyncFunctionDeclaration9_es2017.ts]
async function foo(): Promise<void> {
var v = { [await]: foo }
}
//// [asyncFunctionDeclaration9_es2017.js]
async function foo() {
var v = { [await ]: foo };
}
@@ -0,0 +1,13 @@
tests/cases/conformance/async/es2017/asyncGetter_es2017.ts(2,3): error TS1042: 'async' modifier cannot be used here.
tests/cases/conformance/async/es2017/asyncGetter_es2017.ts(2,13): error TS2378: A 'get' accessor must return a value.
==== tests/cases/conformance/async/es2017/asyncGetter_es2017.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.
}
}
@@ -0,0 +1,11 @@
//// [asyncGetter_es2017.ts]
class C {
async get foo() {
}
}
//// [asyncGetter_es2017.js]
class C {
async get foo() {
}
}
@@ -0,0 +1,13 @@
tests/cases/conformance/async/es2017/test.ts(3,25): error TS1064: The return type of an async function or method must be the global Promise<T> type.
==== tests/cases/conformance/async/es2017/task.ts (0 errors) ====
export class Task<T> extends Promise<T> { }
==== tests/cases/conformance/async/es2017/test.ts (1 errors) ====
import { Task } from "./task";
class Test {
async example<T>(): Task<T> { return; }
~~~~~~~
!!! error TS1064: The return type of an async function or method must be the global Promise<T> type.
}
@@ -0,0 +1,21 @@
//// [tests/cases/conformance/async/es2017/asyncImportedPromise_es2017.ts] ////
//// [task.ts]
export class Task<T> extends Promise<T> { }
//// [test.ts]
import { Task } from "./task";
class Test {
async example<T>(): Task<T> { return; }
}
//// [task.js]
"use strict";
class Task extends Promise {
}
exports.Task = Task;
//// [test.js]
"use strict";
class Test {
async example() { return; }
}
@@ -0,0 +1,8 @@
tests/cases/conformance/async/es2017/asyncInterface_es2017.ts(1,1): error TS1042: 'async' modifier cannot be used here.
==== tests/cases/conformance/async/es2017/asyncInterface_es2017.ts (1 errors) ====
async interface I {
~~~~~
!!! error TS1042: 'async' modifier cannot be used here.
}
@@ -0,0 +1,5 @@
//// [asyncInterface_es2017.ts]
async interface I {
}
//// [asyncInterface_es2017.js]
@@ -0,0 +1,90 @@
//// [asyncMethodWithSuper_es2017.ts]
class A {
x() {
}
}
class B extends A {
// async method with only call/get on 'super' does not require a binding
async simple() {
// call with property access
super.x();
// call with element access
super["x"]();
// property access (read)
const a = super.x;
// element access (read)
const b = super["x"];
}
// async method with assignment/destructuring on 'super' requires a binding
async advanced() {
const f = () => {};
// call with property access
super.x();
// call with element access
super["x"]();
// property access (read)
const a = super.x;
// element access (read)
const b = super["x"];
// property access (assign)
super.x = f;
// element access (assign)
super["x"] = f;
// destructuring assign with property access
({ f: super.x } = { f });
// destructuring assign with element access
({ f: super["x"] } = { f });
}
}
//// [asyncMethodWithSuper_es2017.js]
class A {
x() {
}
}
class B extends A {
// async method with only call/get on 'super' does not require a binding
async simple() {
// call with property access
super.x();
// call with element access
super["x"]();
// property access (read)
const a = super.x;
// element access (read)
const b = super["x"];
}
// async method with assignment/destructuring on 'super' requires a binding
async advanced() {
const f = () => { };
// call with property access
super.x();
// call with element access
super["x"]();
// property access (read)
const a = super.x;
// element access (read)
const b = super["x"];
// property access (assign)
super.x = f;
// element access (assign)
super["x"] = f;
// destructuring assign with property access
({ f: super.x } = { f });
// destructuring assign with element access
({ f: super["x"] } = { f });
}
}
@@ -0,0 +1,102 @@
=== tests/cases/conformance/async/es2017/asyncMethodWithSuper_es2017.ts ===
class A {
>A : Symbol(A, Decl(asyncMethodWithSuper_es2017.ts, 0, 0))
x() {
>x : Symbol(A.x, Decl(asyncMethodWithSuper_es2017.ts, 0, 9))
}
}
class B extends A {
>B : Symbol(B, Decl(asyncMethodWithSuper_es2017.ts, 3, 1))
>A : Symbol(A, Decl(asyncMethodWithSuper_es2017.ts, 0, 0))
// async method with only call/get on 'super' does not require a binding
async simple() {
>simple : Symbol(B.simple, Decl(asyncMethodWithSuper_es2017.ts, 5, 19))
// call with property access
super.x();
>super.x : Symbol(A.x, Decl(asyncMethodWithSuper_es2017.ts, 0, 9))
>super : Symbol(A, Decl(asyncMethodWithSuper_es2017.ts, 0, 0))
>x : Symbol(A.x, Decl(asyncMethodWithSuper_es2017.ts, 0, 9))
// call with element access
super["x"]();
>super : Symbol(A, Decl(asyncMethodWithSuper_es2017.ts, 0, 0))
>"x" : Symbol(A.x, Decl(asyncMethodWithSuper_es2017.ts, 0, 9))
// property access (read)
const a = super.x;
>a : Symbol(a, Decl(asyncMethodWithSuper_es2017.ts, 15, 13))
>super.x : Symbol(A.x, Decl(asyncMethodWithSuper_es2017.ts, 0, 9))
>super : Symbol(A, Decl(asyncMethodWithSuper_es2017.ts, 0, 0))
>x : Symbol(A.x, Decl(asyncMethodWithSuper_es2017.ts, 0, 9))
// element access (read)
const b = super["x"];
>b : Symbol(b, Decl(asyncMethodWithSuper_es2017.ts, 18, 13))
>super : Symbol(A, Decl(asyncMethodWithSuper_es2017.ts, 0, 0))
>"x" : Symbol(A.x, Decl(asyncMethodWithSuper_es2017.ts, 0, 9))
}
// async method with assignment/destructuring on 'super' requires a binding
async advanced() {
>advanced : Symbol(B.advanced, Decl(asyncMethodWithSuper_es2017.ts, 19, 5))
const f = () => {};
>f : Symbol(f, Decl(asyncMethodWithSuper_es2017.ts, 23, 13))
// call with property access
super.x();
>super.x : Symbol(A.x, Decl(asyncMethodWithSuper_es2017.ts, 0, 9))
>super : Symbol(A, Decl(asyncMethodWithSuper_es2017.ts, 0, 0))
>x : Symbol(A.x, Decl(asyncMethodWithSuper_es2017.ts, 0, 9))
// call with element access
super["x"]();
>super : Symbol(A, Decl(asyncMethodWithSuper_es2017.ts, 0, 0))
>"x" : Symbol(A.x, Decl(asyncMethodWithSuper_es2017.ts, 0, 9))
// property access (read)
const a = super.x;
>a : Symbol(a, Decl(asyncMethodWithSuper_es2017.ts, 32, 13))
>super.x : Symbol(A.x, Decl(asyncMethodWithSuper_es2017.ts, 0, 9))
>super : Symbol(A, Decl(asyncMethodWithSuper_es2017.ts, 0, 0))
>x : Symbol(A.x, Decl(asyncMethodWithSuper_es2017.ts, 0, 9))
// element access (read)
const b = super["x"];
>b : Symbol(b, Decl(asyncMethodWithSuper_es2017.ts, 35, 13))
>super : Symbol(A, Decl(asyncMethodWithSuper_es2017.ts, 0, 0))
>"x" : Symbol(A.x, Decl(asyncMethodWithSuper_es2017.ts, 0, 9))
// property access (assign)
super.x = f;
>super.x : Symbol(A.x, Decl(asyncMethodWithSuper_es2017.ts, 0, 9))
>super : Symbol(A, Decl(asyncMethodWithSuper_es2017.ts, 0, 0))
>x : Symbol(A.x, Decl(asyncMethodWithSuper_es2017.ts, 0, 9))
>f : Symbol(f, Decl(asyncMethodWithSuper_es2017.ts, 23, 13))
// element access (assign)
super["x"] = f;
>super : Symbol(A, Decl(asyncMethodWithSuper_es2017.ts, 0, 0))
>"x" : Symbol(A.x, Decl(asyncMethodWithSuper_es2017.ts, 0, 9))
>f : Symbol(f, Decl(asyncMethodWithSuper_es2017.ts, 23, 13))
// destructuring assign with property access
({ f: super.x } = { f });
>f : Symbol(f, Decl(asyncMethodWithSuper_es2017.ts, 44, 10))
>super.x : Symbol(A.x, Decl(asyncMethodWithSuper_es2017.ts, 0, 9))
>super : Symbol(A, Decl(asyncMethodWithSuper_es2017.ts, 0, 0))
>x : Symbol(A.x, Decl(asyncMethodWithSuper_es2017.ts, 0, 9))
>f : Symbol(f, Decl(asyncMethodWithSuper_es2017.ts, 44, 27))
// destructuring assign with element access
({ f: super["x"] } = { f });
>f : Symbol(f, Decl(asyncMethodWithSuper_es2017.ts, 47, 10))
>super : Symbol(A, Decl(asyncMethodWithSuper_es2017.ts, 0, 0))
>"x" : Symbol(A.x, Decl(asyncMethodWithSuper_es2017.ts, 0, 9))
>f : Symbol(f, Decl(asyncMethodWithSuper_es2017.ts, 47, 30))
}
}
@@ -0,0 +1,123 @@
=== tests/cases/conformance/async/es2017/asyncMethodWithSuper_es2017.ts ===
class A {
>A : A
x() {
>x : () => void
}
}
class B extends A {
>B : B
>A : A
// async method with only call/get on 'super' does not require a binding
async simple() {
>simple : () => Promise<void>
// call with property access
super.x();
>super.x() : void
>super.x : () => void
>super : A
>x : () => void
// call with element access
super["x"]();
>super["x"]() : void
>super["x"] : () => void
>super : A
>"x" : "x"
// property access (read)
const a = super.x;
>a : () => void
>super.x : () => void
>super : A
>x : () => void
// element access (read)
const b = super["x"];
>b : () => void
>super["x"] : () => void
>super : A
>"x" : "x"
}
// async method with assignment/destructuring on 'super' requires a binding
async advanced() {
>advanced : () => Promise<void>
const f = () => {};
>f : () => void
>() => {} : () => void
// call with property access
super.x();
>super.x() : void
>super.x : () => void
>super : A
>x : () => void
// call with element access
super["x"]();
>super["x"]() : void
>super["x"] : () => void
>super : A
>"x" : "x"
// property access (read)
const a = super.x;
>a : () => void
>super.x : () => void
>super : A
>x : () => void
// element access (read)
const b = super["x"];
>b : () => void
>super["x"] : () => void
>super : A
>"x" : "x"
// property access (assign)
super.x = f;
>super.x = f : () => void
>super.x : () => void
>super : A
>x : () => void
>f : () => void
// element access (assign)
super["x"] = f;
>super["x"] = f : () => void
>super["x"] : () => void
>super : A
>"x" : "x"
>f : () => void
// destructuring assign with property access
({ f: super.x } = { f });
>({ f: super.x } = { f }) : { f: () => void; }
>{ f: super.x } = { f } : { f: () => void; }
>{ f: super.x } : { f: () => void; }
>f : () => void
>super.x : () => void
>super : A
>x : () => void
>{ f } : { f: () => void; }
>f : () => void
// destructuring assign with element access
({ f: super["x"] } = { f });
>({ f: super["x"] } = { f }) : { f: () => void; }
>{ f: super["x"] } = { f } : { f: () => void; }
>{ f: super["x"] } : { f: () => void; }
>f : () => void
>super["x"] : () => void
>super : A
>"x" : "x"
>{ f } : { f: () => void; }
>f : () => void
}
}
@@ -0,0 +1,8 @@
tests/cases/conformance/async/es2017/asyncModule_es2017.ts(1,1): error TS1042: 'async' modifier cannot be used here.
==== tests/cases/conformance/async/es2017/asyncModule_es2017.ts (1 errors) ====
async module M {
~~~~~
!!! error TS1042: 'async' modifier cannot be used here.
}
@@ -0,0 +1,5 @@
//// [asyncModule_es2017.ts]
async module M {
}
//// [asyncModule_es2017.js]
@@ -0,0 +1,11 @@
//// [tests/cases/conformance/async/es2017/asyncMultiFile_es2017.ts] ////
//// [a.ts]
async function f() {}
//// [b.ts]
function g() { }
//// [a.js]
async function f() { }
//// [b.js]
function g() { }
@@ -0,0 +1,8 @@
=== tests/cases/conformance/async/es2017/a.ts ===
async function f() {}
>f : Symbol(f, Decl(a.ts, 0, 0))
=== tests/cases/conformance/async/es2017/b.ts ===
function g() { }
>g : Symbol(g, Decl(b.ts, 0, 0))
@@ -0,0 +1,8 @@
=== tests/cases/conformance/async/es2017/a.ts ===
async function f() {}
>f : () => Promise<void>
=== tests/cases/conformance/async/es2017/b.ts ===
function g() { }
>g : () => void
@@ -0,0 +1,13 @@
tests/cases/conformance/async/es2017/asyncQualifiedReturnType_es2017.ts(6,21): error TS1064: The return type of an async function or method must be the global Promise<T> type.
==== tests/cases/conformance/async/es2017/asyncQualifiedReturnType_es2017.ts (1 errors) ====
namespace X {
export class MyPromise<T> extends Promise<T> {
}
}
async function f(): X.MyPromise<void> {
~~~~~~~~~~~~~~~~~
!!! error TS1064: The return type of an async function or method must be the global Promise<T> type.
}
@@ -0,0 +1,18 @@
//// [asyncQualifiedReturnType_es2017.ts]
namespace X {
export class MyPromise<T> extends Promise<T> {
}
}
async function f(): X.MyPromise<void> {
}
//// [asyncQualifiedReturnType_es2017.js]
var X;
(function (X) {
class MyPromise extends Promise {
}
X.MyPromise = MyPromise;
})(X || (X = {}));
async function f() {
}
@@ -0,0 +1,10 @@
tests/cases/conformance/async/es2017/asyncSetter_es2017.ts(2,3): error TS1042: 'async' modifier cannot be used here.
==== tests/cases/conformance/async/es2017/asyncSetter_es2017.ts (1 errors) ====
class C {
async set foo(value) {
~~~~~
!!! error TS1042: 'async' modifier cannot be used here.
}
}

Some files were not shown because too many files have changed in this diff Show More