mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-04 21:53:42 -06:00
Put semantically relevant tokens in the tree.
This commit is contained in:
parent
8ad4a0a5b8
commit
db89584a86
@ -756,7 +756,7 @@ module ts {
|
||||
//
|
||||
// x is an optional parameter, but it is a required property.
|
||||
return propertySymbol.valueDeclaration &&
|
||||
propertySymbol.valueDeclaration.flags & NodeFlags.QuestionMark &&
|
||||
hasQuestionToken(propertySymbol.valueDeclaration) &&
|
||||
propertySymbol.valueDeclaration.kind !== SyntaxKind.Parameter;
|
||||
}
|
||||
|
||||
@ -1441,7 +1441,7 @@ module ts {
|
||||
writePunctuation(writer, SyntaxKind.DotDotDotToken);
|
||||
}
|
||||
appendSymbolNameOnly(p, writer);
|
||||
if (p.valueDeclaration.flags & NodeFlags.QuestionMark || (<VariableDeclaration>p.valueDeclaration).initializer) {
|
||||
if (hasQuestionToken(p.valueDeclaration) || (<VariableDeclaration>p.valueDeclaration).initializer) {
|
||||
writePunctuation(writer, SyntaxKind.QuestionToken);
|
||||
}
|
||||
writePunctuation(writer, SyntaxKind.ColonToken);
|
||||
@ -2527,7 +2527,7 @@ module ts {
|
||||
hasStringLiterals = true;
|
||||
}
|
||||
if (minArgumentCount < 0) {
|
||||
if (param.initializer || param.flags & NodeFlags.QuestionMark || param.dotDotDotToken) {
|
||||
if (param.initializer || param.questionToken || param.dotDotDotToken) {
|
||||
minArgumentCount = i;
|
||||
}
|
||||
}
|
||||
@ -7020,20 +7020,23 @@ module ts {
|
||||
return;
|
||||
}
|
||||
|
||||
function getCanonicalOverload(overloads: Declaration[], implementation: FunctionLikeDeclaration) {
|
||||
// Consider the canonical set of flags to be the flags of the bodyDeclaration or the first declaration
|
||||
// Error on all deviations from this canonical set of flags
|
||||
// The caveat is that if some overloads are defined in lib.d.ts, we don't want to
|
||||
// report the errors on those. To achieve this, we will say that the implementation is
|
||||
// the canonical signature only if it is in the same container as the first overload
|
||||
var implementationSharesContainerWithFirstOverload = implementation !== undefined && implementation.parent === overloads[0].parent;
|
||||
return implementationSharesContainerWithFirstOverload ? implementation : overloads[0];
|
||||
}
|
||||
|
||||
function checkFlagAgreementBetweenOverloads(overloads: Declaration[], implementation: FunctionLikeDeclaration, flagsToCheck: NodeFlags, someOverloadFlags: NodeFlags, allOverloadFlags: NodeFlags): void {
|
||||
// Error if some overloads have a flag that is not shared by all overloads. To find the
|
||||
// deviations, we XOR someOverloadFlags with allOverloadFlags
|
||||
var someButNotAllOverloadFlags = someOverloadFlags ^ allOverloadFlags;
|
||||
if (someButNotAllOverloadFlags !== 0) {
|
||||
// Consider the canonical set of flags to be the flags of the bodyDeclaration or the first declaration
|
||||
// Error on all deviations from this canonical set of flags
|
||||
// The caveat is that if some overloads are defined in lib.d.ts, we don't want to
|
||||
// report the errors on those. To achieve this, we will say that the implementation is
|
||||
// the canonical signature only if it is in the same container as the first overload
|
||||
var implementationSharesContainerWithFirstOverload = implementation !== undefined && implementation.parent === overloads[0].parent;
|
||||
var canonicalFlags = implementationSharesContainerWithFirstOverload
|
||||
? getEffectiveDeclarationFlags(implementation, flagsToCheck)
|
||||
: getEffectiveDeclarationFlags(overloads[0], flagsToCheck);
|
||||
var canonicalFlags = getEffectiveDeclarationFlags(getCanonicalOverload(overloads, implementation), flagsToCheck);
|
||||
|
||||
forEach(overloads, o => {
|
||||
var deviation = getEffectiveDeclarationFlags(o, flagsToCheck) ^ canonicalFlags;
|
||||
if (deviation & NodeFlags.Export) {
|
||||
@ -7045,16 +7048,27 @@ module ts {
|
||||
else if (deviation & (NodeFlags.Private | NodeFlags.Protected)) {
|
||||
error(o.name, Diagnostics.Overload_signatures_must_all_be_public_private_or_protected);
|
||||
}
|
||||
else if (deviation & NodeFlags.QuestionMark) {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function checkQuestionTokenAgreementBetweenOverloads(overloads: Declaration[], implementation: FunctionLikeDeclaration, someHaveQuestionToken: boolean, allHaveQuestionToken: boolean): void {
|
||||
if (someHaveQuestionToken !== allHaveQuestionToken) {
|
||||
var canonicalHasQuestionToken = hasQuestionToken(getCanonicalOverload(overloads, implementation));
|
||||
forEach(overloads, o => {
|
||||
var deviation = hasQuestionToken(o) !== canonicalHasQuestionToken;
|
||||
if (deviation) {
|
||||
error(o.name, Diagnostics.Overload_signatures_must_all_be_optional_or_required);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
var flagsToCheck: NodeFlags = NodeFlags.Export | NodeFlags.Ambient | NodeFlags.Private | NodeFlags.Protected | NodeFlags.QuestionMark;
|
||||
var flagsToCheck: NodeFlags = NodeFlags.Export | NodeFlags.Ambient | NodeFlags.Private | NodeFlags.Protected;
|
||||
var someNodeFlags: NodeFlags = 0;
|
||||
var allNodeFlags = flagsToCheck;
|
||||
var someHaveQuestionToken = false;
|
||||
var allHaveQuestionToken = true;
|
||||
var hasOverloads = false;
|
||||
var bodyDeclaration: FunctionLikeDeclaration;
|
||||
var lastSeenNonAmbientDeclaration: FunctionLikeDeclaration;
|
||||
@ -7128,6 +7142,8 @@ module ts {
|
||||
var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck);
|
||||
someNodeFlags |= currentNodeFlags;
|
||||
allNodeFlags &= currentNodeFlags;
|
||||
someHaveQuestionToken = someHaveQuestionToken || hasQuestionToken(node);
|
||||
allHaveQuestionToken = allHaveQuestionToken && hasQuestionToken(node);
|
||||
|
||||
if (node.body && bodyDeclaration) {
|
||||
if (isConstructor) {
|
||||
@ -7176,6 +7192,8 @@ module ts {
|
||||
|
||||
if (hasOverloads) {
|
||||
checkFlagAgreementBetweenOverloads(declarations, bodyDeclaration, flagsToCheck, someNodeFlags, allNodeFlags);
|
||||
checkQuestionTokenAgreementBetweenOverloads(declarations, bodyDeclaration, someHaveQuestionToken, allHaveQuestionToken);
|
||||
|
||||
if (bodyDeclaration) {
|
||||
var signatures = getSignaturesOfSymbol(symbol);
|
||||
var bodySignature = getSignatureFromDeclaration(bodyDeclaration);
|
||||
|
||||
@ -943,7 +943,7 @@ module ts {
|
||||
if (node.kind !== SyntaxKind.VariableDeclaration || resolver.isDeclarationVisible(node)) {
|
||||
writeTextOfNode(currentSourceFile, node.name);
|
||||
// If optional property emit ?
|
||||
if (node.kind === SyntaxKind.Property && (node.flags & NodeFlags.QuestionMark)) {
|
||||
if (node.kind === SyntaxKind.Property && hasQuestionToken(node)) {
|
||||
write("?");
|
||||
}
|
||||
if (node.kind === SyntaxKind.Property && node.parent.kind === SyntaxKind.TypeLiteral) {
|
||||
@ -1124,7 +1124,7 @@ module ts {
|
||||
}
|
||||
else {
|
||||
writeTextOfNode(currentSourceFile, node.name);
|
||||
if (node.flags & NodeFlags.QuestionMark) {
|
||||
if (hasQuestionToken(node)) {
|
||||
write("?");
|
||||
}
|
||||
}
|
||||
@ -1256,7 +1256,7 @@ module ts {
|
||||
write("...");
|
||||
}
|
||||
writeTextOfNode(currentSourceFile, node.name);
|
||||
if (node.initializer || (node.flags & NodeFlags.QuestionMark)) {
|
||||
if (node.initializer || hasQuestionToken(node)) {
|
||||
write("?");
|
||||
}
|
||||
decreaseIndent();
|
||||
|
||||
@ -219,6 +219,7 @@ module ts {
|
||||
return children(node.modifiers) ||
|
||||
child((<ParameterDeclaration>node).dotDotDotToken) ||
|
||||
child((<ParameterDeclaration>node).name) ||
|
||||
child((<ParameterDeclaration>node).questionToken) ||
|
||||
child((<ParameterDeclaration>node).type) ||
|
||||
child((<ParameterDeclaration>node).initializer);
|
||||
case SyntaxKind.Property:
|
||||
@ -226,6 +227,7 @@ module ts {
|
||||
case SyntaxKind.ShorthandPropertyAssignment:
|
||||
return children(node.modifiers) ||
|
||||
child((<PropertyDeclaration>node).name) ||
|
||||
child((<PropertyDeclaration>node).questionToken) ||
|
||||
child((<PropertyDeclaration>node).type) ||
|
||||
child((<PropertyDeclaration>node).initializer);
|
||||
case SyntaxKind.FunctionType:
|
||||
@ -246,6 +248,7 @@ module ts {
|
||||
case SyntaxKind.ArrowFunction:
|
||||
return children(node.modifiers) ||
|
||||
child((<FunctionLikeDeclaration>node).name) ||
|
||||
child((<FunctionLikeDeclaration>node).questionToken) ||
|
||||
children((<FunctionLikeDeclaration>node).typeParameters) ||
|
||||
children((<FunctionLikeDeclaration>node).parameters) ||
|
||||
child((<FunctionLikeDeclaration>node).type) ||
|
||||
@ -626,6 +629,23 @@ module ts {
|
||||
return node && node.kind === SyntaxKind.Parameter && (<ParameterDeclaration>node).dotDotDotToken !== undefined;
|
||||
}
|
||||
|
||||
export function hasQuestionToken(node: Node) {
|
||||
if (node) {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.Parameter:
|
||||
return (<ParameterDeclaration>node).questionToken !== undefined;
|
||||
case SyntaxKind.Method:
|
||||
return (<MethodDeclaration>node).questionToken !== undefined;
|
||||
case SyntaxKind.ShorthandPropertyAssignment:
|
||||
case SyntaxKind.PropertyAssignment:
|
||||
case SyntaxKind.Property:
|
||||
return (<PropertyDeclaration>node).questionToken !== undefined;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
export function hasRestParameters(s: SignatureDeclaration): boolean {
|
||||
return s.parameters.length > 0 && s.parameters[s.parameters.length - 1].dotDotDotToken !== undefined;
|
||||
}
|
||||
@ -1853,9 +1873,7 @@ module ts {
|
||||
nextToken();
|
||||
}
|
||||
|
||||
if (parseOptional(SyntaxKind.QuestionToken)) {
|
||||
node.flags |= NodeFlags.QuestionMark;
|
||||
}
|
||||
node.questionToken = token === SyntaxKind.QuestionToken ? parseTokenNode() : undefined;
|
||||
node.type = parseParameterType();
|
||||
node.initializer = inGeneratorParameterContext()
|
||||
? doOutsideOfYieldContext(parseParameterInitializer)
|
||||
@ -2020,15 +2038,12 @@ module ts {
|
||||
function parsePropertyOrMethod(): Declaration {
|
||||
var fullStart = scanner.getStartPos();
|
||||
var name = parsePropertyName();
|
||||
var flags = 0;
|
||||
if (parseOptional(SyntaxKind.QuestionToken)) {
|
||||
flags = NodeFlags.QuestionMark;
|
||||
}
|
||||
var questionToken = token === SyntaxKind.QuestionToken ? parseTokenNode() : undefined;
|
||||
|
||||
if (token === SyntaxKind.OpenParenToken || token === SyntaxKind.LessThanToken) {
|
||||
var method = <MethodDeclaration>createNode(SyntaxKind.Method, fullStart);
|
||||
method.name = name;
|
||||
method.flags = flags;
|
||||
method.questionToken = questionToken;
|
||||
|
||||
// Method signatues don't exist in expression contexts. So they have neither
|
||||
// [Yield] nor [GeneratorParameter]
|
||||
@ -2040,7 +2055,7 @@ module ts {
|
||||
else {
|
||||
var property = <PropertyDeclaration>createNode(SyntaxKind.Property, fullStart);
|
||||
property.name = name;
|
||||
property.flags = flags;
|
||||
property.questionToken = questionToken;
|
||||
property.type = parseTypeAnnotation();
|
||||
parseSemicolon();
|
||||
return finishNode(property);
|
||||
@ -3125,28 +3140,24 @@ module ts {
|
||||
return finishNode(node);
|
||||
}
|
||||
|
||||
var flags: NodeFlags = 0;
|
||||
|
||||
// Disallowing of optional property assignments happens in the grammar checker.
|
||||
if (token === SyntaxKind.QuestionToken) {
|
||||
flags |= NodeFlags.QuestionMark;
|
||||
nextToken();
|
||||
}
|
||||
var questionToken = token === SyntaxKind.QuestionToken ? parseTokenNode() : undefined;
|
||||
|
||||
// Parse to check if it is short-hand property assignment or normal property assignment
|
||||
if ((token === SyntaxKind.CommaToken || token === SyntaxKind.CloseBraceToken) && tokenIsIdentifier) {
|
||||
node = <ShortHandPropertyDeclaration>createNode(SyntaxKind.ShorthandPropertyAssignment, nodePos);
|
||||
node.name = propertyName;
|
||||
var shorthandDeclaration = <ShortHandPropertyDeclaration>createNode(SyntaxKind.ShorthandPropertyAssignment, nodePos);
|
||||
shorthandDeclaration.name = <Identifier>propertyName;
|
||||
shorthandDeclaration.questionToken = questionToken;
|
||||
return finishNode(shorthandDeclaration);
|
||||
}
|
||||
else {
|
||||
node = <PropertyDeclaration>createNode(SyntaxKind.PropertyAssignment, nodePos);
|
||||
node.name = propertyName;
|
||||
var propertyDeclaration = <PropertyDeclaration>createNode(SyntaxKind.PropertyAssignment, nodePos);
|
||||
propertyDeclaration.name = propertyName;
|
||||
propertyDeclaration.questionToken = questionToken;
|
||||
parseExpected(SyntaxKind.ColonToken);
|
||||
(<PropertyDeclaration>node).initializer = allowInAnd(parseAssignmentExpressionOrHigher);
|
||||
propertyDeclaration.initializer = allowInAnd(parseAssignmentExpressionOrHigher);
|
||||
return finishNode(propertyDeclaration);
|
||||
}
|
||||
|
||||
node.flags = flags;
|
||||
return finishNode(node);
|
||||
}
|
||||
|
||||
function parseObjectLiteralMember(): Declaration {
|
||||
@ -3671,23 +3682,18 @@ module ts {
|
||||
}
|
||||
|
||||
function parsePropertyMemberDeclaration(fullStart: number, modifiers: ModifiersArray): ClassElement {
|
||||
var flags = modifiers ? modifiers.flags : 0;
|
||||
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
|
||||
// report an error in the grammar checker.
|
||||
flags |= NodeFlags.QuestionMark;
|
||||
}
|
||||
|
||||
// Note: this is not legal as per the grammar. But we allow it in the parser and
|
||||
// report an error in the grammar checker.
|
||||
var questionToken = token === SyntaxKind.QuestionToken ? parseTokenNode() : undefined;
|
||||
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;
|
||||
method.questionToken = questionToken;
|
||||
fillSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken, /* returnTokenRequired */ false, /*yieldAndGeneratorParameterContext:*/ !!asteriskToken, method);
|
||||
method.body = parseFunctionBlockOrSemicolon(!!asteriskToken);
|
||||
return finishNode(method);
|
||||
@ -3695,10 +3701,8 @@ module ts {
|
||||
else {
|
||||
var property = <PropertyDeclaration>createNode(SyntaxKind.Property, fullStart);
|
||||
setModifiers(property, modifiers);
|
||||
if (flags) {
|
||||
property.flags = flags;
|
||||
}
|
||||
property.name = name;
|
||||
property.questionToken = questionToken;
|
||||
property.type = parseTypeAnnotation();
|
||||
property.initializer = allowInAnd(() => parseInitializer(/*inParameter*/ false));
|
||||
parseSemicolon();
|
||||
@ -4820,13 +4824,13 @@ module ts {
|
||||
}
|
||||
}
|
||||
else if (parameter.dotDotDotToken) {
|
||||
return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_cannot_have_a_rest_parameter);
|
||||
return grammarErrorOnNode(parameter.dotDotDotToken, Diagnostics.An_index_signature_cannot_have_a_rest_parameter);
|
||||
}
|
||||
else if (parameter.flags & NodeFlags.Modifier) {
|
||||
return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_cannot_have_an_accessibility_modifier);
|
||||
}
|
||||
else if (parameter.flags & NodeFlags.QuestionMark) {
|
||||
return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_cannot_have_a_question_mark);
|
||||
else if (parameter.questionToken) {
|
||||
return grammarErrorOnNode(parameter.questionToken, Diagnostics.An_index_signature_parameter_cannot_have_a_question_mark);
|
||||
}
|
||||
else if (parameter.initializer) {
|
||||
return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_cannot_have_an_initializer);
|
||||
@ -4878,7 +4882,7 @@ module ts {
|
||||
return true;
|
||||
}
|
||||
if (node.parent.kind === SyntaxKind.ClassDeclaration) {
|
||||
if (checkForInvalidQuestionMark(node, Diagnostics.A_class_member_cannot_be_declared_optional)) {
|
||||
if (checkForInvalidQuestionMark(node, node.questionToken, Diagnostics.A_class_member_cannot_be_declared_optional)) {
|
||||
return true;
|
||||
}
|
||||
// Technically, computed properties in ambient contexts is disallowed
|
||||
@ -5178,21 +5182,21 @@ module ts {
|
||||
var parameter = parameters[i];
|
||||
if (parameter.dotDotDotToken) {
|
||||
if (i !== (parameterCount - 1)) {
|
||||
return grammarErrorOnNode(parameter.name, Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list);
|
||||
return grammarErrorOnNode(parameter.dotDotDotToken, Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list);
|
||||
}
|
||||
|
||||
if (parameter.flags & NodeFlags.QuestionMark) {
|
||||
return grammarErrorOnNode(parameter.name, Diagnostics.A_rest_parameter_cannot_be_optional);
|
||||
if (parameter.questionToken) {
|
||||
return grammarErrorOnNode(parameter.questionToken, Diagnostics.A_rest_parameter_cannot_be_optional);
|
||||
}
|
||||
|
||||
if (parameter.initializer) {
|
||||
return grammarErrorOnNode(parameter.name, Diagnostics.A_rest_parameter_cannot_have_an_initializer);
|
||||
}
|
||||
}
|
||||
else if (parameter.flags & NodeFlags.QuestionMark || parameter.initializer) {
|
||||
else if (parameter.questionToken || parameter.initializer) {
|
||||
seenOptionalParameter = true;
|
||||
|
||||
if (parameter.flags & NodeFlags.QuestionMark && parameter.initializer) {
|
||||
if (parameter.questionToken && parameter.initializer) {
|
||||
return grammarErrorOnNode(parameter.name, Diagnostics.Parameter_cannot_have_question_mark_and_initializer);
|
||||
}
|
||||
}
|
||||
@ -5226,7 +5230,7 @@ module ts {
|
||||
|
||||
function checkProperty(node: PropertyDeclaration) {
|
||||
if (node.parent.kind === SyntaxKind.ClassDeclaration) {
|
||||
if (checkForInvalidQuestionMark(node, Diagnostics.A_class_member_cannot_be_declared_optional) ||
|
||||
if (checkForInvalidQuestionMark(node, node.questionToken, Diagnostics.A_class_member_cannot_be_declared_optional) ||
|
||||
checkForDisallowedComputedProperty(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_class_property_declarations)) {
|
||||
return true;
|
||||
}
|
||||
@ -5267,13 +5271,12 @@ module ts {
|
||||
}
|
||||
|
||||
function checkPropertyAssignment(node: PropertyDeclaration) {
|
||||
return checkForInvalidQuestionMark(node, Diagnostics.An_object_member_cannot_be_declared_optional);
|
||||
return checkForInvalidQuestionMark(node, node.questionToken, Diagnostics.An_object_member_cannot_be_declared_optional);
|
||||
}
|
||||
|
||||
function checkForInvalidQuestionMark(node: Declaration, message: DiagnosticMessage) {
|
||||
if (node.flags & NodeFlags.QuestionMark) {
|
||||
var pos = skipTrivia(sourceText, node.name.end);
|
||||
return grammarErrorAtPos(pos, "?".length, message);
|
||||
function checkForInvalidQuestionMark(node: Declaration, questionToken: Node, message: DiagnosticMessage) {
|
||||
if (questionToken) {
|
||||
return grammarErrorOnNode(questionToken, message);
|
||||
}
|
||||
}
|
||||
|
||||
@ -5315,13 +5318,13 @@ module ts {
|
||||
else {
|
||||
var parameter = accessor.parameters[0];
|
||||
if (parameter.dotDotDotToken) {
|
||||
return grammarErrorOnNode(accessor.name, Diagnostics.A_set_accessor_cannot_have_rest_parameter);
|
||||
return grammarErrorOnNode(parameter.dotDotDotToken, Diagnostics.A_set_accessor_cannot_have_rest_parameter);
|
||||
}
|
||||
else if (parameter.flags & NodeFlags.Modifier) {
|
||||
return grammarErrorOnNode(accessor.name, Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation);
|
||||
}
|
||||
else if (parameter.flags & NodeFlags.QuestionMark) {
|
||||
return grammarErrorOnNode(accessor.name, Diagnostics.A_set_accessor_cannot_have_an_optional_parameter);
|
||||
else if (parameter.questionToken) {
|
||||
return grammarErrorOnNode(parameter.questionToken, Diagnostics.A_set_accessor_cannot_have_an_optional_parameter);
|
||||
}
|
||||
else if (parameter.initializer) {
|
||||
return grammarErrorOnNode(accessor.name, Diagnostics.A_set_accessor_parameter_cannot_have_an_initializer);
|
||||
@ -5368,7 +5371,7 @@ module ts {
|
||||
}
|
||||
|
||||
function checkShorthandPropertyAssignment(node: ShortHandPropertyDeclaration): boolean {
|
||||
return checkForInvalidQuestionMark(node, Diagnostics.An_object_member_cannot_be_declared_optional);
|
||||
return checkForInvalidQuestionMark(node, node.questionToken, Diagnostics.An_object_member_cannot_be_declared_optional);
|
||||
}
|
||||
|
||||
function checkSwitchStatement(node: SwitchStatement) {
|
||||
|
||||
@ -272,7 +272,6 @@ module ts {
|
||||
export const enum NodeFlags {
|
||||
Export = 0x00000001, // Declarations
|
||||
Ambient = 0x00000002, // Declarations
|
||||
QuestionMark = 0x00000004, // Parameter/Property/Method
|
||||
Public = 0x00000010, // Property/Method
|
||||
Private = 0x00000020, // Property/Method
|
||||
Protected = 0x00000040, // Property/Method
|
||||
@ -370,11 +369,13 @@ module ts {
|
||||
export interface ParameterDeclaration extends Declaration {
|
||||
dotDotDotToken?: Node;
|
||||
name: Identifier;
|
||||
questionToken?: Node;
|
||||
type?: TypeNode | StringLiteralExpression;
|
||||
initializer?: Expression;
|
||||
}
|
||||
|
||||
export interface PropertyDeclaration extends Declaration, ClassElement {
|
||||
questionToken?: Node;
|
||||
type?: TypeNode;
|
||||
initializer?: Expression;
|
||||
}
|
||||
@ -384,6 +385,7 @@ module ts {
|
||||
|
||||
export interface ShortHandPropertyDeclaration extends Declaration {
|
||||
name: Identifier;
|
||||
questionToken?: Node;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -398,6 +400,7 @@ module ts {
|
||||
_functionLikeDeclarationBrand: any;
|
||||
|
||||
asteriskToken?: Node;
|
||||
questionToken?: Node;
|
||||
body?: Block | Expression;
|
||||
}
|
||||
|
||||
|
||||
@ -524,7 +524,7 @@ module ts.SignatureHelp {
|
||||
var displayParts = mapToDisplayParts(writer =>
|
||||
typeInfoResolver.getSymbolDisplayBuilder().buildParameterDisplay(parameter, writer, invocation));
|
||||
|
||||
var isOptional = !!(parameter.valueDeclaration.flags & NodeFlags.QuestionMark);
|
||||
var isOptional = hasQuestionToken(parameter.valueDeclaration);
|
||||
|
||||
return {
|
||||
name: parameter.name,
|
||||
|
||||
@ -1,14 +1,14 @@
|
||||
tests/cases/compiler/accessorWithRestParam.ts(3,9): error TS1053: A 'set' accessor cannot have rest parameter.
|
||||
tests/cases/compiler/accessorWithRestParam.ts(4,16): error TS1053: A 'set' accessor cannot have rest parameter.
|
||||
tests/cases/compiler/accessorWithRestParam.ts(3,11): error TS1053: A 'set' accessor cannot have rest parameter.
|
||||
tests/cases/compiler/accessorWithRestParam.ts(4,18): error TS1053: A 'set' accessor cannot have rest parameter.
|
||||
|
||||
|
||||
==== tests/cases/compiler/accessorWithRestParam.ts (2 errors) ====
|
||||
|
||||
class C {
|
||||
set X(...v) { }
|
||||
~
|
||||
~~~
|
||||
!!! error TS1053: A 'set' accessor cannot have rest parameter.
|
||||
static set X(...v2) { }
|
||||
~
|
||||
~~~
|
||||
!!! error TS1053: A 'set' accessor cannot have rest parameter.
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors1.ts(1,9): error TS1016: A required parameter cannot follow an optional parameter.
|
||||
tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors1.ts(2,5): error TS1047: A rest parameter cannot be optional.
|
||||
tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors1.ts(2,8): error TS1047: A rest parameter cannot be optional.
|
||||
tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors1.ts(4,5): error TS1048: A rest parameter cannot have an initializer.
|
||||
tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors1.ts(7,12): error TS1016: A required parameter cannot follow an optional parameter.
|
||||
|
||||
@ -9,7 +9,7 @@ tests/cases/compiler/fatarrowfunctionsOptionalArgsErrors1.ts(7,12): error TS1016
|
||||
~~~~
|
||||
!!! error TS1016: A required parameter cannot follow an optional parameter.
|
||||
(...arg?) => 102;
|
||||
~~~
|
||||
~
|
||||
!!! error TS1047: A rest parameter cannot be optional.
|
||||
(...arg) => 103;
|
||||
(...arg:number [] = []) => 104;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
tests/cases/conformance/functions/functionOverloadErrorsSyntax.ts(2,27): error TS1016: A required parameter cannot follow an optional parameter.
|
||||
tests/cases/conformance/functions/functionOverloadErrorsSyntax.ts(5,38): error TS1016: A required parameter cannot follow an optional parameter.
|
||||
tests/cases/conformance/functions/functionOverloadErrorsSyntax.ts(9,28): error TS1014: A rest parameter must be last in a parameter list.
|
||||
tests/cases/conformance/functions/functionOverloadErrorsSyntax.ts(9,25): error TS1014: A rest parameter must be last in a parameter list.
|
||||
|
||||
|
||||
==== tests/cases/conformance/functions/functionOverloadErrorsSyntax.ts (3 errors) ====
|
||||
@ -17,7 +17,7 @@ tests/cases/conformance/functions/functionOverloadErrorsSyntax.ts(9,28): error T
|
||||
|
||||
//Function overload signature with rest param followed by non-optional parameter
|
||||
function fn5(x: string, ...y: any[], z: string);
|
||||
~
|
||||
~~~
|
||||
!!! error TS1014: A rest parameter must be last in a parameter list.
|
||||
function fn5() { }
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/indexSignatureTypeCheck.ts(14,6): error TS1019: An index signature parameter cannot have a question mark.
|
||||
tests/cases/compiler/indexSignatureTypeCheck.ts(15,9): error TS1017: An index signature cannot have a rest parameter.
|
||||
tests/cases/compiler/indexSignatureTypeCheck.ts(14,8): error TS1019: An index signature parameter cannot have a question mark.
|
||||
tests/cases/compiler/indexSignatureTypeCheck.ts(15,6): error TS1017: An index signature cannot have a rest parameter.
|
||||
tests/cases/compiler/indexSignatureTypeCheck.ts(16,6): error TS1096: An index signature must have exactly one parameter.
|
||||
tests/cases/compiler/indexSignatureTypeCheck.ts(17,6): error TS1096: An index signature must have exactly one parameter.
|
||||
|
||||
@ -19,10 +19,10 @@ tests/cases/compiler/indexSignatureTypeCheck.ts(17,6): error TS1096: An index si
|
||||
|
||||
interface indexErrors {
|
||||
[p2?: string];
|
||||
~~
|
||||
~
|
||||
!!! error TS1019: An index signature parameter cannot have a question mark.
|
||||
[...p3: any[]];
|
||||
~~
|
||||
~~~
|
||||
!!! error TS1017: An index signature cannot have a rest parameter.
|
||||
[p4: string, p5?: string];
|
||||
~~
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/indexSignatureTypeCheck2.ts(10,6): error TS1019: An index signature parameter cannot have a question mark.
|
||||
tests/cases/compiler/indexSignatureTypeCheck2.ts(11,9): error TS1017: An index signature cannot have a rest parameter.
|
||||
tests/cases/compiler/indexSignatureTypeCheck2.ts(10,8): error TS1019: An index signature parameter cannot have a question mark.
|
||||
tests/cases/compiler/indexSignatureTypeCheck2.ts(11,6): error TS1017: An index signature cannot have a rest parameter.
|
||||
tests/cases/compiler/indexSignatureTypeCheck2.ts(12,6): error TS1096: An index signature must have exactly one parameter.
|
||||
tests/cases/compiler/indexSignatureTypeCheck2.ts(13,6): error TS1096: An index signature must have exactly one parameter.
|
||||
|
||||
@ -15,10 +15,10 @@ tests/cases/compiler/indexSignatureTypeCheck2.ts(13,6): error TS1096: An index s
|
||||
|
||||
interface indexErrors {
|
||||
[p2?: string];
|
||||
~~
|
||||
~
|
||||
!!! error TS1019: An index signature parameter cannot have a question mark.
|
||||
[...p3: any[]];
|
||||
~~
|
||||
~~~
|
||||
!!! error TS1017: An index signature cannot have a rest parameter.
|
||||
[p4: string, p5?: string];
|
||||
~~
|
||||
|
||||
@ -1,18 +1,18 @@
|
||||
tests/cases/compiler/indexerAsOptional.ts(3,6): error TS1019: An index signature parameter cannot have a question mark.
|
||||
tests/cases/compiler/indexerAsOptional.ts(8,6): error TS1019: An index signature parameter cannot have a question mark.
|
||||
tests/cases/compiler/indexerAsOptional.ts(3,9): error TS1019: An index signature parameter cannot have a question mark.
|
||||
tests/cases/compiler/indexerAsOptional.ts(8,9): error TS1019: An index signature parameter cannot have a question mark.
|
||||
|
||||
|
||||
==== tests/cases/compiler/indexerAsOptional.ts (2 errors) ====
|
||||
interface indexSig {
|
||||
//Index signatures can't be optional
|
||||
[idx?: number]: any; //err
|
||||
~~~
|
||||
~
|
||||
!!! error TS1019: An index signature parameter cannot have a question mark.
|
||||
}
|
||||
|
||||
class indexSig2 {
|
||||
//Index signatures can't be optional
|
||||
[idx?: number]: any //err
|
||||
~~~
|
||||
~
|
||||
!!! error TS1019: An index signature parameter cannot have a question mark.
|
||||
}
|
||||
@ -1,16 +1,16 @@
|
||||
tests/cases/compiler/indexerSignatureWithRestParam.ts(2,9): error TS1017: An index signature cannot have a rest parameter.
|
||||
tests/cases/compiler/indexerSignatureWithRestParam.ts(6,9): error TS1017: An index signature cannot have a rest parameter.
|
||||
tests/cases/compiler/indexerSignatureWithRestParam.ts(2,6): error TS1017: An index signature cannot have a rest parameter.
|
||||
tests/cases/compiler/indexerSignatureWithRestParam.ts(6,6): error TS1017: An index signature cannot have a rest parameter.
|
||||
|
||||
|
||||
==== tests/cases/compiler/indexerSignatureWithRestParam.ts (2 errors) ====
|
||||
interface I {
|
||||
[...x]: string;
|
||||
~
|
||||
~~~
|
||||
!!! error TS1017: An index signature cannot have a rest parameter.
|
||||
}
|
||||
|
||||
class C {
|
||||
[...x]: string
|
||||
~
|
||||
~~~
|
||||
!!! error TS1017: An index signature cannot have a rest parameter.
|
||||
}
|
||||
@ -1,9 +1,9 @@
|
||||
tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature1.ts(2,7): error TS1017: An index signature cannot have a rest parameter.
|
||||
tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature1.ts(2,4): error TS1017: An index signature cannot have a rest parameter.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature1.ts (1 errors) ====
|
||||
interface I {
|
||||
[...a]
|
||||
~
|
||||
~~~
|
||||
!!! error TS1017: An index signature cannot have a rest parameter.
|
||||
}
|
||||
@ -1,9 +1,9 @@
|
||||
tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature3.ts(2,4): error TS1019: An index signature parameter cannot have a question mark.
|
||||
tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature3.ts(2,5): error TS1019: An index signature parameter cannot have a question mark.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature3.ts (1 errors) ====
|
||||
interface I {
|
||||
[a?]
|
||||
~
|
||||
~
|
||||
!!! error TS1019: An index signature parameter cannot have a question mark.
|
||||
}
|
||||
@ -1,9 +1,9 @@
|
||||
tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration17.ts(2,8): error TS1051: A 'set' accessor cannot have an optional parameter.
|
||||
tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration17.ts(2,13): error TS1051: A 'set' accessor cannot have an optional parameter.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration17.ts (1 errors) ====
|
||||
class C {
|
||||
set Foo(a?: number) { }
|
||||
~~~
|
||||
~
|
||||
!!! error TS1051: A 'set' accessor cannot have an optional parameter.
|
||||
}
|
||||
@ -1,9 +1,9 @@
|
||||
tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration18.ts(2,8): error TS1053: A 'set' accessor cannot have rest parameter.
|
||||
tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration18.ts(2,12): error TS1053: A 'set' accessor cannot have rest parameter.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration18.ts (1 errors) ====
|
||||
class C {
|
||||
set Foo(...a) { }
|
||||
~~~
|
||||
~~~
|
||||
!!! error TS1053: A 'set' accessor cannot have rest parameter.
|
||||
}
|
||||
@ -1,9 +1,9 @@
|
||||
tests/cases/conformance/parser/ecmascript5/ParameterLists/parserParameterList1.ts(2,9): error TS1014: A rest parameter must be last in a parameter list.
|
||||
tests/cases/conformance/parser/ecmascript5/ParameterLists/parserParameterList1.ts(2,6): error TS1014: A rest parameter must be last in a parameter list.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/ParameterLists/parserParameterList1.ts (1 errors) ====
|
||||
class C {
|
||||
F(...A, B) { }
|
||||
~
|
||||
~~~
|
||||
!!! error TS1014: A rest parameter must be last in a parameter list.
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
tests/cases/conformance/parser/ecmascript5/ParameterLists/parserParameterList11.ts(1,5): error TS1047: A rest parameter cannot be optional.
|
||||
tests/cases/conformance/parser/ecmascript5/ParameterLists/parserParameterList11.ts(1,8): error TS1047: A rest parameter cannot be optional.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/ParameterLists/parserParameterList11.ts (1 errors) ====
|
||||
(...arg?) => 102;
|
||||
~~~
|
||||
~
|
||||
!!! error TS1047: A rest parameter cannot be optional.
|
||||
@ -1,9 +1,9 @@
|
||||
tests/cases/conformance/parser/ecmascript5/ParameterLists/parserParameterList9.ts(2,11): error TS1047: A rest parameter cannot be optional.
|
||||
tests/cases/conformance/parser/ecmascript5/ParameterLists/parserParameterList9.ts(2,14): error TS1047: A rest parameter cannot be optional.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/ParameterLists/parserParameterList9.ts (1 errors) ====
|
||||
class C {
|
||||
foo(...bar?) { }
|
||||
~~~
|
||||
~
|
||||
!!! error TS1047: A rest parameter cannot be optional.
|
||||
}
|
||||
@ -1,10 +1,10 @@
|
||||
tests/cases/compiler/restParamAsOptional.ts(1,15): error TS1047: A rest parameter cannot be optional.
|
||||
tests/cases/compiler/restParamAsOptional.ts(1,16): error TS1047: A rest parameter cannot be optional.
|
||||
tests/cases/compiler/restParamAsOptional.ts(2,16): error TS1048: A rest parameter cannot have an initializer.
|
||||
|
||||
|
||||
==== tests/cases/compiler/restParamAsOptional.ts (2 errors) ====
|
||||
function f(...x?) { }
|
||||
~
|
||||
~
|
||||
!!! error TS1047: A rest parameter cannot be optional.
|
||||
function f2(...x = []) { }
|
||||
~
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
tests/cases/compiler/restParameterNotLast.ts(1,15): error TS1014: A rest parameter must be last in a parameter list.
|
||||
tests/cases/compiler/restParameterNotLast.ts(1,12): error TS1014: A rest parameter must be last in a parameter list.
|
||||
|
||||
|
||||
==== tests/cases/compiler/restParameterNotLast.ts (1 errors) ====
|
||||
function f(...x, y) { }
|
||||
~
|
||||
~~~
|
||||
!!! error TS1014: A rest parameter must be last in a parameter list.
|
||||
@ -1,6 +1,6 @@
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParameterWithoutAnnotationIsAnyArray.ts(5,14): error TS1014: A rest parameter must be last in a parameter list.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParameterWithoutAnnotationIsAnyArray.ts(13,12): error TS1014: A rest parameter must be last in a parameter list.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParameterWithoutAnnotationIsAnyArray.ts(23,24): error TS1014: A rest parameter must be last in a parameter list.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParameterWithoutAnnotationIsAnyArray.ts(5,11): error TS1014: A rest parameter must be last in a parameter list.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParameterWithoutAnnotationIsAnyArray.ts(13,9): error TS1014: A rest parameter must be last in a parameter list.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParameterWithoutAnnotationIsAnyArray.ts(23,21): error TS1014: A rest parameter must be last in a parameter list.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParameterWithoutAnnotationIsAnyArray.ts (3 errors) ====
|
||||
@ -9,7 +9,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParameterWith
|
||||
function foo(...x) { }
|
||||
var f = function foo(...x) { }
|
||||
var f2 = (...x, ...y) => { }
|
||||
~
|
||||
~~~
|
||||
!!! error TS1014: A rest parameter must be last in a parameter list.
|
||||
|
||||
class C {
|
||||
@ -19,7 +19,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParameterWith
|
||||
interface I {
|
||||
(...x);
|
||||
foo(...x, ...y);
|
||||
~
|
||||
~~~
|
||||
!!! error TS1014: A rest parameter must be last in a parameter list.
|
||||
}
|
||||
|
||||
@ -31,7 +31,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParameterWith
|
||||
var b = {
|
||||
foo(...x) { },
|
||||
a: function foo(...x, ...y) { },
|
||||
~
|
||||
~~~
|
||||
!!! error TS1014: A rest parameter must be last in a parameter list.
|
||||
b: (...x) => { }
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts(5,14): error TS1014: A rest parameter must be last in a parameter list.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts(13,12): error TS1014: A rest parameter must be last in a parameter list.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts(23,24): error TS1014: A rest parameter must be last in a parameter list.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts(5,11): error TS1014: A rest parameter must be last in a parameter list.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts(13,9): error TS1014: A rest parameter must be last in a parameter list.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts(23,21): error TS1014: A rest parameter must be last in a parameter list.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts(3,14): error TS2370: A rest parameter must be of an array type.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts(4,22): error TS2370: A rest parameter must be of an array type.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts(5,11): error TS2370: A rest parameter must be of an array type.
|
||||
@ -27,7 +27,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfN
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2370: A rest parameter must be of an array type.
|
||||
var f2 = (...x: Date, ...y: boolean) => { }
|
||||
~
|
||||
~~~
|
||||
!!! error TS1014: A rest parameter must be last in a parameter list.
|
||||
~~~~~~~~~~
|
||||
!!! error TS2370: A rest parameter must be of an array type.
|
||||
@ -45,7 +45,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfN
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2370: A rest parameter must be of an array type.
|
||||
foo(...x: number, ...y: number);
|
||||
~
|
||||
~~~
|
||||
!!! error TS1014: A rest parameter must be last in a parameter list.
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2370: A rest parameter must be of an array type.
|
||||
@ -67,7 +67,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfN
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2370: A rest parameter must be of an array type.
|
||||
a: function foo(...x: number, ...y: Date) { },
|
||||
~
|
||||
~~~
|
||||
!!! error TS1014: A rest parameter must be last in a parameter list.
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2370: A rest parameter must be of an array type.
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(9,14): error TS1014: A rest parameter must be last in a parameter list.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(17,12): error TS1014: A rest parameter must be last in a parameter list.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(27,24): error TS1014: A rest parameter must be last in a parameter list.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(36,14): error TS1014: A rest parameter must be last in a parameter list.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(44,12): error TS1014: A rest parameter must be last in a parameter list.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(54,24): error TS1014: A rest parameter must be last in a parameter list.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(9,11): error TS1014: A rest parameter must be last in a parameter list.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(17,9): error TS1014: A rest parameter must be last in a parameter list.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(27,21): error TS1014: A rest parameter must be last in a parameter list.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(36,11): error TS1014: A rest parameter must be last in a parameter list.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(44,9): error TS1014: A rest parameter must be last in a parameter list.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(54,21): error TS1014: A rest parameter must be last in a parameter list.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(7,14): error TS2370: A rest parameter must be of an array type.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(8,22): error TS2370: A rest parameter must be of an array type.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes2.ts(9,11): error TS2370: A rest parameter must be of an array type.
|
||||
@ -48,7 +48,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfN
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2370: A rest parameter must be of an array type.
|
||||
var f2 = (...x: MyThing, ...y: MyThing) => { }
|
||||
~
|
||||
~~~
|
||||
!!! error TS1014: A rest parameter must be last in a parameter list.
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2370: A rest parameter must be of an array type.
|
||||
@ -66,7 +66,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfN
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2370: A rest parameter must be of an array type.
|
||||
foo(...x: MyThing, ...y: MyThing);
|
||||
~
|
||||
~~~
|
||||
!!! error TS1014: A rest parameter must be last in a parameter list.
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2370: A rest parameter must be of an array type.
|
||||
@ -88,7 +88,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfN
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2370: A rest parameter must be of an array type.
|
||||
a: function foo(...x: MyThing, ...y: MyThing) { },
|
||||
~
|
||||
~~~
|
||||
!!! error TS1014: A rest parameter must be last in a parameter list.
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2370: A rest parameter must be of an array type.
|
||||
@ -109,7 +109,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfN
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2370: A rest parameter must be of an array type.
|
||||
var f4 = (...x: MyThing2<string>, ...y: MyThing2<string>) => { }
|
||||
~
|
||||
~~~
|
||||
!!! error TS1014: A rest parameter must be last in a parameter list.
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2370: A rest parameter must be of an array type.
|
||||
@ -127,7 +127,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfN
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2370: A rest parameter must be of an array type.
|
||||
foo(...x: MyThing2<string>, ...y: MyThing2<string>);
|
||||
~
|
||||
~~~
|
||||
!!! error TS1014: A rest parameter must be last in a parameter list.
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2370: A rest parameter must be of an array type.
|
||||
@ -149,7 +149,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfN
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2370: A rest parameter must be of an array type.
|
||||
a: function foo(...x: MyThing2<string>, ...y: MyThing2<string>) { },
|
||||
~
|
||||
~~~
|
||||
!!! error TS1014: A rest parameter must be last in a parameter list.
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2370: A rest parameter must be of an array type.
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts(5,14): error TS1014: A rest parameter must be last in a parameter list.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts(13,12): error TS1014: A rest parameter must be last in a parameter list.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts(23,24): error TS1014: A rest parameter must be last in a parameter list.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts(32,14): error TS1014: A rest parameter must be last in a parameter list.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts(40,12): error TS1014: A rest parameter must be last in a parameter list.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts(50,24): error TS1014: A rest parameter must be last in a parameter list.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts(5,11): error TS1014: A rest parameter must be last in a parameter list.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts(13,9): error TS1014: A rest parameter must be last in a parameter list.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts(23,21): error TS1014: A rest parameter must be last in a parameter list.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts(32,11): error TS1014: A rest parameter must be last in a parameter list.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts(40,9): error TS1014: A rest parameter must be last in a parameter list.
|
||||
tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts(50,21): error TS1014: A rest parameter must be last in a parameter list.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWithArrayTypeAnnotations.ts (6 errors) ====
|
||||
@ -12,7 +12,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWit
|
||||
function foo(...x: number[]) { }
|
||||
var f = function foo(...x: number[]) { }
|
||||
var f2 = (...x: number[], ...y: number[]) => { }
|
||||
~
|
||||
~~~
|
||||
!!! error TS1014: A rest parameter must be last in a parameter list.
|
||||
|
||||
class C {
|
||||
@ -22,7 +22,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWit
|
||||
interface I {
|
||||
(...x: number[]);
|
||||
foo(...x: number[], ...y: number[]);
|
||||
~
|
||||
~~~
|
||||
!!! error TS1014: A rest parameter must be last in a parameter list.
|
||||
}
|
||||
|
||||
@ -34,7 +34,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWit
|
||||
var b = {
|
||||
foo(...x: number[]) { },
|
||||
a: function foo(...x: number[], ...y: number[]) { },
|
||||
~
|
||||
~~~
|
||||
!!! error TS1014: A rest parameter must be last in a parameter list.
|
||||
b: (...x: number[]) => { }
|
||||
}
|
||||
@ -45,7 +45,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWit
|
||||
function foo2(...x: Array<string>) { }
|
||||
var f3 = function foo(...x: Array<string>) { }
|
||||
var f4 = (...x: Array<string>, ...y: Array<string>) => { }
|
||||
~
|
||||
~~~
|
||||
!!! error TS1014: A rest parameter must be last in a parameter list.
|
||||
|
||||
class C2 {
|
||||
@ -55,7 +55,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWit
|
||||
interface I2 {
|
||||
(...x: Array<string>);
|
||||
foo(...x: Array<string>, ...y: Array<string>);
|
||||
~
|
||||
~~~
|
||||
!!! error TS1014: A rest parameter must be last in a parameter list.
|
||||
}
|
||||
|
||||
@ -67,7 +67,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersWit
|
||||
var b2 = {
|
||||
foo(...x: Array<string>) { },
|
||||
a: function foo(...x: Array<string>, ...y: Array<string>) { },
|
||||
~
|
||||
~~~
|
||||
!!! error TS1014: A rest parameter must be last in a parameter list.
|
||||
b: (...x: Array<string>) => { }
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user