Fix arrow expressions in conditional expressions, take N+1 (#49531)

This commit is contained in:
Jake Bailey
2022-06-17 16:34:27 -07:00
committed by GitHub
parent 6004b35ce4
commit d7e58c8ea9
130 changed files with 1580 additions and 431 deletions

View File

@@ -4343,10 +4343,10 @@ namespace ts {
}
const pos = getNodePos();
let expr = parseAssignmentExpressionOrHigher();
let expr = parseAssignmentExpressionOrHigher(/*allowReturnTypeInArrowFunction*/ true);
let operatorToken: BinaryOperatorToken;
while ((operatorToken = parseOptionalToken(SyntaxKind.CommaToken))) {
expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher(), pos);
expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher(/*allowReturnTypeInArrowFunction*/ true), pos);
}
if (saveDecoratorContext) {
@@ -4356,10 +4356,10 @@ namespace ts {
}
function parseInitializer(): Expression | undefined {
return parseOptional(SyntaxKind.EqualsToken) ? parseAssignmentExpressionOrHigher() : undefined;
return parseOptional(SyntaxKind.EqualsToken) ? parseAssignmentExpressionOrHigher(/*allowReturnTypeInArrowFunction*/ true) : undefined;
}
function parseAssignmentExpressionOrHigher(): Expression {
function parseAssignmentExpressionOrHigher(allowReturnTypeInArrowFunction: boolean): Expression {
// AssignmentExpression[in,yield]:
// 1) ConditionalExpression[?in,?yield]
// 2) LeftHandSideExpression = AssignmentExpression[?in,?yield]
@@ -4387,7 +4387,7 @@ namespace ts {
// If we do successfully parse arrow-function, we must *not* recurse for productions 1, 2 or 3. An ArrowFunction is
// not a LeftHandSideExpression, nor does it start a ConditionalExpression. So we are done
// with AssignmentExpression if we see one.
const arrowExpression = tryParseParenthesizedArrowFunctionExpression() || tryParseAsyncSimpleArrowFunctionExpression();
const arrowExpression = tryParseParenthesizedArrowFunctionExpression(allowReturnTypeInArrowFunction) || tryParseAsyncSimpleArrowFunctionExpression(allowReturnTypeInArrowFunction);
if (arrowExpression) {
return arrowExpression;
}
@@ -4408,7 +4408,7 @@ namespace ts {
// parameter ('x => ...') above. We handle it here by checking if the parsed expression was a single
// identifier and the current token is an arrow.
if (expr.kind === SyntaxKind.Identifier && token() === SyntaxKind.EqualsGreaterThanToken) {
return parseSimpleArrowFunctionExpression(pos, expr as Identifier, /*asyncModifier*/ undefined);
return parseSimpleArrowFunctionExpression(pos, expr as Identifier, allowReturnTypeInArrowFunction, /*asyncModifier*/ undefined);
}
// Now see if we might be in cases '2' or '3'.
@@ -4418,11 +4418,11 @@ namespace ts {
// Note: we call reScanGreaterToken so that we get an appropriately merged token
// for cases like `> > =` becoming `>>=`
if (isLeftHandSideExpression(expr) && isAssignmentOperator(reScanGreaterToken())) {
return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher(), pos);
return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher(allowReturnTypeInArrowFunction), pos);
}
// It wasn't an assignment or a lambda. This is a conditional expression:
return parseConditionalExpressionRest(expr, pos);
return parseConditionalExpressionRest(expr, pos, allowReturnTypeInArrowFunction);
}
function isYieldExpression(): boolean {
@@ -4472,7 +4472,7 @@ namespace ts {
return finishNode(
factory.createYieldExpression(
parseOptionalToken(SyntaxKind.AsteriskToken),
parseAssignmentExpressionOrHigher()
parseAssignmentExpressionOrHigher(/*allowReturnTypeInArrowFunction*/ true)
),
pos
);
@@ -4484,7 +4484,7 @@ namespace ts {
}
}
function parseSimpleArrowFunctionExpression(pos: number, identifier: Identifier, asyncModifier?: NodeArray<Modifier> | undefined): ArrowFunction {
function parseSimpleArrowFunctionExpression(pos: number, identifier: Identifier, allowReturnTypeInArrowFunction: boolean, asyncModifier?: NodeArray<Modifier> | undefined): ArrowFunction {
Debug.assert(token() === SyntaxKind.EqualsGreaterThanToken, "parseSimpleArrowFunctionExpression should only have been called if we had a =>");
const parameter = factory.createParameterDeclaration(
/*modifiers*/ undefined,
@@ -4498,12 +4498,12 @@ namespace ts {
const parameters = createNodeArray<ParameterDeclaration>([parameter], parameter.pos, parameter.end);
const equalsGreaterThanToken = parseExpectedToken(SyntaxKind.EqualsGreaterThanToken);
const body = parseArrowFunctionExpressionBody(/*isAsync*/ !!asyncModifier);
const body = parseArrowFunctionExpressionBody(/*isAsync*/ !!asyncModifier, allowReturnTypeInArrowFunction);
const node = factory.createArrowFunction(asyncModifier, /*typeParameters*/ undefined, parameters, /*type*/ undefined, equalsGreaterThanToken, body);
return addJSDocComment(finishNode(node, pos));
}
function tryParseParenthesizedArrowFunctionExpression(): Expression | undefined {
function tryParseParenthesizedArrowFunctionExpression(allowReturnTypeInArrowFunction: boolean): Expression | undefined {
const triState = isParenthesizedArrowFunctionExpression();
if (triState === Tristate.False) {
// It's definitely not a parenthesized arrow function expression.
@@ -4515,8 +4515,8 @@ namespace ts {
// it out, but don't allow any ambiguity, and return 'undefined' if this could be an
// expression instead.
return triState === Tristate.True ?
parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true) :
tryParse(parsePossibleParenthesizedArrowFunctionExpression);
parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true, /*allowReturnTypeInArrowFunction*/ true) :
tryParse(() => parsePossibleParenthesizedArrowFunctionExpression(allowReturnTypeInArrowFunction));
}
// True -> We definitely expect a parenthesized arrow function here.
@@ -4666,13 +4666,13 @@ namespace ts {
}
}
function parsePossibleParenthesizedArrowFunctionExpression(): ArrowFunction | undefined {
function parsePossibleParenthesizedArrowFunctionExpression(allowReturnTypeInArrowFunction: boolean): ArrowFunction | undefined {
const tokenPos = scanner.getTokenPos();
if (notParenthesizedArrow?.has(tokenPos)) {
return undefined;
}
const result = parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ false);
const result = parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ false, allowReturnTypeInArrowFunction);
if (!result) {
(notParenthesizedArrow || (notParenthesizedArrow = new Set())).add(tokenPos);
}
@@ -4680,14 +4680,14 @@ namespace ts {
return result;
}
function tryParseAsyncSimpleArrowFunctionExpression(): ArrowFunction | undefined {
function tryParseAsyncSimpleArrowFunctionExpression(allowReturnTypeInArrowFunction: boolean): ArrowFunction | undefined {
// We do a check here so that we won't be doing unnecessarily call to "lookAhead"
if (token() === SyntaxKind.AsyncKeyword) {
if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === Tristate.True) {
const pos = getNodePos();
const asyncModifier = parseModifiersForArrowFunction();
const expr = parseBinaryExpressionOrHigher(OperatorPrecedence.Lowest);
return parseSimpleArrowFunctionExpression(pos, expr as Identifier, asyncModifier);
return parseSimpleArrowFunctionExpression(pos, expr as Identifier, allowReturnTypeInArrowFunction, asyncModifier);
}
}
return undefined;
@@ -4714,7 +4714,7 @@ namespace ts {
return Tristate.False;
}
function parseParenthesizedArrowFunctionExpression(allowAmbiguity: boolean): ArrowFunction | undefined {
function parseParenthesizedArrowFunctionExpression(allowAmbiguity: boolean, allowReturnTypeInArrowFunction: boolean): ArrowFunction | undefined {
const pos = getNodePos();
const hasJSDoc = hasPrecedingJSDocComment();
const modifiers = parseModifiersForArrowFunction();
@@ -4751,6 +4751,7 @@ namespace ts {
}
}
const hasReturnColon = token() === SyntaxKind.ColonToken;
const type = parseReturnType(SyntaxKind.ColonToken, /*isType*/ false);
if (type && !allowAmbiguity && typeHasArrowFunctionBlockingParseError(type)) {
return undefined;
@@ -4783,14 +4784,40 @@ namespace ts {
const lastToken = token();
const equalsGreaterThanToken = parseExpectedToken(SyntaxKind.EqualsGreaterThanToken);
const body = (lastToken === SyntaxKind.EqualsGreaterThanToken || lastToken === SyntaxKind.OpenBraceToken)
? parseArrowFunctionExpressionBody(some(modifiers, isAsyncModifier))
? parseArrowFunctionExpressionBody(some(modifiers, isAsyncModifier), allowReturnTypeInArrowFunction)
: parseIdentifier();
// Given:
// x ? y => ({ y }) : z => ({ z })
// We try to parse the body of the first arrow function by looking at:
// ({ y }) : z => ({ z })
// This is a valid arrow function with "z" as the return type.
//
// But, if we're in the true side of a conditional expression, this colon
// terminates the expression, so we cannot allow a return type if we aren't
// certain whether or not the preceding text was parsed as a parameter list.
//
// For example,
// a() ? (b: number, c?: string): void => d() : e
// is determined by isParenthesizedArrowFunctionExpression to unambiguously
// be an arrow expression, so we allow a return type.
if (!allowReturnTypeInArrowFunction && hasReturnColon) {
// However, if the arrow function we were able to parse is followed by another colon
// as in:
// a ? (x): string => x : null
// Then allow the arrow function, and treat the second colon as terminating
// the conditional expression. It's okay to do this because this code would
// be a syntax error in JavaScript (as the second colon shouldn't be there).
if (token() !== SyntaxKind.ColonToken) {
return undefined;
}
}
const node = factory.createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body);
return withJSDoc(finishNode(node, pos), hasJSDoc);
}
function parseArrowFunctionExpressionBody(isAsync: boolean): Block | Expression {
function parseArrowFunctionExpressionBody(isAsync: boolean, allowReturnTypeInArrowFunction: boolean): Block | Expression {
if (token() === SyntaxKind.OpenBraceToken) {
return parseFunctionBlock(isAsync ? SignatureFlags.Await : SignatureFlags.None);
}
@@ -4820,13 +4847,13 @@ namespace ts {
const savedTopLevel = topLevel;
topLevel = false;
const node = isAsync
? doInAwaitContext(parseAssignmentExpressionOrHigher)
: doOutsideOfAwaitContext(parseAssignmentExpressionOrHigher);
? doInAwaitContext(() => parseAssignmentExpressionOrHigher(allowReturnTypeInArrowFunction))
: doOutsideOfAwaitContext(() => parseAssignmentExpressionOrHigher(allowReturnTypeInArrowFunction));
topLevel = savedTopLevel;
return node;
}
function parseConditionalExpressionRest(leftOperand: Expression, pos: number): Expression {
function parseConditionalExpressionRest(leftOperand: Expression, pos: number, allowReturnTypeInArrowFunction: boolean): Expression {
// Note: we are passed in an expression which was produced from parseBinaryExpressionOrHigher.
const questionToken = parseOptionalToken(SyntaxKind.QuestionToken);
if (!questionToken) {
@@ -4840,10 +4867,10 @@ namespace ts {
factory.createConditionalExpression(
leftOperand,
questionToken,
doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher),
doOutsideOfContext(disallowInAndDecoratorContext, () => parseAssignmentExpressionOrHigher(/*allowReturnTypeInArrowFunction*/ false)),
colonToken = parseExpectedToken(SyntaxKind.ColonToken),
nodeIsPresent(colonToken)
? parseAssignmentExpressionOrHigher()
? parseAssignmentExpressionOrHigher(allowReturnTypeInArrowFunction)
: createMissingNode(SyntaxKind.Identifier, /*reportAtCurrentPosition*/ false, Diagnostics._0_expected, tokenToString(SyntaxKind.ColonToken))
),
pos
@@ -5859,14 +5886,14 @@ namespace ts {
function parseSpreadElement(): Expression {
const pos = getNodePos();
parseExpected(SyntaxKind.DotDotDotToken);
const expression = parseAssignmentExpressionOrHigher();
const expression = parseAssignmentExpressionOrHigher(/*allowReturnTypeInArrowFunction*/ true);
return finishNode(factory.createSpreadElement(expression), pos);
}
function parseArgumentOrArrayLiteralElement(): Expression {
return token() === SyntaxKind.DotDotDotToken ? parseSpreadElement() :
token() === SyntaxKind.CommaToken ? finishNode(factory.createOmittedExpression(), getNodePos()) :
parseAssignmentExpressionOrHigher();
parseAssignmentExpressionOrHigher(/*allowReturnTypeInArrowFunction*/ true);
}
function parseArgumentExpression(): Expression {
@@ -5888,7 +5915,7 @@ namespace ts {
const hasJSDoc = hasPrecedingJSDocComment();
if (parseOptionalToken(SyntaxKind.DotDotDotToken)) {
const expression = parseAssignmentExpressionOrHigher();
const expression = parseAssignmentExpressionOrHigher(/*allowReturnTypeInArrowFunction*/ true);
return withJSDoc(finishNode(factory.createSpreadAssignment(expression), pos), hasJSDoc);
}
@@ -5923,7 +5950,7 @@ namespace ts {
const isShorthandPropertyAssignment = tokenIsIdentifier && (token() !== SyntaxKind.ColonToken);
if (isShorthandPropertyAssignment) {
const equalsToken = parseOptionalToken(SyntaxKind.EqualsToken);
const objectAssignmentInitializer = equalsToken ? allowInAnd(parseAssignmentExpressionOrHigher) : undefined;
const objectAssignmentInitializer = equalsToken ? allowInAnd(() => parseAssignmentExpressionOrHigher(/*allowReturnTypeInArrowFunction*/ true)) : undefined;
node = factory.createShorthandPropertyAssignment(name as Identifier, objectAssignmentInitializer);
// Save equals token for error reporting.
// TODO(rbuckton): Consider manufacturing this when we need to report an error as it is otherwise not useful.
@@ -5931,7 +5958,7 @@ namespace ts {
}
else {
parseExpected(SyntaxKind.ColonToken);
const initializer = allowInAnd(parseAssignmentExpressionOrHigher);
const initializer = allowInAnd(() => parseAssignmentExpressionOrHigher(/*allowReturnTypeInArrowFunction*/ true));
node = factory.createPropertyAssignment(name, initializer);
}
// Decorators, Modifiers, questionToken, and exclamationToken are not supported by property assignments and are reported in the grammar checker
@@ -6134,7 +6161,7 @@ namespace ts {
let node: IterationStatement;
if (awaitToken ? parseExpected(SyntaxKind.OfKeyword) : parseOptional(SyntaxKind.OfKeyword)) {
const expression = allowInAnd(parseAssignmentExpressionOrHigher);
const expression = allowInAnd(() => parseAssignmentExpressionOrHigher(/*allowReturnTypeInArrowFunction*/ true));
parseExpected(SyntaxKind.CloseParenToken);
node = factory.createForOfStatement(awaitToken, initializer, expression, parseStatement());
}
@@ -7501,7 +7528,7 @@ namespace ts {
const pos = getNodePos();
const name = tokenIsIdentifierOrKeyword(token()) ? parseIdentifierName() : parseLiteralLikeNode(SyntaxKind.StringLiteral) as StringLiteral;
parseExpected(SyntaxKind.ColonToken);
const value = parseAssignmentExpressionOrHigher();
const value = parseAssignmentExpressionOrHigher(/*allowReturnTypeInArrowFunction*/ true);
return finishNode(factory.createAssertEntry(name, value), pos);
}
@@ -7769,7 +7796,7 @@ namespace ts {
else {
parseExpected(SyntaxKind.DefaultKeyword);
}
const expression = parseAssignmentExpressionOrHigher();
const expression = parseAssignmentExpressionOrHigher(/*allowReturnTypeInArrowFunction*/ true);
parseSemicolon();
setAwaitContext(savedAwaitContext);
const node = factory.createExportAssignment(modifiers, isExportEquals, expression);

View File

@@ -0,0 +1,35 @@
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,1): error TS2304: Cannot find name 'a'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,11): error TS2304: Cannot find name 'c'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,11): error TS8010: Type annotations can only be used in TypeScript files.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,17): error TS2304: Cannot find name 'd'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,27): error TS2304: Cannot find name 'f'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts(1,1): error TS2304: Cannot find name 'a'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts(1,11): error TS2304: Cannot find name 'c'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts(1,17): error TS2304: Cannot find name 'd'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts(1,27): error TS2304: Cannot find name 'f'.
==== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js (5 errors) ====
a ? (b) : c => (d) : e => f // Not legal JS; "Unexpected token ':'" at last colon
~
!!! error TS2304: Cannot find name 'a'.
~
!!! error TS2304: Cannot find name 'c'.
~
!!! error TS8010: Type annotations can only be used in TypeScript files.
~
!!! error TS2304: Cannot find name 'd'.
~
!!! error TS2304: Cannot find name 'f'.
==== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts (4 errors) ====
a ? (b) : c => (d) : e => f
~
!!! error TS2304: Cannot find name 'a'.
~
!!! error TS2304: Cannot find name 'c'.
~
!!! error TS2304: Cannot find name 'd'.
~
!!! error TS2304: Cannot find name 'f'.

View File

@@ -0,0 +1,13 @@
//// [tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression10.ts] ////
//// [fileJs.js]
a ? (b) : c => (d) : e => f // Not legal JS; "Unexpected token ':'" at last colon
//// [fileTs.ts]
a ? (b) : c => (d) : e => f
//// [fileJs.js]
a ? function (b) { return (d); } : function (e) { return f; }; // Not legal JS; "Unexpected token ':'" at last colon
//// [fileTs.js]
a ? function (b) { return (d); } : function (e) { return f; };

View File

@@ -0,0 +1,12 @@
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js ===
a ? (b) : c => (d) : e => f // Not legal JS; "Unexpected token ':'" at last colon
>b : Symbol(b, Decl(fileJs.js, 0, 5))
>c : Symbol(c)
>e : Symbol(e, Decl(fileJs.js, 0, 20))
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts ===
a ? (b) : c => (d) : e => f
>b : Symbol(b, Decl(fileTs.ts, 0, 5))
>c : Symbol(c)
>e : Symbol(e, Decl(fileTs.ts, 0, 20))

View File

@@ -0,0 +1,24 @@
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js ===
a ? (b) : c => (d) : e => f // Not legal JS; "Unexpected token ':'" at last colon
>a ? (b) : c => (d) : e => f : (b: any) => c
>a : any
>(b) : c => (d) : (b: any) => c
>b : any
>(d) : any
>d : any
>e => f : (e: any) => any
>e : any
>f : any
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts ===
a ? (b) : c => (d) : e => f
>a ? (b) : c => (d) : e => f : (b: any) => c
>a : any
>(b) : c => (d) : (b: any) => c
>b : any
>(d) : any
>d : any
>e => f : (e: any) => any
>e : any
>f : any

View File

@@ -0,0 +1,35 @@
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,1): error TS2304: Cannot find name 'a'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,11): error TS2304: Cannot find name 'c'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,11): error TS8010: Type annotations can only be used in TypeScript files.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,17): error TS2304: Cannot find name 'd'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,27): error TS2304: Cannot find name 'f'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts(1,1): error TS2304: Cannot find name 'a'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts(1,11): error TS2304: Cannot find name 'c'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts(1,17): error TS2304: Cannot find name 'd'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts(1,27): error TS2304: Cannot find name 'f'.
==== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js (5 errors) ====
a ? (b) : c => (d) : e => f // Not legal JS; "Unexpected token ':'" at last colon
~
!!! error TS2304: Cannot find name 'a'.
~
!!! error TS2304: Cannot find name 'c'.
~
!!! error TS8010: Type annotations can only be used in TypeScript files.
~
!!! error TS2304: Cannot find name 'd'.
~
!!! error TS2304: Cannot find name 'f'.
==== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts (4 errors) ====
a ? (b) : c => (d) : e => f
~
!!! error TS2304: Cannot find name 'a'.
~
!!! error TS2304: Cannot find name 'c'.
~
!!! error TS2304: Cannot find name 'd'.
~
!!! error TS2304: Cannot find name 'f'.

View File

@@ -0,0 +1,13 @@
//// [tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression10.ts] ////
//// [fileJs.js]
a ? (b) : c => (d) : e => f // Not legal JS; "Unexpected token ':'" at last colon
//// [fileTs.ts]
a ? (b) : c => (d) : e => f
//// [fileJs.js]
a ? (b) => (d) : e => f; // Not legal JS; "Unexpected token ':'" at last colon
//// [fileTs.js]
a ? (b) => (d) : e => f;

View File

@@ -0,0 +1,12 @@
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js ===
a ? (b) : c => (d) : e => f // Not legal JS; "Unexpected token ':'" at last colon
>b : Symbol(b, Decl(fileJs.js, 0, 5))
>c : Symbol(c)
>e : Symbol(e, Decl(fileJs.js, 0, 20))
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts ===
a ? (b) : c => (d) : e => f
>b : Symbol(b, Decl(fileTs.ts, 0, 5))
>c : Symbol(c)
>e : Symbol(e, Decl(fileTs.ts, 0, 20))

View File

@@ -0,0 +1,24 @@
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js ===
a ? (b) : c => (d) : e => f // Not legal JS; "Unexpected token ':'" at last colon
>a ? (b) : c => (d) : e => f : (b: any) => c
>a : any
>(b) : c => (d) : (b: any) => c
>b : any
>(d) : any
>d : any
>e => f : (e: any) => any
>e : any
>f : any
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts ===
a ? (b) : c => (d) : e => f
>a ? (b) : c => (d) : e => f : (b: any) => c
>a : any
>(b) : c => (d) : (b: any) => c
>b : any
>(d) : any
>d : any
>e => f : (e: any) => any
>e : any
>f : any

View File

@@ -1,20 +0,0 @@
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression10.ts(1,1): error TS2304: Cannot find name 'a'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression10.ts(1,11): error TS2304: Cannot find name 'c'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression10.ts(1,22): error TS2304: Cannot find name 'e'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression10.ts(1,27): error TS2304: Cannot find name 'f'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression10.ts(2,1): error TS1005: ':' expected.
==== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression10.ts (5 errors) ====
a ? (b) : c => (d) : e => f
~
!!! error TS2304: Cannot find name 'a'.
~
!!! error TS2304: Cannot find name 'c'.
~
!!! error TS2304: Cannot find name 'e'.
~
!!! error TS2304: Cannot find name 'f'.
!!! error TS1005: ':' expected.

View File

@@ -1,8 +0,0 @@
//// [parserArrowFunctionExpression10.ts]
a ? (b) : c => (d) : e => f
//// [parserArrowFunctionExpression10.js]
a ? function (b) { return function (d) { return f; }; }
:
;

View File

@@ -1,7 +0,0 @@
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression10.ts ===
a ? (b) : c => (d) : e => f
>b : Symbol(b, Decl(parserArrowFunctionExpression10.ts, 0, 5))
>c : Symbol(c)
>d : Symbol(d, Decl(parserArrowFunctionExpression10.ts, 0, 16))
>e : Symbol(e)

View File

@@ -1,12 +0,0 @@
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression10.ts ===
a ? (b) : c => (d) : e => f
>a ? (b) : c => (d) : e => f : any
>a : any
>(b) : c => (d) : e => f : (b: any) => c
>b : any
>(d) : e => f : (d: any) => e
>d : any
>f : any
> : any

View File

@@ -0,0 +1,38 @@
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,1): error TS2304: Cannot find name 'a'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,5): error TS2304: Cannot find name 'b'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,9): error TS2304: Cannot find name 'c'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,14): error TS2304: Cannot find name 'd'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,24): error TS2304: Cannot find name 'f'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts(1,1): error TS2304: Cannot find name 'a'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts(1,5): error TS2304: Cannot find name 'b'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts(1,9): error TS2304: Cannot find name 'c'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts(1,14): error TS2304: Cannot find name 'd'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts(1,24): error TS2304: Cannot find name 'f'.
==== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js (5 errors) ====
a ? b ? c : (d) : e => f // Legal JS
~
!!! error TS2304: Cannot find name 'a'.
~
!!! error TS2304: Cannot find name 'b'.
~
!!! error TS2304: Cannot find name 'c'.
~
!!! error TS2304: Cannot find name 'd'.
~
!!! error TS2304: Cannot find name 'f'.
==== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts (5 errors) ====
a ? b ? c : (d) : e => f
~
!!! error TS2304: Cannot find name 'a'.
~
!!! error TS2304: Cannot find name 'b'.
~
!!! error TS2304: Cannot find name 'c'.
~
!!! error TS2304: Cannot find name 'd'.
~
!!! error TS2304: Cannot find name 'f'.

View File

@@ -0,0 +1,13 @@
//// [tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression11.ts] ////
//// [fileJs.js]
a ? b ? c : (d) : e => f // Legal JS
//// [fileTs.ts]
a ? b ? c : (d) : e => f
//// [fileJs.js]
a ? b ? c : (d) : function (e) { return f; }; // Legal JS
//// [fileTs.js]
a ? b ? c : (d) : function (e) { return f; };

View File

@@ -0,0 +1,8 @@
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js ===
a ? b ? c : (d) : e => f // Legal JS
>e : Symbol(e, Decl(fileJs.js, 0, 17))
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts ===
a ? b ? c : (d) : e => f
>e : Symbol(e, Decl(fileTs.ts, 0, 17))

View File

@@ -0,0 +1,26 @@
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js ===
a ? b ? c : (d) : e => f // Legal JS
>a ? b ? c : (d) : e => f : any
>a : any
>b ? c : (d) : any
>b : any
>c : any
>(d) : any
>d : any
>e => f : (e: any) => any
>e : any
>f : any
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts ===
a ? b ? c : (d) : e => f
>a ? b ? c : (d) : e => f : any
>a : any
>b ? c : (d) : any
>b : any
>c : any
>(d) : any
>d : any
>e => f : (e: any) => any
>e : any
>f : any

View File

@@ -0,0 +1,38 @@
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,1): error TS2304: Cannot find name 'a'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,5): error TS2304: Cannot find name 'b'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,9): error TS2304: Cannot find name 'c'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,14): error TS2304: Cannot find name 'd'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,24): error TS2304: Cannot find name 'f'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts(1,1): error TS2304: Cannot find name 'a'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts(1,5): error TS2304: Cannot find name 'b'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts(1,9): error TS2304: Cannot find name 'c'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts(1,14): error TS2304: Cannot find name 'd'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts(1,24): error TS2304: Cannot find name 'f'.
==== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js (5 errors) ====
a ? b ? c : (d) : e => f // Legal JS
~
!!! error TS2304: Cannot find name 'a'.
~
!!! error TS2304: Cannot find name 'b'.
~
!!! error TS2304: Cannot find name 'c'.
~
!!! error TS2304: Cannot find name 'd'.
~
!!! error TS2304: Cannot find name 'f'.
==== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts (5 errors) ====
a ? b ? c : (d) : e => f
~
!!! error TS2304: Cannot find name 'a'.
~
!!! error TS2304: Cannot find name 'b'.
~
!!! error TS2304: Cannot find name 'c'.
~
!!! error TS2304: Cannot find name 'd'.
~
!!! error TS2304: Cannot find name 'f'.

View File

@@ -0,0 +1,13 @@
//// [tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression11.ts] ////
//// [fileJs.js]
a ? b ? c : (d) : e => f // Legal JS
//// [fileTs.ts]
a ? b ? c : (d) : e => f
//// [fileJs.js]
a ? b ? c : (d) : e => f; // Legal JS
//// [fileTs.js]
a ? b ? c : (d) : e => f;

View File

@@ -0,0 +1,8 @@
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js ===
a ? b ? c : (d) : e => f // Legal JS
>e : Symbol(e, Decl(fileJs.js, 0, 17))
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts ===
a ? b ? c : (d) : e => f
>e : Symbol(e, Decl(fileTs.ts, 0, 17))

View File

@@ -0,0 +1,26 @@
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js ===
a ? b ? c : (d) : e => f // Legal JS
>a ? b ? c : (d) : e => f : any
>a : any
>b ? c : (d) : any
>b : any
>c : any
>(d) : any
>d : any
>e => f : (e: any) => any
>e : any
>f : any
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts ===
a ? b ? c : (d) : e => f
>a ? b ? c : (d) : e => f : any
>a : any
>b ? c : (d) : any
>b : any
>c : any
>(d) : any
>d : any
>e => f : (e: any) => any
>e : any
>f : any

View File

@@ -1,23 +0,0 @@
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression11.ts(1,1): error TS2304: Cannot find name 'a'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression11.ts(1,5): error TS2304: Cannot find name 'b'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression11.ts(1,9): error TS2304: Cannot find name 'c'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression11.ts(1,19): error TS2304: Cannot find name 'e'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression11.ts(1,24): error TS2304: Cannot find name 'f'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression11.ts(2,1): error TS1005: ':' expected.
==== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression11.ts (6 errors) ====
a ? b ? c : (d) : e => f
~
!!! error TS2304: Cannot find name 'a'.
~
!!! error TS2304: Cannot find name 'b'.
~
!!! error TS2304: Cannot find name 'c'.
~
!!! error TS2304: Cannot find name 'e'.
~
!!! error TS2304: Cannot find name 'f'.
!!! error TS1005: ':' expected.

View File

@@ -1,8 +0,0 @@
//// [parserArrowFunctionExpression11.ts]
a ? b ? c : (d) : e => f
//// [parserArrowFunctionExpression11.js]
a ? b ? c : function (d) { return f; }
:
;

View File

@@ -1,5 +0,0 @@
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression11.ts ===
a ? b ? c : (d) : e => f
>d : Symbol(d, Decl(parserArrowFunctionExpression11.ts, 0, 13))
>e : Symbol(e)

View File

@@ -1,13 +0,0 @@
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression11.ts ===
a ? b ? c : (d) : e => f
>a ? b ? c : (d) : e => f : any
>a : any
>b ? c : (d) : e => f : any
>b : any
>c : any
>(d) : e => f : (d: any) => e
>d : any
>f : any
> : any

View File

@@ -0,0 +1,26 @@
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,1): error TS2304: Cannot find name 'a'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,13): error TS2304: Cannot find name 'c'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,22): error TS2304: Cannot find name 'e'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts(1,1): error TS2304: Cannot find name 'a'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts(1,13): error TS2304: Cannot find name 'c'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts(1,22): error TS2304: Cannot find name 'e'.
==== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js (3 errors) ====
a ? (b) => (c): d => e // Legal JS
~
!!! error TS2304: Cannot find name 'a'.
~
!!! error TS2304: Cannot find name 'c'.
~
!!! error TS2304: Cannot find name 'e'.
==== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts (3 errors) ====
a ? (b) => (c): d => e
~
!!! error TS2304: Cannot find name 'a'.
~
!!! error TS2304: Cannot find name 'c'.
~
!!! error TS2304: Cannot find name 'e'.

