Skip to content

Commit 1b4c0e3

Browse files
committed
Add es2017 async conformance
1 parent 5d52c9f commit 1b4c0e3

File tree

230 files changed

+4602
-14
lines changed

Some content is hidden

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

230 files changed

+4602
-14
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
//// [arrowFunctionWithParameterNameAsync_es2017.ts]
2+
3+
const x = async => async;
4+
5+
//// [arrowFunctionWithParameterNameAsync_es2017.js]
6+
var x = function (async) { return async; };
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
=== tests/cases/conformance/async/es2017/asyncArrowFunction/arrowFunctionWithParameterNameAsync_es2017.ts ===
2+
3+
const x = async => async;
4+
>x : Symbol(x, Decl(arrowFunctionWithParameterNameAsync_es2017.ts, 1, 5))
5+
>async : Symbol(async, Decl(arrowFunctionWithParameterNameAsync_es2017.ts, 1, 9))
6+
>async : Symbol(async, Decl(arrowFunctionWithParameterNameAsync_es2017.ts, 1, 9))
7+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
=== tests/cases/conformance/async/es2017/asyncArrowFunction/arrowFunctionWithParameterNameAsync_es2017.ts ===
2+
3+
const x = async => async;
4+
>x : (async: any) => any
5+
>async => async : (async: any) => any
6+
>async : any
7+
>async : any
8+
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
//// [asyncAliasReturnType_es2017.ts]
2+
type PromiseAlias<T> = Promise<T>;
3+
4+
async function f(): PromiseAlias<void> {
5+
}
6+
7+
//// [asyncAliasReturnType_es2017.js]
8+
async function f() {
9+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
=== tests/cases/conformance/async/es2017/asyncAliasReturnType_es2017.ts ===
2+
type PromiseAlias<T> = Promise<T>;
3+
>PromiseAlias : Symbol(PromiseAlias, Decl(asyncAliasReturnType_es2017.ts, 0, 0))
4+
>T : Symbol(T, Decl(asyncAliasReturnType_es2017.ts, 0, 18))
5+
>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, --, --))
6+
>T : Symbol(T, Decl(asyncAliasReturnType_es2017.ts, 0, 18))
7+
8+
async function f(): PromiseAlias<void> {
9+
>f : Symbol(f, Decl(asyncAliasReturnType_es2017.ts, 0, 34))
10+
>PromiseAlias : Symbol(PromiseAlias, Decl(asyncAliasReturnType_es2017.ts, 0, 0))
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
=== tests/cases/conformance/async/es2017/asyncAliasReturnType_es2017.ts ===
2+
type PromiseAlias<T> = Promise<T>;
3+
>PromiseAlias : Promise<T>
4+
>T : T
5+
>Promise : Promise<T>
6+
>T : T
7+
8+
async function f(): PromiseAlias<void> {
9+
>f : () => Promise<void>
10+
>PromiseAlias : Promise<T>
11+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction10_es2017.ts(4,11): error TS2304: Cannot find name 'await'.
2+
3+
4+
==== tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction10_es2017.ts (1 errors) ====
5+
6+
var foo = async (): Promise<void> => {
7+
// Legal to use 'await' in a type context.
8+
var v: await;
9+
~~~~~
10+
!!! error TS2304: Cannot find name 'await'.
11+
}
12+
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//// [asyncArrowFunction10_es2017.ts]
2+
3+
var foo = async (): Promise<void> => {
4+
// Legal to use 'await' in a type context.
5+
var v: await;
6+
}
7+
8+
9+
//// [asyncArrowFunction10_es2017.js]
10+
var foo = async () => {
11+
// Legal to use 'await' in a type context.
12+
var v;
13+
};
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
//// [asyncArrowFunction1_es2017.ts]
2+
3+
var foo = async (): Promise<void> => {
4+
};
5+
6+
//// [asyncArrowFunction1_es2017.js]
7+
var foo = async () => {
8+
};
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
=== tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction1_es2017.ts ===
2+
3+
var foo = async (): Promise<void> => {
4+
>foo : Symbol(foo, Decl(asyncArrowFunction1_es2017.ts, 1, 3))
5+
>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, --, --))
6+
7+
};

0 commit comments

Comments
 (0)