Merge branch 'master' into cancellableClassification

This commit is contained in:
Cyrus Najmabadi
2015-07-06 13:22:40 -07:00
1023 changed files with 42728 additions and 18466 deletions

View File

@@ -75,28 +75,28 @@ function delint(sourceFile) {
delintNode(sourceFile);
function delintNode(node) {
switch (node.kind) {
case 189 /* ForStatement */:
case 190 /* ForInStatement */:
case 188 /* WhileStatement */:
case 187 /* DoStatement */:
if (node.statement.kind !== 182 /* 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 186 /* IfStatement */:
case 193 /* IfStatement */:
var ifStatement = node;
if (ifStatement.thenStatement.kind !== 182 /* 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 !== 182 /* Block */ &&
ifStatement.elseStatement.kind !== 186 /* 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 172 /* BinaryExpression */:
case 178 /* BinaryExpression */:
var op = node.operatorToken.kind;
if (op === 28 /* EqualsEqualsToken */ || op == 29 /* ExclamationEqualsToken */) {
if (op === 29 /* EqualsEqualsToken */ || op == 30 /* ExclamationEqualsToken */) {
report(node, "Use '===' and '!=='.");
}
break;

View File

@@ -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.
}

View File

@@ -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;
{
}

View File

@@ -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.
}

View File

@@ -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.
}
}

View 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;
}

View File

@@ -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))
}

View 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
}

View File

@@ -0,0 +1,8 @@
//// [abstractInterfaceIdentifierName.ts]
interface abstract {
abstract(): void;
}
//// [abstractInterfaceIdentifierName.js]

View File

@@ -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))
}

View File

@@ -0,0 +1,9 @@
=== tests/cases/compiler/abstractInterfaceIdentifierName.ts ===
interface abstract {
>abstract : abstract
abstract(): void;
>abstract : () => void
}

View File

@@ -1,9 +0,0 @@
tests/cases/compiler/anonymousClassExpression1.ts(2,19): error TS9003: 'class' expressions are not currently supported.
==== tests/cases/compiler/anonymousClassExpression1.ts (1 errors) ====
function f() {
return typeof class {} === "function";
~~~~~
!!! error TS9003: 'class' expressions are not currently supported.
}

View File

@@ -6,8 +6,8 @@ function f() {
//// [anonymousClassExpression1.js]
function f() {
return typeof (function () {
function default_1() {
function class_1() {
}
return default_1;
return class_1;
})() === "function";
}

View File

@@ -0,0 +1,6 @@
=== tests/cases/compiler/anonymousClassExpression1.ts ===
function f() {
>f : Symbol(f, Decl(anonymousClassExpression1.ts, 0, 0))
return typeof class {} === "function";
}

View File

@@ -0,0 +1,10 @@
=== tests/cases/compiler/anonymousClassExpression1.ts ===
function f() {
>f : () => boolean
return typeof class {} === "function";
>typeof class {} === "function" : boolean
>typeof class {} : string
>class {} : typeof (Anonymous class)
>"function" : string
}

View File

@@ -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))

View File

@@ -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))

View File

@@ -0,0 +1,19 @@
//// [asOperator1.ts]
var as = 43;
var x = undefined as number;
var y = (null as string).length;
var z = Date as any as string;
// Should parse as a union type, not a bitwise 'or' of (32 as number) and 'string'
var j = 32 as number|string;
j = '';
//// [asOperator1.js]
var as = 43;
var x = undefined;
var y = null.length;
var z = Date;
// Should parse as a union type, not a bitwise 'or' of (32 as number) and 'string'
var j = 32;
j = '';

View File

