Fix the incorrect error reporting and declaration file emit for the type parameter constraint of private methods

Also incorporates code review feedback
This commit is contained in:
Sheetal Nandi
2014-08-04 12:06:07 -07:00
parent 9fd95fcb95
commit 0e76a82072
8 changed files with 181 additions and 99 deletions

View File

@@ -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<T>()' 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." },

View File

@@ -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
},

View File

@@ -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: (<Declaration>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);
}
}

View File

@@ -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 <T extends privateClass>(): 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'.
<T extends 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<T extends privateClass>(): 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<T extends privateClass>() { // 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<T extends privateClass>() {
~~~~~~~~~~~~~~~~~~~~~~
!!! TypeParameter 'T' of public static method from exported class has or is using private name 'privateClass'.
}
myPublicMethod<T extends privateClass>() { // 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<T extends privateClass>() {
~~~~~~~~~~~~~~~~~~~~~~
!!! TypeParameter 'T' of public method from exported class has or is using private name 'privateClass'.
}
}
@@ -89,7 +85,7 @@
export function publicFunctionWithPrivateTypeParameters<T extends privateClass>() { // 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<T extends publicClass>() {
@@ -143,27 +139,27 @@
export interface publicInterfaceWithPrivatModuleTypeParameters {
new <T extends privateModule.publicClass>(): 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'.
<T extends privateModule.publicClass>(): 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<T extends privateModule.publicClass>(): 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<T extends privateModule.publicClass>() { // 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<T extends privateModule.publicClass>() { // 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<T extends privateModule.publicClass>() { // 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 <T extends privateClass>(): 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'.
<T extends 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<T extends privateClass>(): 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<T extends privateClass>() { // 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<T extends privateClass>() {
~~~~~~~~~~~~~~~~~~~~~~
!!! TypeParameter 'T' of public static method from exported class has or is using private name 'privateClass'.
}
myPublicMethod<T extends privateClass>() { // 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<T extends privateClass>() {
~~~~~~~~~~~~~~~~~~~~~~
!!! TypeParameter 'T' of public method from exported class has or is using private name 'privateClass'.
}
}
@@ -273,7 +265,7 @@
export function publicFunctionWithPrivateTypeParameters<T extends privateClass>() { // 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<T extends publicClass>() {
@@ -327,27 +319,27 @@
export interface publicInterfaceWithPrivatModuleTypeParameters {
new <T extends privateModule.publicClass>(): 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'.
<T extends privateModule.publicClass>(): 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<T extends privateModule.publicClass>(): 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<T extends privateModule.publicClass>() { // 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<T extends privateModule.publicClass>() { // 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<T extends privateModule.publicClass>() { // 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'.
}

View File

@@ -7,7 +7,7 @@
export class publicClassWithPrivateTypeParameters<T extends privateClass> { // 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<T extends privateModule.publicClassInPrivateModule> { // 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<T extends privateClassInPublicModule> { // 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<T extends privateModule.publicClassInPrivateModule> { // 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;
}

View File

@@ -13,7 +13,7 @@
export interface publicInterfaceWithPrivateTypeParameters<T extends privateClass> { // 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<T>;
myMethod1(): privateClassT<privateClass>;
@@ -62,7 +62,7 @@
export interface publicInterfaceWithPrivateModuleTypeParameterConstraints<T extends privateModule.publicClassInPrivateModule> { // 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<T extends privateModule.publicClassInPrivateModule> { // Error
@@ -83,7 +83,7 @@
export interface publicInterfaceWithPrivateTypeParameters<T extends privateClassInPublicModule> { // 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<T>;
myMethod1(): privateClassInPublicModuleT<privateClassInPublicModule>;
@@ -131,7 +131,7 @@
export interface publicInterfaceWithPrivateModuleTypeParameterConstraints<T extends privateModule.publicClassInPrivateModule> { // 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<T extends privateModule.publicClassInPrivateModule> { // Error

View File

@@ -0,0 +1,66 @@
//// [staticMethodWithTypeParameterExtendsClauseDeclFile.ts]
class privateClass {
}
export class publicClass {
}
export class publicClassWithWithPrivateTypeParameters {
private static myPrivateStaticMethod1<T extends privateClass>() { // do not emit extends clause
}
private myPrivateMethod1<T extends privateClass>() { // do not emit extends clause
}
private static myPrivateStaticMethod2<T extends publicClass>() { // do not emit extends clause
}
private myPrivateMethod2<T extends publicClass>() { // do not emit extends clause
}
public static myPublicStaticMethod<T extends publicClass>() {
}
public myPublicMethod<T extends publicClass>() {
}
}
//// [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<T>();
private myPrivateMethod1<T>();
private static myPrivateStaticMethod2<T>();
private myPrivateMethod2<T>();
static myPublicStaticMethod<T extends publicClass>(): void;
myPublicMethod<T extends publicClass>(): void;
}

View File

@@ -0,0 +1,22 @@
// @module: commonjs
// @declaration: true
class privateClass {
}
export class publicClass {
}
export class publicClassWithWithPrivateTypeParameters {
private static myPrivateStaticMethod1<T extends privateClass>() { // do not emit extends clause
}
private myPrivateMethod1<T extends privateClass>() { // do not emit extends clause
}
private static myPrivateStaticMethod2<T extends publicClass>() { // do not emit extends clause
}
private myPrivateMethod2<T extends publicClass>() { // do not emit extends clause
}
public static myPublicStaticMethod<T extends publicClass>() {
}
public myPublicMethod<T extends publicClass>() {
}
}