mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-24 02:21:30 -05:00
Merge remote-tracking branch 'origin/master' into systemModule
This commit is contained in:
@@ -5,6 +5,6 @@ function * foo() {
|
||||
|
||||
//// [FunctionDeclaration9_es6.js]
|
||||
function foo() {
|
||||
var v = (_a = {}, _a[] = foo, _a);
|
||||
var v = (_a = {}, _a[yield] = foo, _a);
|
||||
var _a;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,6 @@ var v = { * foo() {
|
||||
|
||||
//// [YieldExpression10_es6.js]
|
||||
var v = { foo: function () {
|
||||
;
|
||||
yield (foo);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -10,7 +10,7 @@ var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.foo = function () {
|
||||
;
|
||||
yield (foo);
|
||||
};
|
||||
return C;
|
||||
})();
|
||||
|
||||
@@ -8,7 +8,7 @@ class C {
|
||||
//// [YieldExpression12_es6.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
;
|
||||
yield foo;
|
||||
}
|
||||
return C;
|
||||
})();
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
function* foo() { yield }
|
||||
|
||||
//// [YieldExpression13_es6.js]
|
||||
function foo() { ; }
|
||||
function foo() { yield; }
|
||||
|
||||
@@ -10,7 +10,7 @@ var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.foo = function () {
|
||||
;
|
||||
yield foo;
|
||||
};
|
||||
return C;
|
||||
})();
|
||||
|
||||
@@ -5,5 +5,5 @@ var v = () => {
|
||||
|
||||
//// [YieldExpression15_es6.js]
|
||||
var v = function () {
|
||||
;
|
||||
yield foo;
|
||||
};
|
||||
|
||||
@@ -8,6 +8,6 @@ function* foo() {
|
||||
//// [YieldExpression16_es6.js]
|
||||
function foo() {
|
||||
function bar() {
|
||||
;
|
||||
yield foo;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
var v = { get foo() { yield foo; } }
|
||||
|
||||
//// [YieldExpression17_es6.js]
|
||||
var v = { get foo() { ; } };
|
||||
var v = { get foo() { yield foo; } };
|
||||
|
||||
@@ -4,4 +4,4 @@ yield(foo);
|
||||
|
||||
//// [YieldExpression18_es6.js]
|
||||
"use strict";
|
||||
;
|
||||
yield (foo);
|
||||
|
||||
@@ -11,7 +11,7 @@ function*foo() {
|
||||
function foo() {
|
||||
function bar() {
|
||||
function quux() {
|
||||
;
|
||||
yield (foo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
yield foo;
|
||||
|
||||
//// [YieldExpression2_es6.js]
|
||||
;
|
||||
yield foo;
|
||||
|
||||
@@ -6,6 +6,6 @@ function* foo() {
|
||||
|
||||
//// [YieldExpression3_es6.js]
|
||||
function foo() {
|
||||
;
|
||||
;
|
||||
yield;
|
||||
yield;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,6 @@ function* foo() {
|
||||
|
||||
//// [YieldExpression4_es6.js]
|
||||
function foo() {
|
||||
;
|
||||
;
|
||||
yield;
|
||||
yield;
|
||||
}
|
||||
|
||||
@@ -5,5 +5,5 @@ function* foo() {
|
||||
|
||||
//// [YieldExpression5_es6.js]
|
||||
function foo() {
|
||||
;
|
||||
yield* ;
|
||||
}
|
||||
|
||||
@@ -5,5 +5,5 @@ function* foo() {
|
||||
|
||||
//// [YieldExpression6_es6.js]
|
||||
function foo() {
|
||||
;
|
||||
yield* foo;
|
||||
}
|
||||
|
||||
@@ -5,5 +5,5 @@ function* foo() {
|
||||
|
||||
//// [YieldExpression7_es6.js]
|
||||
function foo() {
|
||||
;
|
||||
yield foo;
|
||||
}
|
||||
|
||||
@@ -7,5 +7,5 @@ function* foo() {
|
||||
//// [YieldExpression8_es6.js]
|
||||
yield(foo);
|
||||
function foo() {
|
||||
;
|
||||
yield (foo);
|
||||
}
|
||||
|
||||
@@ -5,5 +5,5 @@ var v = function*() {
|
||||
|
||||
//// [YieldExpression9_es6.js]
|
||||
var v = function () {
|
||||
;
|
||||
yield (foo);
|
||||
};
|
||||
|
||||
@@ -13,6 +13,17 @@ var d = n => c = n;
|
||||
var d = (n) => c = n;
|
||||
var d: (n: any) => any;
|
||||
|
||||
// Binding patterns in arrow functions
|
||||
var p1 = ([a]) => { };
|
||||
var p2 = ([...a]) => { };
|
||||
var p3 = ([, a]) => { };
|
||||
var p4 = ([, ...a]) => { };
|
||||
var p5 = ([a = 1]) => { };
|
||||
var p6 = ({ a }) => { };
|
||||
var p7 = ({ a: { b } }) => { };
|
||||
var p8 = ({ a = 1 }) => { };
|
||||
var p9 = ({ a: { b = 1 } = { b: 1 } }) => { };
|
||||
var p10 = ([{ value, done }]) => { };
|
||||
|
||||
// Arrow function used in class member initializer
|
||||
// Arrow function used in class member function
|
||||
@@ -100,6 +111,37 @@ var c;
|
||||
var d = function (n) { return c = n; };
|
||||
var d = function (n) { return c = n; };
|
||||
var d;
|
||||
// Binding patterns in arrow functions
|
||||
var p1 = function (_a) {
|
||||
var a = _a[0];
|
||||
};
|
||||
var p2 = function (_a) {
|
||||
var a = _a.slice(0);
|
||||
};
|
||||
var p3 = function (_a) {
|
||||
var a = _a[1];
|
||||
};
|
||||
var p4 = function (_a) {
|
||||
var a = _a.slice(1);
|
||||
};
|
||||
var p5 = function (_a) {
|
||||
var _b = _a[0], a = _b === void 0 ? 1 : _b;
|
||||
};
|
||||
var p6 = function (_a) {
|
||||
var a = _a.a;
|
||||
};
|
||||
var p7 = function (_a) {
|
||||
var b = _a.a.b;
|
||||
};
|
||||
var p8 = function (_a) {
|
||||
var _b = _a.a, a = _b === void 0 ? 1 : _b;
|
||||
};
|
||||
var p9 = function (_a) {
|
||||
var _b = _a.a, _c = (_b === void 0 ? { b: 1 } : _b).b, b = _c === void 0 ? 1 : _c;
|
||||
};
|
||||
var p10 = function (_a) {
|
||||
var _b = _a[0], value = _b.value, done = _b.done;
|
||||
};
|
||||
// Arrow function used in class member initializer
|
||||
// Arrow function used in class member function
|
||||
var MyClass = (function () {
|
||||
|
||||
@@ -51,6 +51,61 @@ var d: (n: any) => any;
|
||||
>d : (n: any) => any
|
||||
>n : any
|
||||
|
||||
// Binding patterns in arrow functions
|
||||
var p1 = ([a]) => { };
|
||||
>p1 : ([a]: [any]) => void
|
||||
>([a]) => { } : ([a]: [any]) => void
|
||||
>a : any
|
||||
|
||||
var p2 = ([...a]) => { };
|
||||
>p2 : ([...a]: any[]) => void
|
||||
>([...a]) => { } : ([...a]: any[]) => void
|
||||
>a : any[]
|
||||
|
||||
var p3 = ([, a]) => { };
|
||||
>p3 : ([, a]: [any, any]) => void
|
||||
>([, a]) => { } : ([, a]: [any, any]) => void
|
||||
>a : any
|
||||
|
||||
var p4 = ([, ...a]) => { };
|
||||
>p4 : ([, ...a]: any[]) => void
|
||||
>([, ...a]) => { } : ([, ...a]: any[]) => void
|
||||
>a : any[]
|
||||
|
||||
var p5 = ([a = 1]) => { };
|
||||
>p5 : ([a = 1]: [number]) => void
|
||||
>([a = 1]) => { } : ([a = 1]: [number]) => void
|
||||
>a : number
|
||||
|
||||
var p6 = ({ a }) => { };
|
||||
>p6 : ({ a }: { a: any; }) => void
|
||||
>({ a }) => { } : ({ a }: { a: any; }) => void
|
||||
>a : any
|
||||
|
||||
var p7 = ({ a: { b } }) => { };
|
||||
>p7 : ({ a: { b } }: { a: { b: any; }; }) => void
|
||||
>({ a: { b } }) => { } : ({ a: { b } }: { a: { b: any; }; }) => void
|
||||
>a : unknown
|
||||
>b : any
|
||||
|
||||
var p8 = ({ a = 1 }) => { };
|
||||
>p8 : ({ a = 1 }: { a?: number; }) => void
|
||||
>({ a = 1 }) => { } : ({ a = 1 }: { a?: number; }) => void
|
||||
>a : number
|
||||
|
||||
var p9 = ({ a: { b = 1 } = { b: 1 } }) => { };
|
||||
>p9 : ({ a: { b = 1 } = { b: 1 } }: { a?: { b: number; }; }) => void
|
||||
>({ a: { b = 1 } = { b: 1 } }) => { } : ({ a: { b = 1 } = { b: 1 } }: { a?: { b: number; }; }) => void
|
||||
>a : unknown
|
||||
>b : number
|
||||
>{ b: 1 } : { b: number; }
|
||||
>b : number
|
||||
|
||||
var p10 = ([{ value, done }]) => { };
|
||||
>p10 : ([{ value, done }]: [{ value: any; done: any; }]) => void
|
||||
>([{ value, done }]) => { } : ([{ value, done }]: [{ value: any; done: any; }]) => void
|
||||
>value : any
|
||||
>done : any
|
||||
|
||||
// Arrow function used in class member initializer
|
||||
// Arrow function used in class member function
|
||||
|
||||
@@ -486,7 +486,7 @@ number;
|
||||
}
|
||||
var CLASS = (function () {
|
||||
function CLASS() {
|
||||
this.d = function () { ; };
|
||||
this.d = function () { yield 0; };
|
||||
}
|
||||
Object.defineProperty(CLASS.prototype, "Property", {
|
||||
get: function () { return 0; },
|
||||
|
||||
@@ -7,4 +7,5 @@ export default 1 + 2;
|
||||
|
||||
|
||||
//// [declarationEmitDefaultExport5.d.ts]
|
||||
export default : number;
|
||||
declare var _default: number;
|
||||
export default _default;
|
||||
|
||||
@@ -12,4 +12,5 @@ export default new A();
|
||||
//// [declarationEmitDefaultExport6.d.ts]
|
||||
export declare class A {
|
||||
}
|
||||
export default : A;
|
||||
declare var _default: A;
|
||||
export default _default;
|
||||
|
||||
18
tests/baselines/reference/declarationEmitDefaultExport8.js
Normal file
18
tests/baselines/reference/declarationEmitDefaultExport8.js
Normal file
@@ -0,0 +1,18 @@
|
||||
//// [declarationEmitDefaultExport8.ts]
|
||||
|
||||
var _default = 1;
|
||||
export {_default as d}
|
||||
export default 1 + 2;
|
||||
|
||||
|
||||
//// [declarationEmitDefaultExport8.js]
|
||||
var _default = 1;
|
||||
export { _default as d };
|
||||
export default 1 + 2;
|
||||
|
||||
|
||||
//// [declarationEmitDefaultExport8.d.ts]
|
||||
declare var _default: number;
|
||||
export { _default as d };
|
||||
declare var _default_1: number;
|
||||
export default _default_1;
|
||||
@@ -0,0 +1,12 @@
|
||||
=== tests/cases/compiler/declarationEmitDefaultExport8.ts ===
|
||||
|
||||
var _default = 1;
|
||||
>_default : number
|
||||
|
||||
export {_default as d}
|
||||
>_default : number
|
||||
>d : number
|
||||
|
||||
export default 1 + 2;
|
||||
>1 + 2 : number
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
//// [tests/cases/conformance/decorators/class/decoratedClassFromExternalModule.ts] ////
|
||||
|
||||
//// [decorated.ts]
|
||||
function decorate() { }
|
||||
|
||||
@decorate
|
||||
export default class Decorated { }
|
||||
|
||||
//// [undecorated.ts]
|
||||
import Decorated from 'decorated';
|
||||
|
||||
//// [decorated.js]
|
||||
var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) {
|
||||
switch (arguments.length) {
|
||||
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
|
||||
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
|
||||
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
|
||||
}
|
||||
};
|
||||
function decorate() { }
|
||||
let Decorated = class {
|
||||
};
|
||||
Object.defineProperty(Decorated, "name", { value: "Decorated", configurable: true });
|
||||
Decorated = __decorate([
|
||||
decorate
|
||||
], Decorated);
|
||||
export default Decorated;
|
||||
//// [undecorated.js]
|
||||
@@ -0,0 +1,14 @@
|
||||
=== tests/cases/conformance/decorators/class/decorated.ts ===
|
||||
function decorate() { }
|
||||
>decorate : () => void
|
||||
|
||||
@decorate
|
||||
>decorate : () => void
|
||||
|
||||
export default class Decorated { }
|
||||
>Decorated : Decorated
|
||||
|
||||
=== tests/cases/conformance/decorators/class/undecorated.ts ===
|
||||
import Decorated from 'decorated';
|
||||
>Decorated : typeof Decorated
|
||||
|
||||
@@ -6,6 +6,18 @@ var f4 = (x: string, y: number, z=10) => { }
|
||||
function foo(func: () => boolean) { }
|
||||
foo(() => true);
|
||||
foo(() => { return false; });
|
||||
|
||||
// Binding patterns in arrow functions
|
||||
var p1 = ([a]) => { };
|
||||
var p2 = ([...a]) => { };
|
||||
var p3 = ([, a]) => { };
|
||||
var p4 = ([, ...a]) => { };
|
||||
var p5 = ([a = 1]) => { };
|
||||
var p6 = ({ a }) => { };
|
||||
var p7 = ({ a: { b } }) => { };
|
||||
var p8 = ({ a = 1 }) => { };
|
||||
var p9 = ({ a: { b = 1 } = { b: 1 } }) => { };
|
||||
var p10 = ([{ value, done }]) => { };
|
||||
|
||||
|
||||
//// [emitArrowFunctionES6.js]
|
||||
@@ -16,3 +28,14 @@ var f4 = (x, y, z = 10) => { };
|
||||
function foo(func) { }
|
||||
foo(() => true);
|
||||
foo(() => { return false; });
|
||||
// Binding patterns in arrow functions
|
||||
var p1 = ([a]) => { };
|
||||
var p2 = ([...a]) => { };
|
||||
var p3 = ([, a]) => { };
|
||||
var p4 = ([, ...a]) => { };
|
||||
var p5 = ([a = 1]) => { };
|
||||
var p6 = ({ a }) => { };
|
||||
var p7 = ({ a: { b } }) => { };
|
||||
var p8 = ({ a = 1 }) => { };
|
||||
var p9 = ({ a: { b = 1 } = { b: 1 } }) => { };
|
||||
var p10 = ([{ value, done }]) => { };
|
||||
|
||||
@@ -37,3 +37,59 @@ foo(() => { return false; });
|
||||
>foo : (func: () => boolean) => void
|
||||
>() => { return false; } : () => boolean
|
||||
|
||||
// Binding patterns in arrow functions
|
||||
var p1 = ([a]) => { };
|
||||
>p1 : ([a]: [any]) => void
|
||||
>([a]) => { } : ([a]: [any]) => void
|
||||
>a : any
|
||||
|
||||
var p2 = ([...a]) => { };
|
||||
>p2 : ([...a]: Iterable<any>) => void
|
||||
>([...a]) => { } : ([...a]: Iterable<any>) => void
|
||||
>a : any[]
|
||||
|
||||
var p3 = ([, a]) => { };
|
||||
>p3 : ([, a]: [any, any]) => void
|
||||
>([, a]) => { } : ([, a]: [any, any]) => void
|
||||
>a : any
|
||||
|
||||
var p4 = ([, ...a]) => { };
|
||||
>p4 : ([, ...a]: Iterable<any>) => void
|
||||
>([, ...a]) => { } : ([, ...a]: Iterable<any>) => void
|
||||
>a : any[]
|
||||
|
||||
var p5 = ([a = 1]) => { };
|
||||
>p5 : ([a = 1]: [number]) => void
|
||||
>([a = 1]) => { } : ([a = 1]: [number]) => void
|
||||
>a : number
|
||||
|
||||
var p6 = ({ a }) => { };
|
||||
>p6 : ({ a }: { a: any; }) => void
|
||||
>({ a }) => { } : ({ a }: { a: any; }) => void
|
||||
>a : any
|
||||
|
||||
var p7 = ({ a: { b } }) => { };
|
||||
>p7 : ({ a: { b } }: { a: { b: any; }; }) => void
|
||||
>({ a: { b } }) => { } : ({ a: { b } }: { a: { b: any; }; }) => void
|
||||
>a : unknown
|
||||
>b : any
|
||||
|
||||
var p8 = ({ a = 1 }) => { };
|
||||
>p8 : ({ a = 1 }: { a?: number; }) => void
|
||||
>({ a = 1 }) => { } : ({ a = 1 }: { a?: number; }) => void
|
||||
>a : number
|
||||
|
||||
var p9 = ({ a: { b = 1 } = { b: 1 } }) => { };
|
||||
>p9 : ({ a: { b = 1 } = { b: 1 } }: { a?: { b: number; }; }) => void
|
||||
>({ a: { b = 1 } = { b: 1 } }) => { } : ({ a: { b = 1 } = { b: 1 } }: { a?: { b: number; }; }) => void
|
||||
>a : unknown
|
||||
>b : number
|
||||
>{ b: 1 } : { b: number; }
|
||||
>b : number
|
||||
|
||||
var p10 = ([{ value, done }]) => { };
|
||||
>p10 : ([{ value, done }]: [{ value: any; done: any; }]) => void
|
||||
>([{ value, done }]) => { } : ([{ value, done }]: [{ value: any; done: any; }]) => void
|
||||
>value : any
|
||||
>done : any
|
||||
|
||||
|
||||
@@ -8,4 +8,5 @@ exports.default = (1 + 2);
|
||||
|
||||
|
||||
//// [es5ExportDefaultExpression.d.ts]
|
||||
export default : number;
|
||||
declare var _default: number;
|
||||
export default _default;
|
||||
|
||||
@@ -8,4 +8,5 @@ export default (1 + 2);
|
||||
|
||||
|
||||
//// [es6ExportDefaultExpression.d.ts]
|
||||
export default : number;
|
||||
declare var _default: number;
|
||||
export default _default;
|
||||
|
||||
@@ -45,5 +45,6 @@ var x1 = m;
|
||||
export declare var a: number;
|
||||
export declare var x: number;
|
||||
export declare var m: number;
|
||||
export default : {};
|
||||
declare var _default: {};
|
||||
export default _default;
|
||||
//// [es6ImportDefaultBindingFollowedWithNamedImport_1.d.ts]
|
||||
|
||||
@@ -44,7 +44,8 @@ define(["require", "exports", "server", "server", "server", "server", "server"],
|
||||
export declare var a: number;
|
||||
export declare var x: number;
|
||||
export declare var m: number;
|
||||
export default : {};
|
||||
declare var _default: {};
|
||||
export default _default;
|
||||
//// [client.d.ts]
|
||||
export declare var x1: number;
|
||||
export declare var x1: number;
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
tests/cases/compiler/exportDefaultTypeAnnoation.ts(2,18): error TS1201: A type annotation on an export statement is only allowed in an ambient external module declaration.
|
||||
|
||||
|
||||
==== tests/cases/compiler/exportDefaultTypeAnnoation.ts (1 errors) ====
|
||||
|
||||
export default : number;
|
||||
~~~~~~
|
||||
!!! error TS1201: A type annotation on an export statement is only allowed in an ambient external module declaration.
|
||||
@@ -1,6 +0,0 @@
|
||||
//// [exportDefaultTypeAnnoation.ts]
|
||||
|
||||
export default : number;
|
||||
|
||||
//// [exportDefaultTypeAnnoation.js]
|
||||
exports.default = ;
|
||||
@@ -1,7 +0,0 @@
|
||||
//// [exportDefaultTypeAnnoation2.ts]
|
||||
|
||||
declare module "mod" {
|
||||
export default : number;
|
||||
}
|
||||
|
||||
//// [exportDefaultTypeAnnoation2.js]
|
||||
@@ -1,6 +0,0 @@
|
||||
=== tests/cases/compiler/exportDefaultTypeAnnoation2.ts ===
|
||||
|
||||
No type information for this code.declare module "mod" {
|
||||
No type information for this code. export default : number;
|
||||
No type information for this code.}
|
||||
No type information for this code.
|
||||
@@ -1,21 +0,0 @@
|
||||
tests/cases/compiler/reference1.ts(2,5): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/compiler/reference2.ts(2,5): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/mod.d.ts (0 errors) ====
|
||||
|
||||
declare module "mod" {
|
||||
export default : number;
|
||||
}
|
||||
|
||||
==== tests/cases/compiler/reference1.ts (1 errors) ====
|
||||
import d from "mod";
|
||||
var s: string = d; // Error
|
||||
~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
|
||||
==== tests/cases/compiler/reference2.ts (1 errors) ====
|
||||
import { default as d } from "mod";
|
||||
var s: string = d; // Error
|
||||
~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
@@ -1,22 +0,0 @@
|
||||
//// [tests/cases/compiler/exportDefaultTypeAnnoation3.ts] ////
|
||||
|
||||
//// [mod.d.ts]
|
||||
|
||||
declare module "mod" {
|
||||
export default : number;
|
||||
}
|
||||
|
||||
//// [reference1.ts]
|
||||
import d from "mod";
|
||||
var s: string = d; // Error
|
||||
|
||||
//// [reference2.ts]
|
||||
import { default as d } from "mod";
|
||||
var s: string = d; // Error
|
||||
|
||||
//// [reference1.js]
|
||||
var mod_1 = require("mod");
|
||||
var s = mod_1.default; // Error
|
||||
//// [reference2.js]
|
||||
var mod_1 = require("mod");
|
||||
var s = mod_1.default; // Error
|
||||
12
tests/baselines/reference/generatorES6_1.errors.txt
Normal file
12
tests/baselines/reference/generatorES6_1.errors.txt
Normal file
@@ -0,0 +1,12 @@
|
||||
tests/cases/compiler/generatorES6_1.ts(1,9): error TS9001: Generators are not currently supported.
|
||||
tests/cases/compiler/generatorES6_1.ts(2,5): error TS9000: 'yield' expressions are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/compiler/generatorES6_1.ts (2 errors) ====
|
||||
function* foo() {
|
||||
~
|
||||
!!! error TS9001: Generators are not currently supported.
|
||||
yield
|
||||
~~~~~
|
||||
!!! error TS9000: 'yield' expressions are not currently supported.
|
||||
}
|
||||
9
tests/baselines/reference/generatorES6_1.js
Normal file
9
tests/baselines/reference/generatorES6_1.js
Normal file
@@ -0,0 +1,9 @@
|
||||
//// [generatorES6_1.ts]
|
||||
function* foo() {
|
||||
yield
|
||||
}
|
||||
|
||||
//// [generatorES6_1.js]
|
||||
function* foo() {
|
||||
yield;
|
||||
}
|
||||
14
tests/baselines/reference/generatorES6_2.errors.txt
Normal file
14
tests/baselines/reference/generatorES6_2.errors.txt
Normal file
@@ -0,0 +1,14 @@
|
||||
tests/cases/compiler/generatorES6_2.ts(2,12): error TS9001: Generators are not currently supported.
|
||||
tests/cases/compiler/generatorES6_2.ts(3,9): error TS9000: 'yield' expressions are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/compiler/generatorES6_2.ts (2 errors) ====
|
||||
class C {
|
||||
public * foo() {
|
||||
~
|
||||
!!! error TS9001: Generators are not currently supported.
|
||||
yield 1
|
||||
~~~~~
|
||||
!!! error TS9000: 'yield' expressions are not currently supported.
|
||||
}
|
||||
}
|
||||
13
tests/baselines/reference/generatorES6_2.js
Normal file
13
tests/baselines/reference/generatorES6_2.js
Normal file
@@ -0,0 +1,13 @@
|
||||
//// [generatorES6_2.ts]
|
||||
class C {
|
||||
public * foo() {
|
||||
yield 1
|
||||
}
|
||||
}
|
||||
|
||||
//// [generatorES6_2.js]
|
||||
class C {
|
||||
*foo() {
|
||||
yield 1;
|
||||
}
|
||||
}
|
||||
12
tests/baselines/reference/generatorES6_3.errors.txt
Normal file
12
tests/baselines/reference/generatorES6_3.errors.txt
Normal file
@@ -0,0 +1,12 @@
|
||||
tests/cases/compiler/generatorES6_3.ts(1,17): error TS9001: Generators are not currently supported.
|
||||
tests/cases/compiler/generatorES6_3.ts(2,5): error TS9000: 'yield' expressions are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/compiler/generatorES6_3.ts (2 errors) ====
|
||||
var v = function*() {
|
||||
~
|
||||
!!! error TS9001: Generators are not currently supported.
|
||||
yield 0
|
||||
~~~~~
|
||||
!!! error TS9000: 'yield' expressions are not currently supported.
|
||||
}
|
||||
9
tests/baselines/reference/generatorES6_3.js
Normal file
9
tests/baselines/reference/generatorES6_3.js
Normal file
@@ -0,0 +1,9 @@
|
||||
//// [generatorES6_3.ts]
|
||||
var v = function*() {
|
||||
yield 0
|
||||
}
|
||||
|
||||
//// [generatorES6_3.js]
|
||||
var v = function* () {
|
||||
yield 0;
|
||||
};
|
||||
14
tests/baselines/reference/generatorES6_4.errors.txt
Normal file
14
tests/baselines/reference/generatorES6_4.errors.txt
Normal file
@@ -0,0 +1,14 @@
|
||||
tests/cases/compiler/generatorES6_4.ts(2,4): error TS9001: Generators are not currently supported.
|
||||
tests/cases/compiler/generatorES6_4.ts(3,8): error TS9000: 'yield' expressions are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/compiler/generatorES6_4.ts (2 errors) ====
|
||||
var v = {
|
||||
*foo() {
|
||||
~
|
||||
!!! error TS9001: Generators are not currently supported.
|
||||
yield 0
|
||||
~~~~~
|
||||
!!! error TS9000: 'yield' expressions are not currently supported.
|
||||
}
|
||||
}
|
||||
13
tests/baselines/reference/generatorES6_4.js
Normal file
13
tests/baselines/reference/generatorES6_4.js
Normal file
@@ -0,0 +1,13 @@
|
||||
//// [generatorES6_4.ts]
|
||||
var v = {
|
||||
*foo() {
|
||||
yield 0
|
||||
}
|
||||
}
|
||||
|
||||
//// [generatorES6_4.js]
|
||||
var v = {
|
||||
*foo() {
|
||||
yield 0;
|
||||
}
|
||||
};
|
||||
12
tests/baselines/reference/generatorES6_5.errors.txt
Normal file
12
tests/baselines/reference/generatorES6_5.errors.txt
Normal file
@@ -0,0 +1,12 @@
|
||||
tests/cases/compiler/generatorES6_5.ts(1,9): error TS9001: Generators are not currently supported.
|
||||
tests/cases/compiler/generatorES6_5.ts(2,5): error TS9000: 'yield' expressions are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/compiler/generatorES6_5.ts (2 errors) ====
|
||||
function* foo() {
|
||||
~
|
||||
!!! error TS9001: Generators are not currently supported.
|
||||
yield a ? b : c;
|
||||
~~~~~
|
||||
!!! error TS9000: 'yield' expressions are not currently supported.
|
||||
}
|
||||
9
tests/baselines/reference/generatorES6_5.js
Normal file
9
tests/baselines/reference/generatorES6_5.js
Normal file
@@ -0,0 +1,9 @@
|
||||
//// [generatorES6_5.ts]
|
||||
function* foo() {
|
||||
yield a ? b : c;
|
||||
}
|
||||
|
||||
//// [generatorES6_5.js]
|
||||
function* foo() {
|
||||
yield a ? b : c;
|
||||
}
|
||||
14
tests/baselines/reference/generatorES6_6.errors.txt
Normal file
14
tests/baselines/reference/generatorES6_6.errors.txt
Normal file
@@ -0,0 +1,14 @@
|
||||
tests/cases/compiler/generatorES6_6.ts(2,3): error TS9001: Generators are not currently supported.
|
||||
tests/cases/compiler/generatorES6_6.ts(3,13): error TS9000: 'yield' expressions are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/compiler/generatorES6_6.ts (2 errors) ====
|
||||
class C {
|
||||
*[Symbol.iterator]() {
|
||||
~
|
||||
!!! error TS9001: Generators are not currently supported.
|
||||
let a = yield 1;
|
||||
~~~~~
|
||||
!!! error TS9000: 'yield' expressions are not currently supported.
|
||||
}
|
||||
}
|
||||
13
tests/baselines/reference/generatorES6_6.js
Normal file
13
tests/baselines/reference/generatorES6_6.js
Normal file
@@ -0,0 +1,13 @@
|
||||
//// [generatorES6_6.ts]
|
||||
class C {
|
||||
*[Symbol.iterator]() {
|
||||
let a = yield 1;
|
||||
}
|
||||
}
|
||||
|
||||
//// [generatorES6_6.js]
|
||||
class C {
|
||||
*[Symbol.iterator]() {
|
||||
let a = yield 1;
|
||||
}
|
||||
}
|
||||
@@ -8,5 +8,5 @@ function* gen() {
|
||||
//// [templateStringInYieldKeyword.js]
|
||||
function gen() {
|
||||
// Once this is supported, the inner expression does not need to be parenthesized.
|
||||
var x = ;
|
||||
var x = yield "abc" + x + "def";
|
||||
}
|
||||
|
||||
@@ -8,5 +8,5 @@ function* gen {
|
||||
//// [templateStringWithEmbeddedYieldKeyword.js]
|
||||
function gen() {
|
||||
// Once this is supported, yield *must* be parenthesized.
|
||||
var x = "abc" + + "def";
|
||||
var x = "abc" + (yield 10) + "def";
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ function* gen() {
|
||||
|
||||
|
||||
//// [templateStringWithEmbeddedYieldKeywordES6.js]
|
||||
function gen() {
|
||||
function* gen() {
|
||||
// Once this is supported, yield *must* be parenthesized.
|
||||
var x = `abc${}def`;
|
||||
var x = `abc${yield 10}def`;
|
||||
}
|
||||
|
||||
@@ -5,5 +5,5 @@ function* foo() {
|
||||
|
||||
//// [yieldExpression1.js]
|
||||
function foo() {
|
||||
;
|
||||
yield;
|
||||
}
|
||||
|
||||
6
tests/cases/compiler/declarationEmitDefaultExport8.ts
Normal file
6
tests/cases/compiler/declarationEmitDefaultExport8.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
// @declaration: true
|
||||
// @target: es6
|
||||
|
||||
var _default = 1;
|
||||
export {_default as d}
|
||||
export default 1 + 2;
|
||||
@@ -1,4 +0,0 @@
|
||||
// @target: es5
|
||||
// @module: commonjs
|
||||
|
||||
export default : number;
|
||||
@@ -1,6 +0,0 @@
|
||||
// @target: es5
|
||||
// @module: commonjs
|
||||
|
||||
declare module "mod" {
|
||||
export default : number;
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
// @target: es5
|
||||
// @module: commonjs
|
||||
|
||||
// @fileName: mod.d.ts
|
||||
declare module "mod" {
|
||||
export default : number;
|
||||
}
|
||||
|
||||
// @fileName: reference1.ts
|
||||
import d from "mod";
|
||||
var s: string = d; // Error
|
||||
|
||||
// @fileName: reference2.ts
|
||||
import { default as d } from "mod";
|
||||
var s: string = d; // Error
|
||||
4
tests/cases/compiler/generatorES6_1.ts
Normal file
4
tests/cases/compiler/generatorES6_1.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
// @target: es6
|
||||
function* foo() {
|
||||
yield
|
||||
}
|
||||
6
tests/cases/compiler/generatorES6_2.ts
Normal file
6
tests/cases/compiler/generatorES6_2.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
// @target: es6
|
||||
class C {
|
||||
public * foo() {
|
||||
yield 1
|
||||
}
|
||||
}
|
||||
4
tests/cases/compiler/generatorES6_3.ts
Normal file
4
tests/cases/compiler/generatorES6_3.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
// @target: es6
|
||||
var v = function*() {
|
||||
yield 0
|
||||
}
|
||||
6
tests/cases/compiler/generatorES6_4.ts
Normal file
6
tests/cases/compiler/generatorES6_4.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
// @target: es6
|
||||
var v = {
|
||||
*foo() {
|
||||
yield 0
|
||||
}
|
||||
}
|
||||
4
tests/cases/compiler/generatorES6_5.ts
Normal file
4
tests/cases/compiler/generatorES6_5.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
// @target: es6
|
||||
function* foo() {
|
||||
yield a ? b : c;
|
||||
}
|
||||
6
tests/cases/compiler/generatorES6_6.ts
Normal file
6
tests/cases/compiler/generatorES6_6.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
// @target: es6
|
||||
class C {
|
||||
*[Symbol.iterator]() {
|
||||
let a = yield 1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// @target: es6
|
||||
// @Filename: decorated.ts
|
||||
function decorate() { }
|
||||
|
||||
@decorate
|
||||
export default class Decorated { }
|
||||
|
||||
// @Filename: undecorated.ts
|
||||
import Decorated from 'decorated';
|
||||
@@ -6,3 +6,15 @@ var f4 = (x: string, y: number, z=10) => { }
|
||||
function foo(func: () => boolean) { }
|
||||
foo(() => true);
|
||||
foo(() => { return false; });
|
||||
|
||||
// Binding patterns in arrow functions
|
||||
var p1 = ([a]) => { };
|
||||
var p2 = ([...a]) => { };
|
||||
var p3 = ([, a]) => { };
|
||||
var p4 = ([, ...a]) => { };
|
||||
var p5 = ([a = 1]) => { };
|
||||
var p6 = ({ a }) => { };
|
||||
var p7 = ({ a: { b } }) => { };
|
||||
var p8 = ({ a = 1 }) => { };
|
||||
var p9 = ({ a: { b = 1 } = { b: 1 } }) => { };
|
||||
var p10 = ([{ value, done }]) => { };
|
||||
|
||||
@@ -12,6 +12,17 @@ var d = n => c = n;
|
||||
var d = (n) => c = n;
|
||||
var d: (n: any) => any;
|
||||
|
||||
// Binding patterns in arrow functions
|
||||
var p1 = ([a]) => { };
|
||||
var p2 = ([...a]) => { };
|
||||
var p3 = ([, a]) => { };
|
||||
var p4 = ([, ...a]) => { };
|
||||
var p5 = ([a = 1]) => { };
|
||||
var p6 = ({ a }) => { };
|
||||
var p7 = ({ a: { b } }) => { };
|
||||
var p8 = ({ a = 1 }) => { };
|
||||
var p9 = ({ a: { b = 1 } = { b: 1 } }) => { };
|
||||
var p10 = ([{ value, done }]) => { };
|
||||
|
||||
// Arrow function used in class member initializer
|
||||
// Arrow function used in class member function
|
||||
|
||||
Reference in New Issue
Block a user