View File

@@ -0,0 +1,13 @@
//// [tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression12.ts] ////
//// [fileJs.js]
a ? (b) => (c): d => e // Legal JS
//// [fileTs.ts]
a ? (b) => (c): d => e
//// [fileJs.js]
a ? function (b) { return (c); } : function (d) { return e; }; // Legal JS
//// [fileTs.js]
a ? function (b) { return (c); } : function (d) { return e; };

View File

@@ -0,0 +1,10 @@
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js ===
a ? (b) => (c): d => e // Legal JS
>b : Symbol(b, Decl(fileJs.js, 0, 5))
>d : Symbol(d, Decl(fileJs.js, 0, 15))
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts ===
a ? (b) => (c): d => e
>b : Symbol(b, Decl(fileTs.ts, 0, 5))
>d : Symbol(d, Decl(fileTs.ts, 0, 15))

View File

@@ -0,0 +1,24 @@
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js ===
a ? (b) => (c): d => e // Legal JS
>a ? (b) => (c): d => e : (b: any) => any
>a : any
>(b) => (c) : (b: any) => any
>b : any
>(c) : any
>c : any
>d => e : (d: any) => any
>d : any
>e : any
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts ===
a ? (b) => (c): d => e
>a ? (b) => (c): d => e : (b: any) => any
>a : any
>(b) => (c) : (b: any) => any
>b : any
>(c) : any
>c : any
>d => e : (d: any) => any
>d : any
>e : any