@@ -0,0 +1,24 @@
=== tests/cases/conformance/expressions/asOperator/asOperator1.ts ===
var as = 43;
>as : Symbol(as, Decl(asOperator1.ts, 0, 3))
var x = undefined as number;
>x : Symbol(x, Decl(asOperator1.ts, 1, 3))
>undefined : Symbol(undefined)
var y = (null as string).length;
>y : Symbol(y, Decl(asOperator1.ts, 2, 3))
>(null as string).length : Symbol(String.length, Decl(lib.d.ts, 414, 19))
>length : Symbol(String.length, Decl(lib.d.ts, 414, 19))
var z = Date as any as string;
>z : Symbol(z, Decl(asOperator1.ts, 3, 3))
>Date : Symbol(Date, Decl(lib.d.ts, 633, 23), Decl(lib.d.ts, 815, 11))
// Should parse as a union type, not a bitwise 'or' of (32 as number) and 'string'
var j = 32 as number|string;
>j : Symbol(j, Decl(asOperator1.ts, 6, 3))
j = '';
>j : Symbol(j, Decl(asOperator1.ts, 6, 3))

View File

@@ -0,0 +1,35 @@
=== tests/cases/conformance/expressions/asOperator/asOperator1.ts ===
var as = 43;
>as : number
>43 : number
var x = undefined as number;
>x : number
>undefined as number : number
>undefined : undefined
var y = (null as string).length;
>y : number
>(null as string).length : number
>(null as string) : string
>null as string : string
>null : null
>length : number
var z = Date as any as string;
>z : string
>Date as any as string : string
>Date as any : any
>Date : DateConstructor
// Should parse as a union type, not a bitwise 'or' of (32 as number) and 'string'
var j = 32 as number|string;
>j : string | number
>32 as number|string : string | number
>32 : number
j = '';
>j = '' : string
>j : string | number
>'' : string

View File

@@ -0,0 +1,8 @@
tests/cases/conformance/expressions/asOperator/asOperator2.ts(1,9): error TS2352: Neither type 'number' nor type 'string' is assignable to the other.
==== tests/cases/conformance/expressions/asOperator/asOperator2.ts (1 errors) ====
var x = 23 as string;
~~~~~~~~~~~~
!!! error TS2352: Neither type 'number' nor type 'string' is assignable to the other.

View File

@@ -0,0 +1,6 @@
//// [asOperator2.ts]
var x = 23 as string;
//// [asOperator2.js]
var x = 23;

View File

@@ -0,0 +1,22 @@
//// [asOperator3.ts]
declare function tag(...x: any[]): any;
var a = `${123 + 456 as number}`;
var b = `leading ${123 + 456 as number}`;
var c = `${123 + 456 as number} trailing`;
var d = `Hello ${123} World` as string;
var e = `Hello` as string;
var f = 1 + `${1} end of string` as string;
var g = tag `Hello ${123} World` as string;
var h = tag `Hello` as string;
//// [asOperator3.js]
var a = "" + 123 + 456;
var b = "leading " + 123 + 456;
var c = 123 + 456 + " trailing";
var d = ("Hello " + 123 + " World");
var e = "Hello";
var f = 1 + (1 + " end of string");
var g = (_a = ["Hello ", " World"], _a.raw = ["Hello ", " World"], tag(_a, 123));
var h = (_b = ["Hello"], _b.raw = ["Hello"], tag(_b));
var _a, _b;

View File

@@ -0,0 +1,31 @@
=== tests/cases/conformance/expressions/asOperator/asOperator3.ts ===
declare function tag(...x: any[]): any;
>tag : Symbol(tag, Decl(asOperator3.ts, 0, 0))
>x : Symbol(x, Decl(asOperator3.ts, 0, 21))
var a = `${123 + 456 as number}`;
>a : Symbol(a, Decl(asOperator3.ts, 2, 3))
var b = `leading ${123 + 456 as number}`;
>b : Symbol(b, Decl(asOperator3.ts, 3, 3))
var c = `${123 + 456 as number} trailing`;
>c : Symbol(c, Decl(asOperator3.ts, 4, 3))
var d = `Hello ${123} World` as string;
>d : Symbol(d, Decl(asOperator3.ts, 5, 3))
var e = `Hello` as string;
>e : Symbol(e, Decl(asOperator3.ts, 6, 3))
var f = 1 + `${1} end of string` as string;
>f : Symbol(f, Decl(asOperator3.ts, 7, 3))
var g = tag `Hello ${123} World` as string;
>g : Symbol(g, Decl(asOperator3.ts, 8, 3))
>tag : Symbol(tag, Decl(asOperator3.ts, 0, 0))
var h = tag `Hello` as string;
>h : Symbol(h, Decl(asOperator3.ts, 9, 3))
>tag : Symbol(tag, Decl(asOperator3.ts, 0, 0))

