diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 2f5daae7ed4..c7c28f9e226 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -105,22 +105,22 @@ module ts { Extends_clause_of_exported_class_0_has_or_is_using_name_1_from_private_module_2: { code: 2021, category: DiagnosticCategory.Error, key: "Extends clause of exported class '{0}' has or is using name '{1}' from private module '{2}'." }, Implements_clause_of_exported_class_0_has_or_is_using_name_1_from_private_module_2: { code: 2022, category: DiagnosticCategory.Error, key: "Implements clause of exported class '{0}' has or is using name '{1}' from private module '{2}'." }, Extends_clause_of_exported_interface_0_has_or_is_using_name_1_from_private_module_2: { code: 2023, category: DiagnosticCategory.Error, key: "Extends clause of exported interface '{0}' has or is using name '{1}' from private module '{2}'." }, - TypeParameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 2208, category: DiagnosticCategory.Error, key: "TypeParameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." }, - TypeParameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 2209, category: DiagnosticCategory.Error, key: "TypeParameter '{0}' of call signature from exported interface has or is using private name '{1}'." }, - TypeParameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 2210, category: DiagnosticCategory.Error, key: "TypeParameter '{0}' of public static method from exported class has or is using private name '{1}'." }, - TypeParameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 2211, category: DiagnosticCategory.Error, key: "TypeParameter '{0}' of public method from exported class has or is using private name '{1}'." }, - TypeParameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 2212, category: DiagnosticCategory.Error, key: "TypeParameter '{0}' of method from exported interface has or is using private name '{1}'." }, - TypeParameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 2213, category: DiagnosticCategory.Error, key: "TypeParameter '{0}' of exported function has or is using private name '{1}'." }, - TypeParameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 2214, category: DiagnosticCategory.Error, key: "TypeParameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'." }, - TypeParameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 2215, category: DiagnosticCategory.Error, key: "TypeParameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'." }, - TypeParameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 2216, category: DiagnosticCategory.Error, key: "TypeParameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'." }, - TypeParameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 2217, category: DiagnosticCategory.Error, key: "TypeParameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'." }, - TypeParameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 2218, category: DiagnosticCategory.Error, key: "TypeParameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'." }, - TypeParameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { code: 2219, category: DiagnosticCategory.Error, key: "TypeParameter '{0}' of exported function has or is using name '{1}' from private module '{2}'." }, - TypeParameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 2220, category: DiagnosticCategory.Error, key: "TypeParameter '{0}' of exported class has or is using private name '{1}'." }, - TypeParameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 2221, category: DiagnosticCategory.Error, key: "TypeParameter '{0}' of exported interface has or is using private name '{1}'." }, - TypeParameter_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 2222, category: DiagnosticCategory.Error, key: "TypeParameter '{0}' of exported class has or is using name '{1}' from private module '{2}'." }, - TypeParameter_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 2223, category: DiagnosticCategory.Error, key: "TypeParameter '{0}' of exported interface has or is using name '{1}' from private module '{2}'." }, + Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 2208, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." }, + Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 2209, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of call signature from exported interface has or is using private name '{1}'." }, + Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 2210, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of public static method from exported class has or is using private name '{1}'." }, + Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 2211, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of public method from exported class has or is using private name '{1}'." }, + Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 2212, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of method from exported interface has or is using private name '{1}'." }, + Type_parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 2213, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported function has or is using private name '{1}'." }, + Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 2214, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'." }, + Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 2215, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'." }, + Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 2216, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'." }, + Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 2217, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'." }, + Type_parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 2218, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'." }, + Type_parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { code: 2219, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'." }, + Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 2220, 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: 2221, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, + Type_parameter_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 2222, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using name '{1}' from private module '{2}'." }, + Type_parameter_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 2223, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using name '{1}' from private module '{2}'." }, new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { code: 2068, category: DiagnosticCategory.Error, key: "'new T[]' cannot be used to create an array. Use 'new Array()' instead." }, Multiple_constructor_implementations_are_not_allowed: { code: 2070, category: DiagnosticCategory.Error, key: "Multiple constructor implementations are not allowed." }, A_class_may_only_implement_another_class_or_interface: { code: 2074, category: DiagnosticCategory.Error, key: "A class may only implement another class or interface." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 1b1ccff36fd..e9637570794 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -414,67 +414,67 @@ "category": "Error", "code": 2023 }, - "TypeParameter '{0}' of constructor signature from exported interface has or is using private name '{1}'.": { + "Type parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'.": { "category": "Error", "code": 2208 }, - "TypeParameter '{0}' of call signature from exported interface has or is using private name '{1}'.": { + "Type parameter '{0}' of call signature from exported interface has or is using private name '{1}'.": { "category": "Error", "code": 2209 }, - "TypeParameter '{0}' of public static method from exported class has or is using private name '{1}'.": { + "Type parameter '{0}' of public static method from exported class has or is using private name '{1}'.": { "category": "Error", "code": 2210 }, - "TypeParameter '{0}' of public method from exported class has or is using private name '{1}'.": { + "Type parameter '{0}' of public method from exported class has or is using private name '{1}'.": { "category": "Error", "code": 2211 }, - "TypeParameter '{0}' of method from exported interface has or is using private name '{1}'.": { + "Type parameter '{0}' of method from exported interface has or is using private name '{1}'.": { "category": "Error", "code": 2212 }, - "TypeParameter '{0}' of exported function has or is using private name '{1}'.": { + "Type parameter '{0}' of exported function has or is using private name '{1}'.": { "category": "Error", "code": 2213 }, - "TypeParameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'.": { + "Type parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'.": { "category": "Error", "code": 2214 }, - "TypeParameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'.": { + "Type parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'.": { "category": "Error", "code": 2215 }, - "TypeParameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'.": { + "Type parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'.": { "category": "Error", "code": 2216 }, - "TypeParameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'.": { + "Type parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'.": { "category": "Error", "code": 2217 }, - "TypeParameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'.": { + "Type parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'.": { "category": "Error", "code": 2218 }, - "TypeParameter '{0}' of exported function has or is using name '{1}' from private module '{2}'.": { + "Type parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'.": { "category": "Error", "code": 2219 }, - "TypeParameter '{0}' of exported class has or is using private name '{1}'.": { + "Type parameter '{0}' of exported class has or is using private name '{1}'.": { "category": "Error", "code": 2220 }, - "TypeParameter '{0}' of exported interface has or is using private name '{1}'.": { + "Type parameter '{0}' of exported interface has or is using private name '{1}'.": { "category": "Error", "code": 2221 }, - "TypeParameter '{0}' of exported class has or is using name '{1}' from private module '{2}'.": { + "Type parameter '{0}' of exported class has or is using name '{1}' from private module '{2}'.": { "category": "Error", "code": 2222 }, - "TypeParameter '{0}' of exported interface has or is using name '{1}' from private module '{2}'.": { + "Type parameter '{0}' of exported interface has or is using name '{1}' from private module '{2}'.": { "category": "Error", "code": 2223 }, diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 4169d48e0b1..6052e5c3ba0 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -2017,50 +2017,50 @@ module ts { switch (node.parent.kind) { case SyntaxKind.ClassDeclaration: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - Diagnostics.TypeParameter_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : - Diagnostics.TypeParameter_0_of_exported_class_has_or_is_using_private_name_1; + Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : + Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; case SyntaxKind.InterfaceDeclaration: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - Diagnostics.TypeParameter_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 : - Diagnostics.TypeParameter_0_of_exported_interface_has_or_is_using_private_name_1; + Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 : + Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; case SyntaxKind.ConstructSignature: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - Diagnostics.TypeParameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : - Diagnostics.TypeParameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; + Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : + Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; case SyntaxKind.CallSignature: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - Diagnostics.TypeParameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : - Diagnostics.TypeParameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; + Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : + Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; case SyntaxKind.Method: if (node.parent.flags & NodeFlags.Static) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - Diagnostics.TypeParameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : - Diagnostics.TypeParameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; + Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : + Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } else if (node.parent.parent.kind === SyntaxKind.ClassDeclaration) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - Diagnostics.TypeParameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : - Diagnostics.TypeParameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; + Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : + Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - Diagnostics.TypeParameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : - Diagnostics.TypeParameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; + Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : + Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; case SyntaxKind.FunctionDeclaration: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - Diagnostics.TypeParameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : - Diagnostics.TypeParameter_0_of_exported_function_has_or_is_using_private_name_1; + Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : + Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; default: @@ -2075,7 +2075,8 @@ module ts { } emitSourceTextOfNode(node.name); - if (node.constraint) { + // If there is constraint present and this is not a type parameter of the private method emit the constraint + if (node.constraint && (node.parent.kind !== SyntaxKind.Method || !(node.parent.flags & NodeFlags.Private))) { write(" extends "); getSymbolVisibilityDiagnosticMessage = getTypeParameterConstraintVisibilityError; resolver.writeTypeAtLocation(node.constraint, enclosingDeclaration, TypeFormatFlags.None, writer); @@ -2092,7 +2093,17 @@ module ts { } function emitHeritageClause(typeReferences: TypeReferenceNode[], isImplementsList: boolean) { + if (typeReferences) { + write(isImplementsList ? " implements " : " extends "); + emitCommaList(typeReferences, emitTypeOfTypeReference); + } + function emitTypeOfTypeReference(node: Node) { + getSymbolVisibilityDiagnosticMessage = getHeritageClauseVisibilityError; + resolver.writeTypeAtLocation(node, enclosingDeclaration, TypeFormatFlags.WriteArrayAsGenericType, writer); + // TODO(shkamat) This is just till we get rest of the error reporting up + getSymbolVisibilityDiagnosticMessage = undefined; + function getHeritageClauseVisibilityError(symbolAccesibilityResult: SymbolAccessiblityResult) { var diagnosticMessage: DiagnosticMessage; if (node.parent.kind === SyntaxKind.ClassDeclaration) { @@ -2140,15 +2151,6 @@ module ts { typeName: (node.parent).name } } - getSymbolVisibilityDiagnosticMessage = getHeritageClauseVisibilityError; - resolver.writeTypeAtLocation(node, enclosingDeclaration, TypeFormatFlags.WriteArrayAsGenericType, writer); - // TODO(shkamat) This is just till we get rest of the error reporting up - getSymbolVisibilityDiagnosticMessage = undefined; - } - - if (typeReferences) { - write(isImplementsList ? " implements " : " extends "); - emitCommaList(typeReferences, emitTypeOfTypeReference); } } diff --git a/tests/baselines/reference/privacyTypeParameterOfFunctionDeclFile.errors.txt b/tests/baselines/reference/privacyTypeParameterOfFunctionDeclFile.errors.txt index ccb7be1e181..8e892e57dee 100644 --- a/tests/baselines/reference/privacyTypeParameterOfFunctionDeclFile.errors.txt +++ b/tests/baselines/reference/privacyTypeParameterOfFunctionDeclFile.errors.txt @@ -1,4 +1,4 @@ -==== tests/cases/compiler/privacyTypeParameterOfFunctionDeclFile.ts (28 errors) ==== +==== tests/cases/compiler/privacyTypeParameterOfFunctionDeclFile.ts (24 errors) ==== class privateClass { } @@ -8,13 +8,13 @@ export interface publicInterfaceWithPrivateTypeParameters { new (): privateClass; // Error ~~~~~~~~~~~~~~~~~~~~~~ -!!! TypeParameter 'T' of constructor signature from exported interface has or is using private name 'privateClass'. +!!! Type parameter 'T' of constructor signature from exported interface has or is using private name 'privateClass'. (): privateClass; // Error ~~~~~~~~~~~~~~~~~~~~~~ -!!! TypeParameter 'T' of call signature from exported interface has or is using private name 'privateClass'. +!!! Type parameter 'T' of call signature from exported interface has or is using private name 'privateClass'. myMethod(): privateClass; // Error ~~~~~~~~~~~~~~~~~~~~~~ -!!! TypeParameter 'T' of method from exported interface has or is using private name 'privateClass'. +!!! Type parameter 'T' of method from exported interface has or is using private name 'privateClass'. } export interface publicInterfaceWithPublicTypeParameters { @@ -38,19 +38,15 @@ export class publicClassWithWithPrivateTypeParameters { static myPublicStaticMethod() { // Error ~~~~~~~~~~~~~~~~~~~~~~ -!!! TypeParameter 'T' of public static method from exported class has or is using private name 'privateClass'. +!!! Type parameter 'T' of public static method from exported class has or is using private name 'privateClass'. } private static myPrivateStaticMethod() { - ~~~~~~~~~~~~~~~~~~~~~~ -!!! TypeParameter 'T' of public static method from exported class has or is using private name 'privateClass'. } myPublicMethod() { // Error ~~~~~~~~~~~~~~~~~~~~~~ -!!! TypeParameter 'T' of public method from exported class has or is using private name 'privateClass'. +!!! Type parameter 'T' of public method from exported class has or is using private name 'privateClass'. } private myPrivateMethod() { - ~~~~~~~~~~~~~~~~~~~~~~ -!!! TypeParameter 'T' of public method from exported class has or is using private name 'privateClass'. } } @@ -89,7 +85,7 @@ export function publicFunctionWithPrivateTypeParameters() { // Error ~~~~~~~~~~~~~~~~~~~~~~ -!!! TypeParameter 'T' of exported function has or is using private name 'privateClass'. +!!! Type parameter 'T' of exported function has or is using private name 'privateClass'. } export function publicFunctionWithPublicTypeParameters() { @@ -143,27 +139,27 @@ export interface publicInterfaceWithPrivatModuleTypeParameters { new (): privateModule.publicClass; // Error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! TypeParameter 'T' of constructor signature from exported interface has or is using name 'privateModule.publicClass' from private module 'privateModule'. +!!! Type parameter 'T' of constructor signature from exported interface has or is using name 'privateModule.publicClass' from private module 'privateModule'. (): privateModule.publicClass; // Error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! TypeParameter 'T' of call signature from exported interface has or is using name 'privateModule.publicClass' from private module 'privateModule'. +!!! Type parameter 'T' of call signature from exported interface has or is using name 'privateModule.publicClass' from private module 'privateModule'. myMethod(): privateModule.publicClass; // Error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! TypeParameter 'T' of method from exported interface has or is using name 'privateModule.publicClass' from private module 'privateModule'. +!!! Type parameter 'T' of method from exported interface has or is using name 'privateModule.publicClass' from private module 'privateModule'. } export class publicClassWithWithPrivateModuleTypeParameters { static myPublicStaticMethod() { // Error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! TypeParameter 'T' of public static method from exported class has or is using name 'privateModule.publicClass' from private module 'privateModule'. +!!! Type parameter 'T' of public static method from exported class has or is using name 'privateModule.publicClass' from private module 'privateModule'. } myPublicMethod() { // Error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! TypeParameter 'T' of public method from exported class has or is using name 'privateModule.publicClass' from private module 'privateModule'. +!!! Type parameter 'T' of public method from exported class has or is using name 'privateModule.publicClass' from private module 'privateModule'. } } export function publicFunctionWithPrivateMopduleTypeParameters() { // Error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! TypeParameter 'T' of exported function has or is using name 'privateModule.publicClass' from private module 'privateModule'. +!!! Type parameter 'T' of exported function has or is using name 'privateModule.publicClass' from private module 'privateModule'. } @@ -192,13 +188,13 @@ export interface publicInterfaceWithPrivateTypeParameters { new (): privateClass; // Error ~~~~~~~~~~~~~~~~~~~~~~ -!!! TypeParameter 'T' of constructor signature from exported interface has or is using private name 'privateClass'. +!!! Type parameter 'T' of constructor signature from exported interface has or is using private name 'privateClass'. (): privateClass; // Error ~~~~~~~~~~~~~~~~~~~~~~ -!!! TypeParameter 'T' of call signature from exported interface has or is using private name 'privateClass'. +!!! Type parameter 'T' of call signature from exported interface has or is using private name 'privateClass'. myMethod(): privateClass; // Error ~~~~~~~~~~~~~~~~~~~~~~ -!!! TypeParameter 'T' of method from exported interface has or is using private name 'privateClass'. +!!! Type parameter 'T' of method from exported interface has or is using private name 'privateClass'. } export interface publicInterfaceWithPublicTypeParameters { @@ -222,19 +218,15 @@ export class publicClassWithWithPrivateTypeParameters { static myPublicStaticMethod() { // Error ~~~~~~~~~~~~~~~~~~~~~~ -!!! TypeParameter 'T' of public static method from exported class has or is using private name 'privateClass'. +!!! Type parameter 'T' of public static method from exported class has or is using private name 'privateClass'. } private static myPrivateStaticMethod() { - ~~~~~~~~~~~~~~~~~~~~~~ -!!! TypeParameter 'T' of public static method from exported class has or is using private name 'privateClass'. } myPublicMethod() { // Error ~~~~~~~~~~~~~~~~~~~~~~ -!!! TypeParameter 'T' of public method from exported class has or is using private name 'privateClass'. +!!! Type parameter 'T' of public method from exported class has or is using private name 'privateClass'. } private myPrivateMethod() { - ~~~~~~~~~~~~~~~~~~~~~~ -!!! TypeParameter 'T' of public method from exported class has or is using private name 'privateClass'. } } @@ -273,7 +265,7 @@ export function publicFunctionWithPrivateTypeParameters() { // Error ~~~~~~~~~~~~~~~~~~~~~~ -!!! TypeParameter 'T' of exported function has or is using private name 'privateClass'. +!!! Type parameter 'T' of exported function has or is using private name 'privateClass'. } export function publicFunctionWithPublicTypeParameters() { @@ -327,27 +319,27 @@ export interface publicInterfaceWithPrivatModuleTypeParameters { new (): privateModule.publicClass; // Error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! TypeParameter 'T' of constructor signature from exported interface has or is using name 'privateModule.publicClass' from private module 'privateModule'. +!!! Type parameter 'T' of constructor signature from exported interface has or is using name 'privateModule.publicClass' from private module 'privateModule'. (): privateModule.publicClass; // Error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! TypeParameter 'T' of call signature from exported interface has or is using name 'privateModule.publicClass' from private module 'privateModule'. +!!! Type parameter 'T' of call signature from exported interface has or is using name 'privateModule.publicClass' from private module 'privateModule'. myMethod(): privateModule.publicClass; // Error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! TypeParameter 'T' of method from exported interface has or is using name 'privateModule.publicClass' from private module 'privateModule'. +!!! Type parameter 'T' of method from exported interface has or is using name 'privateModule.publicClass' from private module 'privateModule'. } export class publicClassWithWithPrivateModuleTypeParameters { static myPublicStaticMethod() { // Error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! TypeParameter 'T' of public static method from exported class has or is using name 'privateModule.publicClass' from private module 'privateModule'. +!!! Type parameter 'T' of public static method from exported class has or is using name 'privateModule.publicClass' from private module 'privateModule'. } myPublicMethod() { // Error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! TypeParameter 'T' of public method from exported class has or is using name 'privateModule.publicClass' from private module 'privateModule'. +!!! Type parameter 'T' of public method from exported class has or is using name 'privateModule.publicClass' from private module 'privateModule'. } } export function publicFunctionWithPrivateMopduleTypeParameters() { // Error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! TypeParameter 'T' of exported function has or is using name 'privateModule.publicClass' from private module 'privateModule'. +!!! Type parameter 'T' of exported function has or is using name 'privateModule.publicClass' from private module 'privateModule'. } diff --git a/tests/baselines/reference/privacyTypeParametersOfClassDeclFile.errors.txt b/tests/baselines/reference/privacyTypeParametersOfClassDeclFile.errors.txt index fd9386f9b13..b413b671f40 100644 --- a/tests/baselines/reference/privacyTypeParametersOfClassDeclFile.errors.txt +++ b/tests/baselines/reference/privacyTypeParametersOfClassDeclFile.errors.txt @@ -7,7 +7,7 @@ export class publicClassWithPrivateTypeParameters { // Error ~~~~~~~~~~~~~~~~~~~~~~ -!!! TypeParameter 'T' of exported class has or is using private name 'privateClass'. +!!! Type parameter 'T' of exported class has or is using private name 'privateClass'. myMethod(val: T): T { return val; } @@ -45,7 +45,7 @@ export class publicClassWithTypeParametersFromPrivateModule { // Error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! TypeParameter 'T' of exported class has or is using name 'privateModule.publicClassInPrivateModule' from private module 'privateModule'. +!!! Type parameter 'T' of exported class has or is using name 'privateModule.publicClassInPrivateModule' from private module 'privateModule'. myMethod(val: T): T { return val; } @@ -66,7 +66,7 @@ export class publicClassWithPrivateTypeParameters { // Error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! TypeParameter 'T' of exported class has or is using private name 'privateClassInPublicModule'. +!!! Type parameter 'T' of exported class has or is using private name 'privateClassInPublicModule'. myMethod(val: T): T { return val; } @@ -104,7 +104,7 @@ export class publicClassWithTypeParametersFromPrivateModule { // Error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! TypeParameter 'T' of exported class has or is using name 'privateModule.publicClassInPrivateModule' from private module 'privateModule'. +!!! Type parameter 'T' of exported class has or is using name 'privateModule.publicClassInPrivateModule' from private module 'privateModule'. myMethod(val: T): T { return val; } diff --git a/tests/baselines/reference/privacyTypeParametersOfInterfaceDeclFile.errors.txt b/tests/baselines/reference/privacyTypeParametersOfInterfaceDeclFile.errors.txt index 090ca91836d..92aa57bcef1 100644 --- a/tests/baselines/reference/privacyTypeParametersOfInterfaceDeclFile.errors.txt +++ b/tests/baselines/reference/privacyTypeParametersOfInterfaceDeclFile.errors.txt @@ -13,7 +13,7 @@ export interface publicInterfaceWithPrivateTypeParameters { // Error ~~~~~~~~~~~~~~~~~~~~~~ -!!! TypeParameter 'T' of exported interface has or is using private name 'privateClass'. +!!! Type parameter 'T' of exported interface has or is using private name 'privateClass'. myMethod(val: T): T; myMethod0(): publicClassT; myMethod1(): privateClassT; @@ -62,7 +62,7 @@ export interface publicInterfaceWithPrivateModuleTypeParameterConstraints { // Error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! TypeParameter 'T' of exported interface has or is using name 'privateModule.publicClassInPrivateModule' from private module 'privateModule'. +!!! Type parameter 'T' of exported interface has or is using name 'privateModule.publicClassInPrivateModule' from private module 'privateModule'. } interface privateInterfaceWithPrivateModuleTypeParameterConstraints { // Error @@ -83,7 +83,7 @@ export interface publicInterfaceWithPrivateTypeParameters { // Error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! TypeParameter 'T' of exported interface has or is using private name 'privateClassInPublicModule'. +!!! Type parameter 'T' of exported interface has or is using private name 'privateClassInPublicModule'. myMethod(val: T): T; myMethod0(): publicClassInPublicModuleT; myMethod1(): privateClassInPublicModuleT; @@ -131,7 +131,7 @@ export interface publicInterfaceWithPrivateModuleTypeParameterConstraints { // Error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! TypeParameter 'T' of exported interface has or is using name 'privateModule.publicClassInPrivateModule' from private module 'privateModule'. +!!! Type parameter 'T' of exported interface has or is using name 'privateModule.publicClassInPrivateModule' from private module 'privateModule'. } interface privateInterfaceWithPrivateModuleTypeParameterConstraints { // Error diff --git a/tests/baselines/reference/staticMethodWithTypeParameterExtendsClauseDeclFile.js b/tests/baselines/reference/staticMethodWithTypeParameterExtendsClauseDeclFile.js new file mode 100644 index 00000000000..ba2ca1ae758 --- /dev/null +++ b/tests/baselines/reference/staticMethodWithTypeParameterExtendsClauseDeclFile.js @@ -0,0 +1,66 @@ +//// [staticMethodWithTypeParameterExtendsClauseDeclFile.ts] +class privateClass { +} + +export class publicClass { +} + +export class publicClassWithWithPrivateTypeParameters { + private static myPrivateStaticMethod1() { // do not emit extends clause + } + private myPrivateMethod1() { // do not emit extends clause + } + private static myPrivateStaticMethod2() { // do not emit extends clause + } + private myPrivateMethod2() { // do not emit extends clause + } + public static myPublicStaticMethod() { + } + public myPublicMethod() { + } +} + + +//// [staticMethodWithTypeParameterExtendsClauseDeclFile.js] +var privateClass = (function () { + function privateClass() { + } + return privateClass; +})(); +var publicClass = (function () { + function publicClass() { + } + return publicClass; +})(); +exports.publicClass = publicClass; +var publicClassWithWithPrivateTypeParameters = (function () { + function publicClassWithWithPrivateTypeParameters() { + } + publicClassWithWithPrivateTypeParameters.myPrivateStaticMethod1 = function () { + }; + publicClassWithWithPrivateTypeParameters.prototype.myPrivateMethod1 = function () { + }; + publicClassWithWithPrivateTypeParameters.myPrivateStaticMethod2 = function () { + }; + publicClassWithWithPrivateTypeParameters.prototype.myPrivateMethod2 = function () { + }; + publicClassWithWithPrivateTypeParameters.myPublicStaticMethod = function () { + }; + publicClassWithWithPrivateTypeParameters.prototype.myPublicMethod = function () { + }; + return publicClassWithWithPrivateTypeParameters; +})(); +exports.publicClassWithWithPrivateTypeParameters = publicClassWithWithPrivateTypeParameters; + + +//// [staticMethodWithTypeParameterExtendsClauseDeclFile.d.ts] +export declare class publicClass { +} +export declare class publicClassWithWithPrivateTypeParameters { + private static myPrivateStaticMethod1(); + private myPrivateMethod1(); + private static myPrivateStaticMethod2(); + private myPrivateMethod2(); + static myPublicStaticMethod(): void; + myPublicMethod(): void; +} diff --git a/tests/cases/compiler/staticMethodWithTypeParameterExtendsClauseDeclFile.ts b/tests/cases/compiler/staticMethodWithTypeParameterExtendsClauseDeclFile.ts new file mode 100644 index 00000000000..48d31d92870 --- /dev/null +++ b/tests/cases/compiler/staticMethodWithTypeParameterExtendsClauseDeclFile.ts @@ -0,0 +1,22 @@ +// @module: commonjs +// @declaration: true +class privateClass { +} + +export class publicClass { +} + +export class publicClassWithWithPrivateTypeParameters { + private static myPrivateStaticMethod1() { // do not emit extends clause + } + private myPrivateMethod1() { // do not emit extends clause + } + private static myPrivateStaticMethod2() { // do not emit extends clause + } + private myPrivateMethod2() { // do not emit extends clause + } + public static myPublicStaticMethod() { + } + public myPublicMethod() { + } +}