View File

@@ -0,0 +1,26 @@
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,1): error TS2304: Cannot find name 'a'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,13): error TS2304: Cannot find name 'c'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,22): error TS2304: Cannot find name 'e'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts(1,1): error TS2304: Cannot find name 'a'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts(1,13): error TS2304: Cannot find name 'c'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts(1,22): error TS2304: Cannot find name 'e'.
==== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js (3 errors) ====
a ? (b) => (c): d => e // Legal JS
~
!!! error TS2304: Cannot find name 'a'.
~
!!! error TS2304: Cannot find name 'c'.
~
!!! error TS2304: Cannot find name 'e'.
==== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts (3 errors) ====
a ? (b) => (c): d => e
~
!!! error TS2304: Cannot find name 'a'.
~
!!! error TS2304: Cannot find name 'c'.
~
!!! error TS2304: Cannot find name 'e'.

View File

@@ -0,0 +1,13 @@
//// [tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression12.ts] ////
//// [fileJs.js]
a ? (b) => (c): d => e // Legal JS
//// [fileTs.ts]
a ? (b) => (c): d => e
//// [fileJs.js]
a ? (b) => (c) : d => e; // Legal JS
//// [fileTs.js]
a ? (b) => (c) : d => e;

View File

@@ -0,0 +1,10 @@
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js ===
a ? (b) => (c): d => e // Legal JS
>b : Symbol(b, Decl(fileJs.js, 0, 5))
>d : Symbol(d, Decl(fileJs.js, 0, 15))
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts ===
a ? (b) => (c): d => e
>b : Symbol(b, Decl(fileTs.ts, 0, 5))
>d : Symbol(d, Decl(fileTs.ts, 0, 15))

