Merge pull request #414 from Microsoft/typeOfFunctionAndStaticFunction
Emit Type of function and static function correctly in declaration file
This commit is contained in:
commit
94544b3cf0
|
@ -661,6 +661,11 @@ module ts {
|
|||
return callback(globals);
|
||||
}
|
||||
|
||||
function getQualifiedLeftMeaning(rightMeaning: SymbolFlags) {
|
||||
// If we are looking in value space, the parent meaning is value, other wise it is namespace
|
||||
return rightMeaning === SymbolFlags.Value ? SymbolFlags.Value : SymbolFlags.Namespace;
|
||||
}
|
||||
|
||||
function getAccessibleSymbolChain(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): Symbol[] {
|
||||
function getAccessibleSymbolChainFromSymbolTable(symbols: SymbolTable): Symbol[] {
|
||||
function canQualifySymbol(symbolFromSymbolTable: Symbol, meaning: SymbolFlags) {
|
||||
|
@ -670,15 +675,17 @@ module ts {
|
|||
}
|
||||
|
||||
// If symbol needs qualification, make sure that parent is accessible, if it is then this symbol is accessible too
|
||||
var accessibleParent = getAccessibleSymbolChain(symbolFromSymbolTable.parent, enclosingDeclaration, SymbolFlags.Namespace);
|
||||
var accessibleParent = getAccessibleSymbolChain(symbolFromSymbolTable.parent, enclosingDeclaration, getQualifiedLeftMeaning(meaning));
|
||||
return !!accessibleParent;
|
||||
}
|
||||
|
||||
function isAccessible(symbolFromSymbolTable: Symbol, resolvedAliasSymbol?: Symbol) {
|
||||
if (symbol === (resolvedAliasSymbol || symbolFromSymbolTable)) {
|
||||
// if symbolfrom symbolTable or alias resolution matches the symbol,
|
||||
// if the symbolFromSymbolTable is not external module (it could be if it was determined as ambient external module and would be in globals table)
|
||||
// and if symbolfrom symbolTable or alias resolution matches the symbol,
|
||||
// check the symbol can be qualified, it is only then this symbol is accessible
|
||||
return canQualifySymbol(symbolFromSymbolTable, meaning);
|
||||
return !forEach(symbolFromSymbolTable.declarations, declaration => hasExternalModuleSymbol(declaration)) &&
|
||||
canQualifySymbol(symbolFromSymbolTable, meaning);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -698,7 +705,7 @@ module ts {
|
|||
// Look in the exported members, if we can find accessibleSymbolChain, symbol is accessible using this chain
|
||||
// but only if the symbolFromSymbolTable can be qualified
|
||||
var accessibleSymbolsFromExports = resolvedImportedSymbol.exports ? getAccessibleSymbolChainFromSymbolTable(resolvedImportedSymbol.exports) : undefined;
|
||||
if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, SymbolFlags.Namespace)) {
|
||||
if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) {
|
||||
return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports);
|
||||
}
|
||||
}
|
||||
|
@ -758,8 +765,6 @@ module ts {
|
|||
return { accessibility: SymbolAccessibility.Accessible, aliasesToMakeVisible: hasAccessibleDeclarations.aliasesToMakeVisible };
|
||||
}
|
||||
|
||||
// TODO(shkamat): Handle static method of class
|
||||
|
||||
// If we havent got the accessible symbol doesnt mean the symbol is actually inaccessible.
|
||||
// It could be qualified symbol and hence verify the path
|
||||
// eg:
|
||||
|
@ -772,18 +777,46 @@ module ts {
|
|||
// we are going to see if c can be accessed in scope directly.
|
||||
// But it cant, hence the accessible is going to be undefined, but that doesnt mean m.c is accessible
|
||||
// It is accessible if the parent m is accessible because then m.c can be accessed through qualification
|
||||
meaningToLook = SymbolFlags.Namespace;
|
||||
meaningToLook = getQualifiedLeftMeaning(meaning);
|
||||
symbol = symbol.parent;
|
||||
}
|
||||
|
||||
// This is a local symbol that cannot be named
|
||||
// This could be a symbol that is not exported in the external module
|
||||
// or it could be a symbol from different external module that is not aliased and hence cannot be named
|
||||
var symbolExternalModule = forEach(initialSymbol.declarations, declaration => getExternalModuleContainer(declaration));
|
||||
if (symbolExternalModule) {
|
||||
var enclosingExternalModule = getExternalModuleContainer(enclosingDeclaration);
|
||||
if (symbolExternalModule !== enclosingExternalModule) {
|
||||
// name from different external module that is not visibile
|
||||
return {
|
||||
accessibility: SymbolAccessibility.CannotBeNamed,
|
||||
errorSymbolName: symbolToString(initialSymbol, enclosingDeclaration, meaning),
|
||||
errorModuleName: symbolToString(symbolExternalModule)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Just a local name that is not accessible
|
||||
return {
|
||||
accessibility: SymbolAccessibility.CannotBeNamed,
|
||||
accessibility: SymbolAccessibility.NotAccessible,
|
||||
errorSymbolName: symbolToString(initialSymbol, enclosingDeclaration, meaning),
|
||||
};
|
||||
}
|
||||
|
||||
return { accessibility: SymbolAccessibility.Accessible };
|
||||
|
||||
function getExternalModuleContainer(declaration: Declaration) {
|
||||
for (; declaration; declaration = declaration.parent) {
|
||||
if (hasExternalModuleSymbol(declaration)) {
|
||||
return getSymbolOfNode(declaration);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function hasExternalModuleSymbol(declaration: Declaration) {
|
||||
return (declaration.kind === SyntaxKind.ModuleDeclaration && declaration.name.kind === SyntaxKind.StringLiteral) ||
|
||||
(declaration.kind === SyntaxKind.SourceFile && isExternalModule(<SourceFile>declaration));
|
||||
}
|
||||
|
||||
function hasVisibleDeclarations(symbol: Symbol): { aliasesToMakeVisible?: ImportDeclaration[]; } {
|
||||
|
@ -851,14 +884,25 @@ module ts {
|
|||
var symbolName: string;
|
||||
while (symbol) {
|
||||
var isFirstName = !symbolName;
|
||||
var meaningToLook = isFirstName ? meaning : SymbolFlags.Namespace;
|
||||
var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaningToLook);
|
||||
var currentSymbolName = accessibleSymbolChain ? ts.map(accessibleSymbolChain, accessibleSymbol => getSymbolName(accessibleSymbol)).join(".") : getSymbolName(symbol);
|
||||
var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning);
|
||||
|
||||
var currentSymbolName: string;
|
||||
if (accessibleSymbolChain) {
|
||||
currentSymbolName = ts.map(accessibleSymbolChain, accessibleSymbol => getSymbolName(accessibleSymbol)).join(".");
|
||||
}
|
||||
else {
|
||||
// If we didnt find accessible symbol chain for this symbol, break if this is external module
|
||||
if (!isFirstName && ts.forEach(symbol.declarations, declaration => hasExternalModuleSymbol(declaration))) {
|
||||
break;
|
||||
}
|
||||
currentSymbolName = getSymbolName(symbol);
|
||||
}
|
||||
symbolName = currentSymbolName + (isFirstName ? "" : ("." + symbolName));
|
||||
if (accessibleSymbolChain && !needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaningToLook : SymbolFlags.Namespace)) {
|
||||
if (accessibleSymbolChain && !needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) {
|
||||
break;
|
||||
}
|
||||
symbol = accessibleSymbolChain ? accessibleSymbolChain[0].parent : symbol.parent;
|
||||
meaning = getQualifiedLeftMeaning(meaning);
|
||||
}
|
||||
|
||||
return symbolName;
|
||||
|
@ -942,10 +986,13 @@ module ts {
|
|||
writeTypeofSymbol(type);
|
||||
}
|
||||
// Use 'typeof T' for types of functions and methods that circularly reference themselves
|
||||
// TODO(shkamat): correct the usuage of typeof function - always on functions that are visible
|
||||
else if (type.symbol && type.symbol.flags & (SymbolFlags.Function | SymbolFlags.Method) && typeStack && contains(typeStack, type)) {
|
||||
else if (shouldWriteTypeOfFunctionSymbol()) {
|
||||
writeTypeofSymbol(type);
|
||||
}
|
||||
else if (typeStack && contains(typeStack, type)) {
|
||||
// Recursive usage, use any
|
||||
writer.write("any");
|
||||
}
|
||||
else {
|
||||
if (!typeStack) {
|
||||
typeStack = [];
|
||||
|
@ -954,6 +1001,23 @@ module ts {
|
|||
writeLiteralType(type, allowFunctionOrConstructorTypeLiteral);
|
||||
typeStack.pop();
|
||||
}
|
||||
|
||||
function shouldWriteTypeOfFunctionSymbol() {
|
||||
if (type.symbol) {
|
||||
var isStaticMethodSymbol = !!(type.symbol.flags & SymbolFlags.Method && // typeof static method
|
||||
ts.forEach(type.symbol.declarations, declaration => declaration.flags & NodeFlags.Static));
|
||||
var isNonLocalFunctionSymbol = !!(type.symbol.flags & SymbolFlags.Function) &&
|
||||
(type.symbol.parent || // is exported function symbol
|
||||
ts.forEach(type.symbol.declarations, declaration =>
|
||||
declaration.parent.kind === SyntaxKind.SourceFile || declaration.parent.kind === SyntaxKind.ModuleBlock));
|
||||
|
||||
if (isStaticMethodSymbol || isNonLocalFunctionSymbol) {
|
||||
// typeof is allowed only for static/non local functions
|
||||
return !!(flags & TypeFormatFlags.UseTypeOfFunction) || // use typeof if format flags specify it
|
||||
(typeStack && contains(typeStack, type)); // it is type of the symbol uses itself recursively
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function writeTypeofSymbol(type: ObjectType) {
|
||||
|
|
|
@ -231,6 +231,18 @@ module ts {
|
|||
A_parameter_property_is_only_allowed_in_a_constructor_implementation: { code: 2246, category: DiagnosticCategory.Error, key: "A parameter property is only allowed in a constructor implementation." },
|
||||
Function_overload_must_be_static: { code: 2247, category: DiagnosticCategory.Error, key: "Function overload must be static." },
|
||||
Function_overload_must_not_be_static: { code: 2248, category: DiagnosticCategory.Error, key: "Function overload must not be static." },
|
||||
Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 2249, category: DiagnosticCategory.Error, key: "Public static property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." },
|
||||
Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 2250, category: DiagnosticCategory.Error, key: "Public property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." },
|
||||
Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 2251, category: DiagnosticCategory.Error, key: "Exported variable '{0}' has or is using name '{1}' from external module {2} but cannot be named." },
|
||||
Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 2252, category: DiagnosticCategory.Error, key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from external module {2} but cannot be named." },
|
||||
Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 2253, category: DiagnosticCategory.Error, key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from external module {2} but cannot be named." },
|
||||
Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 2254, category: DiagnosticCategory.Error, key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from external module {2} but cannot be named." },
|
||||
Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 2255, category: DiagnosticCategory.Error, key: "Parameter '{0}' of exported function has or is using name '{1}' from external module {2} but cannot be named." },
|
||||
Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 2256, category: DiagnosticCategory.Error, key: "Return type of public static property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." },
|
||||
Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 2257, category: DiagnosticCategory.Error, key: "Return type of public property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." },
|
||||
Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 2258, category: DiagnosticCategory.Error, key: "Return type of public static method from exported class has or is using name '{0}' from external module {1} but cannot be named." },
|
||||
Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 2259, category: DiagnosticCategory.Error, key: "Return type of public method from exported class has or is using name '{0}' from external module {1} but cannot be named." },
|
||||
Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 2260, category: DiagnosticCategory.Error, key: "Return type of exported function has or is using name '{0}' from external module {1} but cannot be named." },
|
||||
Circular_definition_of_import_alias_0: { code: 3000, category: DiagnosticCategory.Error, key: "Circular definition of import alias '{0}'." },
|
||||
Cannot_find_name_0: { code: 3001, category: DiagnosticCategory.Error, key: "Cannot find name '{0}'." },
|
||||
Module_0_has_no_exported_member_1: { code: 3002, category: DiagnosticCategory.Error, key: "Module '{0}' has no exported member '{1}'." },
|
||||
|
|
|
@ -916,6 +916,54 @@
|
|||
"category": "Error",
|
||||
"code": 2248
|
||||
},
|
||||
"Public static property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named.": {
|
||||
"category": "Error",
|
||||
"code": 2249
|
||||
},
|
||||
"Public property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named.": {
|
||||
"category": "Error",
|
||||
"code": 2250
|
||||
},
|
||||
"Exported variable '{0}' has or is using name '{1}' from external module {2} but cannot be named.": {
|
||||
"category": "Error",
|
||||
"code": 2251
|
||||
},
|
||||
"Parameter '{0}' of constructor from exported class has or is using name '{1}' from external module {2} but cannot be named.": {
|
||||
"category": "Error",
|
||||
"code": 2252
|
||||
},
|
||||
"Parameter '{0}' of public static method from exported class has or is using name '{1}' from external module {2} but cannot be named.": {
|
||||
"category": "Error",
|
||||
"code": 2253
|
||||
},
|
||||
"Parameter '{0}' of public method from exported class has or is using name '{1}' from external module {2} but cannot be named.": {
|
||||
"category": "Error",
|
||||
"code": 2254
|
||||
},
|
||||
"Parameter '{0}' of exported function has or is using name '{1}' from external module {2} but cannot be named.": {
|
||||
"category": "Error",
|
||||
"code": 2255
|
||||
},
|
||||
"Return type of public static property getter from exported class has or is using name '{0}' from external module {1} but cannot be named.": {
|
||||
"category": "Error",
|
||||
"code": 2256
|
||||
},
|
||||
"Return type of public property getter from exported class has or is using name '{0}' from external module {1} but cannot be named.": {
|
||||
"category": "Error",
|
||||
"code": 2257
|
||||
},
|
||||
"Return type of public static method from exported class has or is using name '{0}' from external module {1} but cannot be named.": {
|
||||
"category": "Error",
|
||||
"code": 2258
|
||||
},
|
||||
"Return type of public method from exported class has or is using name '{0}' from external module {1} but cannot be named.": {
|
||||
"category": "Error",
|
||||
"code": 2259
|
||||
},
|
||||
"Return type of exported function has or is using name '{0}' from external module {1} but cannot be named.": {
|
||||
"category": "Error",
|
||||
"code": 2260
|
||||
},
|
||||
"Circular definition of import alias '{0}'.": {
|
||||
"category": "Error",
|
||||
"code": 3000
|
||||
|
|
|
@ -2093,7 +2093,7 @@ module ts {
|
|||
function emitTypeParameters(typeParameters: TypeParameterDeclaration[]) {
|
||||
function emitTypeParameter(node: TypeParameterDeclaration) {
|
||||
function getTypeParameterConstraintVisibilityError(symbolAccesibilityResult: SymbolAccessiblityResult) {
|
||||
// TODO(shkamat) Cannot access name errors
|
||||
// Type parameter constraints are named by user so we should always be able to name it
|
||||
var diagnosticMessage: DiagnosticMessage;
|
||||
switch (node.parent.kind) {
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
|
@ -2160,7 +2160,7 @@ module ts {
|
|||
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);
|
||||
resolver.writeTypeAtLocation(node.constraint, enclosingDeclaration, TypeFormatFlags.UseTypeOfFunction, writer);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2179,46 +2179,34 @@ module ts {
|
|||
|
||||
function emitTypeOfTypeReference(node: Node) {
|
||||
getSymbolVisibilityDiagnosticMessage = getHeritageClauseVisibilityError;
|
||||
resolver.writeTypeAtLocation(node, enclosingDeclaration, TypeFormatFlags.WriteArrayAsGenericType, writer);
|
||||
resolver.writeTypeAtLocation(node, enclosingDeclaration, TypeFormatFlags.WriteArrayAsGenericType | TypeFormatFlags.UseTypeOfFunction, writer);
|
||||
|
||||
function getHeritageClauseVisibilityError(symbolAccesibilityResult: SymbolAccessiblityResult) {
|
||||
var diagnosticMessage: DiagnosticMessage;
|
||||
// Heritage clause is written by user so it can always be named
|
||||
if (node.parent.kind === SyntaxKind.ClassDeclaration) {
|
||||
// Class
|
||||
if (symbolAccesibilityResult.accessibility == SymbolAccessibility.NotAccessible) {
|
||||
if (symbolAccesibilityResult.errorModuleName) {
|
||||
// Module is inaccessible
|
||||
diagnosticMessage = isImplementsList ?
|
||||
Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_name_1_from_private_module_2 :
|
||||
Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_name_1_from_private_module_2;
|
||||
}
|
||||
else {
|
||||
// Class or Interface implemented/extended is inaccessible
|
||||
diagnosticMessage = isImplementsList ?
|
||||
Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 :
|
||||
Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_private_name_1;
|
||||
}
|
||||
if (symbolAccesibilityResult.errorModuleName) {
|
||||
// Module is inaccessible
|
||||
diagnosticMessage = isImplementsList ?
|
||||
Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_name_1_from_private_module_2 :
|
||||
Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_name_1_from_private_module_2;
|
||||
}
|
||||
else {
|
||||
// CannotBeNamed
|
||||
// TODO(shkamat): CannotBeNamed error needs to be handled
|
||||
// Class or Interface implemented/extended is inaccessible
|
||||
diagnosticMessage = isImplementsList ?
|
||||
Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 :
|
||||
Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_private_name_1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Interface
|
||||
if (symbolAccesibilityResult.accessibility == SymbolAccessibility.NotAccessible) {
|
||||
if (symbolAccesibilityResult.errorModuleName) {
|
||||
// Module is inaccessible
|
||||
diagnosticMessage = Diagnostics.Extends_clause_of_exported_interface_0_has_or_is_using_name_1_from_private_module_2;
|
||||
}
|
||||
else {
|
||||
// interface is inaccessible
|
||||
diagnosticMessage = Diagnostics.Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1;
|
||||
}
|
||||
if (symbolAccesibilityResult.errorModuleName) {
|
||||
// Module is inaccessible
|
||||
diagnosticMessage = Diagnostics.Extends_clause_of_exported_interface_0_has_or_is_using_name_1_from_private_module_2;
|
||||
}
|
||||
else {
|
||||
// CannotBeNamed
|
||||
// TODO(shkamat): CannotBeNamed error needs to be handled
|
||||
// interface is inaccessible
|
||||
diagnosticMessage = Diagnostics.Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2304,15 +2292,16 @@ module ts {
|
|||
if (!(node.flags & NodeFlags.Private)) {
|
||||
write(": ");
|
||||
getSymbolVisibilityDiagnosticMessage = getVariableDeclarationTypeVisibilityError;
|
||||
resolver.writeTypeAtLocation(node, enclosingDeclaration, TypeFormatFlags.None, writer);
|
||||
resolver.writeTypeAtLocation(node, enclosingDeclaration, TypeFormatFlags.UseTypeOfFunction, writer);
|
||||
}
|
||||
}
|
||||
|
||||
function getVariableDeclarationTypeVisibilityError(symbolAccesibilityResult: SymbolAccessiblityResult) {
|
||||
// TODO(shkamat) Cannot access name errors
|
||||
var diagnosticMessage: DiagnosticMessage;
|
||||
if (node.kind === SyntaxKind.VariableDeclaration) {
|
||||
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
|
||||
symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
|
||||
Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
|
||||
Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 :
|
||||
Diagnostics.Exported_variable_0_has_or_is_using_private_name_1;
|
||||
}
|
||||
|
@ -2320,15 +2309,20 @@ module ts {
|
|||
else if (node.kind === SyntaxKind.Property) {
|
||||
if (node.flags & NodeFlags.Static) {
|
||||
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
|
||||
symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
|
||||
Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
|
||||
Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 :
|
||||
Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1;
|
||||
}
|
||||
else if (node.parent.kind === SyntaxKind.ClassDeclaration) {
|
||||
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
|
||||
symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
|
||||
Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
|
||||
Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 :
|
||||
Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1;
|
||||
}
|
||||
else {
|
||||
// Interfaces cannot have types that cannot be named
|
||||
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
|
||||
Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 :
|
||||
Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1;
|
||||
|
@ -2362,16 +2356,16 @@ module ts {
|
|||
if (!(node.flags & NodeFlags.Private)) {
|
||||
write(": ");
|
||||
getSymbolVisibilityDiagnosticMessage = getAccessorDeclarationTypeVisibilityError;
|
||||
resolver.writeTypeAtLocation(node, enclosingDeclaration, TypeFormatFlags.None, writer);
|
||||
resolver.writeTypeAtLocation(node, enclosingDeclaration, TypeFormatFlags.UseTypeOfFunction, writer);
|
||||
}
|
||||
write(";");
|
||||
writeLine();
|
||||
}
|
||||
|
||||
function getAccessorDeclarationTypeVisibilityError(symbolAccesibilityResult: SymbolAccessiblityResult) {
|
||||
// TODO(shkamat) Cannot access name errors
|
||||
var diagnosticMessage: DiagnosticMessage;
|
||||
if (node.kind === SyntaxKind.SetAccessor) {
|
||||
// Setters have to have type named and cannot infer it so, the type should always be named
|
||||
if (node.parent.flags & NodeFlags.Static) {
|
||||
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
|
||||
Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
|
||||
|
@ -2391,11 +2385,15 @@ module ts {
|
|||
else {
|
||||
if (node.flags & NodeFlags.Static) {
|
||||
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
|
||||
symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
|
||||
Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named :
|
||||
Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 :
|
||||
Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0;
|
||||
}
|
||||
else {
|
||||
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
|
||||
symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
|
||||
Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named :
|
||||
Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 :
|
||||
Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0;
|
||||
}
|
||||
|
@ -2459,28 +2457,30 @@ module ts {
|
|||
if (node.kind !== SyntaxKind.Constructor && !(node.flags & NodeFlags.Private)) {
|
||||
write(": ");
|
||||
getSymbolVisibilityDiagnosticMessage = getReturnTypeVisibilityError;
|
||||
resolver.writeReturnTypeOfSignatureDeclaration(node, enclosingDeclaration, TypeFormatFlags.None, writer);
|
||||
resolver.writeReturnTypeOfSignatureDeclaration(node, enclosingDeclaration, TypeFormatFlags.UseTypeOfFunction, writer);
|
||||
}
|
||||
write(";");
|
||||
writeLine();
|
||||
|
||||
function getReturnTypeVisibilityError(symbolAccesibilityResult: SymbolAccessiblityResult) {
|
||||
// TODO(shkamat) Cannot access name errors
|
||||
var diagnosticMessage: DiagnosticMessage;
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.ConstructSignature:
|
||||
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
|
||||
// Interfaces cannot have return types that cannot be named
|
||||
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
|
||||
Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :
|
||||
Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0;
|
||||
break;
|
||||
|
||||
case SyntaxKind.CallSignature:
|
||||
// Interfaces cannot have return types that cannot be named
|
||||
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
|
||||
Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :
|
||||
Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0;
|
||||
break;
|
||||
|
||||
case SyntaxKind.IndexSignature:
|
||||
// Interfaces cannot have return types that cannot be named
|
||||
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
|
||||
Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :
|
||||
Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0;
|
||||
|
@ -2489,15 +2489,20 @@ module ts {
|
|||
case SyntaxKind.Method:
|
||||
if (node.flags & NodeFlags.Static) {
|
||||
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
|
||||
symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
|
||||
Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named :
|
||||
Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 :
|
||||
Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0;
|
||||
}
|
||||
else if (node.parent.kind === SyntaxKind.ClassDeclaration) {
|
||||
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
|
||||
symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
|
||||
Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named :
|
||||
Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 :
|
||||
Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0;
|
||||
}
|
||||
else {
|
||||
// Interfaces cannot have return types that cannot be named
|
||||
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
|
||||
Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :
|
||||
Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0;
|
||||
|
@ -2506,6 +2511,8 @@ module ts {
|
|||
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
|
||||
symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
|
||||
Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named :
|
||||
Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1 :
|
||||
Diagnostics.Return_type_of_exported_function_has_or_is_using_private_name_0;
|
||||
break;
|
||||
|
@ -2519,7 +2526,6 @@ module ts {
|
|||
errorNode: <Node>node.name || node,
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function emitParameterDeclaration(node: ParameterDeclaration) {
|
||||
|
@ -2534,26 +2540,29 @@ module ts {
|
|||
if (!(node.parent.flags & NodeFlags.Private)) {
|
||||
write(": ");
|
||||
getSymbolVisibilityDiagnosticMessage = getParameterDeclarationTypeVisibilityError;
|
||||
resolver.writeTypeAtLocation(node, enclosingDeclaration, TypeFormatFlags.None, writer);
|
||||
resolver.writeTypeAtLocation(node, enclosingDeclaration, TypeFormatFlags.UseTypeOfFunction, writer);
|
||||
}
|
||||
|
||||
function getParameterDeclarationTypeVisibilityError(symbolAccesibilityResult: SymbolAccessiblityResult) {
|
||||
// TODO(shkamat) Cannot access name errors
|
||||
var diagnosticMessage: DiagnosticMessage;
|
||||
switch (node.parent.kind) {
|
||||
case SyntaxKind.Constructor:
|
||||
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
|
||||
symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
|
||||
Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
|
||||
Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
|
||||
Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1;
|
||||
break;
|
||||
|
||||
case SyntaxKind.ConstructSignature:
|
||||
// Interfaces cannot have parameter types that cannot be named
|
||||
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
|
||||
Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
|
||||
Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1;
|
||||
break;
|
||||
|
||||
case SyntaxKind.CallSignature:
|
||||
// Interfaces cannot have parameter types that cannot be named
|
||||
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
|
||||
Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
|
||||
Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1;
|
||||
|
@ -2562,15 +2571,20 @@ module ts {
|
|||
case SyntaxKind.Method:
|
||||
if (node.parent.flags & NodeFlags.Static) {
|
||||
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
|
||||
symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
|
||||
Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
|
||||
Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
|
||||
Diagnostics.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 ?
|
||||
symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
|
||||
Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
|
||||
Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
|
||||
Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1;
|
||||
}
|
||||
else {
|
||||
// Interfaces cannot have parameter types that cannot be named
|
||||
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
|
||||
Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
|
||||
Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1;
|
||||
|
@ -2579,6 +2593,8 @@ module ts {
|
|||
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
|
||||
symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
|
||||
Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
|
||||
Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 :
|
||||
Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1;
|
||||
break;
|
||||
|
|
|
@ -626,6 +626,8 @@ module ts {
|
|||
|
||||
/** writes Array<T> instead T[] */
|
||||
WriteArrayAsGenericType = 0x00000001, // Declarations
|
||||
|
||||
UseTypeOfFunction = 0x00000002, // instead of writing signature type of function use typeof
|
||||
}
|
||||
|
||||
export enum SymbolAccessibility {
|
||||
|
|
|
@ -487,11 +487,11 @@ declare var i1_ncf: (b: number) => number;
|
|||
declare var i1_ncr: number;
|
||||
declare var i1_ncprop: number;
|
||||
declare var i1_s_p: number;
|
||||
declare var i1_s_f: (b: number) => number;
|
||||
declare var i1_s_f: typeof c1.s2;
|
||||
declare var i1_s_r: number;
|
||||
declare var i1_s_prop: number;
|
||||
declare var i1_s_nc_p: number;
|
||||
declare var i1_s_ncf: (b: number) => number;
|
||||
declare var i1_s_ncf: typeof c1.nc_s2;
|
||||
declare var i1_s_ncr: number;
|
||||
declare var i1_s_ncprop: number;
|
||||
declare var i1_c: typeof c1;
|
||||
|
|
|
@ -131,10 +131,10 @@ export declare module C {
|
|||
}
|
||||
}
|
||||
export declare var a: C.A<C.B>;
|
||||
export declare var b: <T>(x: T) => C.A<C.B>;
|
||||
export declare var c: <T>(x: T) => C.A<C.B>;
|
||||
export declare var d: <T>(x: T) => C.A<C.B>[];
|
||||
export declare var e: <T extends C.A<C.B>>(x: T) => C.A<C.B>[];
|
||||
export declare var b: typeof C.F;
|
||||
export declare var c: typeof C.F2;
|
||||
export declare var d: typeof C.F3;
|
||||
export declare var e: typeof C.F4;
|
||||
export declare var x: C.A<C.B>;
|
||||
export declare function f<T extends C.A<C.B>>(): void;
|
||||
export declare var g: C.A<C.B>;
|
||||
|
@ -142,4 +142,4 @@ export declare class h extends C.A<C.B> {
|
|||
}
|
||||
export interface i extends C.A<C.B> {
|
||||
}
|
||||
export declare var j: <T extends C.A<C.B>>(x: T) => T;
|
||||
export declare var j: typeof C.F6;
|
||||
|
|
|
@ -64,39 +64,15 @@ function foo5(x) {
|
|||
|
||||
|
||||
//// [declFileTypeofFunction.d.ts]
|
||||
declare function f(n: {
|
||||
(n: typeof f): string;
|
||||
(n: {
|
||||
(n: typeof g): number;
|
||||
(n: typeof f): number;
|
||||
}): string;
|
||||
}): string;
|
||||
declare function f(n: {
|
||||
(n: typeof g): number;
|
||||
(n: {
|
||||
(n: typeof f): string;
|
||||
(n: typeof g): string;
|
||||
}): number;
|
||||
}): string;
|
||||
declare function g(n: {
|
||||
(n: typeof g): number;
|
||||
(n: {
|
||||
(n: typeof f): string;
|
||||
(n: typeof g): string;
|
||||
}): number;
|
||||
}): number;
|
||||
declare function g(n: {
|
||||
(n: typeof f): string;
|
||||
(n: {
|
||||
(n: typeof g): number;
|
||||
(n: typeof f): number;
|
||||
}): string;
|
||||
}): number;
|
||||
declare function f(n: typeof f): string;
|
||||
declare function f(n: typeof g): string;
|
||||
declare function g(n: typeof g): number;
|
||||
declare function g(n: typeof f): number;
|
||||
declare var b: any;
|
||||
declare function b1(): () => typeof b1;
|
||||
declare function foo(): () => typeof foo;
|
||||
declare var foo1: () => typeof foo;
|
||||
declare var foo2: () => typeof foo;
|
||||
declare function b1(): typeof b1;
|
||||
declare function foo(): typeof foo;
|
||||
declare var foo1: typeof foo;
|
||||
declare var foo2: typeof foo;
|
||||
declare var foo3: any;
|
||||
declare var x: any;
|
||||
declare function foo5(x: number): (x: number) => number;
|
||||
|
|
|
@ -28,7 +28,6 @@ export module M.P {
|
|||
export interface I { }
|
||||
}
|
||||
export import im = M.P.f;
|
||||
// Bug 887180: Invalid .d.ts when an aliased entity is referenced, and a different entity is closer in scope
|
||||
export var a = M.a; // emitted incorrectly as typeof f
|
||||
export var b = M.b; // ok
|
||||
export var c = M.c; // ok
|
||||
|
@ -170,10 +169,10 @@ export declare module M.P {
|
|||
}
|
||||
}
|
||||
export import im = M.P.f;
|
||||
var a: () => void;
|
||||
var a: typeof M.f;
|
||||
var b: typeof M.C;
|
||||
var c: typeof M.N;
|
||||
var g: () => void;
|
||||
var g: typeof M.c.g;
|
||||
var d: typeof M.d;
|
||||
}
|
||||
export declare module M.Q {
|
||||
|
|
|
@ -9,7 +9,6 @@ module X.Y.base {
|
|||
}
|
||||
|
||||
module X.Y.base.Z {
|
||||
// Bug 887180
|
||||
export var f = X.Y.base.f; // Should be base.f
|
||||
export var C = X.Y.base.C; // Should be base.C
|
||||
export var M = X.Y.base.M; // Should be base.M
|
||||
|
@ -72,7 +71,7 @@ declare module X.Y.base {
|
|||
}
|
||||
}
|
||||
declare module X.Y.base.Z {
|
||||
var f: () => void;
|
||||
var f: typeof base.f;
|
||||
var C: typeof base.C;
|
||||
var M: typeof base.M;
|
||||
var E: typeof base.E;
|
||||
|
|
|
@ -20,7 +20,6 @@ module M.P {
|
|||
export enum D {
|
||||
f
|
||||
}
|
||||
// Bug 887180
|
||||
export var v: M.D; // ok
|
||||
export var w = M.D.f; // error, should be typeof M.D.f
|
||||
export var x = M.C.f; // error, should be typeof M.C.f
|
||||
|
@ -111,7 +110,7 @@ declare module M.P {
|
|||
f = 0,
|
||||
}
|
||||
var v: M.D;
|
||||
var w: () => void;
|
||||
var x: () => void;
|
||||
var x: () => void;
|
||||
var w: typeof M.D.f;
|
||||
var x: typeof M.C.f;
|
||||
var x: typeof M.C.f;
|
||||
}
|
||||
|
|
|
@ -134,29 +134,26 @@ var f2 = function () {
|
|||
|
||||
//// [funcdecl.d.ts]
|
||||
declare function simpleFunc(): string;
|
||||
declare var simpleFuncVar: () => string;
|
||||
declare var simpleFuncVar: typeof simpleFunc;
|
||||
declare function anotherFuncNoReturn(): void;
|
||||
declare var anotherFuncNoReturnVar: () => void;
|
||||
declare var anotherFuncNoReturnVar: typeof anotherFuncNoReturn;
|
||||
declare function withReturn(): string;
|
||||
declare var withReturnVar: () => string;
|
||||
declare var withReturnVar: typeof withReturn;
|
||||
declare function withParams(a: string): string;
|
||||
declare var withparamsVar: (a: string) => string;
|
||||
declare var withparamsVar: typeof withParams;
|
||||
declare function withMultiParams(a: number, b: any, c: Object): number;
|
||||
declare var withMultiParamsVar: (a: number, b: any, c: Object) => number;
|
||||
declare var withMultiParamsVar: typeof withMultiParams;
|
||||
declare function withOptionalParams(a?: string): void;
|
||||
declare var withOptionalParamsVar: (a?: string) => void;
|
||||
declare var withOptionalParamsVar: typeof withOptionalParams;
|
||||
declare function withInitializedParams(a: string, b0: any, b?: number, c?: string): void;
|
||||
declare var withInitializedParamsVar: (a: string, b0: any, b?: number, c?: string) => void;
|
||||
declare var withInitializedParamsVar: typeof withInitializedParams;
|
||||
declare function withOptionalInitializedParams(a: string, c?: string): void;
|
||||
declare var withOptionalInitializedParamsVar: (a: string, c?: string) => void;
|
||||
declare var withOptionalInitializedParamsVar: typeof withOptionalInitializedParams;
|
||||
declare function withRestParams(a: string, ...myRestParameter: number[]): number[];
|
||||
declare var withRestParamsVar: (a: string, ...myRestParameter: number[]) => number[];
|
||||
declare var withRestParamsVar: typeof withRestParams;
|
||||
declare function overload1(n: number): string;
|
||||
declare function overload1(s: string): string;
|
||||
declare var withOverloadSignature: {
|
||||
(n: number): string;
|
||||
(s: string): string;
|
||||
};
|
||||
declare var withOverloadSignature: typeof overload1;
|
||||
declare function f(n: () => void): void;
|
||||
declare module m2 {
|
||||
function foo(n: () => void): void;
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
==== tests/cases/compiler/functionExpressionReturningItself.ts (1 errors) ====
|
||||
var x = function somefn() { return somefn; };
|
||||
~
|
||||
!!! Exported variable 'x' has or is using private name 'somefn'.
|
|
@ -5,3 +5,7 @@ var x = function somefn() { return somefn; };
|
|||
var x = function somefn() {
|
||||
return somefn;
|
||||
};
|
||||
|
||||
|
||||
//// [functionExpressionReturningItself.d.ts]
|
||||
declare var x: () => any;
|
||||
|
|
|
@ -10,4 +10,4 @@ function somefn() {
|
|||
|
||||
|
||||
//// [functionReturningItself.d.ts]
|
||||
declare function somefn(): () => typeof somefn;
|
||||
declare function somefn(): typeof somefn;
|
||||
|
|
|
@ -33,6 +33,7 @@ declare module a {
|
|||
function foo(x: number): number;
|
||||
}
|
||||
declare module c {
|
||||
import b = a.foo;
|
||||
var bVal: number;
|
||||
var bVal2: (x: number) => number;
|
||||
var bVal2: typeof b;
|
||||
}
|
||||
|
|
|
@ -35,5 +35,5 @@ export declare module a {
|
|||
export declare module c {
|
||||
export import b = a.foo;
|
||||
var bVal: number;
|
||||
var bVal2: (x: number) => number;
|
||||
var bVal2: typeof b;
|
||||
}
|
||||
|
|
|
@ -33,5 +33,6 @@ export declare module a {
|
|||
function foo(x: number): number;
|
||||
}
|
||||
export declare module c {
|
||||
var bVal2: (x: number) => number;
|
||||
import b = a.foo;
|
||||
var bVal2: typeof b;
|
||||
}
|
||||
|
|
|
@ -31,4 +31,4 @@ export declare module a {
|
|||
}
|
||||
export import b = a.foo;
|
||||
export declare var bVal: number;
|
||||
export declare var bVal2: (x: number) => number;
|
||||
export declare var bVal2: typeof b;
|
||||
|
|
|
@ -27,5 +27,6 @@ exports.bVal2 = b;
|
|||
export declare module a {
|
||||
function foo(x: number): number;
|
||||
}
|
||||
import b = a.foo;
|
||||
export declare var bVal: number;
|
||||
export declare var bVal2: (x: number) => number;
|
||||
export declare var bVal2: typeof b;
|
||||
|
|
|
@ -0,0 +1,151 @@
|
|||
==== tests/cases/compiler/privacyCannotNameAccessorDeclFile_consumer.ts (8 errors) ====
|
||||
import exporter = require("privacyCannotNameAccessorDeclFile_exporter");
|
||||
export class publicClassWithWithPrivateGetAccessorTypes {
|
||||
static get myPublicStaticMethod() { // Error
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Return type of public static property getter from exported class has or is using name 'Widget1' from external module "tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets" but cannot be named.
|
||||
return exporter.createExportedWidget1();
|
||||
}
|
||||
private static get myPrivateStaticMethod() {
|
||||
return exporter.createExportedWidget1();
|
||||
}
|
||||
get myPublicMethod() { // Error
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Return type of public property getter from exported class has or is using name 'Widget1' from external module "tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets" but cannot be named.
|
||||
return exporter.createExportedWidget1();
|
||||
}
|
||||
private get myPrivateMethod() {
|
||||
return exporter.createExportedWidget1();
|
||||
}
|
||||
static get myPublicStaticMethod1() { // Error
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Return type of public static property getter from exported class has or is using name 'Widget3' from external module "GlobalWidgets" but cannot be named.
|
||||
return exporter.createExportedWidget3();
|
||||
}
|
||||
private static get myPrivateStaticMethod1() {
|
||||
return exporter.createExportedWidget3();
|
||||
}
|
||||
get myPublicMethod1() { // Error
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! Return type of public property getter from exported class has or is using name 'Widget3' from external module "GlobalWidgets" but cannot be named.
|
||||
return exporter.createExportedWidget3();
|
||||
}
|
||||
private get myPrivateMethod1() {
|
||||
return exporter.createExportedWidget3();
|
||||
}
|
||||
}
|
||||
|
||||
class privateClassWithWithPrivateGetAccessorTypes {
|
||||
static get myPublicStaticMethod() {
|
||||
return exporter.createExportedWidget1();
|
||||
}
|
||||
private static get myPrivateStaticMethod() {
|
||||
return exporter.createExportedWidget1();
|
||||
}
|
||||
get myPublicMethod() {
|
||||
return exporter.createExportedWidget1();
|
||||
}
|
||||
private get myPrivateMethod() {
|
||||
return exporter.createExportedWidget1();
|
||||
}
|
||||
static get myPublicStaticMethod1() {
|
||||
return exporter.createExportedWidget3();
|
||||
}
|
||||
private static get myPrivateStaticMethod1() {
|
||||
return exporter.createExportedWidget3();
|
||||
}
|
||||
get myPublicMethod1() {
|
||||
return exporter.createExportedWidget3();
|
||||
}
|
||||
private get myPrivateMethod1() {
|
||||
return exporter.createExportedWidget3();
|
||||
}
|
||||
}
|
||||
|
||||
export class publicClassWithPrivateModuleGetAccessorTypes {
|
||||
static get myPublicStaticMethod() { // Error
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Return type of public static property getter from exported class has or is using name 'SpecializedWidget.Widget2' from external module "tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets" but cannot be named.
|
||||
return exporter.createExportedWidget2();
|
||||
}
|
||||
get myPublicMethod() { // Error
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Return type of public property getter from exported class has or is using name 'SpecializedWidget.Widget2' from external module "tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets" but cannot be named.
|
||||
return exporter.createExportedWidget2();
|
||||
}
|
||||
static get myPublicStaticMethod1() { // Error
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Return type of public static property getter from exported class has or is using name 'SpecializedGlobalWidget.Widget4' from external module "GlobalWidgets" but cannot be named.
|
||||
return exporter.createExportedWidget4();
|
||||
}
|
||||
get myPublicMethod1() { // Error
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! Return type of public property getter from exported class has or is using name 'SpecializedGlobalWidget.Widget4' from external module "GlobalWidgets" but cannot be named.
|
||||
return exporter.createExportedWidget4();
|
||||
}
|
||||
}
|
||||
|
||||
class privateClassWithPrivateModuleGetAccessorTypes {
|
||||
static get myPublicStaticMethod() {
|
||||
return exporter.createExportedWidget2();
|
||||
}
|
||||
get myPublicMethod() {
|
||||
return exporter.createExportedWidget2();
|
||||
}
|
||||
static get myPublicStaticMethod1() {
|
||||
return exporter.createExportedWidget4();
|
||||
}
|
||||
get myPublicMethod1() {
|
||||
return exporter.createExportedWidget4();
|
||||
}
|
||||
}
|
||||
==== tests/cases/compiler/privacyCannotNameAccessorDeclFile_GlobalWidgets.ts (0 errors) ====
|
||||
|
||||
declare module "GlobalWidgets" {
|
||||
export class Widget3 {
|
||||
name: string;
|
||||
}
|
||||
export function createWidget3(): Widget3;
|
||||
|
||||
export module SpecializedGlobalWidget {
|
||||
export class Widget4 {
|
||||
name: string;
|
||||
}
|
||||
function createWidget4(): Widget4;
|
||||
}
|
||||
}
|
||||
|
||||
==== tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets.ts (0 errors) ====
|
||||
export class Widget1 {
|
||||
name = 'one';
|
||||
}
|
||||
export function createWidget1() {
|
||||
return new Widget1();
|
||||
}
|
||||
|
||||
export module SpecializedWidget {
|
||||
export class Widget2 {
|
||||
name = 'one';
|
||||
}
|
||||
export function createWidget2() {
|
||||
return new Widget2();
|
||||
}
|
||||
}
|
||||
|
||||
==== tests/cases/compiler/privacyCannotNameAccessorDeclFile_exporter.ts (0 errors) ====
|
||||
///<reference path='privacyCannotNameAccessorDeclFile_GlobalWidgets.ts'/>
|
||||
import Widgets = require("privacyCannotNameAccessorDeclFile_Widgets");
|
||||
import Widgets1 = require("GlobalWidgets");
|
||||
export function createExportedWidget1() {
|
||||
return Widgets.createWidget1();
|
||||
}
|
||||
export function createExportedWidget2() {
|
||||
return Widgets.SpecializedWidget.createWidget2();
|
||||
}
|
||||
export function createExportedWidget3() {
|
||||
return Widgets1.createWidget3();
|
||||
}
|
||||
export function createExportedWidget4() {
|
||||
return Widgets1.SpecializedGlobalWidget.createWidget4();
|
||||
}
|
||||
|
410
tests/baselines/reference/privacyCannotNameAccessorDeclFile.js
Normal file
410
tests/baselines/reference/privacyCannotNameAccessorDeclFile.js
Normal file
|
@ -0,0 +1,410 @@
|
|||
//// [tests/cases/compiler/privacyCannotNameAccessorDeclFile.ts] ////
|
||||
|
||||
//// [privacyCannotNameAccessorDeclFile_GlobalWidgets.ts]
|
||||
|
||||
declare module "GlobalWidgets" {
|
||||
export class Widget3 {
|
||||
name: string;
|
||||
}
|
||||
export function createWidget3(): Widget3;
|
||||
|
||||
export module SpecializedGlobalWidget {
|
||||
export class Widget4 {
|
||||
name: string;
|
||||
}
|
||||
function createWidget4(): Widget4;
|
||||
}
|
||||
}
|
||||
|
||||
//// [privacyCannotNameAccessorDeclFile_Widgets.ts]
|
||||
export class Widget1 {
|
||||
name = 'one';
|
||||
}
|
||||
export function createWidget1() {
|
||||
return new Widget1();
|
||||
}
|
||||
|
||||
export module SpecializedWidget {
|
||||
export class Widget2 {
|
||||
name = 'one';
|
||||
}
|
||||
export function createWidget2() {
|
||||
return new Widget2();
|
||||
}
|
||||
}
|
||||
|
||||
//// [privacyCannotNameAccessorDeclFile_exporter.ts]
|
||||
///<reference path='privacyCannotNameAccessorDeclFile_GlobalWidgets.ts'/>
|
||||
import Widgets = require("privacyCannotNameAccessorDeclFile_Widgets");
|
||||
import Widgets1 = require("GlobalWidgets");
|
||||
export function createExportedWidget1() {
|
||||
return Widgets.createWidget1();
|
||||
}
|
||||
export function createExportedWidget2() {
|
||||
return Widgets.SpecializedWidget.createWidget2();
|
||||
}
|
||||
export function createExportedWidget3() {
|
||||
return Widgets1.createWidget3();
|
||||
}
|
||||
export function createExportedWidget4() {
|
||||
return Widgets1.SpecializedGlobalWidget.createWidget4();
|
||||
}
|
||||
|
||||
//// [privacyCannotNameAccessorDeclFile_consumer.ts]
|
||||
import exporter = require("privacyCannotNameAccessorDeclFile_exporter");
|
||||
export class publicClassWithWithPrivateGetAccessorTypes {
|
||||
static get myPublicStaticMethod() { // Error
|
||||
return exporter.createExportedWidget1();
|
||||
}
|
||||
private static get myPrivateStaticMethod() {
|
||||
return exporter.createExportedWidget1();
|
||||
}
|
||||
get myPublicMethod() { // Error
|
||||
return exporter.createExportedWidget1();
|
||||
}
|
||||
private get myPrivateMethod() {
|
||||
return exporter.createExportedWidget1();
|
||||
}
|
||||
static get myPublicStaticMethod1() { // Error
|
||||
return exporter.createExportedWidget3();
|
||||
}
|
||||
private static get myPrivateStaticMethod1() {
|
||||
return exporter.createExportedWidget3();
|
||||
}
|
||||
get myPublicMethod1() { // Error
|
||||
return exporter.createExportedWidget3();
|
||||
}
|
||||
private get myPrivateMethod1() {
|
||||
return exporter.createExportedWidget3();
|
||||
}
|
||||
}
|
||||
|
||||
class privateClassWithWithPrivateGetAccessorTypes {
|
||||
static get myPublicStaticMethod() {
|
||||
return exporter.createExportedWidget1();
|
||||
}
|
||||
private static get myPrivateStaticMethod() {
|
||||
return exporter.createExportedWidget1();
|
||||
}
|
||||
get myPublicMethod() {
|
||||
return exporter.createExportedWidget1();
|
||||
}
|
||||
private get myPrivateMethod() {
|
||||
return exporter.createExportedWidget1();
|
||||
}
|
||||
static get myPublicStaticMethod1() {
|
||||
return exporter.createExportedWidget3();
|
||||
}
|
||||
private static get myPrivateStaticMethod1() {
|
||||
return exporter.createExportedWidget3();
|
||||
}
|
||||
get myPublicMethod1() {
|
||||
return exporter.createExportedWidget3();
|
||||
}
|
||||
private get myPrivateMethod1() {
|
||||
return exporter.createExportedWidget3();
|
||||
}
|
||||
}
|
||||
|
||||
export class publicClassWithPrivateModuleGetAccessorTypes {
|
||||
static get myPublicStaticMethod() { // Error
|
||||
return exporter.createExportedWidget2();
|
||||
}
|
||||
get myPublicMethod() { // Error
|
||||
return exporter.createExportedWidget2();
|
||||
}
|
||||
static get myPublicStaticMethod1() { // Error
|
||||
return exporter.createExportedWidget4();
|
||||
}
|
||||
get myPublicMethod1() { // Error
|
||||
return exporter.createExportedWidget4();
|
||||
}
|
||||
}
|
||||
|
||||
class privateClassWithPrivateModuleGetAccessorTypes {
|
||||
static get myPublicStaticMethod() {
|
||||
return exporter.createExportedWidget2();
|
||||
}
|
||||
get myPublicMethod() {
|
||||
return exporter.createExportedWidget2();
|
||||
}
|
||||
static get myPublicStaticMethod1() {
|
||||
return exporter.createExportedWidget4();
|
||||
}
|
||||
get myPublicMethod1() {
|
||||
return exporter.createExportedWidget4();
|
||||
}
|
||||
}
|
||||
|
||||
//// [privacyCannotNameAccessorDeclFile_GlobalWidgets.js]
|
||||
//// [privacyCannotNameAccessorDeclFile_Widgets.js]
|
||||
var Widget1 = (function () {
|
||||
function Widget1() {
|
||||
this.name = 'one';
|
||||
}
|
||||
return Widget1;
|
||||
})();
|
||||
exports.Widget1 = Widget1;
|
||||
function createWidget1() {
|
||||
return new Widget1();
|
||||
}
|
||||
exports.createWidget1 = createWidget1;
|
||||
(function (SpecializedWidget) {
|
||||
var Widget2 = (function () {
|
||||
function Widget2() {
|
||||
this.name = 'one';
|
||||
}
|
||||
return Widget2;
|
||||
})();
|
||||
SpecializedWidget.Widget2 = Widget2;
|
||||
function createWidget2() {
|
||||
return new Widget2();
|
||||
}
|
||||
SpecializedWidget.createWidget2 = createWidget2;
|
||||
})(exports.SpecializedWidget || (exports.SpecializedWidget = {}));
|
||||
var SpecializedWidget = exports.SpecializedWidget;
|
||||
//// [privacyCannotNameAccessorDeclFile_exporter.js]
|
||||
var Widgets = require("privacyCannotNameAccessorDeclFile_Widgets");
|
||||
var Widgets1 = require("GlobalWidgets");
|
||||
function createExportedWidget1() {
|
||||
return Widgets.createWidget1();
|
||||
}
|
||||
exports.createExportedWidget1 = createExportedWidget1;
|
||||
function createExportedWidget2() {
|
||||
return Widgets.SpecializedWidget.createWidget2();
|
||||
}
|
||||
exports.createExportedWidget2 = createExportedWidget2;
|
||||
function createExportedWidget3() {
|
||||
return Widgets1.createWidget3();
|
||||
}
|
||||
exports.createExportedWidget3 = createExportedWidget3;
|
||||
function createExportedWidget4() {
|
||||
return Widgets1.SpecializedGlobalWidget.createWidget4();
|
||||
}
|
||||
exports.createExportedWidget4 = createExportedWidget4;
|
||||
//// [privacyCannotNameAccessorDeclFile_consumer.js]
|
||||
var exporter = require("privacyCannotNameAccessorDeclFile_exporter");
|
||||
var publicClassWithWithPrivateGetAccessorTypes = (function () {
|
||||
function publicClassWithWithPrivateGetAccessorTypes() {
|
||||
}
|
||||
Object.defineProperty(publicClassWithWithPrivateGetAccessorTypes, "myPublicStaticMethod", {
|
||||
get: function () {
|
||||
return exporter.createExportedWidget1();
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(publicClassWithWithPrivateGetAccessorTypes, "myPrivateStaticMethod", {
|
||||
get: function () {
|
||||
return exporter.createExportedWidget1();
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(publicClassWithWithPrivateGetAccessorTypes.prototype, "myPublicMethod", {
|
||||
get: function () {
|
||||
return exporter.createExportedWidget1();
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(publicClassWithWithPrivateGetAccessorTypes.prototype, "myPrivateMethod", {
|
||||
get: function () {
|
||||
return exporter.createExportedWidget1();
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(publicClassWithWithPrivateGetAccessorTypes, "myPublicStaticMethod1", {
|
||||
get: function () {
|
||||
return exporter.createExportedWidget3();
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(publicClassWithWithPrivateGetAccessorTypes, "myPrivateStaticMethod1", {
|
||||
get: function () {
|
||||
return exporter.createExportedWidget3();
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(publicClassWithWithPrivateGetAccessorTypes.prototype, "myPublicMethod1", {
|
||||
get: function () {
|
||||
return exporter.createExportedWidget3();
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(publicClassWithWithPrivateGetAccessorTypes.prototype, "myPrivateMethod1", {
|
||||
get: function () {
|
||||
return exporter.createExportedWidget3();
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
return publicClassWithWithPrivateGetAccessorTypes;
|
||||
})();
|
||||
exports.publicClassWithWithPrivateGetAccessorTypes = publicClassWithWithPrivateGetAccessorTypes;
|
||||
var privateClassWithWithPrivateGetAccessorTypes = (function () {
|
||||
function privateClassWithWithPrivateGetAccessorTypes() {
|
||||
}
|
||||
Object.defineProperty(privateClassWithWithPrivateGetAccessorTypes, "myPublicStaticMethod", {
|
||||
get: function () {
|
||||
return exporter.createExportedWidget1();
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(privateClassWithWithPrivateGetAccessorTypes, "myPrivateStaticMethod", {
|
||||
get: function () {
|
||||
return exporter.createExportedWidget1();
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(privateClassWithWithPrivateGetAccessorTypes.prototype, "myPublicMethod", {
|
||||
get: function () {
|
||||
return exporter.createExportedWidget1();
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(privateClassWithWithPrivateGetAccessorTypes.prototype, "myPrivateMethod", {
|
||||
get: function () {
|
||||
return exporter.createExportedWidget1();
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(privateClassWithWithPrivateGetAccessorTypes, "myPublicStaticMethod1", {
|
||||
get: function () {
|
||||
return exporter.createExportedWidget3();
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(privateClassWithWithPrivateGetAccessorTypes, "myPrivateStaticMethod1", {
|
||||
get: function () {
|
||||
return exporter.createExportedWidget3();
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(privateClassWithWithPrivateGetAccessorTypes.prototype, "myPublicMethod1", {
|
||||
get: function () {
|
||||
return exporter.createExportedWidget3();
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(privateClassWithWithPrivateGetAccessorTypes.prototype, "myPrivateMethod1", {
|
||||
get: function () {
|
||||
return exporter.createExportedWidget3();
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
return privateClassWithWithPrivateGetAccessorTypes;
|
||||
})();
|
||||
var publicClassWithPrivateModuleGetAccessorTypes = (function () {
|
||||
function publicClassWithPrivateModuleGetAccessorTypes() {
|
||||
}
|
||||
Object.defineProperty(publicClassWithPrivateModuleGetAccessorTypes, "myPublicStaticMethod", {
|
||||
get: function () {
|
||||
return exporter.createExportedWidget2();
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(publicClassWithPrivateModuleGetAccessorTypes.prototype, "myPublicMethod", {
|
||||
get: function () {
|
||||
return exporter.createExportedWidget2();
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(publicClassWithPrivateModuleGetAccessorTypes, "myPublicStaticMethod1", {
|
||||
get: function () {
|
||||
return exporter.createExportedWidget4();
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(publicClassWithPrivateModuleGetAccessorTypes.prototype, "myPublicMethod1", {
|
||||
get: function () {
|
||||
return exporter.createExportedWidget4();
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
return publicClassWithPrivateModuleGetAccessorTypes;
|
||||
})();
|
||||
exports.publicClassWithPrivateModuleGetAccessorTypes = publicClassWithPrivateModuleGetAccessorTypes;
|
||||
var privateClassWithPrivateModuleGetAccessorTypes = (function () {
|
||||
function privateClassWithPrivateModuleGetAccessorTypes() {
|
||||
}
|
||||
Object.defineProperty(privateClassWithPrivateModuleGetAccessorTypes, "myPublicStaticMethod", {
|
||||
get: function () {
|
||||
return exporter.createExportedWidget2();
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(privateClassWithPrivateModuleGetAccessorTypes.prototype, "myPublicMethod", {
|
||||
get: function () {
|
||||
return exporter.createExportedWidget2();
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(privateClassWithPrivateModuleGetAccessorTypes, "myPublicStaticMethod1", {
|
||||
get: function () {
|
||||
return exporter.createExportedWidget4();
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(privateClassWithPrivateModuleGetAccessorTypes.prototype, "myPublicMethod1", {
|
||||
get: function () {
|
||||
return exporter.createExportedWidget4();
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
return privateClassWithPrivateModuleGetAccessorTypes;
|
||||
})();
|
||||
|
||||
|
||||
//// [privacyCannotNameAccessorDeclFile_GlobalWidgets.d.ts]
|
||||
declare module "GlobalWidgets" {
|
||||
class Widget3 {
|
||||
name: string;
|
||||
}
|
||||
function createWidget3(): Widget3;
|
||||
module SpecializedGlobalWidget {
|
||||
class Widget4 {
|
||||
name: string;
|
||||
}
|
||||
function createWidget4(): Widget4;
|
||||
}
|
||||
}
|
||||
//// [privacyCannotNameAccessorDeclFile_Widgets.d.ts]
|
||||
export declare class Widget1 {
|
||||
name: string;
|
||||
}
|
||||
export declare function createWidget1(): Widget1;
|
||||
export declare module SpecializedWidget {
|
||||
class Widget2 {
|
||||
name: string;
|
||||
}
|
||||
function createWidget2(): Widget2;
|
||||
}
|
||||
//// [privacyCannotNameAccessorDeclFile_exporter.d.ts]
|
||||
/// <reference path='privacyCannotNameAccessorDeclFile_GlobalWidgets.d.ts' />
|
||||
import Widgets = require("privacyCannotNameAccessorDeclFile_Widgets");
|
||||
import Widgets1 = require("GlobalWidgets");
|
||||
export declare function createExportedWidget1(): Widgets.Widget1;
|
||||
export declare function createExportedWidget2(): Widgets.SpecializedWidget.Widget2;
|
||||
export declare function createExportedWidget3(): Widgets1.Widget3;
|
||||
export declare function createExportedWidget4(): Widgets1.SpecializedGlobalWidget.Widget4;
|
|
@ -0,0 +1,123 @@
|
|||
==== tests/cases/compiler/privacyCannotNameVarTypeDeclFile_consumer.ts (12 errors) ====
|
||||
import exporter = require("privacyCannotNameVarTypeDeclFile_exporter");
|
||||
export class publicClassWithWithPrivatePropertyTypes {
|
||||
static myPublicStaticProperty = exporter.createExportedWidget1(); // Error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Public static property 'myPublicStaticProperty' of exported class has or is using name 'Widget1' from external module "tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets" but cannot be named.
|
||||
private static myPrivateStaticProperty = exporter.createExportedWidget1();
|
||||
myPublicProperty = exporter.createExportedWidget1(); // Error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Public property 'myPublicProperty' of exported class has or is using name 'Widget1' from external module "tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets" but cannot be named.
|
||||
private myPrivateProperty = exporter.createExportedWidget1();
|
||||
|
||||
static myPublicStaticProperty1 = exporter.createExportedWidget3(); // Error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Public static property 'myPublicStaticProperty1' of exported class has or is using name 'Widget3' from external module "GlobalWidgets" but cannot be named.
|
||||
private static myPrivateStaticProperty1 = exporter.createExportedWidget3();
|
||||
myPublicProperty1 = exporter.createExportedWidget3(); // Error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Public property 'myPublicProperty1' of exported class has or is using name 'Widget3' from external module "GlobalWidgets" but cannot be named.
|
||||
private myPrivateProperty1 = exporter.createExportedWidget3();
|
||||
}
|
||||
|
||||
class privateClassWithWithPrivatePropertyTypes {
|
||||
static myPublicStaticProperty = exporter.createExportedWidget1();
|
||||
private static myPrivateStaticProperty = exporter.createExportedWidget1();
|
||||
myPublicProperty = exporter.createExportedWidget1();
|
||||
private myPrivateProperty = exporter.createExportedWidget1();
|
||||
|
||||
static myPublicStaticProperty1 = exporter.createExportedWidget3();
|
||||
private static myPrivateStaticProperty1 = exporter.createExportedWidget3();
|
||||
myPublicProperty1 = exporter.createExportedWidget3();
|
||||
private myPrivateProperty1 = exporter.createExportedWidget3();
|
||||
}
|
||||
|
||||
export var publicVarWithPrivatePropertyTypes= exporter.createExportedWidget1(); // Error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Exported variable 'publicVarWithPrivatePropertyTypes' has or is using name 'Widget1' from external module "tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets" but cannot be named.
|
||||
var privateVarWithPrivatePropertyTypes= exporter.createExportedWidget1();
|
||||
export var publicVarWithPrivatePropertyTypes1 = exporter.createExportedWidget3(); // Error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Exported variable 'publicVarWithPrivatePropertyTypes1' has or is using name 'Widget3' from external module "GlobalWidgets" but cannot be named.
|
||||
var privateVarWithPrivatePropertyTypes1 = exporter.createExportedWidget3();
|
||||
|
||||
export class publicClassWithPrivateModulePropertyTypes {
|
||||
static myPublicStaticProperty= exporter.createExportedWidget2(); // Error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Public static property 'myPublicStaticProperty' of exported class has or is using name 'SpecializedWidget.Widget2' from external module "tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets" but cannot be named.
|
||||
myPublicProperty = exporter.createExportedWidget2(); // Error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Public property 'myPublicProperty' of exported class has or is using name 'SpecializedWidget.Widget2' from external module "tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets" but cannot be named.
|
||||
static myPublicStaticProperty1 = exporter.createExportedWidget4(); // Error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Public static property 'myPublicStaticProperty1' of exported class has or is using name 'SpecializedGlobalWidget.Widget4' from external module "GlobalWidgets" but cannot be named.
|
||||
myPublicProperty1 = exporter.createExportedWidget4(); // Error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Public property 'myPublicProperty1' of exported class has or is using name 'SpecializedGlobalWidget.Widget4' from external module "GlobalWidgets" but cannot be named.
|
||||
}
|
||||
export var publicVarWithPrivateModulePropertyTypes= exporter.createExportedWidget2(); // Error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Exported variable 'publicVarWithPrivateModulePropertyTypes' has or is using name 'SpecializedWidget.Widget2' from external module "tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets" but cannot be named.
|
||||
export var publicVarWithPrivateModulePropertyTypes1 = exporter.createExportedWidget4(); // Error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Exported variable 'publicVarWithPrivateModulePropertyTypes1' has or is using name 'SpecializedGlobalWidget.Widget4' from external module "GlobalWidgets" but cannot be named.
|
||||
|
||||
class privateClassWithPrivateModulePropertyTypes {
|
||||
static myPublicStaticProperty= exporter.createExportedWidget2();
|
||||
myPublicProperty= exporter.createExportedWidget2();
|
||||
static myPublicStaticProperty1 = exporter.createExportedWidget4();
|
||||
myPublicProperty1 = exporter.createExportedWidget4();
|
||||
}
|
||||
var privateVarWithPrivateModulePropertyTypes= exporter.createExportedWidget2();
|
||||
var privateVarWithPrivateModulePropertyTypes1 = exporter.createExportedWidget4();
|
||||
==== tests/cases/compiler/privacyCannotNameVarTypeDeclFile_GlobalWidgets.ts (0 errors) ====
|
||||
|
||||
|
||||
declare module "GlobalWidgets" {
|
||||
export class Widget3 {
|
||||
name: string;
|
||||
}
|
||||
export function createWidget3(): Widget3;
|
||||
|
||||
export module SpecializedGlobalWidget {
|
||||
export class Widget4 {
|
||||
name: string;
|
||||
}
|
||||
function createWidget4(): Widget4;
|
||||
}
|
||||
}
|
||||
|
||||
==== tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets.ts (0 errors) ====
|
||||
export class Widget1 {
|
||||
name = 'one';
|
||||
}
|
||||
export function createWidget1() {
|
||||
return new Widget1();
|
||||
}
|
||||
|
||||
export module SpecializedWidget {
|
||||
export class Widget2 {
|
||||
name = 'one';
|
||||
}
|
||||
export function createWidget2() {
|
||||
return new Widget2();
|
||||
}
|
||||
}
|
||||
|
||||
==== tests/cases/compiler/privacyCannotNameVarTypeDeclFile_exporter.ts (0 errors) ====
|
||||
///<reference path='privacyCannotNameVarTypeDeclFile_GlobalWidgets.ts'/>
|
||||
import Widgets = require("privacyCannotNameVarTypeDeclFile_Widgets");
|
||||
import Widgets1 = require("GlobalWidgets");
|
||||
export function createExportedWidget1() {
|
||||
return Widgets.createWidget1();
|
||||
}
|
||||
export function createExportedWidget2() {
|
||||
return Widgets.SpecializedWidget.createWidget2();
|
||||
}
|
||||
export function createExportedWidget3() {
|
||||
return Widgets1.createWidget3();
|
||||
}
|
||||
export function createExportedWidget4() {
|
||||
return Widgets1.SpecializedGlobalWidget.createWidget4();
|
||||
}
|
||||
|
238
tests/baselines/reference/privacyCannotNameVarTypeDeclFile.js
Normal file
238
tests/baselines/reference/privacyCannotNameVarTypeDeclFile.js
Normal file
|
@ -0,0 +1,238 @@
|
|||
//// [tests/cases/compiler/privacyCannotNameVarTypeDeclFile.ts] ////
|
||||
|
||||
//// [privacyCannotNameVarTypeDeclFile_GlobalWidgets.ts]
|
||||
|
||||
|
||||
declare module "GlobalWidgets" {
|
||||
export class Widget3 {
|
||||
name: string;
|
||||
}
|
||||
export function createWidget3(): Widget3;
|
||||
|
||||
export module SpecializedGlobalWidget {
|
||||
export class Widget4 {
|
||||
name: string;
|
||||
}
|
||||
function createWidget4(): Widget4;
|
||||
}
|
||||
}
|
||||
|
||||
//// [privacyCannotNameVarTypeDeclFile_Widgets.ts]
|
||||
export class Widget1 {
|
||||
name = 'one';
|
||||
}
|
||||
export function createWidget1() {
|
||||
return new Widget1();
|
||||
}
|
||||
|
||||
export module SpecializedWidget {
|
||||
export class Widget2 {
|
||||
name = 'one';
|
||||
}
|
||||
export function createWidget2() {
|
||||
return new Widget2();
|
||||
}
|
||||
}
|
||||
|
||||
//// [privacyCannotNameVarTypeDeclFile_exporter.ts]
|
||||
///<reference path='privacyCannotNameVarTypeDeclFile_GlobalWidgets.ts'/>
|
||||
import Widgets = require("privacyCannotNameVarTypeDeclFile_Widgets");
|
||||
import Widgets1 = require("GlobalWidgets");
|
||||
export function createExportedWidget1() {
|
||||
return Widgets.createWidget1();
|
||||
}
|
||||
export function createExportedWidget2() {
|
||||
return Widgets.SpecializedWidget.createWidget2();
|
||||
}
|
||||
export function createExportedWidget3() {
|
||||
return Widgets1.createWidget3();
|
||||
}
|
||||
export function createExportedWidget4() {
|
||||
return Widgets1.SpecializedGlobalWidget.createWidget4();
|
||||
}
|
||||
|
||||
//// [privacyCannotNameVarTypeDeclFile_consumer.ts]
|
||||
import exporter = require("privacyCannotNameVarTypeDeclFile_exporter");
|
||||
export class publicClassWithWithPrivatePropertyTypes {
|
||||
static myPublicStaticProperty = exporter.createExportedWidget1(); // Error
|
||||
private static myPrivateStaticProperty = exporter.createExportedWidget1();
|
||||
myPublicProperty = exporter.createExportedWidget1(); // Error
|
||||
private myPrivateProperty = exporter.createExportedWidget1();
|
||||
|
||||
static myPublicStaticProperty1 = exporter.createExportedWidget3(); // Error
|
||||
private static myPrivateStaticProperty1 = exporter.createExportedWidget3();
|
||||
myPublicProperty1 = exporter.createExportedWidget3(); // Error
|
||||
private myPrivateProperty1 = exporter.createExportedWidget3();
|
||||
}
|
||||
|
||||
class privateClassWithWithPrivatePropertyTypes {
|
||||
static myPublicStaticProperty = exporter.createExportedWidget1();
|
||||
private static myPrivateStaticProperty = exporter.createExportedWidget1();
|
||||
myPublicProperty = exporter.createExportedWidget1();
|
||||
private myPrivateProperty = exporter.createExportedWidget1();
|
||||
|
||||
static myPublicStaticProperty1 = exporter.createExportedWidget3();
|
||||
private static myPrivateStaticProperty1 = exporter.createExportedWidget3();
|
||||
myPublicProperty1 = exporter.createExportedWidget3();
|
||||
private myPrivateProperty1 = exporter.createExportedWidget3();
|
||||
}
|
||||
|
||||
export var publicVarWithPrivatePropertyTypes= exporter.createExportedWidget1(); // Error
|
||||
var privateVarWithPrivatePropertyTypes= exporter.createExportedWidget1();
|
||||
export var publicVarWithPrivatePropertyTypes1 = exporter.createExportedWidget3(); // Error
|
||||
var privateVarWithPrivatePropertyTypes1 = exporter.createExportedWidget3();
|
||||
|
||||
export class publicClassWithPrivateModulePropertyTypes {
|
||||
static myPublicStaticProperty= exporter.createExportedWidget2(); // Error
|
||||
myPublicProperty = exporter.createExportedWidget2(); // Error
|
||||
static myPublicStaticProperty1 = exporter.createExportedWidget4(); // Error
|
||||
myPublicProperty1 = exporter.createExportedWidget4(); // Error
|
||||
}
|
||||
export var publicVarWithPrivateModulePropertyTypes= exporter.createExportedWidget2(); // Error
|
||||
export var publicVarWithPrivateModulePropertyTypes1 = exporter.createExportedWidget4(); // Error
|
||||
|
||||
class privateClassWithPrivateModulePropertyTypes {
|
||||
static myPublicStaticProperty= exporter.createExportedWidget2();
|
||||
myPublicProperty= exporter.createExportedWidget2();
|
||||
static myPublicStaticProperty1 = exporter.createExportedWidget4();
|
||||
myPublicProperty1 = exporter.createExportedWidget4();
|
||||
}
|
||||
var privateVarWithPrivateModulePropertyTypes= exporter.createExportedWidget2();
|
||||
var privateVarWithPrivateModulePropertyTypes1 = exporter.createExportedWidget4();
|
||||
|
||||
//// [privacyCannotNameVarTypeDeclFile_GlobalWidgets.js]
|
||||
//// [privacyCannotNameVarTypeDeclFile_Widgets.js]
|
||||
var Widget1 = (function () {
|
||||
function Widget1() {
|
||||
this.name = 'one';
|
||||
}
|
||||
return Widget1;
|
||||
})();
|
||||
exports.Widget1 = Widget1;
|
||||
function createWidget1() {
|
||||
return new Widget1();
|
||||
}
|
||||
exports.createWidget1 = createWidget1;
|
||||
(function (SpecializedWidget) {
|
||||
var Widget2 = (function () {
|
||||
function Widget2() {
|
||||
this.name = 'one';
|
||||
}
|
||||
return Widget2;
|
||||
})();
|
||||
SpecializedWidget.Widget2 = Widget2;
|
||||
function createWidget2() {
|
||||
return new Widget2();
|
||||
}
|
||||
SpecializedWidget.createWidget2 = createWidget2;
|
||||
})(exports.SpecializedWidget || (exports.SpecializedWidget = {}));
|
||||
var SpecializedWidget = exports.SpecializedWidget;
|
||||
//// [privacyCannotNameVarTypeDeclFile_exporter.js]
|
||||
var Widgets = require("privacyCannotNameVarTypeDeclFile_Widgets");
|
||||
var Widgets1 = require("GlobalWidgets");
|
||||
function createExportedWidget1() {
|
||||
return Widgets.createWidget1();
|
||||
}
|
||||
exports.createExportedWidget1 = createExportedWidget1;
|
||||
function createExportedWidget2() {
|
||||
return Widgets.SpecializedWidget.createWidget2();
|
||||
}
|
||||
exports.createExportedWidget2 = createExportedWidget2;
|
||||
function createExportedWidget3() {
|
||||
return Widgets1.createWidget3();
|
||||
}
|
||||
exports.createExportedWidget3 = createExportedWidget3;
|
||||
function createExportedWidget4() {
|
||||
return Widgets1.SpecializedGlobalWidget.createWidget4();
|
||||
}
|
||||
exports.createExportedWidget4 = createExportedWidget4;
|
||||
//// [privacyCannotNameVarTypeDeclFile_consumer.js]
|
||||
var exporter = require("privacyCannotNameVarTypeDeclFile_exporter");
|
||||
var publicClassWithWithPrivatePropertyTypes = (function () {
|
||||
function publicClassWithWithPrivatePropertyTypes() {
|
||||
this.myPublicProperty = exporter.createExportedWidget1();
|
||||
this.myPrivateProperty = exporter.createExportedWidget1();
|
||||
this.myPublicProperty1 = exporter.createExportedWidget3();
|
||||
this.myPrivateProperty1 = exporter.createExportedWidget3();
|
||||
}
|
||||
publicClassWithWithPrivatePropertyTypes.myPublicStaticProperty = exporter.createExportedWidget1();
|
||||
publicClassWithWithPrivatePropertyTypes.myPrivateStaticProperty = exporter.createExportedWidget1();
|
||||
publicClassWithWithPrivatePropertyTypes.myPublicStaticProperty1 = exporter.createExportedWidget3();
|
||||
publicClassWithWithPrivatePropertyTypes.myPrivateStaticProperty1 = exporter.createExportedWidget3();
|
||||
return publicClassWithWithPrivatePropertyTypes;
|
||||
})();
|
||||
exports.publicClassWithWithPrivatePropertyTypes = publicClassWithWithPrivatePropertyTypes;
|
||||
var privateClassWithWithPrivatePropertyTypes = (function () {
|
||||
function privateClassWithWithPrivatePropertyTypes() {
|
||||
this.myPublicProperty = exporter.createExportedWidget1();
|
||||
this.myPrivateProperty = exporter.createExportedWidget1();
|
||||
this.myPublicProperty1 = exporter.createExportedWidget3();
|
||||
this.myPrivateProperty1 = exporter.createExportedWidget3();
|
||||
}
|
||||
privateClassWithWithPrivatePropertyTypes.myPublicStaticProperty = exporter.createExportedWidget1();
|
||||
privateClassWithWithPrivatePropertyTypes.myPrivateStaticProperty = exporter.createExportedWidget1();
|
||||
privateClassWithWithPrivatePropertyTypes.myPublicStaticProperty1 = exporter.createExportedWidget3();
|
||||
privateClassWithWithPrivatePropertyTypes.myPrivateStaticProperty1 = exporter.createExportedWidget3();
|
||||
return privateClassWithWithPrivatePropertyTypes;
|
||||
})();
|
||||
exports.publicVarWithPrivatePropertyTypes = exporter.createExportedWidget1();
|
||||
var privateVarWithPrivatePropertyTypes = exporter.createExportedWidget1();
|
||||
exports.publicVarWithPrivatePropertyTypes1 = exporter.createExportedWidget3();
|
||||
var privateVarWithPrivatePropertyTypes1 = exporter.createExportedWidget3();
|
||||
var publicClassWithPrivateModulePropertyTypes = (function () {
|
||||
function publicClassWithPrivateModulePropertyTypes() {
|
||||
this.myPublicProperty = exporter.createExportedWidget2();
|
||||
this.myPublicProperty1 = exporter.createExportedWidget4();
|
||||
}
|
||||
publicClassWithPrivateModulePropertyTypes.myPublicStaticProperty = exporter.createExportedWidget2();
|
||||
publicClassWithPrivateModulePropertyTypes.myPublicStaticProperty1 = exporter.createExportedWidget4();
|
||||
return publicClassWithPrivateModulePropertyTypes;
|
||||
})();
|
||||
exports.publicClassWithPrivateModulePropertyTypes = publicClassWithPrivateModulePropertyTypes;
|
||||
exports.publicVarWithPrivateModulePropertyTypes = exporter.createExportedWidget2();
|
||||
exports.publicVarWithPrivateModulePropertyTypes1 = exporter.createExportedWidget4();
|
||||
var privateClassWithPrivateModulePropertyTypes = (function () {
|
||||
function privateClassWithPrivateModulePropertyTypes() {
|
||||
this.myPublicProperty = exporter.createExportedWidget2();
|
||||
this.myPublicProperty1 = exporter.createExportedWidget4();
|
||||
}
|
||||
privateClassWithPrivateModulePropertyTypes.myPublicStaticProperty = exporter.createExportedWidget2();
|
||||
privateClassWithPrivateModulePropertyTypes.myPublicStaticProperty1 = exporter.createExportedWidget4();
|
||||
return privateClassWithPrivateModulePropertyTypes;
|
||||
})();
|
||||
var privateVarWithPrivateModulePropertyTypes = exporter.createExportedWidget2();
|
||||
var privateVarWithPrivateModulePropertyTypes1 = exporter.createExportedWidget4();
|
||||
|
||||
|
||||
//// [privacyCannotNameVarTypeDeclFile_GlobalWidgets.d.ts]
|
||||
declare module "GlobalWidgets" {
|
||||
class Widget3 {
|
||||
name: string;
|
||||
}
|
||||
function createWidget3(): Widget3;
|
||||
module SpecializedGlobalWidget {
|
||||
class Widget4 {
|
||||
name: string;
|
||||
}
|
||||
function createWidget4(): Widget4;
|
||||
}
|
||||
}
|
||||
//// [privacyCannotNameVarTypeDeclFile_Widgets.d.ts]
|
||||
export declare class Widget1 {
|
||||
name: string;
|
||||
}
|
||||
export declare function createWidget1(): Widget1;
|
||||
export declare module SpecializedWidget {
|
||||
class Widget2 {
|
||||
name: string;
|
||||
}
|
||||
function createWidget2(): Widget2;
|
||||
}
|
||||
//// [privacyCannotNameVarTypeDeclFile_exporter.d.ts]
|
||||
/// <reference path='privacyCannotNameVarTypeDeclFile_GlobalWidgets.d.ts' />
|
||||
import Widgets = require("privacyCannotNameVarTypeDeclFile_Widgets");
|
||||
import Widgets1 = require("GlobalWidgets");
|
||||
export declare function createExportedWidget1(): Widgets.Widget1;
|
||||
export declare function createExportedWidget2(): Widgets.SpecializedWidget.Widget2;
|
||||
export declare function createExportedWidget3(): Widgets1.Widget3;
|
||||
export declare function createExportedWidget4(): Widgets1.SpecializedGlobalWidget.Widget4;
|
|
@ -0,0 +1,10 @@
|
|||
==== tests/cases/compiler/privacyCheckTypeOfFunction.ts (2 errors) ====
|
||||
function foo() {
|
||||
}
|
||||
export var x: typeof foo;
|
||||
~
|
||||
!!! Exported variable 'x' has or is using private name 'foo'.
|
||||
export var b = foo;
|
||||
~
|
||||
!!! Exported variable 'b' has or is using private name 'foo'.
|
||||
|
|
@ -10,8 +10,3 @@ function foo() {
|
|||
}
|
||||
exports.x;
|
||||
exports.b = foo;
|
||||
|
||||
|
||||
//// [privacyCheckTypeOfFunction.d.ts]
|
||||
export declare var x: () => void;
|
||||
export declare var b: () => void;
|
||||
|
|
|
@ -0,0 +1,203 @@
|
|||
==== tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_consumer.ts (24 errors) ====
|
||||
import exporter = require("privacyFunctionCannotNameParameterTypeDeclFile_exporter");
|
||||
export class publicClassWithWithPrivateParmeterTypes {
|
||||
static myPublicStaticMethod(param = exporter.createExportedWidget1()) { // Error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Parameter 'param' of public static method from exported class has or is using name 'Widget1' from external module "tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets" but cannot be named.
|
||||
}
|
||||
private static myPrivateStaticMethod(param = exporter.createExportedWidget1()) {
|
||||
}
|
||||
myPublicMethod(param = exporter.createExportedWidget1()) { // Error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Parameter 'param' of public method from exported class has or is using name 'Widget1' from external module "tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets" but cannot be named.
|
||||
}
|
||||
private myPrivateMethod(param = exporter.createExportedWidget1()) {
|
||||
}
|
||||
constructor(param = exporter.createExportedWidget1(), private param1 = exporter.createExportedWidget1(), public param2 = exporter.createExportedWidget1()) { // Error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Parameter 'param' of constructor from exported class has or is using name 'Widget1' from external module "tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets" but cannot be named.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Parameter 'param1' of constructor from exported class has or is using name 'Widget1' from external module "tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets" but cannot be named.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Parameter 'param2' of constructor from exported class has or is using name 'Widget1' from external module "tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets" but cannot be named.
|
||||
}
|
||||
}
|
||||
export class publicClassWithWithPrivateParmeterTypes1 {
|
||||
static myPublicStaticMethod(param = exporter.createExportedWidget3()) { // Error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Parameter 'param' of public static method from exported class has or is using name 'Widget3' from external module "GlobalWidgets" but cannot be named.
|
||||
}
|
||||
private static myPrivateStaticMethod(param = exporter.createExportedWidget3()) {
|
||||
}
|
||||
myPublicMethod(param = exporter.createExportedWidget3()) { // Error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Parameter 'param' of public method from exported class has or is using name 'Widget3' from external module "GlobalWidgets" but cannot be named.
|
||||
}
|
||||
private myPrivateMethod(param = exporter.createExportedWidget3()) {
|
||||
}
|
||||
constructor(param = exporter.createExportedWidget3(), private param1 = exporter.createExportedWidget3(), public param2 = exporter.createExportedWidget3()) { // Error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Parameter 'param' of constructor from exported class has or is using name 'Widget3' from external module "GlobalWidgets" but cannot be named.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Parameter 'param1' of constructor from exported class has or is using name 'Widget3' from external module "GlobalWidgets" but cannot be named.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Parameter 'param2' of constructor from exported class has or is using name 'Widget3' from external module "GlobalWidgets" but cannot be named.
|
||||
}
|
||||
}
|
||||
|
||||
class privateClassWithWithPrivateParmeterTypes {
|
||||
static myPublicStaticMethod(param = exporter.createExportedWidget1()) {
|
||||
}
|
||||
private static myPrivateStaticMethod(param = exporter.createExportedWidget1()) {
|
||||
}
|
||||
myPublicMethod(param = exporter.createExportedWidget1()) {
|
||||
}
|
||||
private myPrivateMethod(param = exporter.createExportedWidget1()) {
|
||||
}
|
||||
constructor(param = exporter.createExportedWidget1(), private param1 = exporter.createExportedWidget1(), public param2 = exporter.createExportedWidget1()) {
|
||||
}
|
||||
}
|
||||
class privateClassWithWithPrivateParmeterTypes2 {
|
||||
static myPublicStaticMethod(param = exporter.createExportedWidget3()) {
|
||||
}
|
||||
private static myPrivateStaticMethod(param = exporter.createExportedWidget3()) {
|
||||
}
|
||||
myPublicMethod(param = exporter.createExportedWidget3()) {
|
||||
}
|
||||
private myPrivateMethod(param = exporter.createExportedWidget3()) {
|
||||
}
|
||||
constructor(param = exporter.createExportedWidget3(), private param1 = exporter.createExportedWidget3(), public param2 = exporter.createExportedWidget3()) {
|
||||
}
|
||||
}
|
||||
|
||||
export function publicFunctionWithPrivateParmeterTypes(param = exporter.createExportedWidget1()) { // Error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Parameter 'param' of exported function has or is using name 'Widget1' from external module "tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets" but cannot be named.
|
||||
}
|
||||
function privateFunctionWithPrivateParmeterTypes(param = exporter.createExportedWidget1()) {
|
||||
}
|
||||
export function publicFunctionWithPrivateParmeterTypes1(param = exporter.createExportedWidget3()) { // Error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Parameter 'param' of exported function has or is using name 'Widget3' from external module "GlobalWidgets" but cannot be named.
|
||||
}
|
||||
function privateFunctionWithPrivateParmeterTypes1(param = exporter.createExportedWidget3()) {
|
||||
}
|
||||
|
||||
|
||||
export class publicClassWithPrivateModuleParameterTypes {
|
||||
static myPublicStaticMethod(param= exporter.createExportedWidget2()) { // Error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Parameter 'param' of public static method from exported class has or is using name 'SpecializedWidget.Widget2' from external module "tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets" but cannot be named.
|
||||
}
|
||||
myPublicMethod(param= exporter.createExportedWidget2()) { // Error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Parameter 'param' of public method from exported class has or is using name 'SpecializedWidget.Widget2' from external module "tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets" but cannot be named.
|
||||
}
|
||||
constructor(param= exporter.createExportedWidget2(), private param1= exporter.createExportedWidget2(), public param2= exporter.createExportedWidget2()) { // Error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Parameter 'param' of constructor from exported class has or is using name 'SpecializedWidget.Widget2' from external module "tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets" but cannot be named.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Parameter 'param1' of constructor from exported class has or is using name 'SpecializedWidget.Widget2' from external module "tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets" but cannot be named.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Parameter 'param2' of constructor from exported class has or is using name 'SpecializedWidget.Widget2' from external module "tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets" but cannot be named.
|
||||
}
|
||||
}
|
||||
export class publicClassWithPrivateModuleParameterTypes2 {
|
||||
static myPublicStaticMethod(param= exporter.createExportedWidget4()) { // Error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Parameter 'param' of public static method from exported class has or is using name 'SpecializedGlobalWidget.Widget4' from external module "GlobalWidgets" but cannot be named.
|
||||
}
|
||||
myPublicMethod(param= exporter.createExportedWidget4()) { // Error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Parameter 'param' of public method from exported class has or is using name 'SpecializedGlobalWidget.Widget4' from external module "GlobalWidgets" but cannot be named.
|
||||
}
|
||||
constructor(param= exporter.createExportedWidget4(), private param1= exporter.createExportedWidget4(), public param2= exporter.createExportedWidget4()) { // Error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Parameter 'param' of constructor from exported class has or is using name 'SpecializedGlobalWidget.Widget4' from external module "GlobalWidgets" but cannot be named.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Parameter 'param1' of constructor from exported class has or is using name 'SpecializedGlobalWidget.Widget4' from external module "GlobalWidgets" but cannot be named.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Parameter 'param2' of constructor from exported class has or is using name 'SpecializedGlobalWidget.Widget4' from external module "GlobalWidgets" but cannot be named.
|
||||
}
|
||||
}
|
||||
export function publicFunctionWithPrivateModuleParameterTypes(param= exporter.createExportedWidget2()) { // Error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Parameter 'param' of exported function has or is using name 'SpecializedWidget.Widget2' from external module "tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets" but cannot be named.
|
||||
}
|
||||
export function publicFunctionWithPrivateModuleParameterTypes1(param= exporter.createExportedWidget4()) { // Error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Parameter 'param' of exported function has or is using name 'SpecializedGlobalWidget.Widget4' from external module "GlobalWidgets" but cannot be named.
|
||||
}
|
||||
|
||||
|
||||
class privateClassWithPrivateModuleParameterTypes {
|
||||
static myPublicStaticMethod(param= exporter.createExportedWidget2()) {
|
||||
}
|
||||
myPublicMethod(param= exporter.createExportedWidget2()) {
|
||||
}
|
||||
constructor(param= exporter.createExportedWidget2(), private param1= exporter.createExportedWidget2(), public param2= exporter.createExportedWidget2()) {
|
||||
}
|
||||
}
|
||||
class privateClassWithPrivateModuleParameterTypes1 {
|
||||
static myPublicStaticMethod(param= exporter.createExportedWidget4()) {
|
||||
}
|
||||
myPublicMethod(param= exporter.createExportedWidget4()) {
|
||||
}
|
||||
constructor(param= exporter.createExportedWidget4(), private param1= exporter.createExportedWidget4(), public param2= exporter.createExportedWidget4()) {
|
||||
}
|
||||
}
|
||||
function privateFunctionWithPrivateModuleParameterTypes(param= exporter.createExportedWidget2()) {
|
||||
}
|
||||
function privateFunctionWithPrivateModuleParameterTypes1(param= exporter.createExportedWidget4()) {
|
||||
}
|
||||
==== tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_GlobalWidgets.ts (0 errors) ====
|
||||
|
||||
|
||||
declare module "GlobalWidgets" {
|
||||
export class Widget3 {
|
||||
name: string;
|
||||
}
|
||||
export function createWidget3(): Widget3;
|
||||
|
||||
export module SpecializedGlobalWidget {
|
||||
export class Widget4 {
|
||||
name: string;
|
||||
}
|
||||
function createWidget4(): Widget4;
|
||||
}
|
||||
}
|
||||
|
||||
==== tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets.ts (0 errors) ====
|
||||
export class Widget1 {
|
||||
name = 'one';
|
||||
}
|
||||
export function createWidget1() {
|
||||
return new Widget1();
|
||||
}
|
||||
|
||||
export module SpecializedWidget {
|
||||
export class Widget2 {
|
||||
name = 'one';
|
||||
}
|
||||
export function createWidget2() {
|
||||
return new Widget2();
|
||||
}
|
||||
}
|
||||
|
||||
==== tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_exporter.ts (0 errors) ====
|
||||
///<reference path='privacyFunctionCannotNameParameterTypeDeclFile_GlobalWidgets.ts'/>
|
||||
import Widgets = require("privacyFunctionCannotNameParameterTypeDeclFile_Widgets");
|
||||
import Widgets1 = require("GlobalWidgets");
|
||||
export function createExportedWidget1() {
|
||||
return Widgets.createWidget1();
|
||||
}
|
||||
export function createExportedWidget2() {
|
||||
return Widgets.SpecializedWidget.createWidget2();
|
||||
}
|
||||
export function createExportedWidget3() {
|
||||
return Widgets1.createWidget3();
|
||||
}
|
||||
export function createExportedWidget4() {
|
||||
return Widgets1.SpecializedGlobalWidget.createWidget4();
|
||||
}
|
||||
|
|
@ -0,0 +1,424 @@
|
|||
//// [tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile.ts] ////
|
||||
|
||||
//// [privacyFunctionCannotNameParameterTypeDeclFile_GlobalWidgets.ts]
|
||||
|
||||
|
||||
declare module "GlobalWidgets" {
|
||||
export class Widget3 {
|
||||
name: string;
|
||||
}
|
||||
export function createWidget3(): Widget3;
|
||||
|
||||
export module SpecializedGlobalWidget {
|
||||
export class Widget4 {
|
||||
name: string;
|
||||
}
|
||||
function createWidget4(): Widget4;
|
||||
}
|
||||
}
|
||||
|
||||
//// [privacyFunctionCannotNameParameterTypeDeclFile_Widgets.ts]
|
||||
export class Widget1 {
|
||||
name = 'one';
|
||||
}
|
||||
export function createWidget1() {
|
||||
return new Widget1();
|
||||
}
|
||||
|
||||
export module SpecializedWidget {
|
||||
export class Widget2 {
|
||||
name = 'one';
|
||||
}
|
||||
export function createWidget2() {
|
||||
return new Widget2();
|
||||
}
|
||||
}
|
||||
|
||||
//// [privacyFunctionCannotNameParameterTypeDeclFile_exporter.ts]
|
||||
///<reference path='privacyFunctionCannotNameParameterTypeDeclFile_GlobalWidgets.ts'/>
|
||||
import Widgets = require("privacyFunctionCannotNameParameterTypeDeclFile_Widgets");
|
||||
import Widgets1 = require("GlobalWidgets");
|
||||
export function createExportedWidget1() {
|
||||
return Widgets.createWidget1();
|
||||
}
|
||||
export function createExportedWidget2() {
|
||||
return Widgets.SpecializedWidget.createWidget2();
|
||||
}
|
||||
export function createExportedWidget3() {
|
||||
return Widgets1.createWidget3();
|
||||
}
|
||||
export function createExportedWidget4() {
|
||||
return Widgets1.SpecializedGlobalWidget.createWidget4();
|
||||
}
|
||||
|
||||
//// [privacyFunctionCannotNameParameterTypeDeclFile_consumer.ts]
|
||||
import exporter = require("privacyFunctionCannotNameParameterTypeDeclFile_exporter");
|
||||
export class publicClassWithWithPrivateParmeterTypes {
|
||||
static myPublicStaticMethod(param = exporter.createExportedWidget1()) { // Error
|
||||
}
|
||||
private static myPrivateStaticMethod(param = exporter.createExportedWidget1()) {
|
||||
}
|
||||
myPublicMethod(param = exporter.createExportedWidget1()) { // Error
|
||||
}
|
||||
private myPrivateMethod(param = exporter.createExportedWidget1()) {
|
||||
}
|
||||
constructor(param = exporter.createExportedWidget1(), private param1 = exporter.createExportedWidget1(), public param2 = exporter.createExportedWidget1()) { // Error
|
||||
}
|
||||
}
|
||||
export class publicClassWithWithPrivateParmeterTypes1 {
|
||||
static myPublicStaticMethod(param = exporter.createExportedWidget3()) { // Error
|
||||
}
|
||||
private static myPrivateStaticMethod(param = exporter.createExportedWidget3()) {
|
||||
}
|
||||
myPublicMethod(param = exporter.createExportedWidget3()) { // Error
|
||||
}
|
||||
private myPrivateMethod(param = exporter.createExportedWidget3()) {
|
||||
}
|
||||
constructor(param = exporter.createExportedWidget3(), private param1 = exporter.createExportedWidget3(), public param2 = exporter.createExportedWidget3()) { // Error
|
||||
}
|
||||
}
|
||||
|
||||
class privateClassWithWithPrivateParmeterTypes {
|
||||
static myPublicStaticMethod(param = exporter.createExportedWidget1()) {
|
||||
}
|
||||
private static myPrivateStaticMethod(param = exporter.createExportedWidget1()) {
|
||||
}
|
||||
myPublicMethod(param = exporter.createExportedWidget1()) {
|
||||
}
|
||||
private myPrivateMethod(param = exporter.createExportedWidget1()) {
|
||||
}
|
||||
constructor(param = exporter.createExportedWidget1(), private param1 = exporter.createExportedWidget1(), public param2 = exporter.createExportedWidget1()) {
|
||||
}
|
||||
}
|
||||
class privateClassWithWithPrivateParmeterTypes2 {
|
||||
static myPublicStaticMethod(param = exporter.createExportedWidget3()) {
|
||||
}
|
||||
private static myPrivateStaticMethod(param = exporter.createExportedWidget3()) {
|
||||
}
|
||||
myPublicMethod(param = exporter.createExportedWidget3()) {
|
||||
}
|
||||
private myPrivateMethod(param = exporter.createExportedWidget3()) {
|
||||
}
|
||||
constructor(param = exporter.createExportedWidget3(), private param1 = exporter.createExportedWidget3(), public param2 = exporter.createExportedWidget3()) {
|
||||
}
|
||||
}
|
||||
|
||||
export function publicFunctionWithPrivateParmeterTypes(param = exporter.createExportedWidget1()) { // Error
|
||||
}
|
||||
function privateFunctionWithPrivateParmeterTypes(param = exporter.createExportedWidget1()) {
|
||||
}
|
||||
export function publicFunctionWithPrivateParmeterTypes1(param = exporter.createExportedWidget3()) { // Error
|
||||
}
|
||||
function privateFunctionWithPrivateParmeterTypes1(param = exporter.createExportedWidget3()) {
|
||||
}
|
||||
|
||||
|
||||
export class publicClassWithPrivateModuleParameterTypes {
|
||||
static myPublicStaticMethod(param= exporter.createExportedWidget2()) { // Error
|
||||
}
|
||||
myPublicMethod(param= exporter.createExportedWidget2()) { // Error
|
||||
}
|
||||
constructor(param= exporter.createExportedWidget2(), private param1= exporter.createExportedWidget2(), public param2= exporter.createExportedWidget2()) { // Error
|
||||
}
|
||||
}
|
||||
export class publicClassWithPrivateModuleParameterTypes2 {
|
||||
static myPublicStaticMethod(param= exporter.createExportedWidget4()) { // Error
|
||||
}
|
||||
myPublicMethod(param= exporter.createExportedWidget4()) { // Error
|
||||
}
|
||||
constructor(param= exporter.createExportedWidget4(), private param1= exporter.createExportedWidget4(), public param2= exporter.createExportedWidget4()) { // Error
|
||||
}
|
||||
}
|
||||
export function publicFunctionWithPrivateModuleParameterTypes(param= exporter.createExportedWidget2()) { // Error
|
||||
}
|
||||
export function publicFunctionWithPrivateModuleParameterTypes1(param= exporter.createExportedWidget4()) { // Error
|
||||
}
|
||||
|
||||
|
||||
class privateClassWithPrivateModuleParameterTypes {
|
||||
static myPublicStaticMethod(param= exporter.createExportedWidget2()) {
|
||||
}
|
||||
myPublicMethod(param= exporter.createExportedWidget2()) {
|
||||
}
|
||||
constructor(param= exporter.createExportedWidget2(), private param1= exporter.createExportedWidget2(), public param2= exporter.createExportedWidget2()) {
|
||||
}
|
||||
}
|
||||
class privateClassWithPrivateModuleParameterTypes1 {
|
||||
static myPublicStaticMethod(param= exporter.createExportedWidget4()) {
|
||||
}
|
||||
myPublicMethod(param= exporter.createExportedWidget4()) {
|
||||
}
|
||||
constructor(param= exporter.createExportedWidget4(), private param1= exporter.createExportedWidget4(), public param2= exporter.createExportedWidget4()) {
|
||||
}
|
||||
}
|
||||
function privateFunctionWithPrivateModuleParameterTypes(param= exporter.createExportedWidget2()) {
|
||||
}
|
||||
function privateFunctionWithPrivateModuleParameterTypes1(param= exporter.createExportedWidget4()) {
|
||||
}
|
||||
|
||||
//// [privacyFunctionCannotNameParameterTypeDeclFile_GlobalWidgets.js]
|
||||
//// [privacyFunctionCannotNameParameterTypeDeclFile_Widgets.js]
|
||||
var Widget1 = (function () {
|
||||
function Widget1() {
|
||||
this.name = 'one';
|
||||
}
|
||||
return Widget1;
|
||||
})();
|
||||
exports.Widget1 = Widget1;
|
||||
function createWidget1() {
|
||||
return new Widget1();
|
||||
}
|
||||
exports.createWidget1 = createWidget1;
|
||||
(function (SpecializedWidget) {
|
||||
var Widget2 = (function () {
|
||||
function Widget2() {
|
||||
this.name = 'one';
|
||||
}
|
||||
return Widget2;
|
||||
})();
|
||||
SpecializedWidget.Widget2 = Widget2;
|
||||
function createWidget2() {
|
||||
return new Widget2();
|
||||
}
|
||||
SpecializedWidget.createWidget2 = createWidget2;
|
||||
})(exports.SpecializedWidget || (exports.SpecializedWidget = {}));
|
||||
var SpecializedWidget = exports.SpecializedWidget;
|
||||
//// [privacyFunctionCannotNameParameterTypeDeclFile_exporter.js]
|
||||
var Widgets = require("privacyFunctionCannotNameParameterTypeDeclFile_Widgets");
|
||||
var Widgets1 = require("GlobalWidgets");
|
||||
function createExportedWidget1() {
|
||||
return Widgets.createWidget1();
|
||||
}
|
||||
exports.createExportedWidget1 = createExportedWidget1;
|
||||
function createExportedWidget2() {
|
||||
return Widgets.SpecializedWidget.createWidget2();
|
||||
}
|
||||
exports.createExportedWidget2 = createExportedWidget2;
|
||||
function createExportedWidget3() {
|
||||
return Widgets1.createWidget3();
|
||||
}
|
||||
exports.createExportedWidget3 = createExportedWidget3;
|
||||
function createExportedWidget4() {
|
||||
return Widgets1.SpecializedGlobalWidget.createWidget4();
|
||||
}
|
||||
exports.createExportedWidget4 = createExportedWidget4;
|
||||
//// [privacyFunctionCannotNameParameterTypeDeclFile_consumer.js]
|
||||
var exporter = require("privacyFunctionCannotNameParameterTypeDeclFile_exporter");
|
||||
var publicClassWithWithPrivateParmeterTypes = (function () {
|
||||
function publicClassWithWithPrivateParmeterTypes(param, param1, param2) {
|
||||
if (param === void 0) { param = exporter.createExportedWidget1(); }
|
||||
if (param1 === void 0) { param1 = exporter.createExportedWidget1(); }
|
||||
if (param2 === void 0) { param2 = exporter.createExportedWidget1(); }
|
||||
this.param1 = param1;
|
||||
this.param2 = param2;
|
||||
}
|
||||
publicClassWithWithPrivateParmeterTypes.myPublicStaticMethod = function (param) {
|
||||
if (param === void 0) { param = exporter.createExportedWidget1(); }
|
||||
};
|
||||
publicClassWithWithPrivateParmeterTypes.myPrivateStaticMethod = function (param) {
|
||||
if (param === void 0) { param = exporter.createExportedWidget1(); }
|
||||
};
|
||||
publicClassWithWithPrivateParmeterTypes.prototype.myPublicMethod = function (param) {
|
||||
if (param === void 0) { param = exporter.createExportedWidget1(); }
|
||||
};
|
||||
publicClassWithWithPrivateParmeterTypes.prototype.myPrivateMethod = function (param) {
|
||||
if (param === void 0) { param = exporter.createExportedWidget1(); }
|
||||
};
|
||||
return publicClassWithWithPrivateParmeterTypes;
|
||||
})();
|
||||
exports.publicClassWithWithPrivateParmeterTypes = publicClassWithWithPrivateParmeterTypes;
|
||||
var publicClassWithWithPrivateParmeterTypes1 = (function () {
|
||||
function publicClassWithWithPrivateParmeterTypes1(param, param1, param2) {
|
||||
if (param === void 0) { param = exporter.createExportedWidget3(); }
|
||||
if (param1 === void 0) { param1 = exporter.createExportedWidget3(); }
|
||||
if (param2 === void 0) { param2 = exporter.createExportedWidget3(); }
|
||||
this.param1 = param1;
|
||||
this.param2 = param2;
|
||||
}
|
||||
publicClassWithWithPrivateParmeterTypes1.myPublicStaticMethod = function (param) {
|
||||
if (param === void 0) { param = exporter.createExportedWidget3(); }
|
||||
};
|
||||
publicClassWithWithPrivateParmeterTypes1.myPrivateStaticMethod = function (param) {
|
||||
if (param === void 0) { param = exporter.createExportedWidget3(); }
|
||||
};
|
||||
publicClassWithWithPrivateParmeterTypes1.prototype.myPublicMethod = function (param) {
|
||||
if (param === void 0) { param = exporter.createExportedWidget3(); }
|
||||
};
|
||||
publicClassWithWithPrivateParmeterTypes1.prototype.myPrivateMethod = function (param) {
|
||||
if (param === void 0) { param = exporter.createExportedWidget3(); }
|
||||
};
|
||||
return publicClassWithWithPrivateParmeterTypes1;
|
||||
})();
|
||||
exports.publicClassWithWithPrivateParmeterTypes1 = publicClassWithWithPrivateParmeterTypes1;
|
||||
var privateClassWithWithPrivateParmeterTypes = (function () {
|
||||
function privateClassWithWithPrivateParmeterTypes(param, param1, param2) {
|
||||
if (param === void 0) { param = exporter.createExportedWidget1(); }
|
||||
if (param1 === void 0) { param1 = exporter.createExportedWidget1(); }
|
||||
if (param2 === void 0) { param2 = exporter.createExportedWidget1(); }
|
||||
this.param1 = param1;
|
||||
this.param2 = param2;
|
||||
}
|
||||
privateClassWithWithPrivateParmeterTypes.myPublicStaticMethod = function (param) {
|
||||
if (param === void 0) { param = exporter.createExportedWidget1(); }
|
||||
};
|
||||
privateClassWithWithPrivateParmeterTypes.myPrivateStaticMethod = function (param) {
|
||||
if (param === void 0) { param = exporter.createExportedWidget1(); }
|
||||
};
|
||||
privateClassWithWithPrivateParmeterTypes.prototype.myPublicMethod = function (param) {
|
||||
if (param === void 0) { param = exporter.createExportedWidget1(); }
|
||||
};
|
||||
privateClassWithWithPrivateParmeterTypes.prototype.myPrivateMethod = function (param) {
|
||||
if (param === void 0) { param = exporter.createExportedWidget1(); }
|
||||
};
|
||||
return privateClassWithWithPrivateParmeterTypes;
|
||||
})();
|
||||
var privateClassWithWithPrivateParmeterTypes2 = (function () {
|
||||
function privateClassWithWithPrivateParmeterTypes2(param, param1, param2) {
|
||||
if (param === void 0) { param = exporter.createExportedWidget3(); }
|
||||
if (param1 === void 0) { param1 = exporter.createExportedWidget3(); }
|
||||
if (param2 === void 0) { param2 = exporter.createExportedWidget3(); }
|
||||
this.param1 = param1;
|
||||
this.param2 = param2;
|
||||
}
|
||||
privateClassWithWithPrivateParmeterTypes2.myPublicStaticMethod = function (param) {
|
||||
if (param === void 0) { param = exporter.createExportedWidget3(); }
|
||||
};
|
||||
privateClassWithWithPrivateParmeterTypes2.myPrivateStaticMethod = function (param) {
|
||||
if (param === void 0) { param = exporter.createExportedWidget3(); }
|
||||
};
|
||||
privateClassWithWithPrivateParmeterTypes2.prototype.myPublicMethod = function (param) {
|
||||
if (param === void 0) { param = exporter.createExportedWidget3(); }
|
||||
};
|
||||
privateClassWithWithPrivateParmeterTypes2.prototype.myPrivateMethod = function (param) {
|
||||
if (param === void 0) { param = exporter.createExportedWidget3(); }
|
||||
};
|
||||
return privateClassWithWithPrivateParmeterTypes2;
|
||||
})();
|
||||
function publicFunctionWithPrivateParmeterTypes(param) {
|
||||
if (param === void 0) { param = exporter.createExportedWidget1(); }
|
||||
}
|
||||
exports.publicFunctionWithPrivateParmeterTypes = publicFunctionWithPrivateParmeterTypes;
|
||||
function privateFunctionWithPrivateParmeterTypes(param) {
|
||||
if (param === void 0) { param = exporter.createExportedWidget1(); }
|
||||
}
|
||||
function publicFunctionWithPrivateParmeterTypes1(param) {
|
||||
if (param === void 0) { param = exporter.createExportedWidget3(); }
|
||||
}
|
||||
exports.publicFunctionWithPrivateParmeterTypes1 = publicFunctionWithPrivateParmeterTypes1;
|
||||
function privateFunctionWithPrivateParmeterTypes1(param) {
|
||||
if (param === void 0) { param = exporter.createExportedWidget3(); }
|
||||
}
|
||||
var publicClassWithPrivateModuleParameterTypes = (function () {
|
||||
function publicClassWithPrivateModuleParameterTypes(param, param1, param2) {
|
||||
if (param === void 0) { param = exporter.createExportedWidget2(); }
|
||||
if (param1 === void 0) { param1 = exporter.createExportedWidget2(); }
|
||||
if (param2 === void 0) { param2 = exporter.createExportedWidget2(); }
|
||||
this.param1 = param1;
|
||||
this.param2 = param2;
|
||||
}
|
||||
publicClassWithPrivateModuleParameterTypes.myPublicStaticMethod = function (param) {
|
||||
if (param === void 0) { param = exporter.createExportedWidget2(); }
|
||||
};
|
||||
publicClassWithPrivateModuleParameterTypes.prototype.myPublicMethod = function (param) {
|
||||
if (param === void 0) { param = exporter.createExportedWidget2(); }
|
||||
};
|
||||
return publicClassWithPrivateModuleParameterTypes;
|
||||
})();
|
||||
exports.publicClassWithPrivateModuleParameterTypes = publicClassWithPrivateModuleParameterTypes;
|
||||
var publicClassWithPrivateModuleParameterTypes2 = (function () {
|
||||
function publicClassWithPrivateModuleParameterTypes2(param, param1, param2) {
|
||||
if (param === void 0) { param = exporter.createExportedWidget4(); }
|
||||
if (param1 === void 0) { param1 = exporter.createExportedWidget4(); }
|
||||
if (param2 === void 0) { param2 = exporter.createExportedWidget4(); }
|
||||
this.param1 = param1;
|
||||
this.param2 = param2;
|
||||
}
|
||||
publicClassWithPrivateModuleParameterTypes2.myPublicStaticMethod = function (param) {
|
||||
if (param === void 0) { param = exporter.createExportedWidget4(); }
|
||||
};
|
||||
publicClassWithPrivateModuleParameterTypes2.prototype.myPublicMethod = function (param) {
|
||||
if (param === void 0) { param = exporter.createExportedWidget4(); }
|
||||
};
|
||||
return publicClassWithPrivateModuleParameterTypes2;
|
||||
})();
|
||||
exports.publicClassWithPrivateModuleParameterTypes2 = publicClassWithPrivateModuleParameterTypes2;
|
||||
function publicFunctionWithPrivateModuleParameterTypes(param) {
|
||||
if (param === void 0) { param = exporter.createExportedWidget2(); }
|
||||
}
|
||||
exports.publicFunctionWithPrivateModuleParameterTypes = publicFunctionWithPrivateModuleParameterTypes;
|
||||
function publicFunctionWithPrivateModuleParameterTypes1(param) {
|
||||
if (param === void 0) { param = exporter.createExportedWidget4(); }
|
||||
}
|
||||
exports.publicFunctionWithPrivateModuleParameterTypes1 = publicFunctionWithPrivateModuleParameterTypes1;
|
||||
var privateClassWithPrivateModuleParameterTypes = (function () {
|
||||
function privateClassWithPrivateModuleParameterTypes(param, param1, param2) {
|
||||
if (param === void 0) { param = exporter.createExportedWidget2(); }
|
||||
if (param1 === void 0) { param1 = exporter.createExportedWidget2(); }
|
||||
if (param2 === void 0) { param2 = exporter.createExportedWidget2(); }
|
||||
this.param1 = param1;
|
||||
this.param2 = param2;
|
||||
}
|
||||
privateClassWithPrivateModuleParameterTypes.myPublicStaticMethod = function (param) {
|
||||
if (param === void 0) { param = exporter.createExportedWidget2(); }
|
||||
};
|
||||
privateClassWithPrivateModuleParameterTypes.prototype.myPublicMethod = function (param) {
|
||||
if (param === void 0) { param = exporter.createExportedWidget2(); }
|
||||
};
|
||||
return privateClassWithPrivateModuleParameterTypes;
|
||||
})();
|
||||
var privateClassWithPrivateModuleParameterTypes1 = (function () {
|
||||
function privateClassWithPrivateModuleParameterTypes1(param, param1, param2) {
|
||||
if (param === void 0) { param = exporter.createExportedWidget4(); }
|
||||
if (param1 === void 0) { param1 = exporter.createExportedWidget4(); }
|
||||
if (param2 === void 0) { param2 = exporter.createExportedWidget4(); }
|
||||
this.param1 = param1;
|
||||
this.param2 = param2;
|
||||
}
|
||||
privateClassWithPrivateModuleParameterTypes1.myPublicStaticMethod = function (param) {
|
||||
if (param === void 0) { param = exporter.createExportedWidget4(); }
|
||||
};
|
||||
privateClassWithPrivateModuleParameterTypes1.prototype.myPublicMethod = function (param) {
|
||||
if (param === void 0) { param = exporter.createExportedWidget4(); }
|
||||
};
|
||||
return privateClassWithPrivateModuleParameterTypes1;
|
||||
})();
|
||||
function privateFunctionWithPrivateModuleParameterTypes(param) {
|
||||
if (param === void 0) { param = exporter.createExportedWidget2(); }
|
||||
}
|
||||
function privateFunctionWithPrivateModuleParameterTypes1(param) {
|
||||
if (param === void 0) { param = exporter.createExportedWidget4(); }
|
||||
}
|
||||
|
||||
|
||||
//// [privacyFunctionCannotNameParameterTypeDeclFile_GlobalWidgets.d.ts]
|
||||
declare module "GlobalWidgets" {
|
||||
class Widget3 {
|
||||
name: string;
|
||||
}
|
||||
function createWidget3(): Widget3;
|
||||
module SpecializedGlobalWidget {
|
||||
class Widget4 {
|
||||
name: string;
|
||||
}
|
||||
function createWidget4(): Widget4;
|
||||
}
|
||||
}
|
||||
//// [privacyFunctionCannotNameParameterTypeDeclFile_Widgets.d.ts]
|
||||
export declare class Widget1 {
|
||||
name: string;
|
||||
}
|
||||
export declare function createWidget1(): Widget1;
|
||||
export declare module SpecializedWidget {
|
||||
class Widget2 {
|
||||
name: string;
|
||||
}
|
||||
function createWidget2(): Widget2;
|
||||
}
|
||||
//// [privacyFunctionCannotNameParameterTypeDeclFile_exporter.d.ts]
|
||||
/// <reference path='privacyFunctionCannotNameParameterTypeDeclFile_GlobalWidgets.d.ts' />
|
||||
import Widgets = require("privacyFunctionCannotNameParameterTypeDeclFile_Widgets");
|
||||
import Widgets1 = require("GlobalWidgets");
|
||||
export declare function createExportedWidget1(): Widgets.Widget1;
|
||||
export declare function createExportedWidget2(): Widgets.SpecializedWidget.Widget2;
|
||||
export declare function createExportedWidget3(): Widgets1.Widget3;
|
||||
export declare function createExportedWidget4(): Widgets1.SpecializedGlobalWidget.Widget4;
|
|
@ -0,0 +1,186 @@
|
|||
==== tests/cases/compiler/privacyFunctionReturnTypeDeclFile_consumer.ts (12 errors) ====
|
||||
import exporter = require("privacyFunctionReturnTypeDeclFile_exporter");
|
||||
export class publicClassWithWithPrivateParmeterTypes {
|
||||
static myPublicStaticMethod() { // Error
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Return type of public static method from exported class has or is using name 'Widget1' from external module "tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets" but cannot be named.
|
||||
return exporter.createExportedWidget1();
|
||||
}
|
||||
private static myPrivateStaticMethod() {
|
||||
return exporter.createExportedWidget1();;
|
||||
}
|
||||
myPublicMethod() { // Error
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Return type of public method from exported class has or is using name 'Widget1' from external module "tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets" but cannot be named.
|
||||
return exporter.createExportedWidget1();;
|
||||
}
|
||||
private myPrivateMethod() {
|
||||
return exporter.createExportedWidget1();;
|
||||
}
|
||||
static myPublicStaticMethod1() { // Error
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Return type of public static method from exported class has or is using name 'Widget3' from external module "GlobalWidgets" but cannot be named.
|
||||
return exporter.createExportedWidget3();
|
||||
}
|
||||
private static myPrivateStaticMethod1() {
|
||||
return exporter.createExportedWidget3();;
|
||||
}
|
||||
myPublicMethod1() { // Error
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! Return type of public method from exported class has or is using name 'Widget3' from external module "GlobalWidgets" but cannot be named.
|
||||
return exporter.createExportedWidget3();;
|
||||
}
|
||||
private myPrivateMethod1() {
|
||||
return exporter.createExportedWidget3();;
|
||||
}
|
||||
}
|
||||
|
||||
class privateClassWithWithPrivateParmeterTypes {
|
||||
static myPublicStaticMethod() {
|
||||
return exporter.createExportedWidget1();
|
||||
}
|
||||
private static myPrivateStaticMethod() {
|
||||
return exporter.createExportedWidget1();;
|
||||
}
|
||||
myPublicMethod() {
|
||||
return exporter.createExportedWidget1();;
|
||||
}
|
||||
private myPrivateMethod() {
|
||||
return exporter.createExportedWidget1();;
|
||||
}
|
||||
static myPublicStaticMethod1() {
|
||||
return exporter.createExportedWidget3();
|
||||
}
|
||||
private static myPrivateStaticMethod1() {
|
||||
return exporter.createExportedWidget3();;
|
||||
}
|
||||
myPublicMethod1() {
|
||||
return exporter.createExportedWidget3();;
|
||||
}
|
||||
private myPrivateMethod1() {
|
||||
return exporter.createExportedWidget3();;
|
||||
}
|
||||
}
|
||||
|
||||
export function publicFunctionWithPrivateParmeterTypes() { // Error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Return type of exported function has or is using name 'Widget1' from external module "tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets" but cannot be named.
|
||||
return exporter.createExportedWidget1();
|
||||
}
|
||||
function privateFunctionWithPrivateParmeterTypes() {
|
||||
return exporter.createExportedWidget1();
|
||||
}
|
||||
export function publicFunctionWithPrivateParmeterTypes1() { // Error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Return type of exported function has or is using name 'Widget3' from external module "GlobalWidgets" but cannot be named.
|
||||
return exporter.createExportedWidget3();
|
||||
}
|
||||
function privateFunctionWithPrivateParmeterTypes1() {
|
||||
return exporter.createExportedWidget3();
|
||||
}
|
||||
|
||||
export class publicClassWithPrivateModuleReturnTypes {
|
||||
static myPublicStaticMethod() { // Error
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Return type of public static method from exported class has or is using name 'SpecializedWidget.Widget2' from external module "tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets" but cannot be named.
|
||||
return exporter.createExportedWidget2();
|
||||
}
|
||||
myPublicMethod() { // Error
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Return type of public method from exported class has or is using name 'SpecializedWidget.Widget2' from external module "tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets" but cannot be named.
|
||||
return exporter.createExportedWidget2();
|
||||
}
|
||||
static myPublicStaticMethod1() { // Error
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Return type of public static method from exported class has or is using name 'SpecializedGlobalWidget.Widget4' from external module "GlobalWidgets" but cannot be named.
|
||||
return exporter.createExportedWidget4();
|
||||
}
|
||||
myPublicMethod1() { // Error
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! Return type of public method from exported class has or is using name 'SpecializedGlobalWidget.Widget4' from external module "GlobalWidgets" but cannot be named.
|
||||
return exporter.createExportedWidget4();
|
||||
}
|
||||
}
|
||||
export function publicFunctionWithPrivateModuleReturnTypes() { // Error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Return type of exported function has or is using name 'SpecializedWidget.Widget2' from external module "tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets" but cannot be named.
|
||||
return exporter.createExportedWidget2();
|
||||
}
|
||||
export function publicFunctionWithPrivateModuleReturnTypes1() { // Error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Return type of exported function has or is using name 'SpecializedGlobalWidget.Widget4' from external module "GlobalWidgets" but cannot be named.
|
||||
return exporter.createExportedWidget4();
|
||||
}
|
||||
|
||||
class privateClassWithPrivateModuleReturnTypes {
|
||||
static myPublicStaticMethod() {
|
||||
return exporter.createExportedWidget2();
|
||||
}
|
||||
myPublicMethod() {
|
||||
return exporter.createExportedWidget2();
|
||||
}
|
||||
static myPublicStaticMethod1() { // Error
|
||||
return exporter.createExportedWidget4();
|
||||
}
|
||||
myPublicMethod1() { // Error
|
||||
return exporter.createExportedWidget4();
|
||||
}
|
||||
}
|
||||
function privateFunctionWithPrivateModuleReturnTypes() {
|
||||
return exporter.createExportedWidget2();
|
||||
}
|
||||
function privateFunctionWithPrivateModuleReturnTypes1() {
|
||||
return exporter.createExportedWidget4();
|
||||
}
|
||||
|
||||
==== tests/cases/compiler/privacyFunctionReturnTypeDeclFile_GlobalWidgets.ts (0 errors) ====
|
||||
|
||||
|
||||
declare module "GlobalWidgets" {
|
||||
export class Widget3 {
|
||||
name: string;
|
||||
}
|
||||
export function createWidget3(): Widget3;
|
||||
|
||||
export module SpecializedGlobalWidget {
|
||||
export class Widget4 {
|
||||
name: string;
|
||||
}
|
||||
function createWidget4(): Widget4;
|
||||
}
|
||||
}
|
||||
|
||||
==== tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets.ts (0 errors) ====
|
||||
export class Widget1 {
|
||||
name = 'one';
|
||||
}
|
||||
export function createWidget1() {
|
||||
return new Widget1();
|
||||
}
|
||||
|
||||
export module SpecializedWidget {
|
||||
export class Widget2 {
|
||||
name = 'one';
|
||||
}
|
||||
export function createWidget2() {
|
||||
return new Widget2();
|
||||
}
|
||||
}
|
||||
|
||||
==== tests/cases/compiler/privacyFunctionReturnTypeDeclFile_exporter.ts (0 errors) ====
|
||||
///<reference path='privacyFunctionReturnTypeDeclFile_GlobalWidgets.ts'/>
|
||||
import Widgets = require("privacyFunctionReturnTypeDeclFile_Widgets");
|
||||
import Widgets1 = require("GlobalWidgets");
|
||||
export function createExportedWidget1() {
|
||||
return Widgets.createWidget1();
|
||||
}
|
||||
export function createExportedWidget2() {
|
||||
return Widgets.SpecializedWidget.createWidget2();
|
||||
}
|
||||
export function createExportedWidget3() {
|
||||
return Widgets1.createWidget3();
|
||||
}
|
||||
export function createExportedWidget4() {
|
||||
return Widgets1.SpecializedGlobalWidget.createWidget4();
|
||||
}
|
||||
|
|
@ -0,0 +1,381 @@
|
|||
//// [tests/cases/compiler/privacyFunctionCannotNameReturnTypeDeclFile.ts] ////
|
||||
|
||||
//// [privacyFunctionReturnTypeDeclFile_GlobalWidgets.ts]
|
||||
|
||||
|
||||
declare module "GlobalWidgets" {
|
||||
export class Widget3 {
|
||||
name: string;
|
||||
}
|
||||
export function createWidget3(): Widget3;
|
||||
|
||||
export module SpecializedGlobalWidget {
|
||||
export class Widget4 {
|
||||
name: string;
|
||||
}
|
||||
function createWidget4(): Widget4;
|
||||
}
|
||||
}
|
||||
|
||||
//// [privacyFunctionReturnTypeDeclFile_Widgets.ts]
|
||||
export class Widget1 {
|
||||
name = 'one';
|
||||
}
|
||||
export function createWidget1() {
|
||||
return new Widget1();
|
||||
}
|
||||
|
||||
export module SpecializedWidget {
|
||||
export class Widget2 {
|
||||
name = 'one';
|
||||
}
|
||||
export function createWidget2() {
|
||||
return new Widget2();
|
||||
}
|
||||
}
|
||||
|
||||
//// [privacyFunctionReturnTypeDeclFile_exporter.ts]
|
||||
///<reference path='privacyFunctionReturnTypeDeclFile_GlobalWidgets.ts'/>
|
||||
import Widgets = require("privacyFunctionReturnTypeDeclFile_Widgets");
|
||||
import Widgets1 = require("GlobalWidgets");
|
||||
export function createExportedWidget1() {
|
||||
return Widgets.createWidget1();
|
||||
}
|
||||
export function createExportedWidget2() {
|
||||
return Widgets.SpecializedWidget.createWidget2();
|
||||
}
|
||||
export function createExportedWidget3() {
|
||||
return Widgets1.createWidget3();
|
||||
}
|
||||
export function createExportedWidget4() {
|
||||
return Widgets1.SpecializedGlobalWidget.createWidget4();
|
||||
}
|
||||
|
||||
//// [privacyFunctionReturnTypeDeclFile_consumer.ts]
|
||||
import exporter = require("privacyFunctionReturnTypeDeclFile_exporter");
|
||||
export class publicClassWithWithPrivateParmeterTypes {
|
||||
static myPublicStaticMethod() { // Error
|
||||
return exporter.createExportedWidget1();
|
||||
}
|
||||
private static myPrivateStaticMethod() {
|
||||
return exporter.createExportedWidget1();;
|
||||
}
|
||||
myPublicMethod() { // Error
|
||||
return exporter.createExportedWidget1();;
|
||||
}
|
||||
private myPrivateMethod() {
|
||||
return exporter.createExportedWidget1();;
|
||||
}
|
||||
static myPublicStaticMethod1() { // Error
|
||||
return exporter.createExportedWidget3();
|
||||
}
|
||||
private static myPrivateStaticMethod1() {
|
||||
return exporter.createExportedWidget3();;
|
||||
}
|
||||
myPublicMethod1() { // Error
|
||||
return exporter.createExportedWidget3();;
|
||||
}
|
||||
private myPrivateMethod1() {
|
||||
return exporter.createExportedWidget3();;
|
||||
}
|
||||
}
|
||||
|
||||
class privateClassWithWithPrivateParmeterTypes {
|
||||
static myPublicStaticMethod() {
|
||||
return exporter.createExportedWidget1();
|
||||
}
|
||||
private static myPrivateStaticMethod() {
|
||||
return exporter.createExportedWidget1();;
|
||||
}
|
||||
myPublicMethod() {
|
||||
return exporter.createExportedWidget1();;
|
||||
}
|
||||
private myPrivateMethod() {
|
||||
return exporter.createExportedWidget1();;
|
||||
}
|
||||
static myPublicStaticMethod1() {
|
||||
return exporter.createExportedWidget3();
|
||||
}
|
||||
private static myPrivateStaticMethod1() {
|
||||
return exporter.createExportedWidget3();;
|
||||
}
|
||||
myPublicMethod1() {
|
||||
return exporter.createExportedWidget3();;
|
||||
}
|
||||
private myPrivateMethod1() {
|
||||
return exporter.createExportedWidget3();;
|
||||
}
|
||||
}
|
||||
|
||||
export function publicFunctionWithPrivateParmeterTypes() { // Error
|
||||
return exporter.createExportedWidget1();
|
||||
}
|
||||
function privateFunctionWithPrivateParmeterTypes() {
|
||||
return exporter.createExportedWidget1();
|
||||
}
|
||||
export function publicFunctionWithPrivateParmeterTypes1() { // Error
|
||||
return exporter.createExportedWidget3();
|
||||
}
|
||||
function privateFunctionWithPrivateParmeterTypes1() {
|
||||
return exporter.createExportedWidget3();
|
||||
}
|
||||
|
||||
export class publicClassWithPrivateModuleReturnTypes {
|
||||
static myPublicStaticMethod() { // Error
|
||||
return exporter.createExportedWidget2();
|
||||
}
|
||||
myPublicMethod() { // Error
|
||||
return exporter.createExportedWidget2();
|
||||
}
|
||||
static myPublicStaticMethod1() { // Error
|
||||
return exporter.createExportedWidget4();
|
||||
}
|
||||
myPublicMethod1() { // Error
|
||||
return exporter.createExportedWidget4();
|
||||
}
|
||||
}
|
||||
export function publicFunctionWithPrivateModuleReturnTypes() { // Error
|
||||
return exporter.createExportedWidget2();
|
||||
}
|
||||
export function publicFunctionWithPrivateModuleReturnTypes1() { // Error
|
||||
return exporter.createExportedWidget4();
|
||||
}
|
||||
|
||||
class privateClassWithPrivateModuleReturnTypes {
|
||||
static myPublicStaticMethod() {
|
||||
return exporter.createExportedWidget2();
|
||||
}
|
||||
myPublicMethod() {
|
||||
return exporter.createExportedWidget2();
|
||||
}
|
||||
static myPublicStaticMethod1() { // Error
|
||||
return exporter.createExportedWidget4();
|
||||
}
|
||||
myPublicMethod1() { // Error
|
||||
return exporter.createExportedWidget4();
|
||||
}
|
||||
}
|
||||
function privateFunctionWithPrivateModuleReturnTypes() {
|
||||
return exporter.createExportedWidget2();
|
||||
}
|
||||
function privateFunctionWithPrivateModuleReturnTypes1() {
|
||||
return exporter.createExportedWidget4();
|
||||
}
|
||||
|
||||
|
||||
//// [privacyFunctionReturnTypeDeclFile_GlobalWidgets.js]
|
||||
//// [privacyFunctionReturnTypeDeclFile_Widgets.js]
|
||||
var Widget1 = (function () {
|
||||
function Widget1() {
|
||||
this.name = 'one';
|
||||
}
|
||||
return Widget1;
|
||||
})();
|
||||
exports.Widget1 = Widget1;
|
||||
function createWidget1() {
|
||||
return new Widget1();
|
||||
}
|
||||
exports.createWidget1 = createWidget1;
|
||||
(function (SpecializedWidget) {
|
||||
var Widget2 = (function () {
|
||||
function Widget2() {
|
||||
this.name = 'one';
|
||||
}
|
||||
return Widget2;
|
||||
})();
|
||||
SpecializedWidget.Widget2 = Widget2;
|
||||
function createWidget2() {
|
||||
return new Widget2();
|
||||
}
|
||||
SpecializedWidget.createWidget2 = createWidget2;
|
||||
})(exports.SpecializedWidget || (exports.SpecializedWidget = {}));
|
||||
var SpecializedWidget = exports.SpecializedWidget;
|
||||
//// [privacyFunctionReturnTypeDeclFile_exporter.js]
|
||||
var Widgets = require("privacyFunctionReturnTypeDeclFile_Widgets");
|
||||
var Widgets1 = require("GlobalWidgets");
|
||||
function createExportedWidget1() {
|
||||
return Widgets.createWidget1();
|
||||
}
|
||||
exports.createExportedWidget1 = createExportedWidget1;
|
||||
function createExportedWidget2() {
|
||||
return Widgets.SpecializedWidget.createWidget2();
|
||||
}
|
||||
exports.createExportedWidget2 = createExportedWidget2;
|
||||
function createExportedWidget3() {
|
||||
return Widgets1.createWidget3();
|
||||
}
|
||||
exports.createExportedWidget3 = createExportedWidget3;
|
||||
function createExportedWidget4() {
|
||||
return Widgets1.SpecializedGlobalWidget.createWidget4();
|
||||
}
|
||||
exports.createExportedWidget4 = createExportedWidget4;
|
||||
//// [privacyFunctionReturnTypeDeclFile_consumer.js]
|
||||
var exporter = require("privacyFunctionReturnTypeDeclFile_exporter");
|
||||
var publicClassWithWithPrivateParmeterTypes = (function () {
|
||||
function publicClassWithWithPrivateParmeterTypes() {
|
||||
}
|
||||
publicClassWithWithPrivateParmeterTypes.myPublicStaticMethod = function () {
|
||||
return exporter.createExportedWidget1();
|
||||
};
|
||||
publicClassWithWithPrivateParmeterTypes.myPrivateStaticMethod = function () {
|
||||
return exporter.createExportedWidget1();
|
||||
;
|
||||
};
|
||||
publicClassWithWithPrivateParmeterTypes.prototype.myPublicMethod = function () {
|
||||
return exporter.createExportedWidget1();
|
||||
;
|
||||
};
|
||||
publicClassWithWithPrivateParmeterTypes.prototype.myPrivateMethod = function () {
|
||||
return exporter.createExportedWidget1();
|
||||
;
|
||||
};
|
||||
publicClassWithWithPrivateParmeterTypes.myPublicStaticMethod1 = function () {
|
||||
return exporter.createExportedWidget3();
|
||||
};
|
||||
publicClassWithWithPrivateParmeterTypes.myPrivateStaticMethod1 = function () {
|
||||
return exporter.createExportedWidget3();
|
||||
;
|
||||
};
|
||||
publicClassWithWithPrivateParmeterTypes.prototype.myPublicMethod1 = function () {
|
||||
return exporter.createExportedWidget3();
|
||||
;
|
||||
};
|
||||
publicClassWithWithPrivateParmeterTypes.prototype.myPrivateMethod1 = function () {
|
||||
return exporter.createExportedWidget3();
|
||||
;
|
||||
};
|
||||
return publicClassWithWithPrivateParmeterTypes;
|
||||
})();
|
||||
exports.publicClassWithWithPrivateParmeterTypes = publicClassWithWithPrivateParmeterTypes;
|
||||
var privateClassWithWithPrivateParmeterTypes = (function () {
|
||||
function privateClassWithWithPrivateParmeterTypes() {
|
||||
}
|
||||
privateClassWithWithPrivateParmeterTypes.myPublicStaticMethod = function () {
|
||||
return exporter.createExportedWidget1();
|
||||
};
|
||||
privateClassWithWithPrivateParmeterTypes.myPrivateStaticMethod = function () {
|
||||
return exporter.createExportedWidget1();
|
||||
;
|
||||
};
|
||||
privateClassWithWithPrivateParmeterTypes.prototype.myPublicMethod = function () {
|
||||
return exporter.createExportedWidget1();
|
||||
;
|
||||
};
|
||||
privateClassWithWithPrivateParmeterTypes.prototype.myPrivateMethod = function () {
|
||||
return exporter.createExportedWidget1();
|
||||
;
|
||||
};
|
||||
privateClassWithWithPrivateParmeterTypes.myPublicStaticMethod1 = function () {
|
||||
return exporter.createExportedWidget3();
|
||||
};
|
||||
privateClassWithWithPrivateParmeterTypes.myPrivateStaticMethod1 = function () {
|
||||
return exporter.createExportedWidget3();
|
||||
;
|
||||
};
|
||||
privateClassWithWithPrivateParmeterTypes.prototype.myPublicMethod1 = function () {
|
||||
return exporter.createExportedWidget3();
|
||||
;
|
||||
};
|
||||
privateClassWithWithPrivateParmeterTypes.prototype.myPrivateMethod1 = function () {
|
||||
return exporter.createExportedWidget3();
|
||||
;
|
||||
};
|
||||
return privateClassWithWithPrivateParmeterTypes;
|
||||
})();
|
||||
function publicFunctionWithPrivateParmeterTypes() {
|
||||
return exporter.createExportedWidget1();
|
||||
}
|
||||
exports.publicFunctionWithPrivateParmeterTypes = publicFunctionWithPrivateParmeterTypes;
|
||||
function privateFunctionWithPrivateParmeterTypes() {
|
||||
return exporter.createExportedWidget1();
|
||||
}
|
||||
function publicFunctionWithPrivateParmeterTypes1() {
|
||||
return exporter.createExportedWidget3();
|
||||
}
|
||||
exports.publicFunctionWithPrivateParmeterTypes1 = publicFunctionWithPrivateParmeterTypes1;
|
||||
function privateFunctionWithPrivateParmeterTypes1() {
|
||||
return exporter.createExportedWidget3();
|
||||
}
|
||||
var publicClassWithPrivateModuleReturnTypes = (function () {
|
||||
function publicClassWithPrivateModuleReturnTypes() {
|
||||
}
|
||||
publicClassWithPrivateModuleReturnTypes.myPublicStaticMethod = function () {
|
||||
return exporter.createExportedWidget2();
|
||||
};
|
||||
publicClassWithPrivateModuleReturnTypes.prototype.myPublicMethod = function () {
|
||||
return exporter.createExportedWidget2();
|
||||
};
|
||||
publicClassWithPrivateModuleReturnTypes.myPublicStaticMethod1 = function () {
|
||||
return exporter.createExportedWidget4();
|
||||
};
|
||||
publicClassWithPrivateModuleReturnTypes.prototype.myPublicMethod1 = function () {
|
||||
return exporter.createExportedWidget4();
|
||||
};
|
||||
return publicClassWithPrivateModuleReturnTypes;
|
||||
})();
|
||||
exports.publicClassWithPrivateModuleReturnTypes = publicClassWithPrivateModuleReturnTypes;
|
||||
function publicFunctionWithPrivateModuleReturnTypes() {
|
||||
return exporter.createExportedWidget2();
|
||||
}
|
||||
exports.publicFunctionWithPrivateModuleReturnTypes = publicFunctionWithPrivateModuleReturnTypes;
|
||||
function publicFunctionWithPrivateModuleReturnTypes1() {
|
||||
return exporter.createExportedWidget4();
|
||||
}
|
||||
exports.publicFunctionWithPrivateModuleReturnTypes1 = publicFunctionWithPrivateModuleReturnTypes1;
|
||||
var privateClassWithPrivateModuleReturnTypes = (function () {
|
||||
function privateClassWithPrivateModuleReturnTypes() {
|
||||
}
|
||||
privateClassWithPrivateModuleReturnTypes.myPublicStaticMethod = function () {
|
||||
return exporter.createExportedWidget2();
|
||||
};
|
||||
privateClassWithPrivateModuleReturnTypes.prototype.myPublicMethod = function () {
|
||||
return exporter.createExportedWidget2();
|
||||
};
|
||||
privateClassWithPrivateModuleReturnTypes.myPublicStaticMethod1 = function () {
|
||||
return exporter.createExportedWidget4();
|
||||
};
|
||||
privateClassWithPrivateModuleReturnTypes.prototype.myPublicMethod1 = function () {
|
||||
return exporter.createExportedWidget4();
|
||||
};
|
||||
return privateClassWithPrivateModuleReturnTypes;
|
||||
})();
|
||||
function privateFunctionWithPrivateModuleReturnTypes() {
|
||||
return exporter.createExportedWidget2();
|
||||
}
|
||||
function privateFunctionWithPrivateModuleReturnTypes1() {
|
||||
return exporter.createExportedWidget4();
|
||||
}
|
||||
|
||||
|
||||
//// [privacyFunctionReturnTypeDeclFile_GlobalWidgets.d.ts]
|
||||
declare module "GlobalWidgets" {
|
||||
class Widget3 {
|
||||
name: string;
|
||||
}
|
||||
function createWidget3(): Widget3;
|
||||
module SpecializedGlobalWidget {
|
||||
class Widget4 {
|
||||
name: string;
|
||||
}
|
||||
function createWidget4(): Widget4;
|
||||
}
|
||||
}
|
||||
//// [privacyFunctionReturnTypeDeclFile_Widgets.d.ts]
|
||||
export declare class Widget1 {
|
||||
name: string;
|
||||
}
|
||||
export declare function createWidget1(): Widget1;
|
||||
export declare module SpecializedWidget {
|
||||
class Widget2 {
|
||||
name: string;
|
||||
}
|
||||
function createWidget2(): Widget2;
|
||||
}
|
||||
//// [privacyFunctionReturnTypeDeclFile_exporter.d.ts]
|
||||
/// <reference path='privacyFunctionReturnTypeDeclFile_GlobalWidgets.d.ts' />
|
||||
import Widgets = require("privacyFunctionReturnTypeDeclFile_Widgets");
|
||||
import Widgets1 = require("GlobalWidgets");
|
||||
export declare function createExportedWidget1(): Widgets.Widget1;
|
||||
export declare function createExportedWidget2(): Widgets.SpecializedWidget.Widget2;
|
||||
export declare function createExportedWidget3(): Widgets1.Widget3;
|
||||
export declare function createExportedWidget4(): Widgets1.SpecializedGlobalWidget.Widget4;
|
|
@ -28,7 +28,6 @@ export module M.P {
|
|||
export interface I { }
|
||||
}
|
||||
export import im = M.P.f;
|
||||
// Bug 887180: Invalid .d.ts when an aliased entity is referenced, and a different entity is closer in scope
|
||||
export var a = M.a; // emitted incorrectly as typeof f
|
||||
export var b = M.b; // ok
|
||||
export var c = M.c; // ok
|
||||
|
|
|
@ -9,7 +9,6 @@ module X.Y.base {
|
|||
}
|
||||
|
||||
module X.Y.base.Z {
|
||||
// Bug 887180
|
||||
export var f = X.Y.base.f; // Should be base.f
|
||||
export var C = X.Y.base.C; // Should be base.C
|
||||
export var M = X.Y.base.M; // Should be base.M
|
||||
|
|
|
@ -21,7 +21,6 @@ module M.P {
|
|||
export enum D {
|
||||
f
|
||||
}
|
||||
// Bug 887180
|
||||
export var v: M.D; // ok
|
||||
export var w = M.D.f; // error, should be typeof M.D.f
|
||||
export var x = M.C.f; // error, should be typeof M.C.f
|
||||
|
|
138
tests/cases/compiler/privacyCannotNameAccessorDeclFile.ts
Normal file
138
tests/cases/compiler/privacyCannotNameAccessorDeclFile.ts
Normal file
|
@ -0,0 +1,138 @@
|
|||
// @target: ES5
|
||||
// @module: commonjs
|
||||
// @declaration: true
|
||||
|
||||
// @Filename: privacyCannotNameAccessorDeclFile_GlobalWidgets.ts
|
||||
declare module "GlobalWidgets" {
|
||||
export class Widget3 {
|
||||
name: string;
|
||||
}
|
||||
export function createWidget3(): Widget3;
|
||||
|
||||
export module SpecializedGlobalWidget {
|
||||
export class Widget4 {
|
||||
name: string;
|
||||
}
|
||||
function createWidget4(): Widget4;
|
||||
}
|
||||
}
|
||||
|
||||
// @Filename: privacyCannotNameAccessorDeclFile_Widgets.ts
|
||||
export class Widget1 {
|
||||
name = 'one';
|
||||
}
|
||||
export function createWidget1() {
|
||||
return new Widget1();
|
||||
}
|
||||
|
||||
export module SpecializedWidget {
|
||||
export class Widget2 {
|
||||
name = 'one';
|
||||
}
|
||||
export function createWidget2() {
|
||||
return new Widget2();
|
||||
}
|
||||
}
|
||||
|
||||
// @Filename:privacyCannotNameAccessorDeclFile_exporter.ts
|
||||
///<reference path='privacyCannotNameAccessorDeclFile_GlobalWidgets.ts'/>
|
||||
import Widgets = require("privacyCannotNameAccessorDeclFile_Widgets");
|
||||
import Widgets1 = require("GlobalWidgets");
|
||||
export function createExportedWidget1() {
|
||||
return Widgets.createWidget1();
|
||||
}
|
||||
export function createExportedWidget2() {
|
||||
return Widgets.SpecializedWidget.createWidget2();
|
||||
}
|
||||
export function createExportedWidget3() {
|
||||
return Widgets1.createWidget3();
|
||||
}
|
||||
export function createExportedWidget4() {
|
||||
return Widgets1.SpecializedGlobalWidget.createWidget4();
|
||||
}
|
||||
|
||||
// @Filename:privacyCannotNameAccessorDeclFile_consumer.ts
|
||||
import exporter = require("privacyCannotNameAccessorDeclFile_exporter");
|
||||
export class publicClassWithWithPrivateGetAccessorTypes {
|
||||
static get myPublicStaticMethod() { // Error
|
||||
return exporter.createExportedWidget1();
|
||||
}
|
||||
private static get myPrivateStaticMethod() {
|
||||
return exporter.createExportedWidget1();
|
||||
}
|
||||
get myPublicMethod() { // Error
|
||||
return exporter.createExportedWidget1();
|
||||
}
|
||||
private get myPrivateMethod() {
|
||||
return exporter.createExportedWidget1();
|
||||
}
|
||||
static get myPublicStaticMethod1() { // Error
|
||||
return exporter.createExportedWidget3();
|
||||
}
|
||||
private static get myPrivateStaticMethod1() {
|
||||
return exporter.createExportedWidget3();
|
||||
}
|
||||
get myPublicMethod1() { // Error
|
||||
return exporter.createExportedWidget3();
|
||||
}
|
||||
private get myPrivateMethod1() {
|
||||
return exporter.createExportedWidget3();
|
||||
}
|
||||
}
|
||||
|
||||
class privateClassWithWithPrivateGetAccessorTypes {
|
||||
static get myPublicStaticMethod() {
|
||||
return exporter.createExportedWidget1();
|
||||
}
|
||||
private static get myPrivateStaticMethod() {
|
||||
return exporter.createExportedWidget1();
|
||||
}
|
||||
get myPublicMethod() {
|
||||
return exporter.createExportedWidget1();
|
||||
}
|
||||
private get myPrivateMethod() {
|
||||
return exporter.createExportedWidget1();
|
||||
}
|
||||
static get myPublicStaticMethod1() {
|
||||
return exporter.createExportedWidget3();
|
||||
}
|
||||
private static get myPrivateStaticMethod1() {
|
||||
return exporter.createExportedWidget3();
|
||||
}
|
||||
get myPublicMethod1() {
|
||||
return exporter.createExportedWidget3();
|
||||
}
|
||||
private get myPrivateMethod1() {
|
||||
return exporter.createExportedWidget3();
|
||||
}
|
||||
}
|
||||
|
||||
export class publicClassWithPrivateModuleGetAccessorTypes {
|
||||
static get myPublicStaticMethod() { // Error
|
||||
return exporter.createExportedWidget2();
|
||||
}
|
||||
get myPublicMethod() { // Error
|
||||
return exporter.createExportedWidget2();
|
||||
}
|
||||
static get myPublicStaticMethod1() { // Error
|
||||
return exporter.createExportedWidget4();
|
||||
}
|
||||
get myPublicMethod1() { // Error
|
||||
return exporter.createExportedWidget4();
|
||||
}
|
||||
}
|
||||
|
||||
class privateClassWithPrivateModuleGetAccessorTypes {
|
||||
static get myPublicStaticMethod() {
|
||||
return exporter.createExportedWidget2();
|
||||
}
|
||||
get myPublicMethod() {
|
||||
return exporter.createExportedWidget2();
|
||||
}
|
||||
static get myPublicStaticMethod1() {
|
||||
return exporter.createExportedWidget4();
|
||||
}
|
||||
get myPublicMethod1() {
|
||||
return exporter.createExportedWidget4();
|
||||
}
|
||||
}
|
101
tests/cases/compiler/privacyCannotNameVarTypeDeclFile.ts
Normal file
101
tests/cases/compiler/privacyCannotNameVarTypeDeclFile.ts
Normal file
|
@ -0,0 +1,101 @@
|
|||
// @module: commonjs
|
||||
// @declaration: true
|
||||
|
||||
|
||||
// @Filename: privacyCannotNameVarTypeDeclFile_GlobalWidgets.ts
|
||||
declare module "GlobalWidgets" {
|
||||
export class Widget3 {
|
||||
name: string;
|
||||
}
|
||||
export function createWidget3(): Widget3;
|
||||
|
||||
export module SpecializedGlobalWidget {
|
||||
export class Widget4 {
|
||||
name: string;
|
||||
}
|
||||
function createWidget4(): Widget4;
|
||||
}
|
||||
}
|
||||
|
||||
// @Filename: privacyCannotNameVarTypeDeclFile_Widgets.ts
|
||||
export class Widget1 {
|
||||
name = 'one';
|
||||
}
|
||||
export function createWidget1() {
|
||||
return new Widget1();
|
||||
}
|
||||
|
||||
export module SpecializedWidget {
|
||||
export class Widget2 {
|
||||
name = 'one';
|
||||
}
|
||||
export function createWidget2() {
|
||||
return new Widget2();
|
||||
}
|
||||
}
|
||||
|
||||
// @Filename:privacyCannotNameVarTypeDeclFile_exporter.ts
|
||||
///<reference path='privacyCannotNameVarTypeDeclFile_GlobalWidgets.ts'/>
|
||||
import Widgets = require("privacyCannotNameVarTypeDeclFile_Widgets");
|
||||
import Widgets1 = require("GlobalWidgets");
|
||||
export function createExportedWidget1() {
|
||||
return Widgets.createWidget1();
|
||||
}
|
||||
export function createExportedWidget2() {
|
||||
return Widgets.SpecializedWidget.createWidget2();
|
||||
}
|
||||
export function createExportedWidget3() {
|
||||
return Widgets1.createWidget3();
|
||||
}
|
||||
export function createExportedWidget4() {
|
||||
return Widgets1.SpecializedGlobalWidget.createWidget4();
|
||||
}
|
||||
|
||||
// @Filename:privacyCannotNameVarTypeDeclFile_consumer.ts
|
||||
import exporter = require("privacyCannotNameVarTypeDeclFile_exporter");
|
||||
export class publicClassWithWithPrivatePropertyTypes {
|
||||
static myPublicStaticProperty = exporter.createExportedWidget1(); // Error
|
||||
private static myPrivateStaticProperty = exporter.createExportedWidget1();
|
||||
myPublicProperty = exporter.createExportedWidget1(); // Error
|
||||
private myPrivateProperty = exporter.createExportedWidget1();
|
||||
|
||||
static myPublicStaticProperty1 = exporter.createExportedWidget3(); // Error
|
||||
private static myPrivateStaticProperty1 = exporter.createExportedWidget3();
|
||||
myPublicProperty1 = exporter.createExportedWidget3(); // Error
|
||||
private myPrivateProperty1 = exporter.createExportedWidget3();
|
||||
}
|
||||
|
||||
class privateClassWithWithPrivatePropertyTypes {
|
||||
static myPublicStaticProperty = exporter.createExportedWidget1();
|
||||
private static myPrivateStaticProperty = exporter.createExportedWidget1();
|
||||
myPublicProperty = exporter.createExportedWidget1();
|
||||
private myPrivateProperty = exporter.createExportedWidget1();
|
||||
|
||||
static myPublicStaticProperty1 = exporter.createExportedWidget3();
|
||||
private static myPrivateStaticProperty1 = exporter.createExportedWidget3();
|
||||
myPublicProperty1 = exporter.createExportedWidget3();
|
||||
private myPrivateProperty1 = exporter.createExportedWidget3();
|
||||
}
|
||||
|
||||
export var publicVarWithPrivatePropertyTypes= exporter.createExportedWidget1(); // Error
|
||||
var privateVarWithPrivatePropertyTypes= exporter.createExportedWidget1();
|
||||
export var publicVarWithPrivatePropertyTypes1 = exporter.createExportedWidget3(); // Error
|
||||
var privateVarWithPrivatePropertyTypes1 = exporter.createExportedWidget3();
|
||||
|
||||
export class publicClassWithPrivateModulePropertyTypes {
|
||||
static myPublicStaticProperty= exporter.createExportedWidget2(); // Error
|
||||
myPublicProperty = exporter.createExportedWidget2(); // Error
|
||||
static myPublicStaticProperty1 = exporter.createExportedWidget4(); // Error
|
||||
myPublicProperty1 = exporter.createExportedWidget4(); // Error
|
||||
}
|
||||
export var publicVarWithPrivateModulePropertyTypes= exporter.createExportedWidget2(); // Error
|
||||
export var publicVarWithPrivateModulePropertyTypes1 = exporter.createExportedWidget4(); // Error
|
||||
|
||||
class privateClassWithPrivateModulePropertyTypes {
|
||||
static myPublicStaticProperty= exporter.createExportedWidget2();
|
||||
myPublicProperty= exporter.createExportedWidget2();
|
||||
static myPublicStaticProperty1 = exporter.createExportedWidget4();
|
||||
myPublicProperty1 = exporter.createExportedWidget4();
|
||||
}
|
||||
var privateVarWithPrivateModulePropertyTypes= exporter.createExportedWidget2();
|
||||
var privateVarWithPrivateModulePropertyTypes1 = exporter.createExportedWidget4();
|
|
@ -0,0 +1,157 @@
|
|||
// @module: commonjs
|
||||
// @declaration: true
|
||||
|
||||
|
||||
// @Filename: privacyFunctionCannotNameParameterTypeDeclFile_GlobalWidgets.ts
|
||||
declare module "GlobalWidgets" {
|
||||
export class Widget3 {
|
||||
name: string;
|
||||
}
|
||||
export function createWidget3(): Widget3;
|
||||
|
||||
export module SpecializedGlobalWidget {
|
||||
export class Widget4 {
|
||||
name: string;
|
||||
}
|
||||
function createWidget4(): Widget4;
|
||||
}
|
||||
}
|
||||
|
||||
// @Filename: privacyFunctionCannotNameParameterTypeDeclFile_Widgets.ts
|
||||
export class Widget1 {
|
||||
name = 'one';
|
||||
}
|
||||
export function createWidget1() {
|
||||
return new Widget1();
|
||||
}
|
||||
|
||||
export module SpecializedWidget {
|
||||
export class Widget2 {
|
||||
name = 'one';
|
||||
}
|
||||
export function createWidget2() {
|
||||
return new Widget2();
|
||||
}
|
||||
}
|
||||
|
||||
// @Filename:privacyFunctionCannotNameParameterTypeDeclFile_exporter.ts
|
||||
///<reference path='privacyFunctionCannotNameParameterTypeDeclFile_GlobalWidgets.ts'/>
|
||||
import Widgets = require("privacyFunctionCannotNameParameterTypeDeclFile_Widgets");
|
||||
import Widgets1 = require("GlobalWidgets");
|
||||
export function createExportedWidget1() {
|
||||
return Widgets.createWidget1();
|
||||
}
|
||||
export function createExportedWidget2() {
|
||||
return Widgets.SpecializedWidget.createWidget2();
|
||||
}
|
||||
export function createExportedWidget3() {
|
||||
return Widgets1.createWidget3();
|
||||
}
|
||||
export function createExportedWidget4() {
|
||||
return Widgets1.SpecializedGlobalWidget.createWidget4();
|
||||
}
|
||||
|
||||
// @Filename:privacyFunctionCannotNameParameterTypeDeclFile_consumer.ts
|
||||
import exporter = require("privacyFunctionCannotNameParameterTypeDeclFile_exporter");
|
||||
export class publicClassWithWithPrivateParmeterTypes {
|
||||
static myPublicStaticMethod(param = exporter.createExportedWidget1()) { // Error
|
||||
}
|
||||
private static myPrivateStaticMethod(param = exporter.createExportedWidget1()) {
|
||||
}
|
||||
myPublicMethod(param = exporter.createExportedWidget1()) { // Error
|
||||
}
|
||||
private myPrivateMethod(param = exporter.createExportedWidget1()) {
|
||||
}
|
||||
constructor(param = exporter.createExportedWidget1(), private param1 = exporter.createExportedWidget1(), public param2 = exporter.createExportedWidget1()) { // Error
|
||||
}
|
||||
}
|
||||
export class publicClassWithWithPrivateParmeterTypes1 {
|
||||
static myPublicStaticMethod(param = exporter.createExportedWidget3()) { // Error
|
||||
}
|
||||
private static myPrivateStaticMethod(param = exporter.createExportedWidget3()) {
|
||||
}
|
||||
myPublicMethod(param = exporter.createExportedWidget3()) { // Error
|
||||
}
|
||||
private myPrivateMethod(param = exporter.createExportedWidget3()) {
|
||||
}
|
||||
constructor(param = exporter.createExportedWidget3(), private param1 = exporter.createExportedWidget3(), public param2 = exporter.createExportedWidget3()) { // Error
|
||||
}
|
||||
}
|
||||
|
||||
class privateClassWithWithPrivateParmeterTypes {
|
||||
static myPublicStaticMethod(param = exporter.createExportedWidget1()) {
|
||||
}
|
||||
private static myPrivateStaticMethod(param = exporter.createExportedWidget1()) {
|
||||
}
|
||||
myPublicMethod(param = exporter.createExportedWidget1()) {
|
||||
}
|
||||
private myPrivateMethod(param = exporter.createExportedWidget1()) {
|
||||
}
|
||||
constructor(param = exporter.createExportedWidget1(), private param1 = exporter.createExportedWidget1(), public param2 = exporter.createExportedWidget1()) {
|
||||
}
|
||||
}
|
||||
class privateClassWithWithPrivateParmeterTypes2 {
|
||||
static myPublicStaticMethod(param = exporter.createExportedWidget3()) {
|
||||
}
|
||||
private static myPrivateStaticMethod(param = exporter.createExportedWidget3()) {
|
||||
}
|
||||
myPublicMethod(param = exporter.createExportedWidget3()) {
|
||||
}
|
||||
private myPrivateMethod(param = exporter.createExportedWidget3()) {
|
||||
}
|
||||
constructor(param = exporter.createExportedWidget3(), private param1 = exporter.createExportedWidget3(), public param2 = exporter.createExportedWidget3()) {
|
||||
}
|
||||
}
|
||||
|
||||
export function publicFunctionWithPrivateParmeterTypes(param = exporter.createExportedWidget1()) { // Error
|
||||
}
|
||||
function privateFunctionWithPrivateParmeterTypes(param = exporter.createExportedWidget1()) {
|
||||
}
|
||||
export function publicFunctionWithPrivateParmeterTypes1(param = exporter.createExportedWidget3()) { // Error
|
||||
}
|
||||
function privateFunctionWithPrivateParmeterTypes1(param = exporter.createExportedWidget3()) {
|
||||
}
|
||||
|
||||
|
||||
export class publicClassWithPrivateModuleParameterTypes {
|
||||
static myPublicStaticMethod(param= exporter.createExportedWidget2()) { // Error
|
||||
}
|
||||
myPublicMethod(param= exporter.createExportedWidget2()) { // Error
|
||||
}
|
||||
constructor(param= exporter.createExportedWidget2(), private param1= exporter.createExportedWidget2(), public param2= exporter.createExportedWidget2()) { // Error
|
||||
}
|
||||
}
|
||||
export class publicClassWithPrivateModuleParameterTypes2 {
|
||||
static myPublicStaticMethod(param= exporter.createExportedWidget4()) { // Error
|
||||
}
|
||||
myPublicMethod(param= exporter.createExportedWidget4()) { // Error
|
||||
}
|
||||
constructor(param= exporter.createExportedWidget4(), private param1= exporter.createExportedWidget4(), public param2= exporter.createExportedWidget4()) { // Error
|
||||
}
|
||||
}
|
||||
export function publicFunctionWithPrivateModuleParameterTypes(param= exporter.createExportedWidget2()) { // Error
|
||||
}
|
||||
export function publicFunctionWithPrivateModuleParameterTypes1(param= exporter.createExportedWidget4()) { // Error
|
||||
}
|
||||
|
||||
|
||||
class privateClassWithPrivateModuleParameterTypes {
|
||||
static myPublicStaticMethod(param= exporter.createExportedWidget2()) {
|
||||
}
|
||||
myPublicMethod(param= exporter.createExportedWidget2()) {
|
||||
}
|
||||
constructor(param= exporter.createExportedWidget2(), private param1= exporter.createExportedWidget2(), public param2= exporter.createExportedWidget2()) {
|
||||
}
|
||||
}
|
||||
class privateClassWithPrivateModuleParameterTypes1 {
|
||||
static myPublicStaticMethod(param= exporter.createExportedWidget4()) {
|
||||
}
|
||||
myPublicMethod(param= exporter.createExportedWidget4()) {
|
||||
}
|
||||
constructor(param= exporter.createExportedWidget4(), private param1= exporter.createExportedWidget4(), public param2= exporter.createExportedWidget4()) {
|
||||
}
|
||||
}
|
||||
function privateFunctionWithPrivateModuleParameterTypes(param= exporter.createExportedWidget2()) {
|
||||
}
|
||||
function privateFunctionWithPrivateModuleParameterTypes1(param= exporter.createExportedWidget4()) {
|
||||
}
|
|
@ -0,0 +1,163 @@
|
|||
// @module: commonjs
|
||||
// @declaration: true
|
||||
|
||||
|
||||
// @Filename: privacyFunctionReturnTypeDeclFile_GlobalWidgets.ts
|
||||
declare module "GlobalWidgets" {
|
||||
export class Widget3 {
|
||||
name: string;
|
||||
}
|
||||
export function createWidget3(): Widget3;
|
||||
|
||||
export module SpecializedGlobalWidget {
|
||||
export class Widget4 {
|
||||
name: string;
|
||||
}
|
||||
function createWidget4(): Widget4;
|
||||
}
|
||||
}
|
||||
|
||||
// @Filename: privacyFunctionReturnTypeDeclFile_Widgets.ts
|
||||
export class Widget1 {
|
||||
name = 'one';
|
||||
}
|
||||
export function createWidget1() {
|
||||
return new Widget1();
|
||||
}
|
||||
|
||||
export module SpecializedWidget {
|
||||
export class Widget2 {
|
||||
name = 'one';
|
||||
}
|
||||
export function createWidget2() {
|
||||
return new Widget2();
|
||||
}
|
||||
}
|
||||
|
||||
// @Filename:privacyFunctionReturnTypeDeclFile_exporter.ts
|
||||
///<reference path='privacyFunctionReturnTypeDeclFile_GlobalWidgets.ts'/>
|
||||
import Widgets = require("privacyFunctionReturnTypeDeclFile_Widgets");
|
||||
import Widgets1 = require("GlobalWidgets");
|
||||
export function createExportedWidget1() {
|
||||
return Widgets.createWidget1();
|
||||
}
|
||||
export function createExportedWidget2() {
|
||||
return Widgets.SpecializedWidget.createWidget2();
|
||||
}
|
||||
export function createExportedWidget3() {
|
||||
return Widgets1.createWidget3();
|
||||
}
|
||||
export function createExportedWidget4() {
|
||||
return Widgets1.SpecializedGlobalWidget.createWidget4();
|
||||
}
|
||||
|
||||
// @Filename:privacyFunctionReturnTypeDeclFile_consumer.ts
|
||||
import exporter = require("privacyFunctionReturnTypeDeclFile_exporter");
|
||||
export class publicClassWithWithPrivateParmeterTypes {
|
||||
static myPublicStaticMethod() { // Error
|
||||
return exporter.createExportedWidget1();
|
||||
}
|
||||
private static myPrivateStaticMethod() {
|
||||
return exporter.createExportedWidget1();;
|
||||
}
|
||||
myPublicMethod() { // Error
|
||||
return exporter.createExportedWidget1();;
|
||||
}
|
||||
private myPrivateMethod() {
|
||||
return exporter.createExportedWidget1();;
|
||||
}
|
||||
static myPublicStaticMethod1() { // Error
|
||||
return exporter.createExportedWidget3();
|
||||
}
|
||||
private static myPrivateStaticMethod1() {
|
||||
return exporter.createExportedWidget3();;
|
||||
}
|
||||
myPublicMethod1() { // Error
|
||||
return exporter.createExportedWidget3();;
|
||||
}
|
||||
private myPrivateMethod1() {
|
||||
return exporter.createExportedWidget3();;
|
||||
}
|
||||
}
|
||||
|
||||
class privateClassWithWithPrivateParmeterTypes {
|
||||
static myPublicStaticMethod() {
|
||||
return exporter.createExportedWidget1();
|
||||
}
|
||||
private static myPrivateStaticMethod() {
|
||||
return exporter.createExportedWidget1();;
|
||||
}
|
||||
myPublicMethod() {
|
||||
return exporter.createExportedWidget1();;
|
||||
}
|
||||
private myPrivateMethod() {
|
||||
return exporter.createExportedWidget1();;
|
||||
}
|
||||
static myPublicStaticMethod1() {
|
||||
return exporter.createExportedWidget3();
|
||||
}
|
||||
private static myPrivateStaticMethod1() {
|
||||
return exporter.createExportedWidget3();;
|
||||
}
|
||||
myPublicMethod1() {
|
||||
return exporter.createExportedWidget3();;
|
||||
}
|
||||
private myPrivateMethod1() {
|
||||
return exporter.createExportedWidget3();;
|
||||
}
|
||||
}
|
||||
|
||||
export function publicFunctionWithPrivateParmeterTypes() { // Error
|
||||
return exporter.createExportedWidget1();
|
||||
}
|
||||
function privateFunctionWithPrivateParmeterTypes() {
|
||||
return exporter.createExportedWidget1();
|
||||
}
|
||||
export function publicFunctionWithPrivateParmeterTypes1() { // Error
|
||||
return exporter.createExportedWidget3();
|
||||
}
|
||||
function privateFunctionWithPrivateParmeterTypes1() {
|
||||
return exporter.createExportedWidget3();
|
||||
}
|
||||
|
||||
export class publicClassWithPrivateModuleReturnTypes {
|
||||
static myPublicStaticMethod() { // Error
|
||||
return exporter.createExportedWidget2();
|
||||
}
|
||||
myPublicMethod() { // Error
|
||||
return exporter.createExportedWidget2();
|
||||
}
|
||||
static myPublicStaticMethod1() { // Error
|
||||
return exporter.createExportedWidget4();
|
||||
}
|
||||
myPublicMethod1() { // Error
|
||||
return exporter.createExportedWidget4();
|
||||
}
|
||||
}
|
||||
export function publicFunctionWithPrivateModuleReturnTypes() { // Error
|
||||
return exporter.createExportedWidget2();
|
||||
}
|
||||
export function publicFunctionWithPrivateModuleReturnTypes1() { // Error
|
||||
return exporter.createExportedWidget4();
|
||||
}
|
||||
|
||||
class privateClassWithPrivateModuleReturnTypes {
|
||||
static myPublicStaticMethod() {
|
||||
return exporter.createExportedWidget2();
|
||||
}
|
||||
myPublicMethod() {
|
||||
return exporter.createExportedWidget2();
|
||||
}
|
||||
static myPublicStaticMethod1() { // Error
|
||||
return exporter.createExportedWidget4();
|
||||
}
|
||||
myPublicMethod1() { // Error
|
||||
return exporter.createExportedWidget4();
|
||||
}
|
||||
}
|
||||
function privateFunctionWithPrivateModuleReturnTypes() {
|
||||
return exporter.createExportedWidget2();
|
||||
}
|
||||
function privateFunctionWithPrivateModuleReturnTypes1() {
|
||||
return exporter.createExportedWidget4();
|
||||
}
|
Loading…
Reference in a new issue