View File

@@ -0,0 +1,63 @@
=== tests/cases/conformance/expressions/asOperator/asOperator3.ts ===
declare function tag(...x: any[]): any;
>tag : (...x: any[]) => any
>x : any[]
var a = `${123 + 456 as number}`;
>a : string
>`${123 + 456 as number}` : string
>123 + 456 as number : number
>123 + 456 : number
>123 : number
>456 : number
var b = `leading ${123 + 456 as number}`;
>b : string
>`leading ${123 + 456 as number}` : string
>123 + 456 as number : number
>123 + 456 : number
>123 : number
>456 : number
var c = `${123 + 456 as number} trailing`;
>c : string
>`${123 + 456 as number} trailing` : string
>123 + 456 as number : number
>123 + 456 : number
>123 : number
>456 : number
var d = `Hello ${123} World` as string;
>d : string
>`Hello ${123} World` as string : string
>`Hello ${123} World` : string
>123 : number
var e = `Hello` as string;
>e : string
>`Hello` as string : string
>`Hello` : string
var f = 1 + `${1} end of string` as string;
>f : string
>1 + `${1} end of string` as string : string
>1 + `${1} end of string` : string
>1 : number
>`${1} end of string` : string
>1 : number
var g = tag `Hello ${123} World` as string;
>g : string
>tag `Hello ${123} World` as string : string
>tag `Hello ${123} World` : any
>tag : (...x: any[]) => any
>`Hello ${123} World` : string
>123 : number
var h = tag `Hello` as string;
>h : string
>tag `Hello` as string : string
>tag `Hello` : any
>tag : (...x: any[]) => any
>`Hello` : string

View File

@@ -0,0 +1,26 @@
//// [asOperatorASI.ts]
class Foo { }
declare function as(...args: any[]);
// Example 1
var x = 10
as `Hello world`; // should not error
// Example 2
var y = 20
as(Foo); // should emit
//// [asOperatorASI.js]
var Foo = (function () {
function Foo() {
}
return Foo;
})();
// Example 1
var x = 10;
(_a = ["Hello world"], _a.raw = ["Hello world"], as(_a)); // should not error
// Example 2
var y = 20;
as(Foo); // should emit
var _a;

View File

@@ -0,0 +1,23 @@
=== tests/cases/conformance/expressions/asOperator/asOperatorASI.ts ===
class Foo { }
>Foo : Symbol(Foo, Decl(asOperatorASI.ts, 0, 0))
declare function as(...args: any[]);
>as : Symbol(as, Decl(asOperatorASI.ts, 0, 13))
>args : Symbol(args, Decl(asOperatorASI.ts, 1, 20))
// Example 1
var x = 10
>x : Symbol(x, Decl(asOperatorASI.ts, 4, 3))
as `Hello world`; // should not error
>as : Symbol(as, Decl(asOperatorASI.ts, 0, 13))
// Example 2
var y = 20
>y : Symbol(y, Decl(asOperatorASI.ts, 8, 3))
as(Foo); // should emit
>as : Symbol(as, Decl(asOperatorASI.ts, 0, 13))
>Foo : Symbol(Foo, Decl(asOperatorASI.ts, 0, 0))

View File

@@ -0,0 +1,28 @@
=== tests/cases/conformance/expressions/asOperator/asOperatorASI.ts ===
class Foo { }
>Foo : Foo
declare function as(...args: any[]);
>as : (...args: any[]) => any
>args : any[]
// Example 1
var x = 10
>x : number
>10 : number
as `Hello world`; // should not error
>as `Hello world` : any
>as : (...args: any[]) => any
>`Hello world` : string
// Example 2
var y = 20
>y : number
>20 : number
as(Foo); // should emit
>as(Foo) : any
>as : (...args: any[]) => any
>Foo : typeof Foo

View File