View File

@@ -0,0 +1,24 @@
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js ===
a ? (b) => (c): d => e // Legal JS
>a ? (b) => (c): d => e : (b: any) => any
>a : any
>(b) => (c) : (b: any) => any
>b : any
>(c) : any
>c : any
>d => e : (d: any) => any
>d : any
>e : any
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts ===
a ? (b) => (c): d => e
>a ? (b) => (c): d => e : (b: any) => any
>a : any
>(b) => (c) : (b: any) => any
>b : any
>(c) : any
>c : any
>d => e : (d: any) => any
>d : any
>e : any

View File

@@ -1,17 +0,0 @@
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression12.ts(1,1): error TS2304: Cannot find name 'a'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression12.ts(1,17): error TS2304: Cannot find name 'd'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression12.ts(1,22): error TS2304: Cannot find name 'e'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression12.ts(2,1): error TS1005: ':' expected.
==== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression12.ts (4 errors) ====
a ? (b) => (c): d => e
~
!!! error TS2304: Cannot find name 'a'.
~
!!! error TS2304: Cannot find name 'd'.
~
!!! error TS2304: Cannot find name 'e'.
!!! error TS1005: ':' expected.

View File

@@ -1,8 +0,0 @@
//// [parserArrowFunctionExpression12.ts]
a ? (b) => (c): d => e
//// [parserArrowFunctionExpression12.js]
a ? function (b) { return function (c) { return e; }; }
:
;

