Port fidelity changes to github.

This commit is contained in:
Cyrus Najmabadi 2014-09-18 15:37:16 -07:00
parent 80bab05d07
commit 0e9134788a
44 changed files with 379 additions and 17 deletions

View file

@ -42,6 +42,10 @@ module TypeScript {
walker.walk(preAst.typeArguments);
}
function walkTupleTypeChildren(preAst: TupleTypeSyntax, walker: AstWalker): void {
walker.walk(preAst.types);
}
function walkTypeOfExpressionChildren(preAst: TypeOfExpressionSyntax, walker: AstWalker): void {
walker.walk(preAst.expression);
}
@ -561,6 +565,7 @@ module TypeScript {
childrenWalkers[SyntaxKind.TriviaList] = null;
childrenWalkers[SyntaxKind.TrueKeyword] = null;
childrenWalkers[SyntaxKind.TryStatement] = walkTryStatementChildren;
childrenWalkers[SyntaxKind.TupleType] = walkTupleTypeChildren;
childrenWalkers[SyntaxKind.TypeAnnotation] = walkTypeAnnotationChildren;
childrenWalkers[SyntaxKind.TypeArgumentList] = walkTypeArgumentListChildren;
childrenWalkers[SyntaxKind.TypeOfExpression] = walkTypeOfExpressionChildren;

View file

@ -42,6 +42,10 @@ module TypeScript {
return this.defaultVisit(node);
}
public visitTupleType(node: TupleTypeSyntax): any {
return this.defaultVisit(node);
}
public visitInterfaceDeclaration(node: InterfaceDeclarationSyntax): any {
return this.defaultVisit(node);
}

View file

@ -1048,6 +1048,7 @@ module TypeScript.Parser {
case SyntaxKind.ExportKeyword:
case SyntaxKind.PublicKeyword:
case SyntaxKind.PrivateKeyword:
case SyntaxKind.ProtectedKeyword:
case SyntaxKind.StaticKeyword:
case SyntaxKind.DeclareKeyword:
return true;
@ -1434,6 +1435,19 @@ module TypeScript.Parser {
return new syntaxFactory.ObjectTypeSyntax(parseNodeData, openBraceToken, typeMembers, eatToken(SyntaxKind.CloseBraceToken));
}
function parseTupleType(currentToken: ISyntaxToken): TupleTypeSyntax {
var openBracket = consumeToken(currentToken);
var types = Syntax.emptySeparatedList<ITypeSyntax>();
if (openBracket.fullWidth() > 0) {
var skippedTokens: ISyntaxToken[] = getArray();
types = parseSeparatedSyntaxList<ITypeSyntax>(ListParsingState.TupleType_Types, skippedTokens);
openBracket = addSkippedTokensAfterToken(openBracket, skippedTokens);
}
return new syntaxFactory.TupleTypeSyntax(parseNodeData, openBracket, types, eatToken(SyntaxKind.CloseBracketToken));
}
function isTypeMember(inErrorRecovery: boolean): boolean {
if (SyntaxUtilities.isTypeMember(currentNode())) {
return true;
@ -1663,6 +1677,7 @@ module TypeScript.Parser {
// ERROR RECOVERY
case SyntaxKind.PublicKeyword:
case SyntaxKind.PrivateKeyword:
case SyntaxKind.ProtectedKeyword:
case SyntaxKind.StaticKeyword:
// None of the above are actually keywords. And they might show up in a real
// statement (i.e. "public();"). However, if we see 'public <identifier>' then
@ -1731,6 +1746,7 @@ module TypeScript.Parser {
// ERROR RECOVERY
case SyntaxKind.PublicKeyword:
case SyntaxKind.PrivateKeyword:
case SyntaxKind.ProtectedKeyword:
case SyntaxKind.StaticKeyword:
// None of the above are actually keywords. And they might show up in a real
// statement (i.e. "public();"). However, if we see 'public <identifier>' then
@ -3133,7 +3149,7 @@ module TypeScript.Parser {
token2 = peekToken(2);
token2Kind = token2.kind();
if (token1Kind === SyntaxKind.PublicKeyword || token1Kind === SyntaxKind.PrivateKeyword) {
if (SyntaxFacts.isAccessibilityModifier(token1Kind)) {
if (isIdentifier(token2)) {
// "(public id" or "(function id". Definitely an arrow function. Could never
// be a parenthesized expression. Note: this will be an *illegal* arrow
@ -3557,11 +3573,12 @@ module TypeScript.Parser {
return consumeToken(_currentToken);
case SyntaxKind.OpenParenToken:
case SyntaxKind.LessThanToken: return tryParseFunctionType();
case SyntaxKind.VoidKeyword: return consumeToken(_currentToken);
case SyntaxKind.OpenBraceToken: return parseObjectType();
case SyntaxKind.NewKeyword: return parseConstructorType();
case SyntaxKind.TypeOfKeyword: return parseTypeQuery(_currentToken);
case SyntaxKind.LessThanToken: return tryParseFunctionType();
case SyntaxKind.VoidKeyword: return consumeToken(_currentToken);
case SyntaxKind.OpenBraceToken: return parseObjectType();
case SyntaxKind.NewKeyword: return parseConstructorType();
case SyntaxKind.TypeOfKeyword: return parseTypeQuery(_currentToken);
case SyntaxKind.OpenBracketToken: return parseTupleType(_currentToken);
}
return tryParseNameOrGenericType();
@ -3973,6 +3990,7 @@ module TypeScript.Parser {
case ListParsingState.IndexSignature_Parameters: return isExpectedIndexSignature_ParametersTerminator();
case ListParsingState.TypeArgumentList_Types: return isExpectedTypeArgumentList_TypesTerminator();
case ListParsingState.TypeParameterList_TypeParameters: return isExpectedTypeParameterList_TypeParametersTerminator();
case ListParsingState.TupleType_Types: return isExpectedTupleType_TypesTerminator();
default:
throw Errors.invalidOperation();
}
@ -4019,6 +4037,17 @@ module TypeScript.Parser {
return false;
}
function isExpectedTupleType_TypesTerminator(): boolean {
var token = currentToken();
var tokenKind = token.kind();
if (tokenKind === SyntaxKind.CloseBracketToken) {
return true;
}
// TODO: add more cases as necessary for error tolerance.
return false;
}
function isExpectedTypeParameterList_TypeParametersTerminator(): boolean {
var tokenKind = currentToken().kind();
if (tokenKind === SyntaxKind.GreaterThanToken) {
@ -4187,7 +4216,8 @@ module TypeScript.Parser {
case ListParsingState.IndexSignature_Parameters: return isParameter();
case ListParsingState.TypeArgumentList_Types: return isType();
case ListParsingState.TypeParameterList_TypeParameters: return isTypeParameter();
default: throw Errors.invalidOperation();
case ListParsingState.TupleType_Types: return isType();
default: throw Errors.invalidOperation();
}
}
@ -4230,6 +4260,7 @@ module TypeScript.Parser {
case ListParsingState.IndexSignature_Parameters: return tryParseParameter();
case ListParsingState.TypeArgumentList_Types: return tryParseType();
case ListParsingState.TypeParameterList_TypeParameters: return tryParseTypeParameter();
case ListParsingState.TupleType_Types: return tryParseType();
default: throw Errors.invalidOperation();
}
}
@ -4254,6 +4285,7 @@ module TypeScript.Parser {
case ListParsingState.IndexSignature_Parameters: return getLocalizedText(DiagnosticCode.parameter, null);
case ListParsingState.TypeArgumentList_Types: return getLocalizedText(DiagnosticCode.type, null);
case ListParsingState.TypeParameterList_TypeParameters: return getLocalizedText(DiagnosticCode.type_parameter, null);
case ListParsingState.TupleType_Types: return getLocalizedText(DiagnosticCode.type, null);
case ListParsingState.ArrayLiteralExpression_AssignmentExpressions: return getLocalizedText(DiagnosticCode.expression, null);
default: throw Errors.invalidOperation();
}
@ -4376,9 +4408,10 @@ module TypeScript.Parser {
IndexSignature_Parameters = 18,
TypeArgumentList_Types = 19,
TypeParameterList_TypeParameters = 20,
TupleType_Types = 21,
FirstListParsingState = SourceUnit_ModuleElements,
LastListParsingState = TypeParameterList_TypeParameters,
LastListParsingState = TupleType_Types,
}
// We keep the parser around as a singleton. This is because calling createParser is actually

View file

@ -421,6 +421,12 @@ module TypeScript.PrettyPrinter {
this.appendToken(node.greaterThanToken);
}
public visitTupleType(node: TupleTypeSyntax): void {
this.appendToken(node.openBracketToken);
this.appendSeparatorSpaceList(node.types);
this.appendToken(node.closeBracketToken);
}
public visitConstructorType(node: ConstructorTypeSyntax): void {
this.appendToken(node.newKeyword);
this.ensureSpace();

View file

@ -26,4 +26,15 @@ module TypeScript.SyntaxFacts {
var tokenKind = token.kind();
return tokenKind === SyntaxKind.IdentifierName || SyntaxFacts.isAnyKeyword(tokenKind);
}
export function isAccessibilityModifier(kind: SyntaxKind): boolean {
switch (kind) {
case SyntaxKind.PublicKeyword:
case SyntaxKind.PrivateKeyword:
case SyntaxKind.ProtectedKeyword:
return true;
}
return false;
}
}

View file

@ -354,6 +354,17 @@ var definitions:ITypeDefinition[] = [
],
isTypeScriptSpecific: true
},
<any> {
name: 'TupleTypeSyntax',
baseType: 'ISyntaxNode',
interfaces: ['ITypeSyntax'],
children: [
<any>{ name: 'openBracketToken', isToken: true, excludeFromAST: true },
<any>{ name: 'types', isSeparatedList: true, elementType: 'ITypeSyntax' },
<any>{ name: 'closeBracketToken', isToken: true, excludeFromAST: true }
],
isTypeScriptSpecific: true
},
<any>{
name: 'TypeAnnotationSyntax',
baseType: 'ISyntaxNode',

View file

@ -158,6 +158,7 @@ module TypeScript {
ConstructorType,
GenericType,
TypeQuery,
TupleType,
// Module elements.
InterfaceDeclaration,

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -84,6 +84,7 @@ module TypeScript {
private cacheSyntaxTreeInfo(): void {
// If we're not keeping around the syntax tree, store the diagnostics and line
// map so they don't have to be recomputed.
var sourceUnit = this.sourceUnit();
var firstToken = firstSyntaxTreeToken(this);
var leadingTrivia = firstToken.leadingTrivia(this.text);
@ -238,7 +239,7 @@ module TypeScript {
}
private checkParameterAccessibilityModifier(parameterList: ParameterListSyntax, modifier: ISyntaxToken, modifierIndex: number): boolean {
if (modifier.kind() !== SyntaxKind.PublicKeyword && modifier.kind() !== SyntaxKind.PrivateKeyword) {
if (!SyntaxFacts.isAccessibilityModifier(modifier.kind())) {
this.pushDiagnostic(modifier, DiagnosticCode._0_modifier_cannot_appear_on_a_parameter, [modifier.text()]);
return true;
}
@ -320,6 +321,15 @@ module TypeScript {
super.visitTypeArgumentList(node);
}
public visitTupleType(node: TupleTypeSyntax): void {
if (this.checkForTrailingComma(node.types) ||
this.checkForAtLeastOneElement(node, node.types, node.openBracketToken, getLocalizedText(DiagnosticCode.type, null))) {
return
}
super.visitTupleType(node);
}
public visitTypeParameterList(node: TypeParameterListSyntax): void {
if (this.checkForTrailingComma(node.typeParameters) ||
this.checkForAtLeastOneElement(node, node.typeParameters, node.lessThanToken, getLocalizedText(DiagnosticCode.type_parameter, null))) {
@ -514,9 +524,7 @@ module TypeScript {
for (var i = 0, n = list.length; i < n; i++) {
var modifier = list[i];
if (modifier.kind() === SyntaxKind.PublicKeyword ||
modifier.kind() === SyntaxKind.PrivateKeyword) {
if (SyntaxFacts.isAccessibilityModifier(modifier.kind())) {
if (seenAccessibilityModifier) {
this.pushDiagnostic(modifier, DiagnosticCode.Accessibility_modifier_already_seen);
return true;
@ -751,8 +759,7 @@ module TypeScript {
for (var i = 0, n = modifiers.length; i < n; i++) {
var modifier = modifiers[i];
if (modifier.kind() === SyntaxKind.PublicKeyword ||
modifier.kind() === SyntaxKind.PrivateKeyword ||
if (SyntaxFacts.isAccessibilityModifier(modifier.kind()) ||
modifier.kind() === SyntaxKind.StaticKeyword) {
this.pushDiagnostic(modifier, DiagnosticCode._0_modifier_cannot_appear_on_a_module_element, [modifier.text()]);
return true;

View file

@ -13,6 +13,7 @@ module TypeScript {
case SyntaxKind.ConstructorType: return visitor.visitConstructorType(<ConstructorTypeSyntax>element);
case SyntaxKind.GenericType: return visitor.visitGenericType(<GenericTypeSyntax>element);
case SyntaxKind.TypeQuery: return visitor.visitTypeQuery(<TypeQuerySyntax>element);
case SyntaxKind.TupleType: return visitor.visitTupleType(<TupleTypeSyntax>element);
case SyntaxKind.InterfaceDeclaration: return visitor.visitInterfaceDeclaration(<InterfaceDeclarationSyntax>element);
case SyntaxKind.FunctionDeclaration: return visitor.visitFunctionDeclaration(<FunctionDeclarationSyntax>element);
case SyntaxKind.ModuleDeclaration: return visitor.visitModuleDeclaration(<ModuleDeclarationSyntax>element);
@ -109,6 +110,7 @@ module TypeScript {
visitConstructorType(node: ConstructorTypeSyntax): any;
visitGenericType(node: GenericTypeSyntax): any;
visitTypeQuery(node: TypeQuerySyntax): any;
visitTupleType(node: TupleTypeSyntax): any;
visitInterfaceDeclaration(node: InterfaceDeclarationSyntax): any;
visitFunctionDeclaration(node: FunctionDeclarationSyntax): any;
visitModuleDeclaration(node: ModuleDeclarationSyntax): any;

View file

@ -103,6 +103,12 @@ module TypeScript {
this.visitNodeOrToken(node.name);
}
public visitTupleType(node: TupleTypeSyntax): void {
this.visitToken(node.openBracketToken);
this.visitSeparatedList(node.types);
this.visitToken(node.closeBracketToken);
}
public visitInterfaceDeclaration(node: InterfaceDeclarationSyntax): void {
this.visitList(node.modifiers);
this.visitToken(node.interfaceKeyword);

View file

@ -0,0 +1,11 @@
tests/cases/conformance/parser/ecmascript5/Protected/Protected1.ts(1,11): error TS1005: ';' expected.
tests/cases/conformance/parser/ecmascript5/Protected/Protected1.ts(1,1): error TS2304: Cannot find name 'protected'.
==== tests/cases/conformance/parser/ecmascript5/Protected/Protected1.ts (2 errors) ====
protected class C {
~~~~~
!!! error TS1005: ';' expected.
~~~~~~~~~
!!! error TS2304: Cannot find name 'protected'.
}

View file

@ -0,0 +1,11 @@
tests/cases/conformance/parser/ecmascript5/Protected/Protected2.ts(1,11): error TS1005: ';' expected.
tests/cases/conformance/parser/ecmascript5/Protected/Protected2.ts(1,1): error TS2304: Cannot find name 'protected'.
==== tests/cases/conformance/parser/ecmascript5/Protected/Protected2.ts (2 errors) ====
protected module M {
~~~~~~
!!! error TS1005: ';' expected.
~~~~~~~~~
!!! error TS2304: Cannot find name 'protected'.
}

View file

@ -0,0 +1,24 @@
tests/cases/conformance/parser/ecmascript5/Protected/Protected3.ts(2,3): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
tests/cases/conformance/parser/ecmascript5/Protected/Protected3.ts(2,13): error TS1005: ';' expected.
tests/cases/conformance/parser/ecmascript5/Protected/Protected3.ts(2,27): error TS1005: ';' expected.
tests/cases/conformance/parser/ecmascript5/Protected/Protected3.ts(3,1): error TS1128: Declaration or statement expected.
tests/cases/conformance/parser/ecmascript5/Protected/Protected3.ts(2,3): error TS2304: Cannot find name 'protected'.
tests/cases/conformance/parser/ecmascript5/Protected/Protected3.ts(2,13): error TS2304: Cannot find name 'constructor'.
==== tests/cases/conformance/parser/ecmascript5/Protected/Protected3.ts (6 errors) ====
class C {
protected constructor() { }
~~~~~~~~~
!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
~~~~~~~~~~~
!!! error TS1005: ';' expected.
~
!!! error TS1005: ';' expected.
~~~~~~~~~
!!! error TS2304: Cannot find name 'protected'.
~~~~~~~~~~~
!!! error TS2304: Cannot find name 'constructor'.
}
~
!!! error TS1128: Declaration or statement expected.

View file

@ -0,0 +1,24 @@
tests/cases/conformance/parser/ecmascript5/Protected/Protected4.ts(2,3): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
tests/cases/conformance/parser/ecmascript5/Protected/Protected4.ts(2,13): error TS1005: ';' expected.
tests/cases/conformance/parser/ecmascript5/Protected/Protected4.ts(2,24): error TS1005: ';' expected.
tests/cases/conformance/parser/ecmascript5/Protected/Protected4.ts(3,1): error TS1128: Declaration or statement expected.
tests/cases/conformance/parser/ecmascript5/Protected/Protected4.ts(2,3): error TS2304: Cannot find name 'protected'.
tests/cases/conformance/parser/ecmascript5/Protected/Protected4.ts(2,20): error TS2304: Cannot find name 'm'.
==== tests/cases/conformance/parser/ecmascript5/Protected/Protected4.ts (6 errors) ====
class C {
protected public m() { }
~~~~~~~~~
!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
~~~~~~
!!! error TS1005: ';' expected.
~
!!! error TS1005: ';' expected.
~~~~~~~~~
!!! error TS2304: Cannot find name 'protected'.
~
!!! error TS2304: Cannot find name 'm'.
}
~
!!! error TS1128: Declaration or statement expected.

View file

@ -0,0 +1,24 @@
tests/cases/conformance/parser/ecmascript5/Protected/Protected5.ts(2,3): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
tests/cases/conformance/parser/ecmascript5/Protected/Protected5.ts(2,13): error TS1005: ';' expected.
tests/cases/conformance/parser/ecmascript5/Protected/Protected5.ts(2,24): error TS1005: ';' expected.
tests/cases/conformance/parser/ecmascript5/Protected/Protected5.ts(3,1): error TS1128: Declaration or statement expected.
tests/cases/conformance/parser/ecmascript5/Protected/Protected5.ts(2,3): error TS2304: Cannot find name 'protected'.
tests/cases/conformance/parser/ecmascript5/Protected/Protected5.ts(2,20): error TS2304: Cannot find name 'm'.
==== tests/cases/conformance/parser/ecmascript5/Protected/Protected5.ts (6 errors) ====
class C {
protected static m() { }
~~~~~~~~~
!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
~~~~~~
!!! error TS1005: ';' expected.
~
!!! error TS1005: ';' expected.
~~~~~~~~~
!!! error TS2304: Cannot find name 'protected'.
~
!!! error TS2304: Cannot find name 'm'.
}
~
!!! error TS1128: Declaration or statement expected.

View file

@ -0,0 +1,27 @@
tests/cases/conformance/parser/ecmascript5/Protected/Protected6.ts(2,3): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
tests/cases/conformance/parser/ecmascript5/Protected/Protected6.ts(2,10): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
tests/cases/conformance/parser/ecmascript5/Protected/Protected6.ts(2,20): error TS1005: ';' expected.
tests/cases/conformance/parser/ecmascript5/Protected/Protected6.ts(2,24): error TS1005: ';' expected.
tests/cases/conformance/parser/ecmascript5/Protected/Protected6.ts(3,1): error TS1128: Declaration or statement expected.
tests/cases/conformance/parser/ecmascript5/Protected/Protected6.ts(2,10): error TS2304: Cannot find name 'protected'.
tests/cases/conformance/parser/ecmascript5/Protected/Protected6.ts(2,20): error TS2304: Cannot find name 'm'.
==== tests/cases/conformance/parser/ecmascript5/Protected/Protected6.ts (7 errors) ====
class C {
static protected m() { }
~~~~~~
!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
~~~~~~~~~
!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
~
!!! error TS1005: ';' expected.
~
!!! error TS1005: ';' expected.
~~~~~~~~~
!!! error TS2304: Cannot find name 'protected'.
~
!!! error TS2304: Cannot find name 'm'.
}
~
!!! error TS1128: Declaration or statement expected.

View file

@ -0,0 +1,24 @@
tests/cases/conformance/parser/ecmascript5/Protected/Protected7.ts(2,3): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
tests/cases/conformance/parser/ecmascript5/Protected/Protected7.ts(2,13): error TS1005: ';' expected.
tests/cases/conformance/parser/ecmascript5/Protected/Protected7.ts(2,25): error TS1005: ';' expected.
tests/cases/conformance/parser/ecmascript5/Protected/Protected7.ts(3,1): error TS1128: Declaration or statement expected.
tests/cases/conformance/parser/ecmascript5/Protected/Protected7.ts(2,3): error TS2304: Cannot find name 'protected'.
tests/cases/conformance/parser/ecmascript5/Protected/Protected7.ts(2,21): error TS2304: Cannot find name 'm'.
==== tests/cases/conformance/parser/ecmascript5/Protected/Protected7.ts (6 errors) ====
class C {
protected private m() { }
~~~~~~~~~
!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
~~~~~~~
!!! error TS1005: ';' expected.
~
!!! error TS1005: ';' expected.
~~~~~~~~~
!!! error TS2304: Cannot find name 'protected'.
~
!!! error TS2304: Cannot find name 'm'.
}
~
!!! error TS1128: Declaration or statement expected.

View file

@ -0,0 +1,7 @@
//// [Protected8.ts]
interface I {
protected
p
}
//// [Protected8.js]

View file

@ -0,0 +1,10 @@
=== tests/cases/conformance/parser/ecmascript5/Protected/Protected8.ts ===
interface I {
>I : I
protected
>protected : any
p
>p : any
}

View file

@ -0,0 +1,12 @@
tests/cases/conformance/parser/ecmascript5/Protected/Protected9.ts(2,26): error TS1005: '=' expected.
tests/cases/conformance/parser/ecmascript5/Protected/Protected9.ts(2,26): error TS2304: Cannot find name 'p'.
==== tests/cases/conformance/parser/ecmascript5/Protected/Protected9.ts (2 errors) ====
class C {
constructor(protected p) { }
~
!!! error TS1005: '=' expected.
~
!!! error TS2304: Cannot find name 'p'.
}

View file

@ -0,0 +1,5 @@
//// [TupleType1.ts]
var v: [number]
//// [TupleType1.js]
var v;

View file

@ -0,0 +1,4 @@
=== tests/cases/conformance/parser/ecmascript5/TupleTypes/TupleType1.ts ===
var v: [number]
>v : [number]

View file

@ -0,0 +1,5 @@
//// [TupleType2.ts]
var v: [number, string]
//// [TupleType2.js]
var v;

View file

@ -0,0 +1,4 @@
=== tests/cases/conformance/parser/ecmascript5/TupleTypes/TupleType2.ts ===
var v: [number, string]
>v : [number, string]

View file

@ -0,0 +1,7 @@
tests/cases/conformance/parser/ecmascript5/TupleTypes/TupleType3.ts(1,8): error TS1122: A tuple type element list cannot be empty.
==== tests/cases/conformance/parser/ecmascript5/TupleTypes/TupleType3.ts (1 errors) ====
var v: []
~~
!!! error TS1122: A tuple type element list cannot be empty.

View file

@ -0,0 +1,7 @@
tests/cases/conformance/parser/ecmascript5/TupleTypes/TupleType4.ts(1,9): error TS1005: ']' expected.
==== tests/cases/conformance/parser/ecmascript5/TupleTypes/TupleType4.ts (1 errors) ====
var v: [
!!! error TS1005: ']' expected.

View file

@ -0,0 +1,7 @@
tests/cases/conformance/parser/ecmascript5/TupleTypes/TupleType5.ts(1,15): error TS1009: Trailing comma not allowed.
==== tests/cases/conformance/parser/ecmascript5/TupleTypes/TupleType5.ts (1 errors) ====
var v: [number,]
~
!!! error TS1009: Trailing comma not allowed.

View file

@ -0,0 +1,2 @@
protected class C {
}

View file

@ -0,0 +1,2 @@
protected module M {
}

View file

@ -0,0 +1,3 @@
class C {
protected constructor() { }
}

View file

@ -0,0 +1,3 @@
class C {
protected public m() { }
}

View file

@ -0,0 +1,3 @@
class C {
protected static m() { }
}

View file

@ -0,0 +1,3 @@
class C {
static protected m() { }
}

View file

@ -0,0 +1,3 @@
class C {
protected private m() { }
}

View file

@ -0,0 +1,4 @@
interface I {
protected
p
}

View file

@ -0,0 +1,3 @@
class C {
constructor(protected p) { }
}

View file

@ -0,0 +1 @@
var v: [number]

View file

@ -0,0 +1 @@
var v: [number, string]

View file

@ -0,0 +1 @@
var v: []

View file

@ -0,0 +1 @@
var v: [

View file

@ -0,0 +1 @@
var v: [number,]