mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge branch 'master' into asyncAwaitFidelity
This commit is contained in:
@@ -81,11 +81,11 @@ module ts {
|
||||
getTypeCount: () => typeCount,
|
||||
isUndefinedSymbol: symbol => symbol === undefinedSymbol,
|
||||
isArgumentsSymbol: symbol => symbol === argumentsSymbol,
|
||||
emitFiles: invokeEmitter,
|
||||
getDiagnostics,
|
||||
getDeclarationDiagnostics,
|
||||
getGlobalDiagnostics,
|
||||
checkProgram,
|
||||
invokeEmitter,
|
||||
getParentOfSymbol,
|
||||
getNarrowedTypeOfSymbol,
|
||||
getDeclaredTypeOfSymbol,
|
||||
|
||||
@@ -414,5 +414,7 @@ module ts {
|
||||
_0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: DiagnosticCategory.Error, key: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." },
|
||||
Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: DiagnosticCategory.Error, key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." },
|
||||
You_cannot_rename_this_element: { code: 8000, category: DiagnosticCategory.Error, key: "You cannot rename this element." },
|
||||
yield_expressions_are_not_currently_supported: { code: 9000, category: DiagnosticCategory.Error, key: "'yield' expressions are not currently supported." },
|
||||
generators_are_not_currently_supported: { code: 9001, category: DiagnosticCategory.Error, key: "'generators' are not currently supported." },
|
||||
};
|
||||
}
|
||||
@@ -1654,5 +1654,13 @@
|
||||
"You cannot rename this element.": {
|
||||
"category": "Error",
|
||||
"code": 8000
|
||||
},
|
||||
"'yield' expressions are not currently supported.": {
|
||||
"category": "Error",
|
||||
"code": 9000
|
||||
},
|
||||
"'generators' are not currently supported.": {
|
||||
"category": "Error",
|
||||
"code": 9001
|
||||
}
|
||||
}
|
||||
|
||||
+45
-42
@@ -1155,6 +1155,15 @@ module ts {
|
||||
return false;
|
||||
}
|
||||
|
||||
function parseOptionalToken(t: SyntaxKind): Node {
|
||||
if (token === t) {
|
||||
var node = createNode(t);
|
||||
nextToken();
|
||||
return finishNode(node);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function canParseSemicolon() {
|
||||
// If there's a real semicolon, then we can always parse it out.
|
||||
if (token === SyntaxKind.SemicolonToken) {
|
||||
@@ -2202,10 +2211,7 @@ module ts {
|
||||
|
||||
if (!scanner.hasPrecedingLineBreak() &&
|
||||
(token === SyntaxKind.AsteriskToken || isStartOfExpression())) {
|
||||
if (parseOptional(SyntaxKind.AsteriskToken)) {
|
||||
node.flags = NodeFlags.YieldStar;
|
||||
}
|
||||
|
||||
node.asteriskToken = parseOptionalToken(SyntaxKind.AsteriskToken);
|
||||
node.expression = parseAssignmentExpression();
|
||||
return finishNode(node);
|
||||
}
|
||||
@@ -2255,7 +2261,7 @@ module ts {
|
||||
}
|
||||
else {
|
||||
// If not, we're probably better off bailing out and returning a bogus function expression.
|
||||
return makeFunctionExpression(SyntaxKind.ArrowFunction, pos, /* name */ undefined, sig, createMissingNode());
|
||||
return makeFunctionExpression(SyntaxKind.ArrowFunction, pos, /*asteriskToken:*/ undefined, /*name:*/ undefined, sig, createMissingNode());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2395,7 +2401,7 @@ module ts {
|
||||
body = parseAssignmentExpression();
|
||||
}
|
||||
|
||||
return makeFunctionExpression(SyntaxKind.ArrowFunction, pos, /* name */ undefined, sig, body);
|
||||
return makeFunctionExpression(SyntaxKind.ArrowFunction, pos, /*asteriskToken:*/ undefined, /*name:*/ undefined, sig, body);
|
||||
}
|
||||
|
||||
function parseConditionalExpression(): Expression {
|
||||
@@ -2731,26 +2737,23 @@ module ts {
|
||||
|
||||
function parsePropertyAssignment(): Declaration {
|
||||
var nodePos = scanner.getStartPos();
|
||||
var isGenerator = parseOptional(SyntaxKind.AsteriskToken);
|
||||
var asteriskToken = parseOptionalToken(SyntaxKind.AsteriskToken);
|
||||
var tokenIsIdentifier = isIdentifier();
|
||||
var nameToken = token;
|
||||
var propertyName = parsePropertyName();
|
||||
var node: Declaration;
|
||||
if (isGenerator || token === SyntaxKind.OpenParenToken || token === SyntaxKind.LessThanToken) {
|
||||
if (asteriskToken || token === SyntaxKind.OpenParenToken || token === SyntaxKind.LessThanToken) {
|
||||
node = <PropertyDeclaration>createNode(SyntaxKind.PropertyAssignment, nodePos);
|
||||
node.name = propertyName;
|
||||
if (isGenerator) {
|
||||
node.flags |= NodeFlags.Generator;
|
||||
}
|
||||
var sig = parseSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false, /*yieldAndGeneratorParameterContext:*/ isGenerator);
|
||||
var sig = parseSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false, /*yieldAndGeneratorParameterContext:*/ !!asteriskToken);
|
||||
|
||||
var body = parseFunctionBlock(isGenerator, /* ignoreMissingOpenBrace */ false);
|
||||
var body = parseFunctionBlock(!!asteriskToken, /* ignoreMissingOpenBrace */ false);
|
||||
// do not propagate property name as name for function expression
|
||||
// for scenarios like
|
||||
// var x = 1;
|
||||
// var y = { x() { } }
|
||||
// otherwise this will bring y.x into the scope of x which is incorrect
|
||||
(<PropertyDeclaration>node).initializer = makeFunctionExpression(SyntaxKind.FunctionExpression, node.pos, undefined, sig, body);
|
||||
(<PropertyDeclaration>node).initializer = makeFunctionExpression(SyntaxKind.FunctionExpression, node.pos, asteriskToken, undefined, sig, body);
|
||||
return finishNode(node);
|
||||
}
|
||||
|
||||
@@ -2808,24 +2811,21 @@ module ts {
|
||||
|
||||
var pos = getNodePos();
|
||||
parseExpected(SyntaxKind.FunctionKeyword);
|
||||
var isGenerator = parseOptional(SyntaxKind.AsteriskToken);
|
||||
var name = isGenerator ? doInYieldContext(parseOptionalIdentifier) : parseOptionalIdentifier();
|
||||
var sig = parseSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false, /*yieldAndGeneratorParameterContext:*/ isGenerator);
|
||||
var asteriskToken = parseOptionalToken(SyntaxKind.AsteriskToken);
|
||||
var name = asteriskToken ? doInYieldContext(parseOptionalIdentifier) : parseOptionalIdentifier();
|
||||
var sig = parseSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false, /*yieldAndGeneratorParameterContext:*/ !!asteriskToken);
|
||||
|
||||
var body = parseFunctionBlock(/*allowYield:*/ isGenerator, /* ignoreMissingOpenBrace */ false);
|
||||
return makeFunctionExpression(SyntaxKind.FunctionExpression, pos, name, sig, body, isGenerator ? NodeFlags.Generator : undefined);
|
||||
var body = parseFunctionBlock(/*allowYield:*/ !!asteriskToken, /* ignoreMissingOpenBrace */ false);
|
||||
return makeFunctionExpression(SyntaxKind.FunctionExpression, pos, asteriskToken, name, sig, body);
|
||||
}
|
||||
|
||||
function parseOptionalIdentifier() {
|
||||
return isIdentifier() ? parseIdentifier() : undefined;
|
||||
}
|
||||
|
||||
function makeFunctionExpression(kind: SyntaxKind, pos: number, name: Identifier, sig: ParsedSignature, body: Node, flags?: NodeFlags): FunctionExpression {
|
||||
function makeFunctionExpression(kind: SyntaxKind, pos: number, asteriskToken: Node, name: Identifier, sig: ParsedSignature, body: Node): FunctionExpression {
|
||||
var node = <FunctionExpression>createNode(kind, pos);
|
||||
if (flags) {
|
||||
node.flags = flags;
|
||||
}
|
||||
|
||||
node.asteriskToken = asteriskToken;
|
||||
node.name = name;
|
||||
node.typeParameters = sig.typeParameters;
|
||||
node.parameters = sig.parameters;
|
||||
@@ -3292,14 +3292,10 @@ module ts {
|
||||
var node = <FunctionLikeDeclaration>createNode(SyntaxKind.FunctionDeclaration, fullStart);
|
||||
setModifiers(node, modifiers);
|
||||
parseExpected(SyntaxKind.FunctionKeyword);
|
||||
var isGenerator = parseOptional(SyntaxKind.AsteriskToken);
|
||||
if (isGenerator) {
|
||||
node.flags |= NodeFlags.Generator;
|
||||
}
|
||||
|
||||
node.asteriskToken = parseOptionalToken(SyntaxKind.AsteriskToken);
|
||||
node.name = parseIdentifier();
|
||||
fillSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false, /*yieldAndGeneratorParameterContext:*/ isGenerator, node);
|
||||
node.body = parseFunctionBlockOrSemicolon(isGenerator);
|
||||
fillSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false, /*yieldAndGeneratorParameterContext:*/ !!node.asteriskToken, node);
|
||||
node.body = parseFunctionBlockOrSemicolon(!!node.asteriskToken);
|
||||
return finishNode(node);
|
||||
}
|
||||
|
||||
@@ -3314,11 +3310,7 @@ module ts {
|
||||
|
||||
function parsePropertyMemberDeclaration(fullStart: number, modifiers: ModifiersArray): Declaration {
|
||||
var flags = modifiers ? modifiers.flags : 0;
|
||||
var isGenerator = parseOptional(SyntaxKind.AsteriskToken);
|
||||
if (isGenerator) {
|
||||
flags |= NodeFlags.Generator;
|
||||
}
|
||||
|
||||
var asteriskToken = parseOptionalToken(SyntaxKind.AsteriskToken);
|
||||
var name = parsePropertyName();
|
||||
if (parseOptional(SyntaxKind.QuestionToken)) {
|
||||
// Note: this is not legal as per the grammar. But we allow it in the parser and
|
||||
@@ -3326,15 +3318,16 @@ module ts {
|
||||
flags |= NodeFlags.QuestionMark;
|
||||
}
|
||||
|
||||
if (isGenerator || token === SyntaxKind.OpenParenToken || token === SyntaxKind.LessThanToken) {
|
||||
if (asteriskToken || token === SyntaxKind.OpenParenToken || token === SyntaxKind.LessThanToken) {
|
||||
var method = <MethodDeclaration>createNode(SyntaxKind.Method, fullStart);
|
||||
setModifiers(method, modifiers);
|
||||
if (flags) {
|
||||
method.flags = flags;
|
||||
}
|
||||
method.asteriskToken = asteriskToken;
|
||||
method.name = name;
|
||||
fillSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false, /*yieldAndGeneratorParameterContext:*/ isGenerator, method);
|
||||
method.body = parseFunctionBlockOrSemicolon(isGenerator);
|
||||
fillSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false, /*yieldAndGeneratorParameterContext:*/ !!asteriskToken, method);
|
||||
method.body = parseFunctionBlockOrSemicolon(!!asteriskToken);
|
||||
return finishNode(method);
|
||||
}
|
||||
else {
|
||||
@@ -4302,12 +4295,20 @@ module ts {
|
||||
function checkFunctionDeclaration(node: FunctionLikeDeclaration) {
|
||||
return checkAnyParsedSignature(node) ||
|
||||
checkFunctionName(node.name) ||
|
||||
checkForBodyInAmbientContext(node.body, /*isConstructor:*/ false);
|
||||
checkForBodyInAmbientContext(node.body, /*isConstructor:*/ false) ||
|
||||
checkForGenerator(node);
|
||||
}
|
||||
|
||||
function checkForGenerator(node: FunctionLikeDeclaration) {
|
||||
if (node.asteriskToken) {
|
||||
return grammarErrorOnNode(node.asteriskToken, Diagnostics.generators_are_not_currently_supported);
|
||||
}
|
||||
}
|
||||
|
||||
function checkFunctionExpression(node: FunctionExpression) {
|
||||
return checkAnyParsedSignature(node) ||
|
||||
checkFunctionName(node.name);
|
||||
checkFunctionName(node.name) ||
|
||||
checkForGenerator(node);
|
||||
}
|
||||
|
||||
function checkFunctionName(name: Node) {
|
||||
@@ -4386,7 +4387,8 @@ module ts {
|
||||
function checkMethod(node: MethodDeclaration) {
|
||||
return checkAnyParsedSignature(node) ||
|
||||
checkForBodyInAmbientContext(node.body, /*isConstructor:*/ false) ||
|
||||
(node.parent.kind === SyntaxKind.ClassDeclaration && checkForInvalidQuestionMark(node, Diagnostics.A_class_member_cannot_be_declared_optional));
|
||||
(node.parent.kind === SyntaxKind.ClassDeclaration && checkForInvalidQuestionMark(node, Diagnostics.A_class_member_cannot_be_declared_optional)) ||
|
||||
checkForGenerator(node);
|
||||
}
|
||||
|
||||
function checkForBodyInAmbientContext(body: Block | Expression, isConstructor: boolean): boolean {
|
||||
@@ -4963,6 +4965,7 @@ module ts {
|
||||
if (!(node.parserContextFlags & ParserContextFlags.Yield)) {
|
||||
return grammarErrorOnFirstToken(node, Diagnostics.yield_expression_must_be_contained_within_a_generator_declaration);
|
||||
}
|
||||
return grammarErrorOnFirstToken(node, Diagnostics.yield_expressions_are_not_currently_supported);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -367,7 +367,7 @@ module ts {
|
||||
}
|
||||
else {
|
||||
var emitStart = new Date().getTime();
|
||||
var emitOutput = checker.invokeEmitter();
|
||||
var emitOutput = checker.emitFiles();
|
||||
var emitErrors = emitOutput.diagnostics;
|
||||
exitStatus = emitOutput.emitResultStatus;
|
||||
var reportStart = new Date().getTime();
|
||||
|
||||
@@ -271,8 +271,6 @@ module ts {
|
||||
Let = 0x00000800, // Variable declaration
|
||||
Const = 0x00001000, // Variable declaration
|
||||
OctalLiteral = 0x00002000,
|
||||
Generator = 0x00004000,
|
||||
YieldStar = 0x00008000,
|
||||
|
||||
Modifier = Export | Ambient | Public | Private | Protected | Static,
|
||||
AccessibilityModifier = Public | Private | Protected,
|
||||
@@ -377,6 +375,7 @@ module ts {
|
||||
* FunctionExpression
|
||||
*/
|
||||
export interface FunctionLikeDeclaration extends Declaration, ParsedSignature {
|
||||
asteriskToken?: Node;
|
||||
body?: Block | Expression;
|
||||
}
|
||||
|
||||
@@ -442,6 +441,7 @@ module ts {
|
||||
}
|
||||
|
||||
export interface YieldExpression extends Expression {
|
||||
asteriskToken?: Node;
|
||||
expression: Expression;
|
||||
}
|
||||
|
||||
@@ -753,7 +753,7 @@ module ts {
|
||||
getSymbolCount(): number;
|
||||
getTypeCount(): number;
|
||||
checkProgram(): void;
|
||||
invokeEmitter(targetSourceFile?: SourceFile): EmitResult;
|
||||
emitFiles(targetSourceFile?: SourceFile): EmitResult;
|
||||
getParentOfSymbol(symbol: Symbol): Symbol;
|
||||
getNarrowedTypeOfSymbol(symbol: Symbol, node: Node): Type;
|
||||
getDeclaredTypeOfSymbol(symbol: Symbol): Type;
|
||||
|
||||
@@ -2223,7 +2223,7 @@ module FourSlash {
|
||||
if (errs.length > 0) {
|
||||
throw new Error('Error compiling ' + fileName + ': ' + errs.map(e => e.messageText).join('\r\n'));
|
||||
}
|
||||
checker.invokeEmitter();
|
||||
checker.emitFiles();
|
||||
result = result || ''; // Might have an empty fourslash file
|
||||
|
||||
// Compile and execute the test
|
||||
|
||||
@@ -806,7 +806,7 @@ module Harness {
|
||||
// only emit if there weren't parse errors
|
||||
var emitResult: ts.EmitResult;
|
||||
if (!isEmitBlocked) {
|
||||
emitResult = checker.invokeEmitter();
|
||||
emitResult = checker.emitFiles();
|
||||
}
|
||||
|
||||
var errors: HarnessDiagnostic[] = [];
|
||||
|
||||
@@ -132,7 +132,7 @@ class ProjectRunner extends RunnerBase {
|
||||
if (!errors.length) {
|
||||
var checker = program.getTypeChecker(/*fullTypeCheck*/ true);
|
||||
errors = checker.getDiagnostics();
|
||||
var emitResult = checker.invokeEmitter();
|
||||
var emitResult = checker.emitFiles();
|
||||
errors = ts.concatenate(errors, emitResult.diagnostics);
|
||||
sourceMapData = emitResult.sourceMaps;
|
||||
|
||||
|
||||
@@ -4642,7 +4642,7 @@ module ts {
|
||||
// Perform semantic and force a type check before emit to ensure that all symbols are updated
|
||||
// EmitFiles will report if there is an error from TypeChecker and Emitter
|
||||
// Depend whether we will have to emit into a single file or not either emit only selected file in the project, emit all files into a single file
|
||||
var emitFilesResult = getFullTypeCheckChecker().invokeEmitter(targetSourceFile);
|
||||
var emitFilesResult = getFullTypeCheckChecker().emitFiles(targetSourceFile);
|
||||
emitOutput.emitOutputStatus = emitFilesResult.emitResultStatus;
|
||||
|
||||
// Reset writer back to undefined to make sure that we produce an error message if CompilerHost.writeFile method is called when we are not in getEmitOutput
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration10_es6.ts(1,10): error TS9001: 'generators' are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration10_es6.ts (1 errors) ====
|
||||
function * foo(a = yield => yield) {
|
||||
~
|
||||
!!! error TS9001: 'generators' are not currently supported.
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
//// [FunctionDeclaration10_es6.ts]
|
||||
function * foo(a = yield => yield) {
|
||||
}
|
||||
|
||||
//// [FunctionDeclaration10_es6.js]
|
||||
function foo(a) {
|
||||
if (a === void 0) { a = function (yield) { return yield; }; }
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
=== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration10_es6.ts ===
|
||||
function * foo(a = yield => yield) {
|
||||
>foo : (a?: (yield: any) => any) => void
|
||||
>a : (yield: any) => any
|
||||
>yield => yield : (yield: any) => any
|
||||
>yield : any
|
||||
>yield : any
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration11_es6.ts(1,10): error TS9001: 'generators' are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration11_es6.ts (1 errors) ====
|
||||
function * yield() {
|
||||
~
|
||||
!!! error TS9001: 'generators' are not currently supported.
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
//// [FunctionDeclaration11_es6.ts]
|
||||
function * yield() {
|
||||
}
|
||||
|
||||
//// [FunctionDeclaration11_es6.js]
|
||||
function yield() {
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
=== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration11_es6.ts ===
|
||||
function * yield() {
|
||||
>yield : () => void
|
||||
}
|
||||
@@ -1,8 +1,11 @@
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration13_es6.ts(1,10): error TS9001: 'generators' are not currently supported.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration13_es6.ts(3,11): error TS2304: Cannot find name 'yield'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration13_es6.ts (1 errors) ====
|
||||
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration13_es6.ts (2 errors) ====
|
||||
function * foo() {
|
||||
~
|
||||
!!! error TS9001: 'generators' are not currently supported.
|
||||
// Legal to use 'yield' in a type context.
|
||||
var v: yield;
|
||||
~~~~~
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
//// [FunctionDeclaration13_es6.ts]
|
||||
function * foo() {
|
||||
// Legal to use 'yield' in a type context.
|
||||
var v: yield;
|
||||
}
|
||||
|
||||
|
||||
//// [FunctionDeclaration13_es6.js]
|
||||
function foo() {
|
||||
// Legal to use 'yield' in a type context.
|
||||
var v;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration1_es6.ts(1,10): error TS9001: 'generators' are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration1_es6.ts (1 errors) ====
|
||||
function * foo() {
|
||||
~
|
||||
!!! error TS9001: 'generators' are not currently supported.
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
//// [FunctionDeclaration1_es6.ts]
|
||||
function * foo() {
|
||||
}
|
||||
|
||||
//// [FunctionDeclaration1_es6.js]
|
||||
function foo() {
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
=== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration1_es6.ts ===
|
||||
function * foo() {
|
||||
>foo : () => void
|
||||
}
|
||||
@@ -1,8 +1,11 @@
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration6_es6.ts(1,9): error TS9001: 'generators' are not currently supported.
|
||||
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 errors) ====
|
||||
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration6_es6.ts (2 errors) ====
|
||||
function*foo(a = yield) {
|
||||
~
|
||||
!!! error TS9001: 'generators' are not currently supported.
|
||||
~~~~~
|
||||
!!! error TS2304: Cannot find name 'yield'.
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
//// [FunctionDeclaration6_es6.ts]
|
||||
function*foo(a = yield) {
|
||||
}
|
||||
|
||||
//// [FunctionDeclaration6_es6.js]
|
||||
function foo(a) {
|
||||
if (a === void 0) { a = yield; }
|
||||
}
|
||||
@@ -1,8 +1,11 @@
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts(1,9): error TS9001: 'generators' are not currently supported.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts(3,20): error TS2304: Cannot find name 'yield'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts (1 errors) ====
|
||||
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts (2 errors) ====
|
||||
function*bar() {
|
||||
~
|
||||
!!! error TS9001: 'generators' are not currently supported.
|
||||
// 'yield' here is an identifier, and not a yield expression.
|
||||
function*foo(a = yield) {
|
||||
~~~~~
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
//// [FunctionDeclaration7_es6.ts]
|
||||
function*bar() {
|
||||
// 'yield' here is an identifier, and not a yield expression.
|
||||
function*foo(a = yield) {
|
||||
}
|
||||
}
|
||||
|
||||
//// [FunctionDeclaration7_es6.js]
|
||||
function bar() {
|
||||
// 'yield' here is an identifier, and not a yield expression.
|
||||
function foo(a) {
|
||||
if (a === void 0) { a = yield; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
tests/cases/conformance/es6/functionExpressions/FunctionExpression1_es6.ts(1,18): error TS9001: 'generators' are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/functionExpressions/FunctionExpression1_es6.ts (1 errors) ====
|
||||
var v = function * () { }
|
||||
~
|
||||
!!! error TS9001: 'generators' are not currently supported.
|
||||
@@ -1,6 +0,0 @@
|
||||
//// [FunctionExpression1_es6.ts]
|
||||
var v = function * () { }
|
||||
|
||||
//// [FunctionExpression1_es6.js]
|
||||
var v = function () {
|
||||
};
|
||||
@@ -1,5 +0,0 @@
|
||||
=== tests/cases/conformance/es6/functionExpressions/FunctionExpression1_es6.ts ===
|
||||
var v = function * () { }
|
||||
>v : () => void
|
||||
>function * () { } : () => void
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
tests/cases/conformance/es6/functionExpressions/FunctionExpression2_es6.ts(1,18): error TS9001: 'generators' are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/functionExpressions/FunctionExpression2_es6.ts (1 errors) ====
|
||||
var v = function * foo() { }
|
||||
~
|
||||
!!! error TS9001: 'generators' are not currently supported.
|
||||
@@ -1,6 +0,0 @@
|
||||
//// [FunctionExpression2_es6.ts]
|
||||
var v = function * foo() { }
|
||||
|
||||
//// [FunctionExpression2_es6.js]
|
||||
var v = function foo() {
|
||||
};
|
||||
@@ -1,6 +0,0 @@
|
||||
=== tests/cases/conformance/es6/functionExpressions/FunctionExpression2_es6.ts ===
|
||||
var v = function * foo() { }
|
||||
>v : () => void
|
||||
>function * foo() { } : () => void
|
||||
>foo : () => void
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments1_es6.ts(1,11): error TS9001: 'generators' are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments1_es6.ts (1 errors) ====
|
||||
var v = { *foo() { } }
|
||||
~
|
||||
!!! error TS9001: 'generators' are not currently supported.
|
||||
@@ -1,6 +0,0 @@
|
||||
//// [FunctionPropertyAssignments1_es6.ts]
|
||||
var v = { *foo() { } }
|
||||
|
||||
//// [FunctionPropertyAssignments1_es6.js]
|
||||
var v = { foo: function () {
|
||||
} };
|
||||
@@ -1,7 +0,0 @@
|
||||
=== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments1_es6.ts ===
|
||||
var v = { *foo() { } }
|
||||
>v : { foo: () => void; }
|
||||
>{ *foo() { } } : { foo: () => void; }
|
||||
>foo : () => void
|
||||
>*foo() { } : () => void
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration1_es6.ts(2,4): error TS9001: 'generators' are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration1_es6.ts (1 errors) ====
|
||||
class C {
|
||||
*foo() { }
|
||||
~
|
||||
!!! error TS9001: 'generators' are not currently supported.
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
//// [MemberFunctionDeclaration1_es6.ts]
|
||||
class C {
|
||||
*foo() { }
|
||||
}
|
||||
|
||||
//// [MemberFunctionDeclaration1_es6.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.foo = function () {
|
||||
};
|
||||
return C;
|
||||
})();
|
||||
@@ -1,7 +0,0 @@
|
||||
=== tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration1_es6.ts ===
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
*foo() { }
|
||||
>foo : () => void
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration2_es6.ts(2,11): error TS9001: 'generators' are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration2_es6.ts (1 errors) ====
|
||||
class C {
|
||||
public * foo() { }
|
||||
~
|
||||
!!! error TS9001: 'generators' are not currently supported.
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
//// [MemberFunctionDeclaration2_es6.ts]
|
||||
class C {
|
||||
public * foo() { }
|
||||
}
|
||||
|
||||
//// [MemberFunctionDeclaration2_es6.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.foo = function () {
|
||||
};
|
||||
return C;
|
||||
})();
|
||||
@@ -1,7 +0,0 @@
|
||||
=== tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration2_es6.ts ===
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
public * foo() { }
|
||||
>foo : () => void
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration7_es6.ts(2,4): error TS9001: 'generators' are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration7_es6.ts (1 errors) ====
|
||||
class C {
|
||||
*foo<T>() { }
|
||||
~
|
||||
!!! error TS9001: 'generators' are not currently supported.
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
//// [MemberFunctionDeclaration7_es6.ts]
|
||||
class C {
|
||||
*foo<T>() { }
|
||||
}
|
||||
|
||||
//// [MemberFunctionDeclaration7_es6.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.foo = function () {
|
||||
};
|
||||
return C;
|
||||
})();
|
||||
@@ -1,8 +0,0 @@
|
||||
=== tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration7_es6.ts ===
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
*foo<T>() { }
|
||||
>foo : <T>() => void
|
||||
>T : T
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression10_es6.ts(1,11): error TS9001: 'generators' are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression10_es6.ts (1 errors) ====
|
||||
var v = { * foo() {
|
||||
~
|
||||
!!! error TS9001: 'generators' are not currently supported.
|
||||
yield(foo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
//// [YieldExpression10_es6.ts]
|
||||
var v = { * foo() {
|
||||
yield(foo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//// [YieldExpression10_es6.js]
|
||||
var v = { foo: function () {
|
||||
;
|
||||
} };
|
||||
@@ -1,11 +0,0 @@
|
||||
=== tests/cases/conformance/es6/yieldExpressions/YieldExpression10_es6.ts ===
|
||||
var v = { * foo() {
|
||||
>v : { foo: () => void; }
|
||||
>{ * foo() { yield(foo); }} : { foo: () => void; }
|
||||
>foo : () => void
|
||||
>* foo() { yield(foo); } : () => void
|
||||
|
||||
yield(foo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression11_es6.ts(2,3): error TS9001: 'generators' are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression11_es6.ts (1 errors) ====
|
||||
class C {
|
||||
*foo() {
|
||||
~
|
||||
!!! error TS9001: 'generators' are not currently supported.
|
||||
yield(foo);
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
//// [YieldExpression11_es6.ts]
|
||||
class C {
|
||||
*foo() {
|
||||
yield(foo);
|
||||
}
|
||||
}
|
||||
|
||||
//// [YieldExpression11_es6.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.foo = function () {
|
||||
;
|
||||
};
|
||||
return C;
|
||||
})();
|
||||
@@ -1,10 +0,0 @@
|
||||
=== tests/cases/conformance/es6/yieldExpressions/YieldExpression11_es6.ts ===
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
*foo() {
|
||||
>foo : () => void
|
||||
|
||||
yield(foo);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression13_es6.ts(1,9): error TS9001: 'generators' are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression13_es6.ts (1 errors) ====
|
||||
function* foo() { yield }
|
||||
~
|
||||
!!! error TS9001: 'generators' are not currently supported.
|
||||
@@ -1,7 +0,0 @@
|
||||
//// [YieldExpression13_es6.ts]
|
||||
function* foo() { yield }
|
||||
|
||||
//// [YieldExpression13_es6.js]
|
||||
function foo() {
|
||||
;
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
=== tests/cases/conformance/es6/yieldExpressions/YieldExpression13_es6.ts ===
|
||||
function* foo() { yield }
|
||||
>foo : () => void
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression16_es6.ts(3,5): error TS1163: 'yield' expression must be contained_within a generator declaration.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression16_es6.ts(1,9): error TS9001: 'generators' are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression16_es6.ts (1 errors) ====
|
||||
function* foo() {
|
||||
~
|
||||
!!! error TS9001: 'generators' are not currently supported.
|
||||
function bar() {
|
||||
yield foo;
|
||||
~~~~~
|
||||
!!! error TS1163: 'yield' expression must be contained_within a generator declaration.
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression19_es6.ts(1,9): error TS9001: 'generators' are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression19_es6.ts (1 errors) ====
|
||||
function*foo() {
|
||||
~
|
||||
!!! error TS9001: 'generators' are not currently supported.
|
||||
function bar() {
|
||||
function* quux() {
|
||||
yield(foo);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
//// [YieldExpression19_es6.ts]
|
||||
function*foo() {
|
||||
function bar() {
|
||||
function* quux() {
|
||||
yield(foo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//// [YieldExpression19_es6.js]
|
||||
function foo() {
|
||||
function bar() {
|
||||
function quux() {
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
=== tests/cases/conformance/es6/yieldExpressions/YieldExpression19_es6.ts ===
|
||||
function*foo() {
|
||||
>foo : () => void
|
||||
|
||||
function bar() {
|
||||
>bar : () => void
|
||||
|
||||
function* quux() {
|
||||
>quux : () => void
|
||||
|
||||
yield(foo);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression3_es6.ts(1,9): error TS9001: 'generators' are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression3_es6.ts (1 errors) ====
|
||||
function* foo() {
|
||||
~
|
||||
!!! error TS9001: 'generators' are not currently supported.
|
||||
yield
|
||||
yield
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
//// [YieldExpression3_es6.ts]
|
||||
function* foo() {
|
||||
yield
|
||||
yield
|
||||
}
|
||||
|
||||
//// [YieldExpression3_es6.js]
|
||||
function foo() {
|
||||
;
|
||||
;
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
=== tests/cases/conformance/es6/yieldExpressions/YieldExpression3_es6.ts ===
|
||||
function* foo() {
|
||||
>foo : () => void
|
||||
|
||||
yield
|
||||
yield
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression4_es6.ts(1,9): error TS9001: 'generators' are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression4_es6.ts (1 errors) ====
|
||||
function* foo() {
|
||||
~
|
||||
!!! error TS9001: 'generators' are not currently supported.
|
||||
yield;
|
||||
yield;
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
//// [YieldExpression4_es6.ts]
|
||||
function* foo() {
|
||||
yield;
|
||||
yield;
|
||||
}
|
||||
|
||||
//// [YieldExpression4_es6.js]
|
||||
function foo() {
|
||||
;
|
||||
;
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
=== tests/cases/conformance/es6/yieldExpressions/YieldExpression4_es6.ts ===
|
||||
function* foo() {
|
||||
>foo : () => void
|
||||
|
||||
yield;
|
||||
yield;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression6_es6.ts(1,9): error TS9001: 'generators' are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression6_es6.ts (1 errors) ====
|
||||
function* foo() {
|
||||
~
|
||||
!!! error TS9001: 'generators' are not currently supported.
|
||||
yield*foo
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
//// [YieldExpression6_es6.ts]
|
||||
function* foo() {
|
||||
yield*foo
|
||||
}
|
||||
|
||||
//// [YieldExpression6_es6.js]
|
||||
function foo() {
|
||||
;
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
=== tests/cases/conformance/es6/yieldExpressions/YieldExpression6_es6.ts ===
|
||||
function* foo() {
|
||||
>foo : () => void
|
||||
|
||||
yield*foo
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression7_es6.ts(1,9): error TS9001: 'generators' are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression7_es6.ts (1 errors) ====
|
||||
function* foo() {
|
||||
~
|
||||
!!! error TS9001: 'generators' are not currently supported.
|
||||
yield foo
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
//// [YieldExpression7_es6.ts]
|
||||
function* foo() {
|
||||
yield foo
|
||||
}
|
||||
|
||||
//// [YieldExpression7_es6.js]
|
||||
function foo() {
|
||||
;
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
=== tests/cases/conformance/es6/yieldExpressions/YieldExpression7_es6.ts ===
|
||||
function* foo() {
|
||||
>foo : () => void
|
||||
|
||||
yield foo
|
||||
}
|
||||
@@ -1,10 +1,13 @@
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression8_es6.ts(2,9): error TS9001: 'generators' are not currently supported.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression8_es6.ts(1,1): error TS2304: Cannot find name 'yield'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression8_es6.ts (1 errors) ====
|
||||
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression8_es6.ts (2 errors) ====
|
||||
yield(foo);
|
||||
~~~~~
|
||||
!!! error TS2304: Cannot find name 'yield'.
|
||||
function* foo() {
|
||||
~
|
||||
!!! error TS9001: 'generators' are not currently supported.
|
||||
yield(foo);
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
//// [YieldExpression8_es6.ts]
|
||||
yield(foo);
|
||||
function* foo() {
|
||||
yield(foo);
|
||||
}
|
||||
|
||||
//// [YieldExpression8_es6.js]
|
||||
yield(foo);
|
||||
function foo() {
|
||||
;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression9_es6.ts(1,17): error TS9001: 'generators' are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression9_es6.ts (1 errors) ====
|
||||
var v = function*() {
|
||||
~
|
||||
!!! error TS9001: 'generators' are not currently supported.
|
||||
yield(foo);
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
//// [YieldExpression9_es6.ts]
|
||||
var v = function*() {
|
||||
yield(foo);
|
||||
}
|
||||
|
||||
//// [YieldExpression9_es6.js]
|
||||
var v = function () {
|
||||
;
|
||||
};
|
||||
@@ -1,7 +0,0 @@
|
||||
=== tests/cases/conformance/es6/yieldExpressions/YieldExpression9_es6.ts ===
|
||||
var v = function*() {
|
||||
>v : () => void
|
||||
>function*() { yield(foo);} : () => void
|
||||
|
||||
yield(foo);
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
tests/cases/compiler/defaultArgsForwardReferencing.ts(6,20): error TS2373: Initializer of parameter 'a' cannot reference identifier 'b' declared after it.
|
||||
tests/cases/compiler/defaultArgsForwardReferencing.ts(11,21): error TS2373: Initializer of parameter 'a' cannot reference identifier 'b' declared after it.
|
||||
tests/cases/compiler/defaultArgsForwardReferencing.ts(11,28): error TS2373: Initializer of parameter 'b' cannot reference identifier 'c' declared after it.
|
||||
tests/cases/compiler/defaultArgsForwardReferencing.ts(17,21): error TS2373: Initializer of parameter 'a' cannot reference identifier 'b' declared after it.
|
||||
tests/cases/compiler/defaultArgsForwardReferencing.ts(23,25): error TS2373: Initializer of parameter 'a' cannot reference identifier 'b' declared after it.
|
||||
tests/cases/compiler/defaultArgsForwardReferencing.ts(32,21): error TS2373: Initializer of parameter 'a' cannot reference identifier 'b' declared after it.
|
||||
tests/cases/compiler/defaultArgsForwardReferencing.ts(33,16): error TS2373: Initializer of parameter 'a' cannot reference identifier 'b' declared after it.
|
||||
tests/cases/compiler/defaultArgsForwardReferencing.ts(37,14): error TS2373: Initializer of parameter 'a' cannot reference identifier 'b' declared after it.
|
||||
tests/cases/compiler/defaultArgsForwardReferencing.ts(37,21): error TS2373: Initializer of parameter 'b' cannot reference identifier 'c' declared after it.
|
||||
tests/cases/compiler/defaultArgsForwardReferencing.ts(37,28): error TS2373: Initializer of parameter 'c' cannot reference identifier 'd' declared after it.
|
||||
|
||||
|
||||
==== tests/cases/compiler/defaultArgsForwardReferencing.ts (10 errors) ====
|
||||
function left(a, b = a, c = b) {
|
||||
a;
|
||||
b;
|
||||
}
|
||||
|
||||
function right(a = b, b = a) {
|
||||
~
|
||||
!!! error TS2373: Initializer of parameter 'a' cannot reference identifier 'b' declared after it.
|
||||
a;
|
||||
b;
|
||||
}
|
||||
|
||||
function right2(a = b, b = c, c = a) {
|
||||
~
|
||||
!!! error TS2373: Initializer of parameter 'a' cannot reference identifier 'b' declared after it.
|
||||
~
|
||||
!!! error TS2373: Initializer of parameter 'b' cannot reference identifier 'c' declared after it.
|
||||
a;
|
||||
b;
|
||||
c;
|
||||
}
|
||||
|
||||
function inside(a = b) {
|
||||
~
|
||||
!!! error TS2373: Initializer of parameter 'a' cannot reference identifier 'b' declared after it.
|
||||
var b;
|
||||
}
|
||||
|
||||
function outside() {
|
||||
var b;
|
||||
function inside(a = b) { // Still an error because b is declared inside the function
|
||||
~
|
||||
!!! error TS2373: Initializer of parameter 'a' cannot reference identifier 'b' declared after it.
|
||||
var b;
|
||||
}
|
||||
}
|
||||
|
||||
function defaultArgFunction(a = function () { return b; }, b = 1) { }
|
||||
function defaultArgArrow(a = () => () => b, b = 3) { }
|
||||
|
||||
class C {
|
||||
constructor(a = b, b = 1) { }
|
||||
~
|
||||
!!! error TS2373: Initializer of parameter 'a' cannot reference identifier 'b' declared after it.
|
||||
method(a = b, b = 1) { }
|
||||
~
|
||||
!!! error TS2373: Initializer of parameter 'a' cannot reference identifier 'b' declared after it.
|
||||
}
|
||||
|
||||
// Function expressions
|
||||
var x = (a = b, b = c, c = d) => { var d; };
|
||||
~
|
||||
!!! error TS2373: Initializer of parameter 'a' cannot reference identifier 'b' declared after it.
|
||||
~
|
||||
!!! error TS2373: Initializer of parameter 'b' cannot reference identifier 'c' declared after it.
|
||||
~
|
||||
!!! error TS2373: Initializer of parameter 'c' cannot reference identifier 'd' declared after it.
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallToOverloadedMethodWithOverloadedArguments.ts(24,38): error TS2345: Argument of type '{ (n: number): Promise<number>; (s: string): Promise<string>; }' is not assignable to parameter of type '(x: number) => Promise<string>'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallToOverloadedMethodWithOverloadedArguments.ts(53,38): error TS2345: Argument of type '{ (n: number): Promise<number>; (s: string): Promise<string>; }' is not assignable to parameter of type '(x: number) => Promise<string>'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallToOverloadedMethodWithOverloadedArguments.ts(69,38): error TS2345: Argument of type '{ (n: number): Promise<number>; (s: string): Promise<string>; }' is not assignable to parameter of type '(x: number) => Promise<string>'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallToOverloadedMethodWithOverloadedArguments.ts(85,38): error TS2345: Argument of type '{ (n: number): Promise<number>; (s: string): Promise<string>; (b: boolean): Promise<boolean>; }' is not assignable to parameter of type '(x: number) => Promise<boolean>'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallToOverloadedMethodWithOverloadedArguments.ts (4 errors) ====
|
||||
|
||||
module m1 {
|
||||
interface Promise<T> {
|
||||
then<U>(cb: (x: T) => Promise<U>): Promise<U>;
|
||||
}
|
||||
|
||||
declare function testFunction(n: number): Promise<number>;
|
||||
|
||||
var numPromise: Promise<number>;
|
||||
var newPromise = numPromise.then(testFunction);
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
|
||||
module m2 {
|
||||
interface Promise<T> {
|
||||
then<U>(cb: (x: T) => Promise<U>): Promise<U>;
|
||||
}
|
||||
|
||||
declare function testFunction(n: number): Promise<number>;
|
||||
declare function testFunction(s: string): Promise<string>;
|
||||
|
||||
var numPromise: Promise<number>;
|
||||
var newPromise = numPromise.then(testFunction);
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '{ (n: number): Promise<number>; (s: string): Promise<string>; }' is not assignable to parameter of type '(x: number) => Promise<string>'.
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
|
||||
module m3 {
|
||||
interface Promise<T> {
|
||||
then<U>(cb: (x: T) => Promise<U>): Promise<U>;
|
||||
then<U>(cb: (x: T) => Promise<U>, error?: (error: any) => Promise<U>): Promise<U>;
|
||||
}
|
||||
|
||||
declare function testFunction(n: number): Promise<number>;
|
||||
|
||||
var numPromise: Promise<number>;
|
||||
var newPromise = numPromise.then(testFunction);
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
|
||||
module m4 {
|
||||
interface Promise<T> {
|
||||
then<U>(cb: (x: T) => Promise<U>): Promise<U>;
|
||||
then<U>(cb: (x: T) => Promise<U>, error?: (error: any) => Promise<U>): Promise<U>;
|
||||
}
|
||||
|
||||
declare function testFunction(n: number): Promise<number>;
|
||||
declare function testFunction(s: string): Promise<string>;
|
||||
|
||||
var numPromise: Promise<number>;
|
||||
var newPromise = numPromise.then(testFunction);
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '{ (n: number): Promise<number>; (s: string): Promise<string>; }' is not assignable to parameter of type '(x: number) => Promise<string>'.
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
|
||||
module m5 {
|
||||
interface Promise<T> {
|
||||
then<U>(cb: (x: T) => Promise<U>): Promise<U>;
|
||||
then<U>(cb: (x: T) => Promise<U>, error?: (error: any) => Promise<U>): Promise<U>;
|
||||
then<U>(cb: (x: T) => Promise<U>, error?: (error: any) => U, progress?: (preservation: any) => void): Promise<U>;
|
||||
}
|
||||
|
||||
declare function testFunction(n: number): Promise<number>;
|
||||
declare function testFunction(s: string): Promise<string>;
|
||||
|
||||
var numPromise: Promise<number>;
|
||||
var newPromise = numPromise.then(testFunction);
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '{ (n: number): Promise<number>; (s: string): Promise<string>; }' is not assignable to parameter of type '(x: number) => Promise<string>'.
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
|
||||
module m6 {
|
||||
interface Promise<T> {
|
||||
then<U>(cb: (x: T) => Promise<U>): Promise<U>;
|
||||
then<U>(cb: (x: T) => Promise<U>, error?: (error: any) => Promise<U>): Promise<U>;
|
||||
}
|
||||
|
||||
declare function testFunction(n: number): Promise<number>;
|
||||
declare function testFunction(s: string): Promise<string>;
|
||||
declare function testFunction(b: boolean): Promise<boolean>;
|
||||
|
||||
var numPromise: Promise<number>;
|
||||
var newPromise = numPromise.then(testFunction);
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '{ (n: number): Promise<number>; (s: string): Promise<string>; (b: boolean): Promise<boolean>; }' is not assignable to parameter of type '(x: number) => Promise<boolean>'.
|
||||
}
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
//// [genericCallToOverloadedMethodWithOverloadedArguments.ts]
|
||||
|
||||
module m1 {
|
||||
interface Promise<T> {
|
||||
then<U>(cb: (x: T) => Promise<U>): Promise<U>;
|
||||
}
|
||||
|
||||
declare function testFunction(n: number): Promise<number>;
|
||||
|
||||
var numPromise: Promise<number>;
|
||||
var newPromise = numPromise.then(testFunction);
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
|
||||
module m2 {
|
||||
interface Promise<T> {
|
||||
then<U>(cb: (x: T) => Promise<U>): Promise<U>;
|
||||
}
|
||||
|
||||
declare function testFunction(n: number): Promise<number>;
|
||||
declare function testFunction(s: string): Promise<string>;
|
||||
|
||||
var numPromise: Promise<number>;
|
||||
var newPromise = numPromise.then(testFunction);
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
|
||||
module m3 {
|
||||
interface Promise<T> {
|
||||
then<U>(cb: (x: T) => Promise<U>): Promise<U>;
|
||||
then<U>(cb: (x: T) => Promise<U>, error?: (error: any) => Promise<U>): Promise<U>;
|
||||
}
|
||||
|
||||
declare function testFunction(n: number): Promise<number>;
|
||||
|
||||
var numPromise: Promise<number>;
|
||||
var newPromise = numPromise.then(testFunction);
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
|
||||
module m4 {
|
||||
interface Promise<T> {
|
||||
then<U>(cb: (x: T) => Promise<U>): Promise<U>;
|
||||
then<U>(cb: (x: T) => Promise<U>, error?: (error: any) => Promise<U>): Promise<U>;
|
||||
}
|
||||
|
||||
declare function testFunction(n: number): Promise<number>;
|
||||
declare function testFunction(s: string): Promise<string>;
|
||||
|
||||
var numPromise: Promise<number>;
|
||||
var newPromise = numPromise.then(testFunction);
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
|
||||
module m5 {
|
||||
interface Promise<T> {
|
||||
then<U>(cb: (x: T) => Promise<U>): Promise<U>;
|
||||
then<U>(cb: (x: T) => Promise<U>, error?: (error: any) => Promise<U>): Promise<U>;
|
||||
then<U>(cb: (x: T) => Promise<U>, error?: (error: any) => U, progress?: (preservation: any) => void): Promise<U>;
|
||||
}
|
||||
|
||||
declare function testFunction(n: number): Promise<number>;
|
||||
declare function testFunction(s: string): Promise<string>;
|
||||
|
||||
var numPromise: Promise<number>;
|
||||
var newPromise = numPromise.then(testFunction);
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
|
||||
module m6 {
|
||||
interface Promise<T> {
|
||||
then<U>(cb: (x: T) => Promise<U>): Promise<U>;
|
||||
then<U>(cb: (x: T) => Promise<U>, error?: (error: any) => Promise<U>): Promise<U>;
|
||||
}
|
||||
|
||||
declare function testFunction(n: number): Promise<number>;
|
||||
declare function testFunction(s: string): Promise<string>;
|
||||
declare function testFunction(b: boolean): Promise<boolean>;
|
||||
|
||||
var numPromise: Promise<number>;
|
||||
var newPromise = numPromise.then(testFunction);
|
||||
}
|
||||
|
||||
|
||||
//// [genericCallToOverloadedMethodWithOverloadedArguments.js]
|
||||
var m1;
|
||||
(function (m1) {
|
||||
var numPromise;
|
||||
var newPromise = numPromise.then(testFunction);
|
||||
})(m1 || (m1 = {}));
|
||||
//////////////////////////////////////
|
||||
var m2;
|
||||
(function (m2) {
|
||||
var numPromise;
|
||||
var newPromise = numPromise.then(testFunction);
|
||||
})(m2 || (m2 = {}));
|
||||
//////////////////////////////////////
|
||||
var m3;
|
||||
(function (m3) {
|
||||
var numPromise;
|
||||
var newPromise = numPromise.then(testFunction);
|
||||
})(m3 || (m3 = {}));
|
||||
//////////////////////////////////////
|
||||
var m4;
|
||||
(function (m4) {
|
||||
var numPromise;
|
||||
var newPromise = numPromise.then(testFunction);
|
||||
})(m4 || (m4 = {}));
|
||||
//////////////////////////////////////
|
||||
var m5;
|
||||
(function (m5) {
|
||||
var numPromise;
|
||||
var newPromise = numPromise.then(testFunction);
|
||||
})(m5 || (m5 = {}));
|
||||
//////////////////////////////////////
|
||||
var m6;
|
||||
(function (m6) {
|
||||
var numPromise;
|
||||
var newPromise = numPromise.then(testFunction);
|
||||
})(m6 || (m6 = {}));
|
||||
@@ -22,6 +22,10 @@ module A {
|
||||
return 'hello ' + s;
|
||||
}
|
||||
var ol = { s: 'hello', id: 2, isvalid: true };
|
||||
|
||||
declare class DC {
|
||||
static x: number;
|
||||
}
|
||||
}
|
||||
|
||||
module Y {
|
||||
@@ -47,6 +51,10 @@ module Y {
|
||||
return 'hello ' + s;
|
||||
}
|
||||
export var ol = { s: 'hello', id: 2, isvalid: true };
|
||||
|
||||
export declare class DC {
|
||||
static x: number;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -71,6 +71,13 @@ module A {
|
||||
>s : string
|
||||
>id : number
|
||||
>isvalid : boolean
|
||||
|
||||
declare class DC {
|
||||
>DC : DC
|
||||
|
||||
static x: number;
|
||||
>x : number
|
||||
}
|
||||
}
|
||||
|
||||
module Y {
|
||||
@@ -145,5 +152,12 @@ module Y {
|
||||
>s : string
|
||||
>id : number
|
||||
>isvalid : boolean
|
||||
|
||||
export declare class DC {
|
||||
>DC : DC
|
||||
|
||||
static x: number;
|
||||
>x : number
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
tests/cases/conformance/functions/parameterInitializersForwardReferencing.ts(6,20): error TS2373: Initializer of parameter 'a' cannot reference identifier 'b' declared after it.
|
||||
tests/cases/conformance/functions/parameterInitializersForwardReferencing.ts(11,21): error TS2373: Initializer of parameter 'a' cannot reference identifier 'b' declared after it.
|
||||
tests/cases/conformance/functions/parameterInitializersForwardReferencing.ts(11,28): error TS2373: Initializer of parameter 'b' cannot reference identifier 'c' declared after it.
|
||||
tests/cases/conformance/functions/parameterInitializersForwardReferencing.ts(17,21): error TS2373: Initializer of parameter 'a' cannot reference identifier 'b' declared after it.
|
||||
tests/cases/conformance/functions/parameterInitializersForwardReferencing.ts(23,25): error TS2373: Initializer of parameter 'a' cannot reference identifier 'b' declared after it.
|
||||
tests/cases/conformance/functions/parameterInitializersForwardReferencing.ts(32,21): error TS2373: Initializer of parameter 'a' cannot reference identifier 'b' declared after it.
|
||||
tests/cases/conformance/functions/parameterInitializersForwardReferencing.ts(33,16): error TS2373: Initializer of parameter 'a' cannot reference identifier 'b' declared after it.
|
||||
tests/cases/conformance/functions/parameterInitializersForwardReferencing.ts(37,14): error TS2373: Initializer of parameter 'a' cannot reference identifier 'b' declared after it.
|
||||
tests/cases/conformance/functions/parameterInitializersForwardReferencing.ts(37,21): error TS2373: Initializer of parameter 'b' cannot reference identifier 'c' declared after it.
|
||||
tests/cases/conformance/functions/parameterInitializersForwardReferencing.ts(37,28): error TS2373: Initializer of parameter 'c' cannot reference identifier 'd' declared after it.
|
||||
|
||||
|
||||
==== tests/cases/conformance/functions/parameterInitializersForwardReferencing.ts (10 errors) ====
|
||||
function left(a, b = a, c = b) {
|
||||
a;
|
||||
b;
|
||||
}
|
||||
|
||||
function right(a = b, b = a) {
|
||||
~
|
||||
!!! error TS2373: Initializer of parameter 'a' cannot reference identifier 'b' declared after it.
|
||||
a;
|
||||
b;
|
||||
}
|
||||
|
||||
function right2(a = b, b = c, c = a) {
|
||||
~
|
||||
!!! error TS2373: Initializer of parameter 'a' cannot reference identifier 'b' declared after it.
|
||||
~
|
||||
!!! error TS2373: Initializer of parameter 'b' cannot reference identifier 'c' declared after it.
|
||||
a;
|
||||
b;
|
||||
c;
|
||||
}
|
||||
|
||||
function inside(a = b) {
|
||||
~
|
||||
!!! error TS2373: Initializer of parameter 'a' cannot reference identifier 'b' declared after it.
|
||||
var b;
|
||||
}
|
||||
|
||||
function outside() {
|
||||
var b;
|
||||
function inside(a = b) { // Still an error because b is declared inside the function
|
||||
~
|
||||
!!! error TS2373: Initializer of parameter 'a' cannot reference identifier 'b' declared after it.
|
||||
var b;
|
||||
}
|
||||
}
|
||||
|
||||
function defaultArgFunction(a = function () { return b; }, b = 1) { }
|
||||
function defaultArgArrow(a = () => () => b, b = 3) { }
|
||||
|
||||
class C {
|
||||
constructor(a = b, b = 1) { }
|
||||
~
|
||||
!!! error TS2373: Initializer of parameter 'a' cannot reference identifier 'b' declared after it.
|
||||
method(a = b, b = 1) { }
|
||||
~
|
||||
!!! error TS2373: Initializer of parameter 'a' cannot reference identifier 'b' declared after it.
|
||||
}
|
||||
|
||||
// Function expressions
|
||||
var x = (a = b, b = c, c = d) => { var d; };
|
||||
~
|
||||
!!! error TS2373: Initializer of parameter 'a' cannot reference identifier 'b' declared after it.
|
||||
~
|
||||
!!! error TS2373: Initializer of parameter 'b' cannot reference identifier 'c' declared after it.
|
||||
~
|
||||
!!! error TS2373: Initializer of parameter 'c' cannot reference identifier 'd' declared after it.
|
||||
|
||||
// Should not produce errors - can reference later parameters if they occur within a function expression initializer.
|
||||
function f(a, b = function () { return c; }, c = b()) {
|
||||
}
|
||||
+14
-3
@@ -1,4 +1,4 @@
|
||||
//// [defaultArgsForwardReferencing.ts]
|
||||
//// [parameterInitializersForwardReferencing.ts]
|
||||
function left(a, b = a, c = b) {
|
||||
a;
|
||||
b;
|
||||
@@ -35,9 +35,13 @@ class C {
|
||||
}
|
||||
|
||||
// Function expressions
|
||||
var x = (a = b, b = c, c = d) => { var d; };
|
||||
var x = (a = b, b = c, c = d) => { var d; };
|
||||
|
||||
// Should not produce errors - can reference later parameters if they occur within a function expression initializer.
|
||||
function f(a, b = function () { return c; }, c = b()) {
|
||||
}
|
||||
|
||||
//// [defaultArgsForwardReferencing.js]
|
||||
//// [parameterInitializersForwardReferencing.js]
|
||||
function left(a, b, c) {
|
||||
if (b === void 0) { b = a; }
|
||||
if (c === void 0) { c = b; }
|
||||
@@ -97,3 +101,10 @@ var x = function (a, b, c) {
|
||||
if (c === void 0) { c = d; }
|
||||
var d;
|
||||
};
|
||||
// Should not produce errors - can reference later parameters if they occur within a function expression initializer.
|
||||
function f(a, b, c) {
|
||||
if (b === void 0) { b = function () {
|
||||
return c;
|
||||
}; }
|
||||
if (c === void 0) { c = b(); }
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
tests/cases/conformance/es6/templates/templateStringInYieldKeyword.ts(1,9): error TS9001: 'generators' are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/templates/templateStringInYieldKeyword.ts (1 errors) ====
|
||||
function* gen() {
|
||||
~
|
||||
!!! error TS9001: 'generators' are not currently supported.
|
||||
// Once this is supported, the inner expression does not need to be parenthesized.
|
||||
var x = yield `abc${ x }def`;
|
||||
}
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
//// [templateStringInYieldKeyword.ts]
|
||||
function* gen() {
|
||||
// Once this is supported, the inner expression does not need to be parenthesized.
|
||||
var x = yield `abc${ x }def`;
|
||||
}
|
||||
|
||||
|
||||
//// [templateStringInYieldKeyword.js]
|
||||
function gen() {
|
||||
// Once this is supported, the inner expression does not need to be parenthesized.
|
||||
var x = ;
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
=== tests/cases/conformance/es6/templates/templateStringInYieldKeyword.ts ===
|
||||
function* gen() {
|
||||
>gen : () => void
|
||||
|
||||
// Once this is supported, the inner expression does not need to be parenthesized.
|
||||
var x = yield `abc${ x }def`;
|
||||
>x : unknown
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeywordES6.ts(1,9): error TS9001: 'generators' are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeywordES6.ts (1 errors) ====
|
||||
function* gen() {
|
||||
~
|
||||
!!! error TS9001: 'generators' are not currently supported.
|
||||
// Once this is supported, yield *must* be parenthesized.
|
||||
var x = `abc${ yield 10 }def`;
|
||||
}
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
//// [templateStringWithEmbeddedYieldKeywordES6.ts]
|
||||
function* gen() {
|
||||
// Once this is supported, yield *must* be parenthesized.
|
||||
var x = `abc${ yield 10 }def`;
|
||||
}
|
||||
|
||||
|
||||
//// [templateStringWithEmbeddedYieldKeywordES6.js]
|
||||
function gen() {
|
||||
// Once this is supported, yield *must* be parenthesized.
|
||||
var x = `abc${}def`;
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
=== tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeywordES6.ts ===
|
||||
function* gen() {
|
||||
>gen : () => void
|
||||
|
||||
// Once this is supported, yield *must* be parenthesized.
|
||||
var x = `abc${ yield 10 }def`;
|
||||
>x : string
|
||||
}
|
||||
|
||||
+5
-1
@@ -34,4 +34,8 @@ class C {
|
||||
}
|
||||
|
||||
// Function expressions
|
||||
var x = (a = b, b = c, c = d) => { var d; };
|
||||
var x = (a = b, b = c, c = d) => { var d; };
|
||||
|
||||
// Should not produce errors - can reference later parameters if they occur within a function expression initializer.
|
||||
function f(a, b = function () { return c; }, c = b()) {
|
||||
}
|
||||
@@ -21,6 +21,10 @@ module A {
|
||||
return 'hello ' + s;
|
||||
}
|
||||
var ol = { s: 'hello', id: 2, isvalid: true };
|
||||
|
||||
declare class DC {
|
||||
static x: number;
|
||||
}
|
||||
}
|
||||
|
||||
module Y {
|
||||
@@ -46,4 +50,8 @@ module Y {
|
||||
return 'hello ' + s;
|
||||
}
|
||||
export var ol = { s: 'hello', id: 2, isvalid: true };
|
||||
|
||||
export declare class DC {
|
||||
static x: number;
|
||||
}
|
||||
}
|
||||
|
||||
+86
@@ -0,0 +1,86 @@
|
||||
|
||||
module m1 {
|
||||
interface Promise<T> {
|
||||
then<U>(cb: (x: T) => Promise<U>): Promise<U>;
|
||||
}
|
||||
|
||||
declare function testFunction(n: number): Promise<number>;
|
||||
|
||||
var numPromise: Promise<number>;
|
||||
var newPromise = numPromise.then(testFunction);
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
|
||||
module m2 {
|
||||
interface Promise<T> {
|
||||
then<U>(cb: (x: T) => Promise<U>): Promise<U>;
|
||||
}
|
||||
|
||||
declare function testFunction(n: number): Promise<number>;
|
||||
declare function testFunction(s: string): Promise<string>;
|
||||
|
||||
var numPromise: Promise<number>;
|
||||
var newPromise = numPromise.then(testFunction);
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
|
||||
module m3 {
|
||||
interface Promise<T> {
|
||||
then<U>(cb: (x: T) => Promise<U>): Promise<U>;
|
||||
then<U>(cb: (x: T) => Promise<U>, error?: (error: any) => Promise<U>): Promise<U>;
|
||||
}
|
||||
|
||||
declare function testFunction(n: number): Promise<number>;
|
||||
|
||||
var numPromise: Promise<number>;
|
||||
var newPromise = numPromise.then(testFunction);
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
|
||||
module m4 {
|
||||
interface Promise<T> {
|
||||
then<U>(cb: (x: T) => Promise<U>): Promise<U>;
|
||||
then<U>(cb: (x: T) => Promise<U>, error?: (error: any) => Promise<U>): Promise<U>;
|
||||
}
|
||||
|
||||
declare function testFunction(n: number): Promise<number>;
|
||||
declare function testFunction(s: string): Promise<string>;
|
||||
|
||||
var numPromise: Promise<number>;
|
||||
var newPromise = numPromise.then(testFunction);
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
|
||||
module m5 {
|
||||
interface Promise<T> {
|
||||
then<U>(cb: (x: T) => Promise<U>): Promise<U>;
|
||||
then<U>(cb: (x: T) => Promise<U>, error?: (error: any) => Promise<U>): Promise<U>;
|
||||
then<U>(cb: (x: T) => Promise<U>, error?: (error: any) => U, progress?: (preservation: any) => void): Promise<U>;
|
||||
}
|
||||
|
||||
declare function testFunction(n: number): Promise<number>;
|
||||
declare function testFunction(s: string): Promise<string>;
|
||||
|
||||
var numPromise: Promise<number>;
|
||||
var newPromise = numPromise.then(testFunction);
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
|
||||
module m6 {
|
||||
interface Promise<T> {
|
||||
then<U>(cb: (x: T) => Promise<U>): Promise<U>;
|
||||
then<U>(cb: (x: T) => Promise<U>, error?: (error: any) => Promise<U>): Promise<U>;
|
||||
}
|
||||
|
||||
declare function testFunction(n: number): Promise<number>;
|
||||
declare function testFunction(s: string): Promise<string>;
|
||||
declare function testFunction(b: boolean): Promise<boolean>;
|
||||
|
||||
var numPromise: Promise<number>;
|
||||
var newPromise = numPromise.then(testFunction);
|
||||
}
|
||||
Reference in New Issue
Block a user