View File

@@ -1,6 +0,0 @@
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression12.ts ===
a ? (b) => (c): d => e
>b : Symbol(b, Decl(parserArrowFunctionExpression12.ts, 0, 5))
>c : Symbol(c, Decl(parserArrowFunctionExpression12.ts, 0, 12))
>d : Symbol(d)

View File

@@ -1,12 +0,0 @@
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression12.ts ===
a ? (b) => (c): d => e
>a ? (b) => (c): d => e : any
>a : any
>(b) => (c): d => e : (b: any) => (c: any) => d
>b : any
>(c): d => e : (c: any) => d
>c : any
>e : any
> : any

View File

@@ -0,0 +1,23 @@
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,1): error TS2304: Cannot find name 'a'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,11): error TS2304: Cannot find name 'a'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,21): error TS8010: Type annotations can only be used in TypeScript files.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts(1,1): error TS2304: Cannot find name 'a'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts(1,11): error TS2304: Cannot find name 'a'.
==== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js (3 errors) ====
a ? () => a() : (): any => null; // Not legal JS; "Unexpected token ')'" at last paren
~
!!! error TS2304: Cannot find name 'a'.
~
!!! error TS2304: Cannot find name 'a'.
~~~
!!! error TS8010: Type annotations can only be used in TypeScript files.
==== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts (2 errors) ====
a ? () => a() : (): any => null;
~
!!! error TS2304: Cannot find name 'a'.
~
!!! error TS2304: Cannot find name 'a'.

View File

@@ -0,0 +1,13 @@
//// [tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression13.ts] ////
//// [fileJs.js]
a ? () => a() : (): any => null; // Not legal JS; "Unexpected token ')'" at last paren
//// [fileTs.ts]
a ? () => a() : (): any => null;
//// [fileJs.js]
a ? function () { return a(); } : function () { return null; }; // Not legal JS; "Unexpected token ')'" at last paren
//// [fileTs.js]
a ? function () { return a(); } : function () { return null; };

View File

@@ -0,0 +1,7 @@
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js ===
a ? () => a() : (): any => null; // Not legal JS; "Unexpected token ')'" at last paren
No type information for this code.
No type information for this code.=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts ===
a ? () => a() : (): any => null;
No type information for this code.
No type information for this code.

View File

@@ -0,0 +1,20 @@
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js ===
a ? () => a() : (): any => null; // Not legal JS; "Unexpected token ')'" at last paren
>a ? () => a() : (): any => null : () => any
>a : any
>() => a() : () => any
>a() : any
>a : any
>(): any => null : () => any
>null : null
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts ===
a ? () => a() : (): any => null;
>a ? () => a() : (): any => null : () => any
>a : any
>() => a() : () => any
>a() : any
>a : any
>(): any => null : () => any
>null : null

View File

@@ -0,0 +1,23 @@
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,1): error TS2304: Cannot find name 'a'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,11): error TS2304: Cannot find name 'a'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,21): error TS8010: Type annotations can only be used in TypeScript files.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts(1,1): error TS2304: Cannot find name 'a'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts(1,11): error TS2304: Cannot find name 'a'.
==== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js (3 errors) ====
a ? () => a() : (): any => null; // Not legal JS; "Unexpected token ')'" at last paren
~
!!! error TS2304: Cannot find name 'a'.
~
!!! error TS2304: Cannot find name 'a'.
~~~
!!! error TS8010: Type annotations can only be used in TypeScript files.
==== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts (2 errors) ====
a ? () => a() : (): any => null;
~
!!! error TS2304: Cannot find name 'a'.
~
!!! error TS2304: Cannot find name 'a'.

View File

@@ -0,0 +1,13 @@
//// [tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression13.ts] ////
//// [fileJs.js]
a ? () => a() : (): any => null; // Not legal JS; "Unexpected token ')'" at last paren
//// [fileTs.ts]
a ? () => a() : (): any => null;
//// [fileJs.js]
a ? () => a() : () => null; // Not legal JS; "Unexpected token ')'" at last paren
//// [fileTs.js]
a ? () => a() : () => null;

View File

@@ -0,0 +1,7 @@
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js ===
a ? () => a() : (): any => null; // Not legal JS; "Unexpected token ')'" at last paren
No type information for this code.
No type information for this code.=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts ===
a ? () => a() : (): any => null;
No type information for this code.
No type information for this code.

View File

@@ -0,0 +1,20 @@
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js ===
a ? () => a() : (): any => null; // Not legal JS; "Unexpected token ')'" at last paren
>a ? () => a() : (): any => null : () => any
>a : any
>() => a() : () => any
>a() : any
>a : any
>(): any => null : () => any
>null : null
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts ===
a ? () => a() : (): any => null;
>a ? () => a() : (): any => null : () => any
>a : any
>() => a() : () => any
>a() : any
>a : any
>(): any => null : () => any
>null : null

View File

@@ -1,11 +0,0 @@
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression13.ts(1,1): error TS2304: Cannot find name 'a'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression13.ts(1,11): error TS2304: Cannot find name 'a'.
==== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression13.ts (2 errors) ====
a ? () => a() : (): any => null;
~
!!! error TS2304: Cannot find name 'a'.
~
!!! error TS2304: Cannot find name 'a'.

View File

@@ -1,6 +0,0 @@
//// [parserArrowFunctionExpression13.ts]
a ? () => a() : (): any => null;
//// [parserArrowFunctionExpression13.js]
a ? function () { return a(); } : function () { return null; };

View File

@@ -1,4 +0,0 @@
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression13.ts ===
a ? () => a() : (): any => null;
No type information for this code.
No type information for this code.

View File

@@ -1,10 +0,0 @@
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression13.ts ===
a ? () => a() : (): any => null;
>a ? () => a() : (): any => null : () => any
>a : any
>() => a() : () => any
>a() : any
>a : any
>(): any => null : () => any
>null : null

View File

@@ -0,0 +1,38 @@
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,1): error TS2304: Cannot find name 'a'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,11): error TS8010: Type annotations can only be used in TypeScript files.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,20): error TS8009: The '?' modifier can only be used in TypeScript files.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,23): error TS8010: Type annotations can only be used in TypeScript files.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,32): error TS8010: Type annotations can only be used in TypeScript files.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,40): error TS2304: Cannot find name 'd'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,46): error TS2304: Cannot find name 'e'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts(1,1): error TS2304: Cannot find name 'a'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts(1,40): error TS2304: Cannot find name 'd'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts(1,46): error TS2304: Cannot find name 'e'.
==== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js (7 errors) ====
a() ? (b: number, c?: string): void => d() : e; // Not legal JS; "Unexpected token ':'" at first colon
~
!!! error TS2304: Cannot find name 'a'.
~~~~~~
!!! error TS8010: Type annotations can only be used in TypeScript files.
~
!!! error TS8009: The '?' modifier can only be used in TypeScript files.
~~~~~~
!!! error TS8010: Type annotations can only be used in TypeScript files.
~~~~
!!! error TS8010: Type annotations can only be used in TypeScript files.
~
!!! error TS2304: Cannot find name 'd'.
~
!!! error TS2304: Cannot find name 'e'.
==== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts (3 errors) ====
a() ? (b: number, c?: string): void => d() : e;
~
!!! error TS2304: Cannot find name 'a'.
~
!!! error TS2304: Cannot find name 'd'.
~
!!! error TS2304: Cannot find name 'e'.

View File

@@ -0,0 +1,13 @@
//// [tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression14.ts] ////
//// [fileJs.js]
a() ? (b: number, c?: string): void => d() : e; // Not legal JS; "Unexpected token ':'" at first colon
//// [fileTs.ts]
a() ? (b: number, c?: string): void => d() : e;
//// [fileJs.js]
a() ? function (b, c) { return d(); } : e; // Not legal JS; "Unexpected token ':'" at first colon
//// [fileTs.js]
a() ? function (b, c) { return d(); } : e;

View File

