CR feedback.

This commit is contained in:
Cyrus Najmabadi 2015-03-31 17:23:52 -07:00
parent 93ff9e69d7
commit ee3ba3bf75
17 changed files with 92 additions and 79 deletions

View File

@ -589,7 +589,7 @@ module ts {
if (moduleSymbol.flags & SymbolFlags.Variable) {
let typeAnnotation = (<VariableDeclaration>moduleSymbol.valueDeclaration).type;
if (typeAnnotation) {
return getPropertyOfType(getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(typeAnnotation), name);
return getPropertyOfType(getTypeFromNode(typeAnnotation), name);
}
}
}
@ -638,7 +638,7 @@ module ts {
if (symbol.flags & SymbolFlags.Variable) {
var typeAnnotation = (<VariableDeclaration>symbol.valueDeclaration).type;
if (typeAnnotation) {
return resolveSymbol(getPropertyOfType(getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(typeAnnotation), name));
return resolveSymbol(getPropertyOfType(getTypeFromNode(typeAnnotation), name));
}
}
}
@ -2106,7 +2106,7 @@ module ts {
}
// Use type from type annotation if one is present
if (declaration.type) {
return getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(declaration.type);
return getTypeFromNode(declaration.type);
}
if (declaration.kind === SyntaxKind.Parameter) {
let func = <FunctionLikeDeclaration>declaration.parent;
@ -2243,7 +2243,7 @@ module ts {
return links.type = checkExpression(exportAssignment.expression);
}
else if (exportAssignment.type) {
return links.type = getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(exportAssignment.type);
return links.type = getTypeFromNode(exportAssignment.type);
}
else {
return links.type = anyType;
@ -2275,11 +2275,11 @@ module ts {
function getAnnotatedAccessorType(accessor: AccessorDeclaration): Type {
if (accessor) {
if (accessor.kind === SyntaxKind.GetAccessor) {
return accessor.type && getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(accessor.type);
return accessor.type && getTypeFromNode(accessor.type);
}
else {
let setterTypeAnnotation = getSetAccessorTypeAnnotationNode(accessor);
return setterTypeAnnotation && getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(setterTypeAnnotation);
return setterTypeAnnotation && getTypeFromNode(setterTypeAnnotation);
}
}
return undefined;
@ -2445,9 +2445,9 @@ module ts {
}
type.baseTypes = [];
let declaration = <ClassDeclaration>getDeclarationOfKind(symbol, SyntaxKind.ClassDeclaration);
let baseTypeNode = getClassBaseTypeNode(declaration);
let baseTypeNode = getClassExtendsHeritageClauseElement(declaration);
if (baseTypeNode) {
let baseType = getTypeFromTypeReferenceOrHeritageClauseElement(baseTypeNode);
let baseType = getTypeFromHeritageClauseElement(baseTypeNode);
if (baseType !== unknownType) {
if (getTargetType(baseType).flags & TypeFlags.Class) {
if (type !== baseType && !hasBaseType(<InterfaceType>baseType, type)) {
@ -2488,7 +2488,7 @@ module ts {
forEach(symbol.declarations, declaration => {
if (declaration.kind === SyntaxKind.InterfaceDeclaration && getInterfaceBaseTypeNodes(<InterfaceDeclaration>declaration)) {
forEach(getInterfaceBaseTypeNodes(<InterfaceDeclaration>declaration), node => {
let baseType = getTypeFromTypeReferenceOrHeritageClauseElement(node);
let baseType = getTypeFromHeritageClauseElement(node);
if (baseType !== unknownType) {
if (getTargetType(baseType).flags & (TypeFlags.Class | TypeFlags.Interface)) {
@ -2520,7 +2520,7 @@ module ts {
if (!links.declaredType) {
links.declaredType = resolvingType;
let declaration = <TypeAliasDeclaration>getDeclarationOfKind(symbol, SyntaxKind.TypeAliasDeclaration);
let type = getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(declaration.type);
let type = getTypeFromNode(declaration.type);
if (links.declaredType === resolvingType) {
links.declaredType = type;
}
@ -3062,7 +3062,7 @@ module ts {
returnType = classType;
}
else if (declaration.type) {
returnType = getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(declaration.type);
returnType = getTypeFromNode(declaration.type);
}
else {
// TypeScript 1.0 spec (April 2014):
@ -3220,7 +3220,7 @@ module ts {
function getIndexTypeOfSymbol(symbol: Symbol, kind: IndexKind): Type {
let declaration = getIndexDeclarationOfSymbol(symbol, kind);
return declaration
? declaration.type ? getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(declaration.type) : anyType
? declaration.type ? getTypeFromNode(declaration.type) : anyType
: undefined;
}
@ -3231,7 +3231,7 @@ module ts {
type.constraint = targetConstraint ? instantiateType(targetConstraint, type.mapper) : noConstraintType;
}
else {
type.constraint = getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement((<TypeParameterDeclaration>getDeclarationOfKind(type.symbol, SyntaxKind.TypeParameter)).constraint);
type.constraint = getTypeFromNode((<TypeParameterDeclaration>getDeclarationOfKind(type.symbol, SyntaxKind.TypeParameter)).constraint);
}
}
return type.constraint === noConstraintType ? undefined : type.constraint;
@ -3328,6 +3328,14 @@ module ts {
}
}
function getTypeFromTypeReference(node: TypeReferenceNode): Type {
return getTypeFromTypeReferenceOrHeritageClauseElement(node);
}
function getTypeFromHeritageClauseElement(node: HeritageClauseElement): Type {
return getTypeFromTypeReferenceOrHeritageClauseElement(node);
}
function getTypeFromTypeReferenceOrHeritageClauseElement(node: TypeReferenceNode | HeritageClauseElement): Type {
let links = getNodeLinks(node);
if (!links.resolvedType) {
@ -3354,7 +3362,7 @@ module ts {
if (type.flags & (TypeFlags.Class | TypeFlags.Interface) && type.flags & TypeFlags.Reference) {
let typeParameters = (<InterfaceType>type).typeParameters;
if (node.typeArguments && node.typeArguments.length === typeParameters.length) {
type = createTypeReference(<GenericType>type, map(node.typeArguments, getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement));
type = createTypeReference(<GenericType>type, map(node.typeArguments, getTypeFromNode));
}
else {
error(node, Diagnostics.Generic_type_0_requires_1_type_argument_s, typeToString(type, /*enclosingDeclaration*/ undefined, TypeFormatFlags.WriteArrayAsGenericType), typeParameters.length);
@ -3448,7 +3456,7 @@ module ts {
function getTypeFromArrayTypeNode(node: ArrayTypeNode): Type {
let links = getNodeLinks(node);
if (!links.resolvedType) {
links.resolvedType = createArrayType(getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(node.elementType));
links.resolvedType = createArrayType(getTypeFromNode(node.elementType));
}
return links.resolvedType;
}
@ -3466,7 +3474,7 @@ module ts {
function getTypeFromTupleTypeNode(node: TupleTypeNode): Type {
let links = getNodeLinks(node);
if (!links.resolvedType) {
links.resolvedType = createTupleType(map(node.elementTypes, getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement));
links.resolvedType = createTupleType(map(node.elementTypes, getTypeFromNode));
}
return links.resolvedType;
}
@ -3562,7 +3570,7 @@ module ts {
function getTypeFromUnionTypeNode(node: UnionTypeNode): Type {
let links = getNodeLinks(node);
if (!links.resolvedType) {
links.resolvedType = getUnionType(map(node.types, getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement), /*noSubtypeReduction*/ true);
links.resolvedType = getUnionType(map(node.types, getTypeFromNode), /*noSubtypeReduction*/ true);
}
return links.resolvedType;
}
@ -3594,7 +3602,7 @@ module ts {
return links.resolvedType;
}
function getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(node: TypeNode | LiteralExpression | HeritageClauseElement): Type {
function getTypeFromNode(node: TypeNode | LiteralExpression | HeritageClauseElement): Type {
switch (node.kind) {
case SyntaxKind.AnyKeyword:
return anyType;
@ -3611,9 +3619,9 @@ module ts {
case SyntaxKind.StringLiteral:
return getTypeFromStringLiteral(<LiteralExpression>node);
case SyntaxKind.TypeReference:
return getTypeFromTypeReferenceOrHeritageClauseElement(<TypeReferenceNode>node);
return getTypeFromTypeReference(<TypeReferenceNode>node);
case SyntaxKind.HeritageClauseElement:
return getTypeFromTypeReferenceOrHeritageClauseElement(<HeritageClauseElement>node);
return getTypeFromHeritageClauseElement(<HeritageClauseElement>node);
case SyntaxKind.TypeQuery:
return getTypeFromTypeQueryNode(<TypeQueryNode>node);
case SyntaxKind.ArrayType:
@ -3623,7 +3631,7 @@ module ts {
case SyntaxKind.UnionType:
return getTypeFromUnionTypeNode(<UnionTypeNode>node);
case SyntaxKind.ParenthesizedType:
return getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement((<ParenthesizedTypeNode>node).type);
return getTypeFromNode((<ParenthesizedTypeNode>node).type);
case SyntaxKind.FunctionType:
case SyntaxKind.ConstructorType:
case SyntaxKind.TypeLiteral:
@ -5492,7 +5500,7 @@ module ts {
let isCallExpression = node.parent.kind === SyntaxKind.CallExpression && (<CallExpression>node.parent).expression === node;
let enclosingClass = <ClassDeclaration>getAncestor(node, SyntaxKind.ClassDeclaration);
let baseClass: Type;
if (enclosingClass && getClassBaseTypeNode(enclosingClass)) {
if (enclosingClass && getClassExtendsHeritageClauseElement(enclosingClass)) {
let classType = <InterfaceType>getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClass));
baseClass = classType.baseTypes.length && classType.baseTypes[0];
}
@ -5624,7 +5632,7 @@ module ts {
let declaration = <VariableLikeDeclaration>node.parent;
if (node === declaration.initializer) {
if (declaration.type) {
return getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(declaration.type);
return getTypeFromNode(declaration.type);
}
if (declaration.kind === SyntaxKind.Parameter) {
let type = getContextuallyTypedParameterType(<ParameterDeclaration>declaration);
@ -5827,7 +5835,7 @@ module ts {
case SyntaxKind.NewExpression:
return getContextualTypeForArgument(<CallExpression>parent, node);
case SyntaxKind.TypeAssertionExpression:
return getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement((<TypeAssertion>parent).type);
return getTypeFromNode((<TypeAssertion>parent).type);
case SyntaxKind.BinaryExpression:
return getContextualTypeForBinaryOperand(node);
case SyntaxKind.PropertyAssignment:
@ -6628,7 +6636,7 @@ module ts {
let typeArgumentsAreAssignable = true;
for (let i = 0; i < typeParameters.length; i++) {
let typeArgNode = typeArguments[i];
let typeArgument = getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(typeArgNode);
let typeArgument = getTypeFromNode(typeArgNode);
// Do not push on this array! It has a preallocated length
typeArgumentResultTypes[i] = typeArgument;
if (typeArgumentsAreAssignable /* so far */) {
@ -6702,7 +6710,7 @@ module ts {
function getEffectiveTypeArguments(callExpression: CallExpression): TypeNode[] {
if (callExpression.expression.kind === SyntaxKind.SuperKeyword) {
let containingClass = <ClassDeclaration>getAncestor(callExpression, SyntaxKind.ClassDeclaration);
let baseClassTypeNode = containingClass && getClassBaseTypeNode(containingClass);
let baseClassTypeNode = containingClass && getClassExtendsHeritageClauseElement(containingClass);
return baseClassTypeNode && baseClassTypeNode.typeArguments;
}
else {
@ -7110,7 +7118,7 @@ module ts {
function checkTypeAssertion(node: TypeAssertion): Type {
let exprType = checkExpression(node.expression);
let targetType = getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(node.type);
let targetType = getTypeFromNode(node.type);
if (produceDiagnostics && targetType !== unknownType) {
let widenedType = getWidenedType(exprType);
if (!(isTypeAssignableTo(targetType, widenedType))) {
@ -7289,7 +7297,7 @@ module ts {
function checkFunctionExpressionOrObjectLiteralMethodBody(node: FunctionExpression | MethodDeclaration) {
Debug.assert(node.kind !== SyntaxKind.MethodDeclaration || isObjectLiteralMethod(node));
if (node.type) {
checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(node.type));
checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromNode(node.type));
}
if (node.body) {
@ -7299,7 +7307,7 @@ module ts {
else {
let exprType = checkExpression(<Expression>node.body);
if (node.type) {
checkTypeAssignableTo(exprType, getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(node.type), node.body, /*headMessage*/ undefined);
checkTypeAssignableTo(exprType, getTypeFromNode(node.type), node.body, /*headMessage*/ undefined);
}
checkFunctionExpressionBodies(node.body);
}
@ -8234,7 +8242,7 @@ module ts {
// TS 1.0 spec (April 2014): 8.3.2
// Constructors of classes with no extends clause may not contain super calls, whereas
// constructors of derived classes must contain at least one super call somewhere in their function body.
if (getClassBaseTypeNode(<ClassDeclaration>node.parent)) {
if (getClassExtendsHeritageClauseElement(<ClassDeclaration>node.parent)) {
if (containsSuperCall(node.body)) {
// The first statement in the body of a constructor must be a super call if both of the following are true:
@ -8305,6 +8313,14 @@ module ts {
checkDecorators(node);
}
function checkTypeReferenceNode(node: TypeReferenceNode) {
return checkTypeReferenceOrHeritageClauseElement(node);
}
function checkHeritageClauseElement(node: HeritageClauseElement) {
return checkTypeReferenceOrHeritageClauseElement(node);
}
function checkTypeReferenceOrHeritageClauseElement(node: TypeReferenceNode | HeritageClauseElement) {
// Grammar checking
checkGrammarTypeArguments(node, node.typeArguments);
@ -8800,7 +8816,7 @@ module ts {
checkSourceElement(node.body);
if (node.type && !isAccessor(node.kind)) {
checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(node.type));
checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromNode(node.type));
}
// Report an implicit any error if there is no body, no explicit return type, and node is not a private method
@ -8900,7 +8916,7 @@ module ts {
return;
}
if (getClassBaseTypeNode(enclosingClass)) {
if (getClassExtendsHeritageClauseElement(enclosingClass)) {
let isDeclaration = node.kind !== SyntaxKind.Identifier;
if (isDeclaration) {
error(node, Diagnostics.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference);
@ -9772,14 +9788,14 @@ module ts {
let symbol = getSymbolOfNode(node);
let type = <InterfaceType>getDeclaredTypeOfSymbol(symbol);
let staticType = <ObjectType>getTypeOfSymbol(symbol);
let baseTypeNode = getClassBaseTypeNode(node);
let baseTypeNode = getClassExtendsHeritageClauseElement(node);
if (baseTypeNode) {
if (!isSupportedHeritageClauseElement(baseTypeNode)) {
error(baseTypeNode.expression, Diagnostics.Only_type_references_are_currently_supported_in_a_class_extends_clauses);
error(baseTypeNode.expression, Diagnostics.Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses);
}
emitExtends = emitExtends || !isInAmbientContext(node);
checkTypeReferenceOrHeritageClauseElement(baseTypeNode);
checkHeritageClauseElement(baseTypeNode);
}
if (type.baseTypes.length) {
if (produceDiagnostics) {
@ -9802,16 +9818,16 @@ module ts {
checkExpressionOrQualifiedName(baseTypeNode.expression);
}
let implementedTypeNodes = getClassImplementedTypeNodes(node);
let implementedTypeNodes = getClassImplementsHeritageClauseElements(node);
if (implementedTypeNodes) {
forEach(implementedTypeNodes, typeRefNode => {
if (!isSupportedHeritageClauseElement(typeRefNode)) {
error(typeRefNode.expression, Diagnostics.A_class_can_only_implement_type_references);
error(typeRefNode.expression, Diagnostics.A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments);
}
checkTypeReferenceOrHeritageClauseElement(typeRefNode);
checkHeritageClauseElement(typeRefNode);
if (produceDiagnostics) {
let t = getTypeFromTypeReferenceOrHeritageClauseElement(typeRefNode);
let t = getTypeFromHeritageClauseElement(typeRefNode);
if (t !== unknownType) {
let declaredType = (t.flags & TypeFlags.Reference) ? (<TypeReference>t).target : t;
if (declaredType.flags & (TypeFlags.Class | TypeFlags.Interface)) {
@ -9933,7 +9949,7 @@ module ts {
if (!tp1.constraint || !tp2.constraint) {
return false;
}
if (!isTypeIdenticalTo(getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(tp1.constraint), getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(tp2.constraint))) {
if (!isTypeIdenticalTo(getTypeFromNode(tp1.constraint), getTypeFromNode(tp2.constraint))) {
return false;
}
}
@ -10006,10 +10022,10 @@ module ts {
}
forEach(getInterfaceBaseTypeNodes(node), heritageElement => {
if (!isSupportedHeritageClauseElement(heritageElement)) {
error(heritageElement.expression, Diagnostics.An_interface_can_only_extend_a_type_reference);
error(heritageElement.expression, Diagnostics.An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments);
}
checkTypeReferenceOrHeritageClauseElement(heritageElement);
checkHeritageClauseElement(heritageElement);
});
forEach(node.members, checkSourceElement);
@ -10551,7 +10567,7 @@ module ts {
case SyntaxKind.SetAccessor:
return checkAccessorDeclaration(<AccessorDeclaration>node);
case SyntaxKind.TypeReference:
return checkTypeReferenceOrHeritageClauseElement(<TypeReferenceNode>node);
return checkTypeReferenceNode(<TypeReferenceNode>node);
case SyntaxKind.TypeQuery:
return checkTypeQuery(<TypeQueryNode>node);
case SyntaxKind.TypeLiteral:
@ -11193,7 +11209,7 @@ module ts {
}
if (isTypeNodeOrStringLiteralTypeOrHeritageClauseElement(node)) {
return getTypeFromTypeNodeOrStringLiteralTypeOrHeritageClauseElement(<TypeNode>node);
return getTypeFromNode(<TypeNode>node);
}
if (isExpression(node)) {

View File

@ -892,11 +892,11 @@ module ts {
let prevEnclosingDeclaration = enclosingDeclaration;
enclosingDeclaration = node;
emitTypeParameters(node.typeParameters);
let baseTypeNode = getClassBaseTypeNode(node);
let baseTypeNode = getClassExtendsHeritageClauseElement(node);
if (baseTypeNode) {
emitHeritageClause([baseTypeNode], /*isImplementsList*/ false);
}
emitHeritageClause(getClassImplementedTypeNodes(node), /*isImplementsList*/ true);
emitHeritageClause(getClassImplementsHeritageClauseElements(node), /*isImplementsList*/ true);
write(" {");
writeLine();
increaseIndent();

View File

@ -353,8 +353,8 @@ module ts {
The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression: { code: 2496, category: DiagnosticCategory.Error, key: "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression." },
External_module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct: { code: 2497, category: DiagnosticCategory.Error, key: "External module '{0}' resolves to a non-module entity and cannot be imported using this construct." },
External_module_0_uses_export_and_cannot_be_used_with_export_Asterisk: { code: 2498, category: DiagnosticCategory.Error, key: "External module '{0}' uses 'export =' and cannot be used with 'export *'." },
An_interface_can_only_extend_a_type_reference: { code: 2499, category: DiagnosticCategory.Error, key: "An interface can only extend a type reference." },
A_class_can_only_implement_type_references: { code: 2500, category: DiagnosticCategory.Error, key: "A class can only implement type references." },
An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2499, category: DiagnosticCategory.Error, key: "An interface can only extend an identifier/qualified-name with optional type arguments." },
A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2500, category: DiagnosticCategory.Error, key: "A class can only implement an identifier/qualified-name with optional type arguments." },
Import_declaration_0_is_using_private_name_1: { code: 4000, category: DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." },
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." },
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." },
@ -507,7 +507,7 @@ module ts {
You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { code: 8001, category: DiagnosticCategory.Error, key: "You cannot rename elements that are defined in the standard TypeScript library." },
yield_expressions_are_not_currently_supported: { code: 9000, category: DiagnosticCategory.Error, key: "'yield' expressions are not currently supported." },
Generators_are_not_currently_supported: { code: 9001, category: DiagnosticCategory.Error, key: "Generators are not currently supported." },
Only_type_references_are_currently_supported_in_a_class_extends_clauses: { code: 9002, category: DiagnosticCategory.Error, key: "Only type references are currently supported in a class 'extends' clauses." },
Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses: { code: 9002, category: DiagnosticCategory.Error, key: "Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses." },
class_expressions_are_not_currently_supported: { code: 9003, category: DiagnosticCategory.Error, key: "'class' expressions are not currently supported." },
class_declarations_are_only_supported_directly_inside_a_module_or_as_a_top_level_declaration: { code: 9004, category: DiagnosticCategory.Error, key: "'class' declarations are only supported directly inside a module or as a top level declaration." },
};

View File

@ -1403,11 +1403,11 @@
"category": "Error",
"code": 2498
},
"An interface can only extend a type reference.": {
"An interface can only extend an identifier/qualified-name with optional type arguments.": {
"category": "Error",
"code": 2499
},
"A class can only implement type references.": {
"A class can only implement an identifier/qualified-name with optional type arguments.": {
"category": "Error",
"code": 2500
},
@ -2021,7 +2021,7 @@
"category": "Error",
"code": 9001
},
"Only type references are currently supported in a class 'extends' clauses.": {
"Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses.": {
"category": "Error",
"code": 9002
},

View File

@ -3547,7 +3547,7 @@ module ts {
emitDeclarationName(node);
}
var baseTypeNode = getClassBaseTypeNode(node);
var baseTypeNode = getClassExtendsHeritageClauseElement(node);
if (baseTypeNode) {
write(" extends ");
emit(baseTypeNode.expression);
@ -3621,7 +3621,7 @@ module ts {
}
write("(function (");
let baseTypeNode = getClassBaseTypeNode(node);
let baseTypeNode = getClassExtendsHeritageClauseElement(node);
if (baseTypeNode) {
write("_super");
}

View File

@ -951,12 +951,12 @@ module ts {
node.kind === SyntaxKind.ExportAssignment && (<ExportAssignment>node).expression.kind === SyntaxKind.Identifier;
}
export function getClassBaseTypeNode(node: ClassLikeDeclaration) {
export function getClassExtendsHeritageClauseElement(node: ClassLikeDeclaration) {
let heritageClause = getHeritageClause(node.heritageClauses, SyntaxKind.ExtendsKeyword);
return heritageClause && heritageClause.types.length > 0 ? heritageClause.types[0] : undefined;
}
export function getClassImplementedTypeNodes(node: ClassDeclaration) {
export function getClassImplementsHeritageClauseElements(node: ClassDeclaration) {
let heritageClause = getHeritageClause(node.heritageClauses, SyntaxKind.ImplementsKeyword);
return heritageClause ? heritageClause.types : undefined;
}

View File

@ -4948,8 +4948,8 @@ module ts {
if (symbol && symbol.flags & (SymbolFlags.Class | SymbolFlags.Interface)) {
forEach(symbol.getDeclarations(), declaration => {
if (declaration.kind === SyntaxKind.ClassDeclaration) {
getPropertySymbolFromTypeReference(getClassBaseTypeNode(<ClassDeclaration>declaration));
forEach(getClassImplementedTypeNodes(<ClassDeclaration>declaration), getPropertySymbolFromTypeReference);
getPropertySymbolFromTypeReference(getClassExtendsHeritageClauseElement(<ClassDeclaration>declaration));
forEach(getClassImplementsHeritageClauseElements(<ClassDeclaration>declaration), getPropertySymbolFromTypeReference);
}
else if (declaration.kind === SyntaxKind.InterfaceDeclaration) {
forEach(getInterfaceBaseTypeNodes(<InterfaceDeclaration>declaration), getPropertySymbolFromTypeReference);

View File

@ -4,7 +4,7 @@ tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/cla
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(6,18): error TS2304: Cannot find name 'Void'.
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(7,19): error TS1109: Expression expected.
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(8,18): error TS2304: Cannot find name 'Null'.
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(9,19): error TS9002: Only type references are currently supported in a class 'extends' clauses.
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(9,19): error TS9002: Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses.
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(10,18): error TS2304: Cannot find name 'undefined'.
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(11,18): error TS2304: Cannot find name 'Undefined'.
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(14,18): error TS2311: A class may only extend another class.
@ -33,7 +33,7 @@ tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/cla
!!! error TS2304: Cannot find name 'Null'.
class C5a extends null { }
~~~~
!!! error TS9002: Only type references are currently supported in a class 'extends' clauses.
!!! error TS9002: Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses.
class C6 extends undefined { }
~~~~~~~~~
!!! error TS2304: Cannot find name 'undefined'.

View File

@ -1,5 +1,5 @@
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive2.ts(3,19): error TS1109: Expression expected.
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive2.ts(4,19): error TS9002: Only type references are currently supported in a class 'extends' clauses.
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive2.ts(4,19): error TS9002: Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses.
==== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive2.ts (2 errors) ====
@ -10,4 +10,4 @@ tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/cla
!!! error TS1109: Expression expected.
class C5a extends null { }
~~~~
!!! error TS9002: Only type references are currently supported in a class 'extends' clauses.
!!! error TS9002: Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses.

View File

@ -1,10 +1,10 @@
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts(4,17): error TS2311: A class may only extend another class.
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts(6,18): error TS9002: Only type references are currently supported in a class 'extends' clauses.
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts(6,18): error TS9002: Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses.
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts(6,31): error TS1005: ',' expected.
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts(8,18): error TS2304: Cannot find name 'x'.
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts(11,18): error TS2304: Cannot find name 'M'.
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts(14,18): error TS2304: Cannot find name 'foo'.
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts(16,18): error TS9002: Only type references are currently supported in a class 'extends' clauses.
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts(16,18): error TS9002: Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses.
==== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts (7 errors) ====
@ -17,7 +17,7 @@ tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/cla
class C2 extends { foo: string; } { } // error
~~~~~~~~~~~~~~~~
!!! error TS9002: Only type references are currently supported in a class 'extends' clauses.
!!! error TS9002: Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses.
~
!!! error TS1005: ',' expected.
var x: { foo: string; }
@ -37,4 +37,4 @@ tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/cla
class C6 extends []{ } // error
~~
!!! error TS9002: Only type references are currently supported in a class 'extends' clauses.
!!! error TS9002: Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses.

View File

@ -1,15 +1,15 @@
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType2.ts(1,18): error TS9002: Only type references are currently supported in a class 'extends' clauses.
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType2.ts(1,18): error TS9002: Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses.
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType2.ts(1,31): error TS1005: ',' expected.
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType2.ts(3,18): error TS9002: Only type references are currently supported in a class 'extends' clauses.
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType2.ts(3,18): error TS9002: Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses.
==== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType2.ts (3 errors) ====
class C2 extends { foo: string; } { } // error
~~~~~~~~~~~~~~~~
!!! error TS9002: Only type references are currently supported in a class 'extends' clauses.
!!! error TS9002: Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses.
~
!!! error TS1005: ',' expected.
class C6 extends []{ } // error
~~
!!! error TS9002: Only type references are currently supported in a class 'extends' clauses.
!!! error TS9002: Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses.

View File

@ -1,4 +1,4 @@
tests/cases/compiler/interfaceMayNotBeExtendedWitACall.ts(3,24): error TS2499: An interface can only extend a type reference.
tests/cases/compiler/interfaceMayNotBeExtendedWitACall.ts(3,24): error TS2499: An interface can only extend an identifier/qualified-name with optional type arguments.
==== tests/cases/compiler/interfaceMayNotBeExtendedWitACall.ts (1 errors) ====
@ -6,7 +6,7 @@ tests/cases/compiler/interfaceMayNotBeExtendedWitACall.ts(3,24): error TS2499: A
interface blue extends color() { // error
~~~~~~~
!!! error TS2499: An interface can only extend a type reference.
!!! error TS2499: An interface can only extend an identifier/qualified-name with optional type arguments.
}

View File

@ -1,7 +1,7 @@
tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts(3,16): error TS2334: 'this' cannot be referenced in a static property initializer.
tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts(22,15): error TS2332: 'this' cannot be referenced in current location.
tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts(28,13): error TS2331: 'this' cannot be referenced in a module body.
tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts(38,25): error TS9002: Only type references are currently supported in a class 'extends' clauses.
tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts(38,25): error TS9002: Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses.
tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts(44,9): error TS2332: 'this' cannot be referenced in current location.
tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts(45,9): error TS2332: 'this' cannot be referenced in current location.
@ -52,7 +52,7 @@ tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts(45,9):
class ErrClass3 extends this {
~~~~
!!! error TS9002: Only type references are currently supported in a class 'extends' clauses.
!!! error TS9002: Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses.
}

View File

@ -1,7 +1,7 @@
tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(3,16): error TS2334: 'this' cannot be referenced in a static property initializer.
tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(22,15): error TS2332: 'this' cannot be referenced in current location.
tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(28,13): error TS2331: 'this' cannot be referenced in a module body.
tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(38,25): error TS9002: Only type references are currently supported in a class 'extends' clauses.
tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(38,25): error TS9002: Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses.
tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(44,9): error TS2332: 'this' cannot be referenced in current location.
tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(45,9): error TS2332: 'this' cannot be referenced in current location.
tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(48,1): error TS1148: Cannot compile external modules unless the '--module' flag is provided.
@ -53,7 +53,7 @@ tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalMod
class ErrClass3 extends this {
~~~~
!!! error TS9002: Only type references are currently supported in a class 'extends' clauses.
!!! error TS9002: Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses.
}

View File

@ -17,7 +17,6 @@
////interface test3 extends IFoo./*3*/ {}
////interface test4 implements Foo./*4*/ {}
debugger;
goTo.marker("1");
verify.not.completionListIsEmpty();

View File

@ -19,7 +19,6 @@ test.ranges().forEach(r => {
goTo.position(r.start);
test.ranges().forEach(range => {
debugger;
verify.occurrencesAtPositionContains(range);
});
verify.occurrencesAtPositionCount(test.ranges().length);

View File

@ -7,7 +7,6 @@
//// interface /*2*/X extends /*3*/M./*4*/I { }
var c = classification;
debugger;
verify.semanticClassificationsAre(
c.moduleName("M", test.marker("0").position),
c.interfaceName("I", test.marker("1").position),