@@ -0,0 +1,15 @@
tests/cases/conformance/expressions/asOperator/asOperatorAmbiguity.ts(7,14): error TS2339: Property 'm' does not exist on type 'A<B>'.
==== tests/cases/conformance/expressions/asOperator/asOperatorAmbiguity.ts (1 errors) ====
interface A<T> { x: T; }
interface B { m: string; }
// Make sure this is a type assertion to an array type, and not nested comparison operators.
var x: any;
var y = x as A<B>[];
var z = y[0].m; // z should be string
~
!!! error TS2339: Property 'm' does not exist on type 'A<B>'.

View File

@@ -0,0 +1,16 @@
//// [asOperatorAmbiguity.ts]
interface A<T> { x: T; }
interface B { m: string; }
// Make sure this is a type assertion to an array type, and not nested comparison operators.
var x: any;
var y = x as A<B>[];
var z = y[0].m; // z should be string
//// [asOperatorAmbiguity.js]
// Make sure this is a type assertion to an array type, and not nested comparison operators.
var x;
var y = x;
var z = y[0].m; // z should be string

View File

@@ -0,0 +1,10 @@
tests/cases/conformance/expressions/asOperator/asOperatorContextualType.ts(2,9): error TS2352: Neither type '(v: number) => number' nor type '(x: number) => string' is assignable to the other.
Type 'number' is not assignable to type 'string'.
==== tests/cases/conformance/expressions/asOperator/asOperatorContextualType.ts (1 errors) ====
// should error
var x = (v => v) as (x: number) => string;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2352: Neither type '(v: number) => number' nor type '(x: number) => string' is assignable to the other.
!!! error TS2352: Type 'number' is not assignable to type 'string'.

View File

@@ -0,0 +1,7 @@
//// [asOperatorContextualType.ts]
// should error
var x = (v => v) as (x: number) => string;
//// [asOperatorContextualType.js]
// should error
var x = (function (v) { return v; });

View File

@@ -0,0 +1,11 @@
tests/cases/conformance/expressions/asOperator/asOperatorNames.ts(2,9): error TS2352: Neither type 'number' nor type 'string' is assignable to the other.
==== tests/cases/conformance/expressions/asOperator/asOperatorNames.ts (1 errors) ====
var a = 20;
var b = a as string;
~~~~~~~~~~~
!!! error TS2352: Neither type 'number' nor type 'string' is assignable to the other.
var as = "hello";
var as1 = as as string;

View File

@@ -0,0 +1,12 @@
//// [asOperatorNames.ts]
var a = 20;
var b = a as string;
var as = "hello";
var as1 = as as string;
//// [asOperatorNames.js]
var a = 20;
var b = a;
var as = "hello";
var as1 = as;

View File

@@ -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'.
}

View 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;
};

View File

@@ -0,0 +1,8 @@
//// [asyncArrowFunction1_es6.ts]
var foo = async (): Promise<void> => {
};
//// [asyncArrowFunction1_es6.js]
var foo = () => __awaiter(this, void 0, Promise, function* () {
});

View File

@@ -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))
};

View 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>
};

View File

@@ -0,0 +1,7 @@
//// [asyncArrowFunction2_es6.ts]
var f = (await) => {
}
//// [asyncArrowFunction2_es6.js]
var f = (await) => {
};

View File

@@ -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))
}

View 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
}

View File

@@ -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.
}

View File

@@ -0,0 +1,7 @@
//// [asyncArrowFunction3_es6.ts]
function f(await = await) {
}
//// [asyncArrowFunction3_es6.js]
function f(await = await) {
}

View File

@@ -0,0 +1,7 @@
//// [asyncArrowFunction4_es6.ts]
var await = () => {
}
//// [asyncArrowFunction4_es6.js]
var await = () => {
};

View File

@@ -0,0 +1,4 @@
=== tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction4_es6.ts ===
var await = () => {
>await : Symbol(await, Decl(asyncArrowFunction4_es6.ts, 0, 3))
}

View File

@@ -0,0 +1,5 @@
=== tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction4_es6.ts ===
var await = () => {
>await : () => void
>() => {} : () => void
}

View 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.
}

View File