@@ -0,0 +1,10 @@
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js ===
a() ? (b: number, c?: string): void => d() : e; // Not legal JS; "Unexpected token ':'" at first colon
>b : Symbol(b, Decl(fileJs.js, 0, 7))
>c : Symbol(c, Decl(fileJs.js, 0, 17))
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts ===
a() ? (b: number, c?: string): void => d() : e;
>b : Symbol(b, Decl(fileTs.ts, 0, 7))
>c : Symbol(c, Decl(fileTs.ts, 0, 17))

View File

@@ -0,0 +1,24 @@
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js ===
a() ? (b: number, c?: string): void => d() : e; // Not legal JS; "Unexpected token ':'" at first colon
>a() ? (b: number, c?: string): void => d() : e : any
>a() : any
>a : any
>(b: number, c?: string): void => d() : (b: number, c?: string) => void
>b : number
>c : string
>d() : any
>d : any
>e : any
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts ===
a() ? (b: number, c?: string): void => d() : e;
>a() ? (b: number, c?: string): void => d() : e : any
>a() : any
>a : any
>(b: number, c?: string): void => d() : (b: number, c?: string) => void
>b : number
>c : string
>d() : any
>d : any
>e : any

View File

@@ -0,0 +1,38 @@
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,1): error TS2304: Cannot find name 'a'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,11): error TS8010: Type annotations can only be used in TypeScript files.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,20): error TS8009: The '?' modifier can only be used in TypeScript files.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,23): error TS8010: Type annotations can only be used in TypeScript files.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,32): error TS8010: Type annotations can only be used in TypeScript files.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,40): error TS2304: Cannot find name 'd'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,46): error TS2304: Cannot find name 'e'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts(1,1): error TS2304: Cannot find name 'a'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts(1,40): error TS2304: Cannot find name 'd'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts(1,46): error TS2304: Cannot find name 'e'.
==== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js (7 errors) ====
a() ? (b: number, c?: string): void => d() : e; // Not legal JS; "Unexpected token ':'" at first colon
~
!!! error TS2304: Cannot find name 'a'.
~~~~~~
!!! error TS8010: Type annotations can only be used in TypeScript files.
~
!!! error TS8009: The '?' modifier can only be used in TypeScript files.
~~~~~~
!!! error TS8010: Type annotations can only be used in TypeScript files.
~~~~
!!! error TS8010: Type annotations can only be used in TypeScript files.
~
!!! error TS2304: Cannot find name 'd'.
~
!!! error TS2304: Cannot find name 'e'.
==== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts (3 errors) ====
a() ? (b: number, c?: string): void => d() : e;
~
!!! error TS2304: Cannot find name 'a'.
~
!!! error TS2304: Cannot find name 'd'.
~
!!! error TS2304: Cannot find name 'e'.

View File

@@ -0,0 +1,13 @@
//// [tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression14.ts] ////
//// [fileJs.js]
a() ? (b: number, c?: string): void => d() : e; // Not legal JS; "Unexpected token ':'" at first colon
//// [fileTs.ts]
a() ? (b: number, c?: string): void => d() : e;
//// [fileJs.js]
a() ? (b, c) => d() : e; // Not legal JS; "Unexpected token ':'" at first colon
//// [fileTs.js]
a() ? (b, c) => d() : e;

View File

@@ -0,0 +1,10 @@
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js ===
a() ? (b: number, c?: string): void => d() : e; // Not legal JS; "Unexpected token ':'" at first colon
>b : Symbol(b, Decl(fileJs.js, 0, 7))
>c : Symbol(c, Decl(fileJs.js, 0, 17))
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts ===
a() ? (b: number, c?: string): void => d() : e;
>b : Symbol(b, Decl(fileTs.ts, 0, 7))
>c : Symbol(c, Decl(fileTs.ts, 0, 17))

View File

@@ -0,0 +1,24 @@
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js ===
a() ? (b: number, c?: string): void => d() : e; // Not legal JS; "Unexpected token ':'" at first colon
>a() ? (b: number, c?: string): void => d() : e : any
>a() : any
>a : any
>(b: number, c?: string): void => d() : (b: number, c?: string) => void
>b : number
>c : string
>d() : any
>d : any
>e : any
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts ===
a() ? (b: number, c?: string): void => d() : e;
>a() ? (b: number, c?: string): void => d() : e : any
>a() : any
>a : any
>(b: number, c?: string): void => d() : (b: number, c?: string) => void
>b : number
>c : string
>d() : any
>d : any
>e : any

View File

@@ -1,14 +0,0 @@
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression14.ts(1,1): error TS2304: Cannot find name 'a'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression14.ts(1,40): error TS2304: Cannot find name 'd'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression14.ts(1,46): error TS2304: Cannot find name 'e'.
==== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression14.ts (3 errors) ====
a() ? (b: number, c?: string): void => d() : e;
~
!!! error TS2304: Cannot find name 'a'.
~
!!! error TS2304: Cannot find name 'd'.
~
!!! error TS2304: Cannot find name 'e'.

View File

@@ -1,6 +0,0 @@
//// [parserArrowFunctionExpression14.ts]
a() ? (b: number, c?: string): void => d() : e;
//// [parserArrowFunctionExpression14.js]
a() ? function (b, c) { return d(); } : e;

View File

@@ -1,5 +0,0 @@
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression14.ts ===
a() ? (b: number, c?: string): void => d() : e;
>b : Symbol(b, Decl(parserArrowFunctionExpression14.ts, 0, 7))
>c : Symbol(c, Decl(parserArrowFunctionExpression14.ts, 0, 17))

View File

@@ -1,12 +0,0 @@
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression14.ts ===
a() ? (b: number, c?: string): void => d() : e;
>a() ? (b: number, c?: string): void => d() : e : any
>a() : any
>a : any
>(b: number, c?: string): void => d() : (b: number, c?: string) => void
>b : number
>c : string
>d() : any
>d : any
>e : any

View File

@@ -0,0 +1,11 @@
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,18): error TS8010: Type annotations can only be used in TypeScript files.
==== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js (1 errors) ====
false ? (param): string => param : null // Not legal JS; "Unexpected token ':'" at last colon
~~~~~~
!!! error TS8010: Type annotations can only be used in TypeScript files.
==== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts (0 errors) ====
false ? (param): string => param : null

View File

@@ -0,0 +1,13 @@
//// [tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression15.ts] ////
//// [fileJs.js]
false ? (param): string => param : null // Not legal JS; "Unexpected token ':'" at last colon
//// [fileTs.ts]
false ? (param): string => param : null
//// [fileJs.js]
false ? function (param) { return param; } : null; // Not legal JS; "Unexpected token ':'" at last colon
//// [fileTs.js]
false ? function (param) { return param; } : null;

View File

@@ -0,0 +1,10 @@
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js ===
false ? (param): string => param : null // Not legal JS; "Unexpected token ':'" at last colon
>param : Symbol(param, Decl(fileJs.js, 0, 9))
>param : Symbol(param, Decl(fileJs.js, 0, 9))
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts ===
false ? (param): string => param : null
>param : Symbol(param, Decl(fileTs.ts, 0, 9))
>param : Symbol(param, Decl(fileTs.ts, 0, 9))

View File

@@ -0,0 +1,18 @@
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js ===
false ? (param): string => param : null // Not legal JS; "Unexpected token ':'" at last colon
>false ? (param): string => param : null : (param: any) => string
>false : false
>(param): string => param : (param: any) => string
>param : any
>param : any
>null : null
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts ===
false ? (param): string => param : null
>false ? (param): string => param : null : (param: any) => string
>false : false
>(param): string => param : (param: any) => string
>param : any
>param : any
>null : null

View File

@@ -0,0 +1,11 @@
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,18): error TS8010: Type annotations can only be used in TypeScript files.
==== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js (1 errors) ====
false ? (param): string => param : null // Not legal JS; "Unexpected token ':'" at last colon
~~~~~~
!!! error TS8010: Type annotations can only be used in TypeScript files.
==== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts (0 errors) ====
false ? (param): string => param : null

View File

@@ -0,0 +1,13 @@
//// [tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression15.ts] ////
//// [fileJs.js]
false ? (param): string => param : null // Not legal JS; "Unexpected token ':'" at last colon
//// [fileTs.ts]
false ? (param): string => param : null
//// [fileJs.js]
false ? (param) => param : null; // Not legal JS; "Unexpected token ':'" at last colon
//// [fileTs.js]
false ? (param) => param : null;

View File

@@ -0,0 +1,10 @@
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js ===
false ? (param): string => param : null // Not legal JS; "Unexpected token ':'" at last colon
>param : Symbol(param, Decl(fileJs.js, 0, 9))
>param : Symbol(param, Decl(fileJs.js, 0, 9))
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts ===
false ? (param): string => param : null
>param : Symbol(param, Decl(fileTs.ts, 0, 9))
>param : Symbol(param, Decl(fileTs.ts, 0, 9))

