Skip error checks on node if any children produced errors.
This commit is contained in:
parent
34bb53f54c
commit
2961d23078
5 changed files with 77 additions and 203 deletions
|
@ -1713,53 +1713,10 @@ module ts {
|
|||
|
||||
function parseIndexSignatureMember(): SignatureDeclaration {
|
||||
var node = <SignatureDeclaration>createNode(SyntaxKind.IndexSignature);
|
||||
var errorCountBeforeIndexSignature = file._parserDiagnostics.length;
|
||||
var indexerStart = scanner.getTokenPos();
|
||||
node.parameters = parseParameterList(SyntaxKind.OpenBracketToken, SyntaxKind.CloseBracketToken);
|
||||
var indexerLength = scanner.getStartPos() - indexerStart;
|
||||
node.type = parseTypeAnnotation();
|
||||
parseSemicolon();
|
||||
finishNode(node)
|
||||
|
||||
if (file._parserDiagnostics.length === errorCountBeforeIndexSignature) {
|
||||
checkIndexSignature(node);
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
function checkIndexSignature(node: SignatureDeclaration): void {
|
||||
var parameter = node.parameters[0];
|
||||
if (node.parameters.length !== 1) {
|
||||
if (parameter) {
|
||||
grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_must_have_exactly_one_parameter);
|
||||
}
|
||||
else {
|
||||
grammarErrorOnNode(node, Diagnostics.An_index_signature_must_have_exactly_one_parameter);
|
||||
}
|
||||
}
|
||||
else if (parameter.flags & NodeFlags.Rest) {
|
||||
grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_cannot_have_a_rest_parameter);
|
||||
}
|
||||
else if (parameter.flags & NodeFlags.Modifier) {
|
||||
grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_cannot_have_an_accessibility_modifier);
|
||||
}
|
||||
else if (parameter.flags & NodeFlags.QuestionMark) {
|
||||
grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_cannot_have_a_question_mark);
|
||||
}
|
||||
else if (parameter.initializer) {
|
||||
grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_cannot_have_an_initializer);
|
||||
}
|
||||
else if (!parameter.type) {
|
||||
grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_must_have_a_type_annotation);
|
||||
}
|
||||
else if (parameter.type.kind !== SyntaxKind.StringKeyword &&
|
||||
parameter.type.kind !== SyntaxKind.NumberKeyword) {
|
||||
grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_type_must_be_string_or_number);
|
||||
}
|
||||
else if (!node.type) {
|
||||
grammarErrorOnNode(node, Diagnostics.An_index_signature_must_have_a_type_annotation);
|
||||
}
|
||||
return finishNode(node)
|
||||
}
|
||||
|
||||
function parsePropertyOrMethod(): Declaration {
|
||||
|
@ -4314,14 +4271,19 @@ module ts {
|
|||
}
|
||||
|
||||
function performGrammarChecks(sourceText: string, file: SourceFileInternal) {
|
||||
var syntacticDiagnostics = file._syntacticDiagnostics;
|
||||
|
||||
performNodeChecks(file);
|
||||
|
||||
function performNodeChecks(node: Node) {
|
||||
function performNodeChecks(node: Node): void {
|
||||
// First recurse and perform all grammar checks on the children of this node. If any
|
||||
// children had an grammar error, then skip reporting errors for this node or anything
|
||||
// higher.
|
||||
if (forEachChild(node, performNodeChecks)) {
|
||||
return true;
|
||||
var diagnosticCount = syntacticDiagnostics.length;
|
||||
forEachChild(node, performNodeChecks);
|
||||
|
||||
if (diagnosticCount !== syntacticDiagnostics.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
// No grammar errors on any of our children. Check this node for grammar errors.
|
||||
|
@ -4335,12 +4297,11 @@ module ts {
|
|||
case SyntaxKind.FunctionExpression: return performFunctionExpressionChecks(<FunctionExpression>node);
|
||||
case SyntaxKind.FunctionType: return performFunctionTypeChecks(<SignatureDeclaration>node);
|
||||
case SyntaxKind.GetAccessor: return performGetAccessorChecks(<MethodDeclaration>node);
|
||||
case SyntaxKind.IndexSignature: return performIndexSignatureChecks(<SignatureDeclaration>node);
|
||||
case SyntaxKind.Method: return performMethodChecks(<MethodDeclaration>node);
|
||||
case SyntaxKind.Parameter: return performParameterChecks(<ParameterDeclaration>node);
|
||||
case SyntaxKind.SetAccessor: return performSetAccessorChecks(<MethodDeclaration>node);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function grammarErrorOnNode(node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): void {
|
||||
|
@ -4358,100 +4319,111 @@ module ts {
|
|||
}
|
||||
|
||||
function performArrowFunctionChecks(node: FunctionExpression) {
|
||||
if (performParameterListChecks(node.parameters)) {
|
||||
return true;
|
||||
if (checkParameterList(node.parameters)) {
|
||||
return;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function performCallSignatureChecks(node: ConstructorDeclaration) {
|
||||
if (performParameterListChecks(node.parameters)) {
|
||||
return true;
|
||||
if (checkParameterList(node.parameters)) {
|
||||
return;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function performConstructorChecks(node: ConstructorDeclaration) {
|
||||
if (performParameterListChecks(node.parameters)) {
|
||||
return true;
|
||||
if (checkParameterList(node.parameters)) {
|
||||
return;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function performConstructorTypeChecks(node: SignatureDeclaration) {
|
||||
if (performParameterListChecks(node.parameters)) {
|
||||
return true;
|
||||
if (checkParameterList(node.parameters)) {
|
||||
return;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function performConstructSignatureChecks(node: FunctionLikeDeclaration) {
|
||||
if (performParameterListChecks(node.parameters)) {
|
||||
return true;
|
||||
if (checkParameterList(node.parameters)) {
|
||||
return;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function performFunctionDeclarationChecks(node: FunctionLikeDeclaration) {
|
||||
if (performParameterListChecks(node.parameters)) {
|
||||
return true;
|
||||
if (checkParameterList(node.parameters)) {
|
||||
return;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function performFunctionExpressionChecks(node: FunctionExpression) {
|
||||
if (performParameterListChecks(node.parameters)) {
|
||||
return true;
|
||||
if (checkParameterList(node.parameters)) {
|
||||
return;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function performFunctionTypeChecks(node: SignatureDeclaration) {
|
||||
if (performParameterListChecks(node.parameters)) {
|
||||
return true;
|
||||
if (checkParameterList(node.parameters)) {
|
||||
return;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function performGetAccessorChecks(node: MethodDeclaration) {
|
||||
if (performParameterListChecks(node.parameters)) {
|
||||
return true;
|
||||
if (checkParameterList(node.parameters)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
function performIndexSignatureChecks(node: SignatureDeclaration): void {
|
||||
var parameter = node.parameters[0];
|
||||
if (node.parameters.length !== 1) {
|
||||
if (parameter) {
|
||||
return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_must_have_exactly_one_parameter);
|
||||
}
|
||||
else {
|
||||
return grammarErrorOnNode(node, Diagnostics.An_index_signature_must_have_exactly_one_parameter);
|
||||
}
|
||||
}
|
||||
else if (parameter.flags & NodeFlags.Rest) {
|
||||
return grammarErrorOnNode(parameter.name, 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.initializer) {
|
||||
return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_cannot_have_an_initializer);
|
||||
}
|
||||
else if (!parameter.type) {
|
||||
return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_must_have_a_type_annotation);
|
||||
}
|
||||
else if (parameter.type.kind !== SyntaxKind.StringKeyword &&
|
||||
parameter.type.kind !== SyntaxKind.NumberKeyword) {
|
||||
return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_type_must_be_string_or_number);
|
||||
}
|
||||
else if (!node.type) {
|
||||
return grammarErrorOnNode(node, Diagnostics.An_index_signature_must_have_a_type_annotation);
|
||||
}
|
||||
}
|
||||
|
||||
function performMethodChecks(node: MethodDeclaration) {
|
||||
if (performParameterListChecks(node.parameters)) {
|
||||
return true;
|
||||
if (checkParameterList(node.parameters)) {
|
||||
return;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function performParameterChecks(node: ParameterDeclaration): boolean {
|
||||
function performParameterChecks(node: ParameterDeclaration): void {
|
||||
// It is a SyntaxError if the Identifier "eval" or the Identifier "arguments" occurs as the
|
||||
// Identifier in a PropertySetParameterList of a PropertyAssignment that is contained in strict code
|
||||
// or if its FunctionBody is strict code(11.1.5).
|
||||
// It is a SyntaxError if the identifier eval or arguments appears within a FormalParameterList of a
|
||||
// strict mode FunctionLikeDeclaration or FunctionExpression(13.1)
|
||||
if (node.flags & NodeFlags.ParsedInStrictMode && isEvalOrArgumentsIdentifier(node.name)) {
|
||||
reportInvalidUseInStrictMode(node.name);
|
||||
return true;
|
||||
return reportInvalidUseInStrictMode(node.name);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function performParameterListChecks(parameters: NodeArray<ParameterDeclaration>): void {
|
||||
function checkParameterList(parameters: NodeArray<ParameterDeclaration>): boolean {
|
||||
var seenOptionalParameter = false;
|
||||
var parameterCount = parameters.length;
|
||||
|
||||
|
@ -4460,17 +4432,17 @@ module ts {
|
|||
if (parameter.flags & NodeFlags.Rest) {
|
||||
if (i !== (parameterCount - 1)) {
|
||||
grammarErrorOnNode(parameter.name, Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list);
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (parameter.flags & NodeFlags.QuestionMark) {
|
||||
grammarErrorOnNode(parameter.name, Diagnostics.A_rest_parameter_cannot_be_optional);
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (parameter.initializer) {
|
||||
grammarErrorOnNode(parameter.name, Diagnostics.A_rest_parameter_cannot_have_an_initializer);
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (parameter.flags & NodeFlags.QuestionMark || parameter.initializer) {
|
||||
|
@ -4478,24 +4450,22 @@ module ts {
|
|||
|
||||
if (parameter.flags & NodeFlags.QuestionMark && parameter.initializer) {
|
||||
grammarErrorOnNode(parameter.name, Diagnostics.Parameter_cannot_have_question_mark_and_initializer);
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (seenOptionalParameter) {
|
||||
grammarErrorOnNode(parameter.name, Diagnostics.A_required_parameter_cannot_follow_an_optional_parameter);
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function performSetAccessorChecks(node: MethodDeclaration) {
|
||||
if (performParameterListChecks(node.parameters)) {
|
||||
return true;
|
||||
if (checkParameterList(node.parameters)) {
|
||||
return;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
tests/cases/compiler/complicatedPrivacy.ts(11,24): error TS1054: A 'get' accessor cannot have parameters.
|
||||
tests/cases/compiler/complicatedPrivacy.ts(24,38): error TS1005: ';' expected.
|
||||
tests/cases/compiler/complicatedPrivacy.ts(35,6): error TS1022: An index signature parameter must have a type annotation.
|
||||
tests/cases/compiler/complicatedPrivacy.ts(73,49): error TS2305: Module 'mglo5' has no exported member 'i6'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/complicatedPrivacy.ts (4 errors) ====
|
||||
==== tests/cases/compiler/complicatedPrivacy.ts (3 errors) ====
|
||||
module m1 {
|
||||
export module m2 {
|
||||
|
||||
|
@ -44,8 +43,6 @@ tests/cases/compiler/complicatedPrivacy.ts(73,49): error TS2305: Module 'mglo5'
|
|||
export function f4(arg1:
|
||||
{
|
||||
[number]: C1;
|
||||
~~~~~~
|
||||
!!! error TS1022: An index signature parameter must have a type annotation.
|
||||
}) {
|
||||
}
|
||||
|
||||
|
|
|
@ -4,18 +4,12 @@ tests/cases/compiler/giant.ts(29,5): error TS1005: '{' expected.
|
|||
tests/cases/compiler/giant.ts(31,5): error TS1005: '{' expected.
|
||||
tests/cases/compiler/giant.ts(35,5): error TS1005: '{' expected.
|
||||
tests/cases/compiler/giant.ts(37,1): error TS1005: '{' expected.
|
||||
tests/cases/compiler/giant.ts(61,6): error TS1022: An index signature parameter must have a type annotation.
|
||||
tests/cases/compiler/giant.ts(62,5): error TS1021: An index signature must have a type annotation.
|
||||
tests/cases/compiler/giant.ts(63,6): error TS1096: An index signature must have exactly one parameter.
|
||||
tests/cases/compiler/giant.ts(89,9): error TS1005: '{' expected.
|
||||
tests/cases/compiler/giant.ts(91,9): error TS1005: '{' expected.
|
||||
tests/cases/compiler/giant.ts(93,9): error TS1005: '{' expected.
|
||||
tests/cases/compiler/giant.ts(95,9): error TS1005: '{' expected.
|
||||
tests/cases/compiler/giant.ts(99,9): error TS1005: '{' expected.
|
||||
tests/cases/compiler/giant.ts(101,5): error TS1005: '{' expected.
|
||||
tests/cases/compiler/giant.ts(125,10): error TS1022: An index signature parameter must have a type annotation.
|
||||
tests/cases/compiler/giant.ts(126,9): error TS1021: An index signature must have a type annotation.
|
||||
tests/cases/compiler/giant.ts(127,10): error TS1096: An index signature must have exactly one parameter.
|
||||
tests/cases/compiler/giant.ts(154,39): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(168,9): error TS1005: '{' expected.
|
||||
tests/cases/compiler/giant.ts(170,9): error TS1005: '{' expected.
|
||||
|
@ -23,9 +17,6 @@ tests/cases/compiler/giant.ts(172,9): error TS1005: '{' expected.
|
|||
tests/cases/compiler/giant.ts(174,9): error TS1005: '{' expected.
|
||||
tests/cases/compiler/giant.ts(178,9): error TS1005: '{' expected.
|
||||
tests/cases/compiler/giant.ts(180,5): error TS1005: '{' expected.
|
||||
tests/cases/compiler/giant.ts(204,10): error TS1022: An index signature parameter must have a type annotation.
|
||||
tests/cases/compiler/giant.ts(205,9): error TS1021: An index signature must have a type annotation.
|
||||
tests/cases/compiler/giant.ts(206,10): error TS1096: An index signature must have exactly one parameter.
|
||||
tests/cases/compiler/giant.ts(233,39): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(238,35): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(240,24): error TS1111: A constructor implementation cannot be declared in an ambient context.
|
||||
|
@ -54,18 +45,12 @@ tests/cases/compiler/giant.ts(287,5): error TS1005: '{' expected.
|
|||
tests/cases/compiler/giant.ts(289,5): error TS1005: '{' expected.
|
||||
tests/cases/compiler/giant.ts(293,5): error TS1005: '{' expected.
|
||||
tests/cases/compiler/giant.ts(295,1): error TS1005: '{' expected.
|
||||
tests/cases/compiler/giant.ts(319,6): error TS1022: An index signature parameter must have a type annotation.
|
||||
tests/cases/compiler/giant.ts(320,5): error TS1021: An index signature must have a type annotation.
|
||||
tests/cases/compiler/giant.ts(321,6): error TS1096: An index signature must have exactly one parameter.
|
||||
tests/cases/compiler/giant.ts(347,9): error TS1005: '{' expected.
|
||||
tests/cases/compiler/giant.ts(349,9): error TS1005: '{' expected.
|
||||
tests/cases/compiler/giant.ts(351,9): error TS1005: '{' expected.
|
||||
tests/cases/compiler/giant.ts(353,9): error TS1005: '{' expected.
|
||||
tests/cases/compiler/giant.ts(357,9): error TS1005: '{' expected.
|
||||
tests/cases/compiler/giant.ts(359,5): error TS1005: '{' expected.
|
||||
tests/cases/compiler/giant.ts(383,10): error TS1022: An index signature parameter must have a type annotation.
|
||||
tests/cases/compiler/giant.ts(384,9): error TS1021: An index signature must have a type annotation.
|
||||
tests/cases/compiler/giant.ts(385,10): error TS1096: An index signature must have exactly one parameter.
|
||||
tests/cases/compiler/giant.ts(412,39): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(426,9): error TS1005: '{' expected.
|
||||
tests/cases/compiler/giant.ts(428,9): error TS1005: '{' expected.
|
||||
|
@ -73,9 +58,6 @@ tests/cases/compiler/giant.ts(430,9): error TS1005: '{' expected.
|
|||
tests/cases/compiler/giant.ts(432,9): error TS1005: '{' expected.
|
||||
tests/cases/compiler/giant.ts(436,9): error TS1005: '{' expected.
|
||||
tests/cases/compiler/giant.ts(438,5): error TS1005: '{' expected.
|
||||
tests/cases/compiler/giant.ts(462,10): error TS1022: An index signature parameter must have a type annotation.
|
||||
tests/cases/compiler/giant.ts(463,9): error TS1021: An index signature must have a type annotation.
|
||||
tests/cases/compiler/giant.ts(464,10): error TS1096: An index signature must have exactly one parameter.
|
||||
tests/cases/compiler/giant.ts(491,39): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(496,35): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(498,24): error TS1111: A constructor implementation cannot be declared in an ambient context.
|
||||
|
@ -120,9 +102,6 @@ tests/cases/compiler/giant.ts(556,21): error TS1036: Statements are not allowed
|
|||
tests/cases/compiler/giant.ts(558,24): error TS1111: A constructor implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(561,21): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(563,21): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(587,10): error TS1022: An index signature parameter must have a type annotation.
|
||||
tests/cases/compiler/giant.ts(588,9): error TS1021: An index signature must have a type annotation.
|
||||
tests/cases/compiler/giant.ts(589,10): error TS1096: An index signature must have exactly one parameter.
|
||||
tests/cases/compiler/giant.ts(606,22): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(606,25): error TS1036: Statements are not allowed in ambient contexts.
|
||||
tests/cases/compiler/giant.ts(611,30): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
|
@ -138,9 +117,6 @@ tests/cases/compiler/giant.ts(621,29): error TS1036: Statements are not allowed
|
|||
tests/cases/compiler/giant.ts(623,24): error TS1111: A constructor implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(626,21): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(628,21): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(653,10): error TS1022: An index signature parameter must have a type annotation.
|
||||
tests/cases/compiler/giant.ts(654,9): error TS1021: An index signature must have a type annotation.
|
||||
tests/cases/compiler/giant.ts(655,10): error TS1096: An index signature must have exactly one parameter.
|
||||
tests/cases/compiler/giant.ts(672,22): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
tests/cases/compiler/giant.ts(672,25): error TS1036: Statements are not allowed in ambient contexts.
|
||||
tests/cases/compiler/giant.ts(676,30): error TS1037: A function implementation cannot be declared in an ambient context.
|
||||
|
@ -281,7 +257,7 @@ tests/cases/compiler/giant.ts(602,9): error TS2386: Overload signatures must all
|
|||
tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all be optional or required.
|
||||
|
||||
|
||||
==== tests/cases/compiler/giant.ts (281 errors) ====
|
||||
==== tests/cases/compiler/giant.ts (257 errors) ====
|
||||
|
||||
/*
|
||||
Prefixes
|
||||
|
@ -385,14 +361,8 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
|
|||
|
||||
//Index Signature
|
||||
[p];
|
||||
~
|
||||
!!! error TS1022: An index signature parameter must have a type annotation.
|
||||
[p1: string];
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1021: An index signature must have a type annotation.
|
||||
[p2: string, p3: number];
|
||||
~~
|
||||
!!! error TS1096: An index signature must have exactly one parameter.
|
||||
|
||||
//Property Signature
|
||||
p;
|
||||
|
@ -499,14 +469,8 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
|
|||
|
||||
//Index Signature
|
||||
[p];
|
||||
~
|
||||
!!! error TS1022: An index signature parameter must have a type annotation.
|
||||
[p1: string];
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1021: An index signature must have a type annotation.
|
||||
[p2: string, p3: number];
|
||||
~~
|
||||
!!! error TS1096: An index signature must have exactly one parameter.
|
||||
|
||||
//Property Signature
|
||||
p;
|
||||
|
@ -630,14 +594,8 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
|
|||
|
||||
//Index Signature
|
||||
[p];
|
||||
~
|
||||
!!! error TS1022: An index signature parameter must have a type annotation.
|
||||
[p1: string];
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1021: An index signature must have a type annotation.
|
||||
[p2: string, p3: number];
|
||||
~~
|
||||
!!! error TS1096: An index signature must have exactly one parameter.
|
||||
|
||||
//Property Signature
|
||||
p;
|
||||
|
@ -863,14 +821,8 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
|
|||
|
||||
//Index Signature
|
||||
[p];
|
||||
~
|
||||
!!! error TS1022: An index signature parameter must have a type annotation.
|
||||
[p1: string];
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1021: An index signature must have a type annotation.
|
||||
[p2: string, p3: number];
|
||||
~~
|
||||
!!! error TS1096: An index signature must have exactly one parameter.
|
||||
|
||||
//Property Signature
|
||||
p;
|
||||
|
@ -977,14 +929,8 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
|
|||
|
||||
//Index Signature
|
||||
[p];
|
||||
~
|
||||
!!! error TS1022: An index signature parameter must have a type annotation.
|
||||
[p1: string];
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1021: An index signature must have a type annotation.
|
||||
[p2: string, p3: number];
|
||||
~~
|
||||
!!! error TS1096: An index signature must have exactly one parameter.
|
||||
|
||||
//Property Signature
|
||||
p;
|
||||
|
@ -1108,14 +1054,8 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
|
|||
|
||||
//Index Signature
|
||||
[p];
|
||||
~
|
||||
!!! error TS1022: An index signature parameter must have a type annotation.
|
||||
[p1: string];
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1021: An index signature must have a type annotation.
|
||||
[p2: string, p3: number];
|
||||
~~
|
||||
!!! error TS1096: An index signature must have exactly one parameter.
|
||||
|
||||
//Property Signature
|
||||
p;
|
||||
|
@ -1377,14 +1317,8 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
|
|||
|
||||
//Index Signature
|
||||
[p];
|
||||
~
|
||||
!!! error TS1022: An index signature parameter must have a type annotation.
|
||||
[p1: string];
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1021: An index signature must have a type annotation.
|
||||
[p2: string, p3: number];
|
||||
~~
|
||||
!!! error TS1096: An index signature must have exactly one parameter.
|
||||
|
||||
//Property Signature
|
||||
p;
|
||||
|
@ -1481,14 +1415,8 @@ tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all
|
|||
|
||||
//Index Signature
|
||||
[p];
|
||||
~
|
||||
!!! error TS1022: An index signature parameter must have a type annotation.
|
||||
[p1: string];
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1021: An index signature must have a type annotation.
|
||||
[p2: string, p3: number];
|
||||
~~
|
||||
!!! error TS1096: An index signature must have exactly one parameter.
|
||||
|
||||
//Property Signature
|
||||
p;
|
||||
|
|
|
@ -1,9 +1,3 @@
|
|||
tests/cases/compiler/intTypeCheck.ts(35,6): error TS1022: An index signature parameter must have a type annotation.
|
||||
tests/cases/compiler/intTypeCheck.ts(36,5): error TS1021: An index signature must have a type annotation.
|
||||
tests/cases/compiler/intTypeCheck.ts(37,6): error TS1096: An index signature must have exactly one parameter.
|
||||
tests/cases/compiler/intTypeCheck.ts(70,6): error TS1022: An index signature parameter must have a type annotation.
|
||||
tests/cases/compiler/intTypeCheck.ts(71,5): error TS1021: An index signature must have a type annotation.
|
||||
tests/cases/compiler/intTypeCheck.ts(72,6): error TS1096: An index signature must have exactly one parameter.
|
||||
tests/cases/compiler/intTypeCheck.ts(104,20): error TS1109: Expression expected.
|
||||
tests/cases/compiler/intTypeCheck.ts(118,21): error TS1109: Expression expected.
|
||||
tests/cases/compiler/intTypeCheck.ts(132,21): error TS1109: Expression expected.
|
||||
|
@ -91,7 +85,7 @@ tests/cases/compiler/intTypeCheck.ts(202,22): error TS2304: Cannot find name 'i8
|
|||
tests/cases/compiler/intTypeCheck.ts(203,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
|
||||
|
||||
|
||||
==== tests/cases/compiler/intTypeCheck.ts (73 errors) ====
|
||||
==== tests/cases/compiler/intTypeCheck.ts (67 errors) ====
|
||||
interface i1 {
|
||||
//Property Signatures
|
||||
p;
|
||||
|
@ -127,14 +121,8 @@ tests/cases/compiler/intTypeCheck.ts(203,17): error TS2351: Cannot use 'new' wit
|
|||
interface i4 {
|
||||
//Index Signatures
|
||||
[p];
|
||||
~
|
||||
!!! error TS1022: An index signature parameter must have a type annotation.
|
||||
[p1: string];
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1021: An index signature must have a type annotation.
|
||||
[p2: string, p3: number];
|
||||
~~
|
||||
!!! error TS1096: An index signature must have exactly one parameter.
|
||||
}
|
||||
interface i5 extends i1 { }
|
||||
interface i6 extends i2 { }
|
||||
|
@ -168,14 +156,8 @@ tests/cases/compiler/intTypeCheck.ts(203,17): error TS2351: Cannot use 'new' wit
|
|||
|
||||
//Index Signatures
|
||||
[p];
|
||||
~
|
||||
!!! error TS1022: An index signature parameter must have a type annotation.
|
||||
[p1: string];
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1021: An index signature must have a type annotation.
|
||||
[p2: string, p3: number];
|
||||
~~
|
||||
!!! error TS1096: An index signature must have exactly one parameter.
|
||||
|
||||
//Property Signatures
|
||||
p;
|
||||
|
|
|
@ -6,7 +6,6 @@ tests/cases/compiler/optionalPropertiesSyntax.ts(18,12): error TS1131: Property
|
|||
tests/cases/compiler/optionalPropertiesSyntax.ts(32,18): error TS1005: ';' expected.
|
||||
tests/cases/compiler/optionalPropertiesSyntax.ts(32,19): error TS1131: Property or signature expected.
|
||||
tests/cases/compiler/optionalPropertiesSyntax.ts(33,5): error TS1131: Property or signature expected.
|
||||
tests/cases/compiler/optionalPropertiesSyntax.ts(34,6): error TS1019: An index signature parameter cannot have a question mark.
|
||||
tests/cases/compiler/optionalPropertiesSyntax.ts(4,5): error TS2386: Overload signatures must all be optional or required.
|
||||
tests/cases/compiler/optionalPropertiesSyntax.ts(24,5): error TS2300: Duplicate identifier 'prop'.
|
||||
tests/cases/compiler/optionalPropertiesSyntax.ts(25,5): error TS2300: Duplicate identifier 'prop'.
|
||||
|
@ -15,7 +14,7 @@ tests/cases/compiler/optionalPropertiesSyntax.ts(33,7): error TS2375: Duplicate
|
|||
tests/cases/compiler/optionalPropertiesSyntax.ts(34,5): error TS2375: Duplicate number index signature.
|
||||
|
||||
|
||||
==== tests/cases/compiler/optionalPropertiesSyntax.ts (15 errors) ====
|
||||
==== tests/cases/compiler/optionalPropertiesSyntax.ts (14 errors) ====
|
||||
interface fnSigs {
|
||||
//functions signatures can be optional
|
||||
fn(): void;
|
||||
|
@ -76,8 +75,6 @@ tests/cases/compiler/optionalPropertiesSyntax.ts(34,5): error TS2375: Duplicate
|
|||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2375: Duplicate number index signature.
|
||||
[idx?: number]: any; //err
|
||||
~~~
|
||||
!!! error TS1019: An index signature parameter cannot have a question mark.
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2375: Duplicate number index signature.
|
||||
}
|
Loading…
Reference in a new issue