@@ -0,0 +1,9 @@
//// [asyncArrowFunction5_es6.ts]
var foo = async (await): Promise<void> => {
}
//// [asyncArrowFunction5_es6.js]
var foo = async(await), Promise = ;
{
}

View 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.
}

View 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* () {
});

View 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.
}
}

View 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* () {
});
});

View 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.
}

View 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 };
});

View 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.
}

View 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 = ;
{
}

View File

@@ -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); });
}
}

View File

@@ -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)
}
}

View File

@@ -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
}
}

View File

@@ -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; });
}
}

View File

@@ -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))
}
}

View File

@@ -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
}
}

View File

@@ -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() { }
}

View 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 = {}));

View 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 = {}));

View 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))
}

View 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>
}

View 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.
}

View File

@@ -0,0 +1,7 @@
//// [asyncClass_es6.ts]
async class C {
}
//// [asyncClass_es6.js]
class C {
}

View 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.
}
}

View File

@@ -0,0 +1,11 @@
//// [asyncConstructor_es6.ts]
class C {
async constructor() {
}
}
//// [asyncConstructor_es6.js]
class C {
constructor() {
}
}

View 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.

View File

@@ -0,0 +1,4 @@
//// [asyncDeclare_es6.ts]
declare async function foo(): Promise<void>;
//// [asyncDeclare_es6.js]

View 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
}

View 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 = {}));

View File

@@ -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.
}

View File

@@ -0,0 +1,7 @@
//// [asyncFunctionDeclaration10_es6.ts]
async function foo(a = await => await): Promise<void> {
}
//// [asyncFunctionDeclaration10_es6.js]
await;
Promise < void > {};

View File

@@ -0,0 +1,9 @@
//// [asyncFunctionDeclaration11_es6.ts]
async function await(): Promise<void> {
}
//// [asyncFunctionDeclaration11_es6.js]
function await() {
return __awaiter(this, void 0, Promise, function* () {
});
}

View File

@@ -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))
}

View File

@@ -0,0 +1,5 @@
=== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration11_es6.ts ===
async function await(): Promise<void> {
>await : () => Promise<void>
>Promise : Promise<T>
}

View File

@@ -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.

View File

@@ -0,0 +1,5 @@
//// [asyncFunctionDeclaration12_es6.ts]
var v = async function await(): Promise<void> { }
//// [asyncFunctionDeclaration12_es6.js]
var v = , await = () => { };

View File

@@ -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'.
}

View 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;
});
}

View 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;
});
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -0,0 +1,9 @@
//// [asyncFunctionDeclaration1_es6.ts]
async function foo(): Promise<void> {
}
//// [asyncFunctionDeclaration1_es6.js]
function foo() {
return __awaiter(this, void 0, Promise, function* () {
});
}

View File

@@ -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))
}

View File

@@ -0,0 +1,5 @@
=== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration1_es6.ts ===
async function foo(): Promise<void> {
>foo : () => Promise<void>
>Promise : Promise<T>
}

View File

@@ -0,0 +1,7 @@
//// [asyncFunctionDeclaration2_es6.ts]
function f(await) {
}
//// [asyncFunctionDeclaration2_es6.js]
function f(await) {
}

View File

@@ -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))
}

View File

@@ -0,0 +1,5 @@
=== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration2_es6.ts ===
function f(await) {
>f : (await: any) => void
>await : any
}

View File

@@ -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.
}

View File

@@ -0,0 +1,7 @@
//// [asyncFunctionDeclaration3_es6.ts]
function f(await = await) {
}
//// [asyncFunctionDeclaration3_es6.js]
function f(await = await) {
}

View File

@@ -0,0 +1,7 @@
//// [asyncFunctionDeclaration4_es6.ts]
function await() {
}
//// [asyncFunctionDeclaration4_es6.js]
function await() {
}

View File

@@ -0,0 +1,4 @@
=== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration4_es6.ts ===
function await() {
>await : Symbol(await, Decl(asyncFunctionDeclaration4_es6.ts, 0, 0))
}

View File

@@ -0,0 +1,4 @@
=== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration4_es6.ts ===
function await() {
>await : () => void
}

View File

@@ -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.
}

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