View File

@@ -0,0 +1,18 @@
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js ===
false ? (param): string => param : null // Not legal JS; "Unexpected token ':'" at last colon
>false ? (param): string => param : null : (param: any) => string
>false : false
>(param): string => param : (param: any) => string
>param : any
>param : any
>null : null
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts ===
false ? (param): string => param : null
>false ? (param): string => param : null : (param: any) => string
>false : false
>(param): string => param : (param: any) => string
>param : any
>param : any
>null : null

View File

@@ -1,6 +0,0 @@
//// [parserArrowFunctionExpression15.ts]
false ? (param): string => param : null
//// [parserArrowFunctionExpression15.js]
false ? function (param) { return param; } : null;

View File

@@ -1,5 +0,0 @@
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression15.ts ===
false ? (param): string => param : null
>param : Symbol(param, Decl(parserArrowFunctionExpression15.ts, 0, 9))
>param : Symbol(param, Decl(parserArrowFunctionExpression15.ts, 0, 9))

View File

@@ -1,9 +0,0 @@
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression15.ts ===
false ? (param): string => param : null
>false ? (param): string => param : null : (param: any) => string
>false : false
>(param): string => param : (param: any) => string
>param : any
>param : any
>null : null

View File

@@ -0,0 +1,11 @@
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,25): error TS8010: Type annotations can only be used in TypeScript files.
==== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js (1 errors) ====
true ? false ? (param): string => param : null : null // Not legal JS; "Unexpected token ':'" at last colon
~~~~~~
!!! error TS8010: Type annotations can only be used in TypeScript files.
==== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts (0 errors) ====
true ? false ? (param): string => param : null : null

View File

@@ -0,0 +1,13 @@
//// [tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression16.ts] ////
//// [fileJs.js]
true ? false ? (param): string => param : null : null // Not legal JS; "Unexpected token ':'" at last colon
//// [fileTs.ts]
true ? false ? (param): string => param : null : null
//// [fileJs.js]
true ? false ? function (param) { return param; } : null : null; // Not legal JS; "Unexpected token ':'" at last colon
//// [fileTs.js]
true ? false ? function (param) { return param; } : null : null;

View File

@@ -0,0 +1,10 @@
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js ===
true ? false ? (param): string => param : null : null // Not legal JS; "Unexpected token ':'" at last colon
>param : Symbol(param, Decl(fileJs.js, 0, 16))
>param : Symbol(param, Decl(fileJs.js, 0, 16))
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts ===
true ? false ? (param): string => param : null : null
>param : Symbol(param, Decl(fileTs.ts, 0, 16))
>param : Symbol(param, Decl(fileTs.ts, 0, 16))

View File

@@ -0,0 +1,24 @@
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js ===
true ? false ? (param): string => param : null : null // Not legal JS; "Unexpected token ':'" at last colon
>true ? false ? (param): string => param : null : null : (param: any) => string
>true : true
>false ? (param): string => param : null : (param: any) => string
>false : false
>(param): string => param : (param: any) => string
>param : any
>param : any
>null : null
>null : null
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts ===
true ? false ? (param): string => param : null : null
>true ? false ? (param): string => param : null : null : (param: any) => string
>true : true
>false ? (param): string => param : null : (param: any) => string
>false : false
>(param): string => param : (param: any) => string
>param : any
>param : any
>null : null
>null : null

View File

@@ -0,0 +1,11 @@
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,25): error TS8010: Type annotations can only be used in TypeScript files.
==== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js (1 errors) ====
true ? false ? (param): string => param : null : null // Not legal JS; "Unexpected token ':'" at last colon
~~~~~~
!!! error TS8010: Type annotations can only be used in TypeScript files.
==== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts (0 errors) ====
true ? false ? (param): string => param : null : null

View File

@@ -0,0 +1,13 @@
//// [tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression16.ts] ////
//// [fileJs.js]
true ? false ? (param): string => param : null : null // Not legal JS; "Unexpected token ':'" at last colon
//// [fileTs.ts]
true ? false ? (param): string => param : null : null
//// [fileJs.js]
true ? false ? (param) => param : null : null; // Not legal JS; "Unexpected token ':'" at last colon
//// [fileTs.js]
true ? false ? (param) => param : null : null;

View File

@@ -0,0 +1,10 @@
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js ===
true ? false ? (param): string => param : null : null // Not legal JS; "Unexpected token ':'" at last colon
>param : Symbol(param, Decl(fileJs.js, 0, 16))
>param : Symbol(param, Decl(fileJs.js, 0, 16))
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts ===
true ? false ? (param): string => param : null : null
>param : Symbol(param, Decl(fileTs.ts, 0, 16))
>param : Symbol(param, Decl(fileTs.ts, 0, 16))

View File

@@ -0,0 +1,24 @@
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js ===
true ? false ? (param): string => param : null : null // Not legal JS; "Unexpected token ':'" at last colon
>true ? false ? (param): string => param : null : null : (param: any) => string
>true : true
>false ? (param): string => param : null : (param: any) => string
>false : false
>(param): string => param : (param: any) => string
>param : any
>param : any
>null : null
>null : null
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts ===
true ? false ? (param): string => param : null : null
>true ? false ? (param): string => param : null : null : (param: any) => string
>true : true
>false ? (param): string => param : null : (param: any) => string
>false : false
>(param): string => param : (param: any) => string
>param : any
>param : any
>null : null
>null : null

View File

@@ -1,6 +0,0 @@
//// [parserArrowFunctionExpression16.ts]
true ? false ? (param): string => param : null : null
//// [parserArrowFunctionExpression16.js]
true ? false ? function (param) { return param; } : null : null;

View File

@@ -1,5 +0,0 @@
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression16.ts ===
true ? false ? (param): string => param : null : null
>param : Symbol(param, Decl(parserArrowFunctionExpression16.ts, 0, 16))
>param : Symbol(param, Decl(parserArrowFunctionExpression16.ts, 0, 16))

View File

@@ -1,12 +0,0 @@
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression16.ts ===
true ? false ? (param): string => param : null : null
>true ? false ? (param): string => param : null : null : (param: any) => string
>true : true
>false ? (param): string => param : null : (param: any) => string
>false : false
>(param): string => param : (param: any) => string
>param : any
>param : any
>null : null
>null : null

View File

@@ -0,0 +1,35 @@
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,1): error TS2304: Cannot find name 'a'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,5): error TS2304: Cannot find name 'b'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,15): error TS2304: Cannot find name 'd'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,15): error TS8010: Type annotations can only be used in TypeScript files.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,20): error TS2304: Cannot find name 'e'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts(1,1): error TS2304: Cannot find name 'a'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts(1,5): error TS2304: Cannot find name 'b'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts(1,15): error TS2304: Cannot find name 'd'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts(1,20): error TS2304: Cannot find name 'e'.
==== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js (5 errors) ====
a ? b : (c) : d => e // Not legal JS; "Unexpected token ':'" at last colon
~
!!! error TS2304: Cannot find name 'a'.
~
!!! error TS2304: Cannot find name 'b'.
~
!!! error TS2304: Cannot find name 'd'.
~
!!! error TS8010: Type annotations can only be used in TypeScript files.
~
!!! error TS2304: Cannot find name 'e'.
==== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts (4 errors) ====
a ? b : (c) : d => e
~
!!! error TS2304: Cannot find name 'a'.
~
!!! error TS2304: Cannot find name 'b'.
~
!!! error TS2304: Cannot find name 'd'.
~
!!! error TS2304: Cannot find name 'e'.

View File

@@ -0,0 +1,13 @@
//// [tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression17.ts] ////
//// [fileJs.js]
a ? b : (c) : d => e // Not legal JS; "Unexpected token ':'" at last colon
//// [fileTs.ts]
a ? b : (c) : d => e
//// [fileJs.js]
a ? b : function (c) { return e; }; // Not legal JS; "Unexpected token ':'" at last colon
//// [fileTs.js]
a ? b : function (c) { return e; };

View File

@@ -0,0 +1,10 @@
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js ===
a ? b : (c) : d => e // Not legal JS; "Unexpected token ':'" at last colon
>c : Symbol(c, Decl(fileJs.js, 0, 9))
>d : Symbol(d)
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts ===
a ? b : (c) : d => e
>c : Symbol(c, Decl(fileTs.ts, 0, 9))
>d : Symbol(d)

View File

@@ -0,0 +1,18 @@
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js ===
a ? b : (c) : d => e // Not legal JS; "Unexpected token ':'" at last colon
>a ? b : (c) : d => e : any
>a : any
>b : any
>(c) : d => e : (c: any) => d
>c : any
>e : any
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts ===
a ? b : (c) : d => e
>a ? b : (c) : d => e : any
>a : any
>b : any
>(c) : d => e : (c: any) => d
>c : any
>e : any

View File

@@ -0,0 +1,35 @@
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,1): error TS2304: Cannot find name 'a'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,5): error TS2304: Cannot find name 'b'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,15): error TS2304: Cannot find name 'd'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,15): error TS8010: Type annotations can only be used in TypeScript files.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,20): error TS2304: Cannot find name 'e'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts(1,1): error TS2304: Cannot find name 'a'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts(1,5): error TS2304: Cannot find name 'b'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts(1,15): error TS2304: Cannot find name 'd'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts(1,20): error TS2304: Cannot find name 'e'.
==== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js (5 errors) ====
a ? b : (c) : d => e // Not legal JS; "Unexpected token ':'" at last colon
~
!!! error TS2304: Cannot find name 'a'.
~
!!! error TS2304: Cannot find name 'b'.
~
!!! error TS2304: Cannot find name 'd'.
~
!!! error TS8010: Type annotations can only be used in TypeScript files.
~
!!! error TS2304: Cannot find name 'e'.
==== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts (4 errors) ====
a ? b : (c) : d => e
~
!!! error TS2304: Cannot find name 'a'.
~
!!! error TS2304: Cannot find name 'b'.
~
!!! error TS2304: Cannot find name 'd'.
~
!!! error TS2304: Cannot find name 'e'.

View File

@@ -0,0 +1,13 @@
//// [tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression17.ts] ////
//// [fileJs.js]
a ? b : (c) : d => e // Not legal JS; "Unexpected token ':'" at last colon
//// [fileTs.ts]
a ? b : (c) : d => e
//// [fileJs.js]
a ? b : (c) => e; // Not legal JS; "Unexpected token ':'" at last colon
//// [fileTs.js]
a ? b : (c) => e;

View File

@@ -0,0 +1,10 @@
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js ===
a ? b : (c) : d => e // Not legal JS; "Unexpected token ':'" at last colon
>c : Symbol(c, Decl(fileJs.js, 0, 9))
>d : Symbol(d)
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts ===
a ? b : (c) : d => e
>c : Symbol(c, Decl(fileTs.ts, 0, 9))
>d : Symbol(d)

View File

@@ -0,0 +1,18 @@
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js ===
a ? b : (c) : d => e // Not legal JS; "Unexpected token ':'" at last colon
>a ? b : (c) : d => e : any
>a : any
>b : any
>(c) : d => e : (c: any) => d
>c : any
>e : any
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts ===
a ? b : (c) : d => e
>a ? b : (c) : d => e : any
>a : any
>b : any
>(c) : d => e : (c: any) => d
>c : any
>e : any

View File

@@ -0,0 +1,14 @@
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,1): error TS2304: Cannot find name 'x'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts(1,1): error TS2304: Cannot find name 'x'.
==== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js (1 errors) ====
x ? y => ({ y }) : z => ({ z }) // Legal JS
~
!!! error TS2304: Cannot find name 'x'.
==== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts (1 errors) ====
x ? y => ({ y }) : z => ({ z })
~
!!! error TS2304: Cannot find name 'x'.

View File

@@ -0,0 +1,13 @@
//// [tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression8.ts] ////
//// [fileJs.js]
x ? y => ({ y }) : z => ({ z }) // Legal JS
//// [fileTs.ts]
x ? y => ({ y }) : z => ({ z })
//// [fileJs.js]
x ? function (y) { return ({ y: y }); } : function (z) { return ({ z: z }); }; // Legal JS
//// [fileTs.js]
x ? function (y) { return ({ y: y }); } : function (z) { return ({ z: z }); };

View File

@@ -0,0 +1,14 @@
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js ===
x ? y => ({ y }) : z => ({ z }) // Legal JS
>y : Symbol(y, Decl(fileJs.js, 0, 3))
>y : Symbol(y, Decl(fileJs.js, 0, 11))
>z : Symbol(z, Decl(fileJs.js, 0, 18))
>z : Symbol(z, Decl(fileJs.js, 0, 26))
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts ===
x ? y => ({ y }) : z => ({ z })
>y : Symbol(y, Decl(fileTs.ts, 0, 3))
>y : Symbol(y, Decl(fileTs.ts, 0, 11))
>z : Symbol(z, Decl(fileTs.ts, 0, 18))
>z : Symbol(z, Decl(fileTs.ts, 0, 26))

View File

@@ -0,0 +1,30 @@
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js ===
x ? y => ({ y }) : z => ({ z }) // Legal JS
>x ? y => ({ y }) : z => ({ z }) : ((y: any) => { y: any; }) | ((z: any) => { z: any; })
>x : any
>y => ({ y }) : (y: any) => { y: any; }
>y : any
>({ y }) : { y: any; }
>{ y } : { y: any; }
>y : any
>z => ({ z }) : (z: any) => { z: any; }
>z : any
>({ z }) : { z: any; }
>{ z } : { z: any; }
>z : any
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts ===
x ? y => ({ y }) : z => ({ z })
>x ? y => ({ y }) : z => ({ z }) : ((y: any) => { y: any; }) | ((z: any) => { z: any; })
>x : any
>y => ({ y }) : (y: any) => { y: any; }
>y : any
>({ y }) : { y: any; }
>{ y } : { y: any; }
>y : any
>z => ({ z }) : (z: any) => { z: any; }
>z : any
>({ z }) : { z: any; }
>{ z } : { z: any; }
>z : any

View File

@@ -0,0 +1,14 @@
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js(1,1): error TS2304: Cannot find name 'x'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts(1,1): error TS2304: Cannot find name 'x'.
==== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js (1 errors) ====
x ? y => ({ y }) : z => ({ z }) // Legal JS
~
!!! error TS2304: Cannot find name 'x'.
==== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts (1 errors) ====
x ? y => ({ y }) : z => ({ z })
~
!!! error TS2304: Cannot find name 'x'.

View File

@@ -0,0 +1,13 @@
//// [tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression8.ts] ////
//// [fileJs.js]
x ? y => ({ y }) : z => ({ z }) // Legal JS
//// [fileTs.ts]
x ? y => ({ y }) : z => ({ z })
//// [fileJs.js]
x ? y => ({ y }) : z => ({ z }); // Legal JS
//// [fileTs.js]
x ? y => ({ y }) : z => ({ z });

View File

@@ -0,0 +1,14 @@
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js ===
x ? y => ({ y }) : z => ({ z }) // Legal JS
>y : Symbol(y, Decl(fileJs.js, 0, 3))
>y : Symbol(y, Decl(fileJs.js, 0, 11))
>z : Symbol(z, Decl(fileJs.js, 0, 18))
>z : Symbol(z, Decl(fileJs.js, 0, 26))
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts ===
x ? y => ({ y }) : z => ({ z })
>y : Symbol(y, Decl(fileTs.ts, 0, 3))
>y : Symbol(y, Decl(fileTs.ts, 0, 11))
>z : Symbol(z, Decl(fileTs.ts, 0, 18))
>z : Symbol(z, Decl(fileTs.ts, 0, 26))

View File

@@ -0,0 +1,30 @@
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileJs.js ===
x ? y => ({ y }) : z => ({ z }) // Legal JS
>x ? y => ({ y }) : z => ({ z }) : ((y: any) => { y: any; }) | ((z: any) => { z: any; })
>x : any
>y => ({ y }) : (y: any) => { y: any; }
>y : any
>({ y }) : { y: any; }
>{ y } : { y: any; }
>y : any
>z => ({ z }) : (z: any) => { z: any; }
>z : any
>({ z }) : { z: any; }
>{ z } : { z: any; }
>z : any
=== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/fileTs.ts ===
x ? y => ({ y }) : z => ({ z })
>x ? y => ({ y }) : z => ({ z }) : ((y: any) => { y: any; }) | ((z: any) => { z: any; })
>x : any
>y => ({ y }) : (y: any) => { y: any; }
>y : any
>({ y }) : { y: any; }
>{ y } : { y: any; }
>y : any
>z => ({ z }) : (z: any) => { z: any; }
>z : any
>({ z }) : { z: any; }
>{ z } : { z: any; }
>z : any

View File

@@ -1,17 +0,0 @@
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression8.ts(1,1): error TS2304: Cannot find name 'x'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression8.ts(1,20): error TS2304: Cannot find name 'z'.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression8.ts(1,28): error TS18004: No value exists in scope for the shorthand property 'z'. Either declare one or provide an initializer.
tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression8.ts(2,1): error TS1005: ':' expected.
==== tests/cases/conformance/parser/ecmascript5/ArrowFunctionExpressions/parserArrowFunctionExpression8.ts (4 errors) ====
x ? y => ({ y }) : z => ({ z })
~
!!! error TS2304: Cannot find name 'x'.
~
!!! error TS2304: Cannot find name 'z'.
~
!!! error TS18004: No value exists in scope for the shorthand property 'z'. Either declare one or provide an initializer.
!!! error TS1005: ':' expected.

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