Merge pull request #381 from branch 'remote/privacyErrors'

Report privacy errors on variable/property declarations and also emit import declarations that get used to defined visible type
This commit is contained in:
Sheetal Nandi committed 2014-08-13 18:48:05 -07:00
commit f622cb4d11
902 files changed
+25122 -3471

No files matched your search

+186 -63
View File
@@ -309,7 +309,7 @@ module ts {
else {
return returnResolvedSymbol(result);
}
}
}
break;
case SyntaxKind.Method:
case SyntaxKind.Constructor:
@@ -449,7 +449,7 @@ module ts {
return moduleSymbol;
}
function getExportAssignmentSymbol(symbol: Symbol): Symbol {
function getExportAssignmentSymbol(symbol: Symbol): Symbol {
checkTypeOfExportAssignmentSymbol(symbol);
var symbolLinks = getSymbolLinks(symbol);
return symbolLinks.exportAssignSymbol === unknownSymbol ? undefined : symbolLinks.exportAssignSymbol;
@@ -660,38 +660,59 @@ module ts {
return callback(globals);
}
function getAccessibleSymbol(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags) {
function getAccessibleSymbolFromSymbolTable(symbols: SymbolTable) {
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) {
// If the symbol is equivalent and doesnt need futher qualification, this symbol is accessible
if (!needsQualification(symbolFromSymbolTable, enclosingDeclaration, meaning)) {
return true;
}
// 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, getQualifiedLeftMeaning(meaning));
return !!accessibleParent;
}
function isAccessible(symbolFromSymbolTable: Symbol, resolvedAliasSymbol?: Symbol) {
if (symbol === (resolvedAliasSymbol || symbolFromSymbolTable)) {
// If the symbol is equivalent and doesnt need futher qualification, this symbol is accessible
if (!needsQualification(symbolFromSymbolTable, enclosingDeclaration, meaning)) {
return true;
}
// If symbol needs qualification, make sure that parent is accessible, if it is then this symbol is accessible too
var accessibleParent = getAccessibleSymbol(symbolFromSymbolTable.parent, enclosingDeclaration, SymbolFlags.Namespace);
return !!accessibleParent;
// 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 !forEach(symbolFromSymbolTable.declarations, declaration => hasExternalModuleSymbol(declaration)) &&
canQualifySymbol(symbolFromSymbolTable, meaning);
}
}
// If symbol is directly available by its name in the symbol table
if (isAccessible(lookUp(symbols, symbol.name))) {
return symbol;
return [symbol];
}
// Check if symbol is any of the alias
return forEachValue(symbols, symbolFromSymbolTable => {
if (symbolFromSymbolTable.flags & SymbolFlags.Import) {
var resolvedImportedSymbol = resolveImport(symbolFromSymbolTable);
if (isAccessible(symbolFromSymbolTable, resolveImport(symbolFromSymbolTable))) {
return symbolFromSymbolTable;
return [symbolFromSymbolTable];
}
// 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, getQualifiedLeftMeaning(meaning))) {
return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports);
}
}
});
}
if (symbol) {
return forEachSymbolTableInScope(enclosingDeclaration, getAccessibleSymbolFromSymbolTable);
return forEachSymbolTableInScope(enclosingDeclaration, getAccessibleSymbolChainFromSymbolTable);
}
}
@@ -730,20 +751,19 @@ module ts {
var meaningToLook = meaning;
while (symbol) {
// Symbol is accessible if it by itself is accessible
var accessibleSymbol = getAccessibleSymbol(symbol, enclosingDeclaration, meaningToLook);
if (accessibleSymbol) {
if (forEach(accessibleSymbol.declarations, declaration => !isDeclarationVisible(declaration))) {
var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaningToLook);
if (accessibleSymbolChain) {
var hasAccessibleDeclarations = hasVisibleDeclarations(accessibleSymbolChain[0]);
if (!hasAccessibleDeclarations) {
return {
accessibility: SymbolAccessibility.NotAccessible,
errorSymbolName: symbolToString(initialSymbol, enclosingDeclaration, meaning),
errorModuleName: symbol !== initialSymbol ? symbolToString(symbol, enclosingDeclaration, SymbolFlags.Namespace) : undefined
errorModuleName: symbol !== initialSymbol ? symbolToString(symbol, enclosingDeclaration, SymbolFlags.Namespace) : undefined,
};
}
return { accessibility: SymbolAccessibility.Accessible };
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:
@@ -756,18 +776,91 @@ 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[]; } {
var aliasesToMakeVisible: ImportDeclaration[];
if (forEach(symbol.declarations, declaration => !getIsDeclarationVisible(declaration))) {
return undefined;
}
return { aliasesToMakeVisible: aliasesToMakeVisible };
function getIsDeclarationVisible(declaration: Declaration) {
if (!isDeclarationVisible(declaration)) {
// Mark the unexported alias as visible if its parent is visible
// because these kind of aliases can be used to name types in declaration file
if (declaration.kind === SyntaxKind.ImportDeclaration &&
!(declaration.flags & NodeFlags.Export) &&
isDeclarationVisible(declaration.parent)) {
getNodeLinks(declaration).isVisible = true;
if (aliasesToMakeVisible) {
if (!contains(aliasesToMakeVisible, declaration)) {
aliasesToMakeVisible.push(declaration);
}
}
else {
aliasesToMakeVisible = [declaration];
}
return true;
}
// Declaration is not visible
return false;
}
return true;
}
}
function isImportDeclarationEntityNameReferenceDeclarationVisibile(entityName: EntityName): SymbolAccessiblityResult {
var firstIdentifier = getFirstIdentifier(entityName);
var firstIdentifierName = identifierToString(<Identifier>firstIdentifier);
var symbolOfNameSpace = resolveName(entityName.parent, (<Identifier>firstIdentifier).text, SymbolFlags.Namespace, Diagnostics.Cannot_find_name_0, firstIdentifierName);
// Verify if the symbol is accessible
var hasNamespaceDeclarationsVisibile = hasVisibleDeclarations(symbolOfNameSpace);
return hasNamespaceDeclarationsVisibile ?
{ accessibility: SymbolAccessibility.Accessible, aliasesToMakeVisible: hasNamespaceDeclarationsVisibile.aliasesToMakeVisible } :
{ accessibility: SymbolAccessibility.NotAccessible, errorSymbolName: firstIdentifierName };
}
// Enclosing declaration is optional when we dont want to get qualified name in the enclosing declaration scope
@@ -788,15 +881,27 @@ module ts {
// Properties/methods/Signatures/Constructors/TypeParameters do not need qualification
!(symbol.flags & SymbolFlags.PropertyOrAccessor & SymbolFlags.Signature & SymbolFlags.Constructor & SymbolFlags.Method & SymbolFlags.TypeParameter)) {
var symbolName: string;
while (symbol) {
while (symbol) {
var isFirstName = !symbolName;
var meaningToLook = isFirstName ? meaning : SymbolFlags.Namespace;
var accessibleSymbol = getAccessibleSymbol(symbol, enclosingDeclaration, meaningToLook);
symbolName = getSymbolName(accessibleSymbol || symbol) + (isFirstName ? "" : ("." + symbolName));
if (accessibleSymbol && !needsQualification(accessibleSymbol, enclosingDeclaration, meaningToLook)) {
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 ? meaning : getQualifiedLeftMeaning(meaning))) {
break;
}
symbol = accessibleSymbol ? accessibleSymbol.parent : symbol.parent;
symbol = accessibleSymbolChain ? accessibleSymbolChain[0].parent : symbol.parent;
meaning = getQualifiedLeftMeaning(meaning);
}
return symbolName;
@@ -821,7 +926,7 @@ module ts {
};
}
function typeToString(type: Type, enclosingDeclaration?:Node, flags?: TypeFormatFlags): string {
function typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string {
var stringWriter = createSingleLineTextWriter();
// TODO(shkamat): typeToString should take enclosingDeclaration as input, once we have implemented enclosingDeclaration
writeTypeToTextWriter(type, enclosingDeclaration, flags, stringWriter);
@@ -880,10 +985,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 = [];
@@ -892,6 +1000,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) {
@@ -1036,30 +1161,31 @@ module ts {
// This is export assigned symbol node
var externalModuleSymbol = getSymbolOfNode(externalModule);
var exportAssignmentSymbol = getExportAssignmentSymbol(externalModuleSymbol);
var resolvedExportSymbol: Symbol;
var symbolOfNode = getSymbolOfNode(node);
if (exportAssignmentSymbol === symbolOfNode) {
if (isSymbolUsedInExportAssignment(symbolOfNode)) {
return true;
}
// if symbolOfNode is import declaration, resolve the symbol declaration and check
if (symbolOfNode.flags & SymbolFlags.Import) {
return isSymbolUsedInExportAssignment(resolveImport(symbolOfNode));
}
}
// Check if the symbol is used in export assignment
function isSymbolUsedInExportAssignment(symbol: Symbol) {
if (exportAssignmentSymbol === symbol) {
return true;
}
if (exportAssignmentSymbol && !!(exportAssignmentSymbol.flags & SymbolFlags.Import)) {
// if export assigned symbol is import declaration, resolve the import
var resolvedExportSymbol = resolveImport(exportAssignmentSymbol);
if (resolvedExportSymbol === symbolOfNode) {
resolvedExportSymbol = resolvedExportSymbol || resolveImport(exportAssignmentSymbol);
if (resolvedExportSymbol === symbol) {
return true;
}
// TODO(shkamat): Chained import assignment
// eg. a should be visible too.
//module m {
// export module c {
// export class c {
// }
// }
//}
//import a = m.c;
//import b = a;
//export = b;
// Container of resolvedExportSymbol is visible
return forEach(resolvedExportSymbol.declarations, declaration => {
while (declaration) {
@@ -1076,25 +1202,21 @@ module ts {
function determineIfDeclarationIsVisible() {
switch (node.kind) {
case SyntaxKind.VariableDeclaration:
if (!(node.flags & NodeFlags.Export)) {
// node.parent is variable statement so look at the variable statement's parent
return isGlobalSourceFile(node.parent.parent) || isUsedInExportAssignment(node);
}
// Exported members are visible if parent is visible
return isDeclarationVisible(node.parent.parent);
case SyntaxKind.ModuleDeclaration:
case SyntaxKind.ClassDeclaration:
case SyntaxKind.InterfaceDeclaration:
case SyntaxKind.FunctionDeclaration:
case SyntaxKind.EnumDeclaration:
case SyntaxKind.ImportDeclaration:
if (!(node.flags & NodeFlags.Export)) {
// TODO(shkamat): non exported aliases can be visible if they are referenced else where for value/type/namespace
return isGlobalSourceFile(node.parent) || isUsedInExportAssignment(node);
// In case of variable declaration, node.parent is variable statement so look at the variable statement's parent
var parent = node.kind === SyntaxKind.VariableDeclaration ? node.parent.parent : node.parent;
// If the node is not exported or it is not ambient module element (except import declaration)
if (!(node.flags & NodeFlags.Export) &&
!(node.kind !== SyntaxKind.ImportDeclaration && parent.kind !== SyntaxKind.SourceFile && isInAmbientContext(parent))) {
return isGlobalSourceFile(parent) || isUsedInExportAssignment(node);
}
// Exported members are visible if parent is visible
return isDeclarationVisible(node.parent);
// Exported members/ambient module elements (exception import declaraiton) are visible if parent is visible
return isDeclarationVisible(parent);
case SyntaxKind.Property:
case SyntaxKind.Method:
@@ -1124,7 +1246,7 @@ module ts {
if (node) {
var links = getNodeLinks(node);
if (links.isVisible === undefined) {
links.isVisible = determineIfDeclarationIsVisible();
links.isVisible = !!determineIfDeclarationIsVisible();
}
return links.isVisible;
}
@@ -6758,7 +6880,8 @@ module ts {
writeTypeAtLocation: writeTypeAtLocation,
writeReturnTypeOfSignatureDeclaration: writeReturnTypeOfSignatureDeclaration,
writeSymbol: writeSymbolToTextWriter,
isSymbolAccessible: isSymbolAccessible
isSymbolAccessible: isSymbolAccessible,
isImportDeclarationEntityNameReferenceDeclarationVisibile: isImportDeclarationEntityNameReferenceDeclarationVisibile
};
checkProgram();
return emitFiles(resolver);
@@ -113,6 +113,51 @@ module ts {
Extends_clause_of_exported_class_0_has_or_is_using_name_1_from_private_module_2: { code: 2021, category: DiagnosticCategory.Error, key: "Extends clause of exported class '{0}' has or is using name '{1}' from private module '{2}'." },
Implements_clause_of_exported_class_0_has_or_is_using_name_1_from_private_module_2: { code: 2022, category: DiagnosticCategory.Error, key: "Implements clause of exported class '{0}' has or is using name '{1}' from private module '{2}'." },
Extends_clause_of_exported_interface_0_has_or_is_using_name_1_from_private_module_2: { code: 2023, category: DiagnosticCategory.Error, key: "Extends clause of exported interface '{0}' has or is using name '{1}' from private module '{2}'." },
Public_static_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 2024, category: DiagnosticCategory.Error, key: "Public static property '{0}' of exported class has or is using private name '{1}'." },
Public_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 2025, category: DiagnosticCategory.Error, key: "Public property '{0}' of exported class has or is using private name '{1}'." },
Property_0_of_exported_interface_has_or_is_using_private_name_1: { code: 2026, category: DiagnosticCategory.Error, key: "Property '{0}' of exported interface has or is using private name '{1}'." },
Exported_variable_0_has_or_is_using_private_name_1: { code: 2027, category: DiagnosticCategory.Error, key: "Exported variable '{0}' has or is using private name '{1}'." },
Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 2028, category: DiagnosticCategory.Error, key: "Public static property '{0}' of exported class has or is using name '{1}' from private module '{2}'." },
Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 2029, category: DiagnosticCategory.Error, key: "Public property '{0}' of exported class has or is using name '{1}' from private module '{2}'." },
Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 2030, category: DiagnosticCategory.Error, key: "Property '{0}' of exported interface has or is using name '{1}' from private module '{2}'." },
Exported_variable_0_has_or_is_using_name_1_from_private_module_2: { code: 2031, category: DiagnosticCategory.Error, key: "Exported variable '{0}' has or is using name '{1}' from private module '{2}'." },
Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1: { code: 2032, category: DiagnosticCategory.Error, key: "Parameter '{0}' of constructor from exported class has or is using private name '{1}'." },
Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 2033, category: DiagnosticCategory.Error, key: "Parameter '{0}' of public static property setter from exported class has or is using private name '{1}'." },
Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 2034, category: DiagnosticCategory.Error, key: "Parameter '{0}' of public property setter from exported class has or is using private name '{1}'." },
Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 2035, category: DiagnosticCategory.Error, key: "Parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." },
Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 2036, category: DiagnosticCategory.Error, key: "Parameter '{0}' of call signature from exported interface has or is using private name '{1}'." },
Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 2037, category: DiagnosticCategory.Error, key: "Parameter '{0}' of public static method from exported class has or is using private name '{1}'." },
Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 2038, category: DiagnosticCategory.Error, key: "Parameter '{0}' of public method from exported class has or is using private name '{1}'." },
Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 2039, category: DiagnosticCategory.Error, key: "Parameter '{0}' of method from exported interface has or is using private name '{1}'." },
Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 2040, category: DiagnosticCategory.Error, key: "Parameter '{0}' of exported function has or is using private name '{1}'." },
Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 2041, category: DiagnosticCategory.Error, key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from private module '{2}'." },
Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 2042, category: DiagnosticCategory.Error, key: "Parameter '{0}' of public static property setter from exported class has or is using name '{1}' from private module '{2}'." },
Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 2043, category: DiagnosticCategory.Error, key: "Parameter '{0}' of public property setter from exported class has or is using name '{1}' from private module '{2}'." },
Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 2044, category: DiagnosticCategory.Error, key: "Parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'." },
Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 2045, category: DiagnosticCategory.Error, key: "Parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'." },
Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 2046, category: DiagnosticCategory.Error, key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'." },
Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 2047, category: DiagnosticCategory.Error, key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'." },
Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 2048, category: DiagnosticCategory.Error, key: "Parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'." },
Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { code: 2049, category: DiagnosticCategory.Error, key: "Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'." },
Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 2050, category: DiagnosticCategory.Error, key: "Return type of public static property getter from exported class has or is using private name '{0}'." },
Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 2051, category: DiagnosticCategory.Error, key: "Return type of public property getter from exported class has or is using private name '{0}'." },
Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 2052, category: DiagnosticCategory.Error, key: "Return type of constructor signature from exported interface has or is using private name '{0}'." },
Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 2053, category: DiagnosticCategory.Error, key: "Return type of call signature from exported interface has or is using private name '{0}'." },
Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 2054, category: DiagnosticCategory.Error, key: "Return type of index signature from exported interface has or is using private name '{0}'." },
Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0: { code: 2055, category: DiagnosticCategory.Error, key: "Return type of public static method from exported class has or is using private name '{0}'." },
Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0: { code: 2056, category: DiagnosticCategory.Error, key: "Return type of public method from exported class has or is using private name '{0}'." },
Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0: { code: 2057, category: DiagnosticCategory.Error, key: "Return type of method from exported interface has or is using private name '{0}'." },
Return_type_of_exported_function_has_or_is_using_private_name_0: { code: 2058, category: DiagnosticCategory.Error, key: "Return type of exported function has or is using private name '{0}'." },
Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 2059, category: DiagnosticCategory.Error, key: "Return type of public static property getter from exported class has or is using name '{0}' from private module '{1}'." },
Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 2060, category: DiagnosticCategory.Error, key: "Return type of public property getter from exported class has or is using name '{0}' from private module '{1}'." },
Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 2061, category: DiagnosticCategory.Error, key: "Return type of constructor signature from exported interface has or is using name '{0}' from private module '{1}'." },
Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 2062, category: DiagnosticCategory.Error, key: "Return type of call signature from exported interface has or is using name '{0}' from private module '{1}'." },
Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 2063, category: DiagnosticCategory.Error, key: "Return type of index signature from exported interface has or is using name '{0}' from private module '{1}'." },
Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 2064, category: DiagnosticCategory.Error, key: "Return type of public static method from exported class has or is using name '{0}' from private module '{1}'." },
Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 2065, category: DiagnosticCategory.Error, key: "Return type of public method from exported class has or is using name '{0}' from private module '{1}'." },
Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 2066, category: DiagnosticCategory.Error, key: "Return type of method from exported interface has or is using name '{0}' from private module '{1}'." },
Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1: { code: 2067, category: DiagnosticCategory.Error, key: "Return type of exported function has or is using name '{0}' from private module '{1}'." },
Import_declaration_0_is_using_private_name_1: { code: 2181, category: DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." },
Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 2208, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." },
Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 2209, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of call signature from exported interface has or is using private name '{1}'." },
Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 2210, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of public static method from exported class has or is using private name '{1}'." },
@@ -187,6 +232,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}'." },
+228
View File
@@ -444,6 +444,186 @@
"category": "Error",
"code": 2023
},
"Public static property '{0}' of exported class has or is using private name '{1}'.": {
"category": "Error",
"code": 2024
},
"Public property '{0}' of exported class has or is using private name '{1}'.": {
"category": "Error",
"code": 2025
},
"Property '{0}' of exported interface has or is using private name '{1}'.": {
"category": "Error",
"code": 2026
},
"Exported variable '{0}' has or is using private name '{1}'.": {
"category": "Error",
"code": 2027
},
"Public static property '{0}' of exported class has or is using name '{1}' from private module '{2}'.": {
"category": "Error",
"code": 2028
},
"Public property '{0}' of exported class has or is using name '{1}' from private module '{2}'.": {
"category": "Error",
"code": 2029
},
"Property '{0}' of exported interface has or is using name '{1}' from private module '{2}'.": {
"category": "Error",
"code": 2030
},
"Exported variable '{0}' has or is using name '{1}' from private module '{2}'.": {
"category": "Error",
"code": 2031
},
"Parameter '{0}' of constructor from exported class has or is using private name '{1}'.": {
"category": "Error",
"code": 2032
},
"Parameter '{0}' of public static property setter from exported class has or is using private name '{1}'.": {
"category": "Error",
"code": 2033
},
"Parameter '{0}' of public property setter from exported class has or is using private name '{1}'.": {
"category": "Error",
"code": 2034
},
"Parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'.": {
"category": "Error",
"code": 2035
},
"Parameter '{0}' of call signature from exported interface has or is using private name '{1}'.": {
"category": "Error",
"code": 2036
},
"Parameter '{0}' of public static method from exported class has or is using private name '{1}'.": {
"category": "Error",
"code": 2037
},
"Parameter '{0}' of public method from exported class has or is using private name '{1}'.": {
"category": "Error",
"code": 2038
},
"Parameter '{0}' of method from exported interface has or is using private name '{1}'.": {
"category": "Error",
"code": 2039
},
"Parameter '{0}' of exported function has or is using private name '{1}'.": {
"category": "Error",
"code": 2040
},
"Parameter '{0}' of constructor from exported class has or is using name '{1}' from private module '{2}'.": {
"category": "Error",
"code": 2041
},
"Parameter '{0}' of public static property setter from exported class has or is using name '{1}' from private module '{2}'.": {
"category": "Error",
"code": 2042
},
"Parameter '{0}' of public property setter from exported class has or is using name '{1}' from private module '{2}'.": {
"category": "Error",
"code": 2043
},
"Parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'.": {
"category": "Error",
"code": 2044
},
"Parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'.": {
"category": "Error",
"code": 2045
},
"Parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'.": {
"category": "Error",
"code": 2046
},
"Parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'.": {
"category": "Error",
"code": 2047
},
"Parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'.": {
"category": "Error",
"code": 2048
},
"Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'.": {
"category": "Error",
"code": 2049
},
"Return type of public static property getter from exported class has or is using private name '{0}'.": {
"category": "Error",
"code": 2050
},
"Return type of public property getter from exported class has or is using private name '{0}'.": {
"category": "Error",
"code": 2051
},
"Return type of constructor signature from exported interface has or is using private name '{0}'.": {
"category": "Error",
"code": 2052
},
"Return type of call signature from exported interface has or is using private name '{0}'.": {
"category": "Error",
"code": 2053
},
"Return type of index signature from exported interface has or is using private name '{0}'.": {
"category": "Error",
"code": 2054
},
"Return type of public static method from exported class has or is using private name '{0}'.": {
"category": "Error",
"code": 2055
},
"Return type of public method from exported class has or is using private name '{0}'.": {
"category": "Error",
"code": 2056
},
"Return type of method from exported interface has or is using private name '{0}'.": {
"category": "Error",
"code": 2057
},
"Return type of exported function has or is using private name '{0}'.": {
"category": "Error",
"code": 2058
},
"Return type of public static property getter from exported class has or is using name '{0}' from private module '{1}'.": {
"category": "Error",
"code": 2059
},
"Return type of public property getter from exported class has or is using name '{0}' from private module '{1}'.": {
"category": "Error",
"code": 2060
},
"Return type of constructor signature from exported interface has or is using name '{0}' from private module '{1}'.": {
"category": "Error",
"code": 2061
},
"Return type of call signature from exported interface has or is using name '{0}' from private module '{1}'.": {
"category": "Error",
"code": 2062
},
"Return type of index signature from exported interface has or is using name '{0}' from private module '{1}'.": {
"category": "Error",
"code": 2063
},
"Return type of public static method from exported class has or is using name '{0}' from private module '{1}'.": {
"category": "Error",
"code": 2064
},
"Return type of public method from exported class has or is using name '{0}' from private module '{1}'.": {
"category": "Error",
"code": 2065
},
"Return type of method from exported interface has or is using name '{0}' from private module '{1}'.": {
"category": "Error",
"code": 2066
},
"Return type of exported function has or is using name '{0}' from private module '{1}'.": {
"category": "Error",
"code": 2067
},
"Import declaration '{0}' is using private name '{1}'.": {
"category": "Error",
"code": 2181
},
"Type parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'.": {
"category": "Error",
"code": 2208
@@ -740,6 +920,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
+353 -63
View File
@@ -9,6 +9,7 @@ module ts {
getTextPos(): number;
getLine(): number;
getColumn(): number;
getIndent(): number;
}
var indentStrings: string[] = [];
@@ -141,6 +142,7 @@ module ts {
writeLine: writeLine,
increaseIndent: () => indent++,
decreaseIndent: () => indent--,
getIndent: () => indent,
getTextPos: () => output.length,
getLine: () => lineCount + 1,
getColumn: () => lineStart ? indent * 4 + 1 : output.length - linePos + 1,
@@ -1867,27 +1869,63 @@ module ts {
var enclosingDeclaration: Node;
var reportedDeclarationError = false;
var aliasDeclarationEmitInfo: {
declaration: ImportDeclaration;
outputPos: number;
indent: number;
asynchronousOutput?: string; // If the output for alias was written asynchronously, the corresponding output
}[] = [];
var getSymbolVisibilityDiagnosticMessage: (symbolAccesibilityResult: SymbolAccessiblityResult) => {
errorNode: Node;
diagnosticMessage: DiagnosticMessage;
typeName: Identifier
typeName?: Identifier
}
function writeAsychronousImportDeclarations(importDeclarations: ImportDeclaration[]) {
var oldWriter = writer;
forEach(importDeclarations, aliasToWrite => {
var aliasEmitInfo = forEach(aliasDeclarationEmitInfo, declEmitInfo => declEmitInfo.declaration === aliasToWrite ? declEmitInfo : undefined);
writer = createTextWriter(writeSymbol);
for (var declarationIndent = aliasEmitInfo.indent; declarationIndent; declarationIndent--) {
writer.increaseIndent();
}
writeImportDeclaration(aliasToWrite);
aliasEmitInfo.asynchronousOutput = writer.getText();
});
writer = oldWriter;
}
function writeSymbol(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags) {
var symbolAccesibilityResult = resolver.isSymbolAccessible(symbol, enclosingDeclaration, meaning);
// TODO(shkamat): Since we dont have error reporting for all the cases as yet we have this check on handler being present
if (!getSymbolVisibilityDiagnosticMessage || symbolAccesibilityResult.accessibility === SymbolAccessibility.Accessible) {
if (symbolAccesibilityResult.accessibility === SymbolAccessibility.Accessible) {
resolver.writeSymbol(symbol, enclosingDeclaration, meaning, writer);
// write the aliases
if (symbolAccesibilityResult && symbolAccesibilityResult.aliasesToMakeVisible) {
writeAsychronousImportDeclarations(symbolAccesibilityResult.aliasesToMakeVisible);
}
}
else {
// Report error
reportedDeclarationError = true;
var errorInfo = getSymbolVisibilityDiagnosticMessage(symbolAccesibilityResult);
diagnostics.push(createDiagnosticForNode(errorInfo.errorNode,
errorInfo.diagnosticMessage,
getSourceTextOfLocalNode(errorInfo.typeName),
symbolAccesibilityResult.errorSymbolName,
symbolAccesibilityResult.errorModuleName));
if (errorInfo) {
if (errorInfo.typeName) {
diagnostics.push(createDiagnosticForNode(errorInfo.errorNode,
errorInfo.diagnosticMessage,
getSourceTextOfLocalNode(errorInfo.typeName),
symbolAccesibilityResult.errorSymbolName,
symbolAccesibilityResult.errorModuleName));
}
else {
diagnostics.push(createDiagnosticForNode(errorInfo.errorNode,
errorInfo.diagnosticMessage,
symbolAccesibilityResult.errorSymbolName,
symbolAccesibilityResult.errorModuleName));
}
}
}
}
@@ -1951,23 +1989,55 @@ module ts {
}
function emitImportDeclaration(node: ImportDeclaration) {
if (resolver.isDeclarationVisible(node)) {
if (node.flags & NodeFlags.Export) {
write("export ");
}
write("import ");
emitSourceTextOfNode(node.name);
write(" = ");
if (node.entityName) {
emitSourceTextOfNode(node.entityName);
write(";");
var nodeEmitInfo = {
declaration: node,
outputPos: writer.getTextPos(),
indent: writer.getIndent(),
hasWritten: resolver.isDeclarationVisible(node)
};
aliasDeclarationEmitInfo.push(nodeEmitInfo);
if (nodeEmitInfo.hasWritten) {
writeImportDeclaration(node);
}
}
function writeImportDeclaration(node: ImportDeclaration) {
// note usage of writer. methods instead of aliases created, just to make sure we are using
// correct writer especially to handle asynchronous alias writing
if (node.flags & NodeFlags.Export) {
writer.write("export ");
}
writer.write("import ");
writer.write(getSourceTextOfLocalNode(node.name));
writer.write(" = ");
if (node.entityName) {
checkEntityNameAccessible();
writer.write(getSourceTextOfLocalNode(node.entityName));
writer.write(";");
}
else {
writer.write("require(");
writer.write(getSourceTextOfLocalNode(node.externalModuleName));
writer.write(");");
}
writer.writeLine();
function checkEntityNameAccessible() {
var symbolAccesibilityResult = resolver.isImportDeclarationEntityNameReferenceDeclarationVisibile(node.entityName);
if (symbolAccesibilityResult.accessibility === SymbolAccessibility.Accessible) {
// write the aliases
if (symbolAccesibilityResult.aliasesToMakeVisible) {
writeAsychronousImportDeclarations(symbolAccesibilityResult.aliasesToMakeVisible);
}
}
else {
write("require(");
emitSourceTextOfNode(node.externalModuleName);
write(");");
// Report error
reportedDeclarationError = true;
diagnostics.push(createDiagnosticForNode(node,
Diagnostics.Import_declaration_0_is_using_private_name_1,
getSourceTextOfLocalNode(node.name),
symbolAccesibilityResult.errorSymbolName));
}
writeLine();
}
}
@@ -2023,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:
@@ -2082,7 +2152,7 @@ module ts {
diagnosticMessage: diagnosticMessage,
errorNode: node,
typeName: node.name
}
};
}
emitSourceTextOfNode(node.name);
@@ -2090,9 +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);
// TODO(shkamat) This is just till we get rest of the error reporting up
getSymbolVisibilityDiagnosticMessage = undefined;
resolver.writeTypeAtLocation(node.constraint, enclosingDeclaration, TypeFormatFlags.UseTypeOfFunction, writer);
}
}
@@ -2111,48 +2179,34 @@ module ts {
function emitTypeOfTypeReference(node: Node) {
getSymbolVisibilityDiagnosticMessage = getHeritageClauseVisibilityError;
resolver.writeTypeAtLocation(node, enclosingDeclaration, TypeFormatFlags.WriteArrayAsGenericType, writer);
// TODO(shkamat) This is just till we get rest of the error reporting up
getSymbolVisibilityDiagnosticMessage = undefined;
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;
}
}
@@ -2160,7 +2214,7 @@ module ts {
diagnosticMessage: diagnosticMessage,
errorNode: node,
typeName: (<Declaration>node.parent).name
}
};
}
}
}
@@ -2237,9 +2291,50 @@ module ts {
}
if (!(node.flags & NodeFlags.Private)) {
write(": ");
resolver.writeTypeAtLocation(node, enclosingDeclaration, TypeFormatFlags.None, writer);
getSymbolVisibilityDiagnosticMessage = getVariableDeclarationTypeVisibilityError;
resolver.writeTypeAtLocation(node, enclosingDeclaration, TypeFormatFlags.UseTypeOfFunction, writer);
}
}
function getVariableDeclarationTypeVisibilityError(symbolAccesibilityResult: SymbolAccessiblityResult) {
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;
}
// This check is to ensure we dont report error on constructor parameter property as that error would be reported during parameter emit
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;
}
}
return diagnosticMessage !== undefined ? {
diagnosticMessage: diagnosticMessage,
errorNode: node,
typeName: node.name
} : undefined;
}
}
function emitVariableStatement(node: VariableStatement) {
@@ -2260,11 +2355,55 @@ module ts {
emitSourceTextOfNode(node.name);
if (!(node.flags & NodeFlags.Private)) {
write(": ");
resolver.writeTypeAtLocation(node, enclosingDeclaration, TypeFormatFlags.None, writer);
getSymbolVisibilityDiagnosticMessage = getAccessorDeclarationTypeVisibilityError;
resolver.writeTypeAtLocation(node, enclosingDeclaration, TypeFormatFlags.UseTypeOfFunction, writer);
}
write(";");
writeLine();
}
function getAccessorDeclarationTypeVisibilityError(symbolAccesibilityResult: SymbolAccessiblityResult) {
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 :
Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1;
}
else {
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1;
}
return {
diagnosticMessage: diagnosticMessage,
errorNode: node.parameters[0],
typeName: node.name
};
}
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;
}
return {
diagnosticMessage: diagnosticMessage,
errorNode: node.name,
typeName: undefined
};
}
}
}
function emitFunctionDeclaration(node: FunctionDeclaration) {
@@ -2317,10 +2456,76 @@ module ts {
// If this is not a constructor and is not private, emit the return type
if (node.kind !== SyntaxKind.Constructor && !(node.flags & NodeFlags.Private)) {
write(": ");
resolver.writeReturnTypeOfSignatureDeclaration(node, enclosingDeclaration, TypeFormatFlags.None, writer);
getSymbolVisibilityDiagnosticMessage = getReturnTypeVisibilityError;
resolver.writeReturnTypeOfSignatureDeclaration(node, enclosingDeclaration, TypeFormatFlags.UseTypeOfFunction, writer);
}
write(";");
writeLine();
function getReturnTypeVisibilityError(symbolAccesibilityResult: SymbolAccessiblityResult) {
var diagnosticMessage: DiagnosticMessage;
switch (node.kind) {
case SyntaxKind.ConstructSignature:
// 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;
break;
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;
}
break;
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;
default:
Debug.fail("This is unknown kind for signature: " + SyntaxKind[node.kind]);
}
return {
diagnosticMessage: diagnosticMessage,
errorNode: <Node>node.name || node,
};
}
}
function emitParameterDeclaration(node: ParameterDeclaration) {
@@ -2334,7 +2539,75 @@ module ts {
if (!(node.parent.flags & NodeFlags.Private)) {
write(": ");
resolver.writeTypeAtLocation(node, enclosingDeclaration, TypeFormatFlags.None, writer);
getSymbolVisibilityDiagnosticMessage = getParameterDeclarationTypeVisibilityError;
resolver.writeTypeAtLocation(node, enclosingDeclaration, TypeFormatFlags.UseTypeOfFunction, writer);
}
function getParameterDeclarationTypeVisibilityError(symbolAccesibilityResult: SymbolAccessiblityResult) {
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;
break;
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;
}
break;
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;
default:
Debug.fail("This is unknown parent for parameter: " + SyntaxKind[node.parent.kind]);
}
return {
diagnosticMessage: diagnosticMessage,
errorNode: node,
typeName: node.name
};
}
}
@@ -2448,7 +2721,19 @@ module ts {
// TODO(shkamat): Should we not write any declaration file if any of them can produce error,
// or should we just not write this file like we are doing now
if (!reportedDeclarationError) {
writeFile(getModuleNameFromFilename(jsFilePath) + ".d.ts", referencePathsOutput + writer.getText(), compilerOptions.emitBOM);
var declarationOutput = referencePathsOutput;
var synchronousDeclarationOutput = writer.getText();
// apply additions
var appliedSyncOutputPos = 0;
forEach(aliasDeclarationEmitInfo, aliasEmitInfo => {
if (aliasEmitInfo.asynchronousOutput) {
declarationOutput += synchronousDeclarationOutput.substring(appliedSyncOutputPos, aliasEmitInfo.outputPos);
declarationOutput += aliasEmitInfo.asynchronousOutput;
appliedSyncOutputPos = aliasEmitInfo.outputPos;
}
});
declarationOutput += synchronousDeclarationOutput.substring(appliedSyncOutputPos);
writeFile(getModuleNameFromFilename(jsFilePath) + ".d.ts", declarationOutput, compilerOptions.emitBOM);
}
}
@@ -2469,6 +2754,11 @@ module ts {
if (compilerOptions.out) {
emitFile(compilerOptions.out);
}
// Sort and make the unique list of diagnostics
diagnostics.sort(compareDiagnostics);
diagnostics = deduplicateSortedDiagnostics(diagnostics);
return {
errors: diagnostics,
sourceMaps: sourceMapDataList
+6 -2
View File
@@ -625,6 +625,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 {
@@ -635,8 +637,9 @@ module ts {
export interface SymbolAccessiblityResult {
accessibility: SymbolAccessibility;
errorSymbolName?: string; // Optional symbol name that results in error
errorModuleName?: string; // If the symbol is not visibile from module, module's name
errorSymbolName?: string // Optional symbol name that results in error
errorModuleName?: string // If the symbol is not visibile from module, module's name
aliasesToMakeVisible?: ImportDeclaration[]; // aliases that need to have this symbol visible
}
export interface EmitResolver {
@@ -656,6 +659,7 @@ module ts {
writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: TextWriter): void;
writeSymbol(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags, writer: TextWriter): void;
isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult;
isImportDeclarationEntityNameReferenceDeclarationVisibile(entityName: EntityName): SymbolAccessiblityResult;
}
export enum SymbolFlags {
+3 -89
View File
@@ -126,93 +126,7 @@ class CompilerBaselineRunner extends RunnerBase {
otherFiles: { unitName: string; content: string }[],
result: Harness.Compiler.CompilerResult
) {
var outputLines: string[] = [];
// Count up all the errors we find so we don't miss any
var totalErrorsReported = 0;
function outputErrorText(error: Harness.Compiler.MinimalDiagnostic) {
var errLines = RunnerBase.removeFullPaths(error.message)
.split('\n')
.map(s => s.length > 0 && s.charAt(s.length - 1) === '\r' ? s.substr(0, s.length - 1) : s)
.filter(s => s.length > 0)
.map(s => '!!! ' + s);
errLines.forEach(e => outputLines.push(e));
totalErrorsReported++;
}
// Report glovbal errors:
var globalErrors = result.errors.filter(err => !err.filename);
globalErrors.forEach(err => outputErrorText(err));
// 'merge' the lines of each input file with any errors associated with it
toBeCompiled.concat(otherFiles).forEach(inputFile => {
// Filter down to the errors in the file
var fileErrors = result.errors.filter(e => {
var errFn = e.filename;
return errFn && errFn === inputFile.unitName;
});
// Header
outputLines.push('==== ' + inputFile.unitName + ' (' + fileErrors.length + ' errors) ====');
// Make sure we emit something for every error
var markedErrorCount = 0;
// For each line, emit the line followed by any error squiggles matching this line
// Note: IE JS engine incorrectly handles consecutive delimiters here when using RegExp split, so
// we have to string-based splitting instead and try to figure out the delimiting chars
var lineStarts = ts.getLineStarts(inputFile.content);
var lines = inputFile.content.split('\n');
lines.forEach((line, lineIndex) => {
if (line.length > 0 && line.charAt(line.length - 1) === '\r') {
line = line.substr(0, line.length - 1);
}
var thisLineStart = lineStarts[lineIndex];
var nextLineStart: number;
// On the last line of the file, fake the next line start number so that we handle errors on the last character of the file correctly
if (lineIndex === lines.length - 1) {
nextLineStart = inputFile.content.length;
} else {
nextLineStart = lineStarts[lineIndex + 1];
}
// Emit this line from the original file
outputLines.push(' ' + line);
fileErrors.forEach(err => {
// Does any error start or continue on to this line? Emit squiggles
if ((err.end >= thisLineStart) && ((err.start < nextLineStart) || (lineIndex === lines.length - 1))) {
// How many characters from the start of this line the error starts at (could be positive or negative)
var relativeOffset = err.start - thisLineStart;
// How many characters of the error are on this line (might be longer than this line in reality)
var length = (err.end - err.start) - Math.max(0, thisLineStart - err.start);
// Calculate the start of the squiggle
var squiggleStart = Math.max(0, relativeOffset);
// TODO/REVIEW: this doesn't work quite right in the browser if a multi file test has files whose names are just the right length relative to one another
outputLines.push(' ' + line.substr(0, squiggleStart).replace(/[^\s]/g, ' ') + new Array(Math.min(length, line.length - squiggleStart) + 1).join('~'));
// If the error ended here, or we're at the end of the file, emit its message
if ((lineIndex === lines.length - 1) || nextLineStart > err.end) {
// Just like above, we need to do a split on a string instead of on a regex
// because the JS engine does regexes wrong
outputErrorText(err);
markedErrorCount++;
}
}
});
});
// Verify we didn't miss any errors in this file
assert.equal(markedErrorCount, fileErrors.length, 'count of errors in ' + inputFile.unitName);
});
// Verify we didn't miss any errors in total
assert.equal(totalErrorsReported, result.errors.length, 'total number of errors');
return outputLines.join('\r\n');
return Harness.Compiler.getErrorBaseline(toBeCompiled.concat(otherFiles), result.errors);
}
// check errors
@@ -250,7 +164,7 @@ class CompilerBaselineRunner extends RunnerBase {
var declFile = ts.forEach(result.declFilesCode,
declFile => declFile.fileName === (file.unitName.substr(0, file.unitName.length - ".ts".length) + ".d.ts")
? declFile : undefined);
return { unitName: rootDir + Harness.Path.getFileName(declFile.fileName), content: declFile.code };
return { unitName: declFile.fileName, content: declFile.code };
}
}
@@ -294,7 +208,7 @@ class CompilerBaselineRunner extends RunnerBase {
if (result.declFilesCode.length > 0) {
jsCode += '\r\n\r\n';
for (var i = 0; i < result.files.length; i++) {
for (var i = 0; i < result.declFilesCode.length; i++) {
jsCode += '//// [' + Harness.Path.getFileName(result.declFilesCode[i].fileName) + ']\r\n';
jsCode += getByteOrderMarkText(result.declFilesCode[i]);
jsCode += result.declFilesCode[i].code;
+97 -1
View File
@@ -748,7 +748,7 @@ module Harness {
var errors: MinimalDiagnostic[] = [];
program.getDiagnostics().concat(checker.getDiagnostics()).concat(emitResult ? emitResult.errors : []).forEach(err => {
// TODO: new compiler formats errors after this point to add . and newlines so we'll just do it manually for now
errors.push({ filename: err.file && err.file.filename, start: err.start, end: err.start + err.length, line: 0, character: 0, message: err.messageText });
errors.push(getMinimalDiagnostic(err));
});
this.lastErrors = errors;
@@ -763,6 +763,102 @@ module Harness {
}
}
export function getMinimalDiagnostic(err: ts.Diagnostic): MinimalDiagnostic {
return { filename: err.file && err.file.filename, start: err.start, end: err.start + err.length, line: 0, character: 0, message: err.messageText };
}
export function getErrorBaseline(inputFiles: { unitName: string; content: string }[],
diagnostics: MinimalDiagnostic[]
) {
var outputLines: string[] = [];
// Count up all the errors we find so we don't miss any
var totalErrorsReported = 0;
function outputErrorText(error: Harness.Compiler.MinimalDiagnostic) {
var errLines = RunnerBase.removeFullPaths(error.message)
.split('\n')
.map(s => s.length > 0 && s.charAt(s.length - 1) === '\r' ? s.substr(0, s.length - 1) : s)
.filter(s => s.length > 0)
.map(s => '!!! ' + s);
errLines.forEach(e => outputLines.push(e));
totalErrorsReported++;
}
// Report glovbal errors:
var globalErrors = diagnostics.filter(err => !err.filename);
globalErrors.forEach(err => outputErrorText(err));
// 'merge' the lines of each input file with any errors associated with it
inputFiles.forEach(inputFile => {
// Filter down to the errors in the file
var fileErrors = diagnostics.filter(e => {
var errFn = e.filename;
return errFn && errFn === inputFile.unitName;
});
// Header
outputLines.push('==== ' + inputFile.unitName + ' (' + fileErrors.length + ' errors) ====');
// Make sure we emit something for every error
var markedErrorCount = 0;
// For each line, emit the line followed by any error squiggles matching this line
// Note: IE JS engine incorrectly handles consecutive delimiters here when using RegExp split, so
// we have to string-based splitting instead and try to figure out the delimiting chars
var lineStarts = ts.getLineStarts(inputFile.content);
var lines = inputFile.content.split('\n');
lines.forEach((line, lineIndex) => {
if (line.length > 0 && line.charAt(line.length - 1) === '\r') {
line = line.substr(0, line.length - 1);
}
var thisLineStart = lineStarts[lineIndex];
var nextLineStart: number;
// On the last line of the file, fake the next line start number so that we handle errors on the last character of the file correctly
if (lineIndex === lines.length - 1) {
nextLineStart = inputFile.content.length;
} else {
nextLineStart = lineStarts[lineIndex + 1];
}
// Emit this line from the original file
outputLines.push(' ' + line);
fileErrors.forEach(err => {
// Does any error start or continue on to this line? Emit squiggles
if ((err.end >= thisLineStart) && ((err.start < nextLineStart) || (lineIndex === lines.length - 1))) {
// How many characters from the start of this line the error starts at (could be positive or negative)
var relativeOffset = err.start - thisLineStart;
// How many characters of the error are on this line (might be longer than this line in reality)
var length = (err.end - err.start) - Math.max(0, thisLineStart - err.start);
// Calculate the start of the squiggle
var squiggleStart = Math.max(0, relativeOffset);
// TODO/REVIEW: this doesn't work quite right in the browser if a multi file test has files whose names are just the right length relative to one another
outputLines.push(' ' + line.substr(0, squiggleStart).replace(/[^\s]/g, ' ') + new Array(Math.min(length, line.length - squiggleStart) + 1).join('~'));
// If the error ended here, or we're at the end of the file, emit its message
if ((lineIndex === lines.length - 1) || nextLineStart > err.end) {
// Just like above, we need to do a split on a string instead of on a regex
// because the JS engine does regexes wrong
outputErrorText(err);
markedErrorCount++;
}
}
});
});
// Verify we didn't miss any errors in this file
assert.equal(markedErrorCount, fileErrors.length, 'count of errors in ' + inputFile.unitName);
});
// Verify we didn't miss any errors in total
assert.equal(totalErrorsReported, diagnostics.length, 'total number of errors');
return outputLines.join('\r\n');
}
/* TODO: Delete?
export function makeDefaultCompilerSettings(options?: { useMinimalDefaultLib: boolean; noImplicitAny: boolean; }) {
var useMinimalDefaultLib = options ? options.useMinimalDefaultLib : true;
+137 -80
View File
@@ -29,13 +29,15 @@ interface BatchCompileProjectTestCaseEmittedFile extends Harness.Compiler.Genera
emittedFileName: string;
}
interface BatchCompileProjectTestCaseResult {
interface CompileProjectFilesResult {
moduleKind: ts.ModuleKind;
program: ts.Program;
readInputFiles: ts.SourceFile[];
sourceMapData: ts.SourceMapData[];
outputFiles: BatchCompileProjectTestCaseEmittedFile[];
errors: ts.Diagnostic[];
sourceMapData: ts.SourceMapData[];
}
interface BatchCompileProjectTestCaseResult extends CompileProjectFilesResult {
outputFiles: BatchCompileProjectTestCaseEmittedFile[];
nonSubfolderDiskFiles: number;
}
@@ -114,13 +116,43 @@ class ProjectRunner extends RunnerBase {
return url;
}
function batchCompilerProjectTestCase(moduleKind: ts.ModuleKind): BatchCompileProjectTestCaseResult{
var nonSubfolderDiskFiles = 0;
var readInputFiles: ts.SourceFile[] = [];
function getCurrentDirectory() {
return sys.resolvePath(testCase.projectRoot);
}
function compileProjectFiles(moduleKind: ts.ModuleKind, getInputFiles: ()=> string[],
getSourceFileText: (filename: string) => string,
writeFile: (filename: string, data: string, writeByteOrderMark: boolean) => void): CompileProjectFilesResult {
var program = ts.createProgram(getInputFiles(), createCompilerOptions(), createCompilerHost());
var errors = program.getDiagnostics();
var sourceMapData: ts.SourceMapData[] = null;
var outputFiles: BatchCompileProjectTestCaseEmittedFile[] = [];
if (!errors.length) {
var checker = program.getTypeChecker();
errors = checker.getDiagnostics();
var emitResult = checker.emitFiles();
errors = ts.concatenate(errors, emitResult.errors);
sourceMapData = emitResult.sourceMaps;
// Clean up source map data that will be used in baselining
if (sourceMapData) {
for (var i = 0; i < sourceMapData.length; i++) {
for (var j = 0; j < sourceMapData[i].sourceMapSources.length; j++) {
sourceMapData[i].sourceMapSources[j] = cleanProjectUrl(sourceMapData[i].sourceMapSources[j]);
}
sourceMapData[i].jsSourceMappingURL = cleanProjectUrl(sourceMapData[i].jsSourceMappingURL);
sourceMapData[i].sourceMapSourceRoot = cleanProjectUrl(sourceMapData[i].sourceMapSourceRoot);
}
}
}
return {
moduleKind: moduleKind,
program: program,
errors: errors,
sourceMapData: sourceMapData
};
function createCompilerOptions(): ts.CompilerOptions {
return {
@@ -140,28 +172,55 @@ class ProjectRunner extends RunnerBase {
sourceFile = Harness.Compiler.defaultLibSourceFile;
}
else {
assert.isTrue(!ts.filter(readInputFiles, sourceFile => sourceFile.filename == filename).length, "Compiler trying to read same file again: " + filename);
try {
var text = sys.readFile(ts.isRootedDiskPath(filename)
? filename
: ts.normalizeSlashes(testCase.projectRoot) + "/" + ts.normalizeSlashes(filename));
}
catch (e) {
// text doesn't get defined.
}
var text = getSourceFileText(filename);
if (text !== undefined) {
sourceFile = ts.createSourceFile(filename, text, languageVersion, /*version:*/ "0");
}
}
if (sourceFile) {
readInputFiles.push(sourceFile);
}
return sourceFile;
}
function createCompilerHost(): ts.CompilerHost {
return {
getSourceFile: getSourceFile,
getDefaultLibFilename: () => "lib.d.ts",
writeFile: writeFile,
getCurrentDirectory: getCurrentDirectory,
getCanonicalFileName: ts.getCanonicalFileName,
useCaseSensitiveFileNames: () => sys.useCaseSensitiveFileNames,
getNewLine: () => sys.newLine
};
}
}
function batchCompilerProjectTestCase(moduleKind: ts.ModuleKind): BatchCompileProjectTestCaseResult{
var nonSubfolderDiskFiles = 0;
var outputFiles: BatchCompileProjectTestCaseEmittedFile[] = [];
var projectCompilerResult = compileProjectFiles(moduleKind, () => testCase.inputFiles, getSourceFileText, writeFile);
return {
moduleKind: moduleKind,
program: projectCompilerResult.program,
sourceMapData: projectCompilerResult.sourceMapData,
outputFiles: outputFiles,
errors: projectCompilerResult.errors,
nonSubfolderDiskFiles: nonSubfolderDiskFiles,
};
function getSourceFileText(filename: string): string {
try {
var text = sys.readFile(ts.isRootedDiskPath(filename)
? filename
: ts.normalizeSlashes(testCase.projectRoot) + "/" + ts.normalizeSlashes(filename));
}
catch (e) {
// text doesn't get defined.
}
return text;
}
function writeFile(filename: string, data: string, writeByteOrderMark: boolean) {
var diskFileName = ts.isRootedDiskPath(filename)
? filename
@@ -209,53 +268,55 @@ class ProjectRunner extends RunnerBase {
outputFiles.push({ emittedFileName: filename, code: data, fileName: diskRelativeName, writeByteOrderMark: writeByteOrderMark });
}
}
function getCurrentDirectory() {
return sys.resolvePath(testCase.projectRoot);
function compileCompileDTsFiles(compilerResult: BatchCompileProjectTestCaseResult) {
var inputDtsSourceFiles = ts.map(ts.filter(compilerResult.program.getSourceFiles(),
sourceFile => Harness.Compiler.isDTS(sourceFile.filename)),
sourceFile => {
return { emittedFileName: sourceFile.filename, code: sourceFile.text };
});
var ouputDtsFiles = ts.filter(compilerResult.outputFiles, ouputFile => Harness.Compiler.isDTS(ouputFile.emittedFileName));
var allInputFiles = inputDtsSourceFiles.concat(ouputDtsFiles);
return compileProjectFiles(compilerResult.moduleKind,getInputFiles, getSourceFileText, writeFile);
function getInputFiles() {
return ts.map(allInputFiles, outputFile => outputFile.emittedFileName);
}
function getSourceFileText(filename: string): string {
return ts.forEach(allInputFiles, inputFile => inputFile.emittedFileName === filename ? inputFile.code : undefined);
}
function createCompilerHost(): ts.CompilerHost {
return {
getSourceFile: getSourceFile,
getDefaultLibFilename: () => Harness.Compiler.defaultLibFileName,
writeFile: writeFile,
getCurrentDirectory: getCurrentDirectory,
getCanonicalFileName: ts.getCanonicalFileName,
useCaseSensitiveFileNames: () => sys.useCaseSensitiveFileNames,
getNewLine:()=> sys.newLine
};
function writeFile(filename: string, data: string, writeByteOrderMark: boolean) {
}
}
var program = ts.createProgram(testCase.inputFiles, createCompilerOptions(), createCompilerHost());
var errors = program.getDiagnostics();
if (!errors.length) {
var checker = program.getTypeChecker();
errors = checker.getDiagnostics();
var emitResult = checker.emitFiles();
errors = ts.concatenate(errors, emitResult.errors);
sourceMapData = emitResult.sourceMaps;
// Clean up source map data that will be used in baselining
if (sourceMapData) {
for (var i = 0; i < sourceMapData.length; i++) {
for (var j = 0; j < sourceMapData[i].sourceMapSources.length; j++) {
sourceMapData[i].sourceMapSources[j] = cleanProjectUrl(sourceMapData[i].sourceMapSources[j]);
}
sourceMapData[i].jsSourceMappingURL = cleanProjectUrl(sourceMapData[i].jsSourceMappingURL);
sourceMapData[i].sourceMapSourceRoot = cleanProjectUrl(sourceMapData[i].sourceMapSourceRoot);
}
function getErrorsBaseline(compilerResult: CompileProjectFilesResult) {
// This is copied from tc.ts's reportError to replicate what tc does
var errors = "";
for (var i = 0; i < compilerResult.errors.length; i++) {
var error = compilerResult.errors[i];
// TODO(jfreeman): Remove assert
ts.Debug.assert(error.messageText.indexOf("{NL}") < 0);
if (error.file) {
var loc = error.file.getLineAndCharacterFromPosition(error.start);
errors += error.file.filename + "(" + loc.line + "," + loc.character + "): " + error.messageText + sys.newLine;
}
else {
errors += error.messageText + sys.newLine;
}
}
return {
moduleKind: moduleKind,
program: program,
readInputFiles: readInputFiles,
sourceMapData: sourceMapData,
outputFiles: outputFiles,
errors: errors,
nonSubfolderDiskFiles: nonSubfolderDiskFiles,
};
var inputFiles = ts.map(ts.filter(compilerResult.program.getSourceFiles(),
sourceFile => sourceFile.filename !== "lib.d.ts"),
sourceFile => {
return { unitName: sourceFile.filename, content: sourceFile.text };
});
var diagnostics = ts.map(compilerResult.errors, error => Harness.Compiler.getMinimalDiagnostic(error));
errors += sys.newLine + sys.newLine + Harness.Compiler.getErrorBaseline(inputFiles, diagnostics);
return errors;
}
describe('Compiling project for ' + testCase.scenario +': testcase ' + testCaseFileName, () => {
@@ -276,7 +337,7 @@ class ProjectRunner extends RunnerBase {
baselineCheck: testCase.baselineCheck,
runTest: testCase.runTest,
bug: testCase.bug,
resolvedInputFiles: ts.map(compilerResult.readInputFiles, inputFile => inputFile.filename),
resolvedInputFiles: ts.map(compilerResult.program.getSourceFiles(), inputFile => inputFile.filename),
emittedFiles: ts.map(compilerResult.outputFiles, outputFile => outputFile.emittedFileName)
};
@@ -284,7 +345,6 @@ class ProjectRunner extends RunnerBase {
}
it('Resolution information of (' + moduleNameToString(compilerResult.moduleKind) + '): ' + testCaseFileName, () => {
assert.equal(compilerResult.program.getSourceFiles().length, compilerResult.readInputFiles.length, "Compiler missing/has extra source files that were read during compilation");
Harness.Baseline.runBaseline('Resolution information of (' + moduleNameToString(compilerResult.moduleKind) + '): ' + testCaseFileName, getBaselineFolder(compilerResult.moduleKind) + testCaseJustName + '.json', () => {
return JSON.stringify(getCompilerResolutionInfo(), undefined, " ");
});
@@ -293,22 +353,7 @@ class ProjectRunner extends RunnerBase {
if (compilerResult.errors.length) {
it('Errors for (' + moduleNameToString(compilerResult.moduleKind) + '): ' + testCaseFileName, () => {
Harness.Baseline.runBaseline('Errors for (' + moduleNameToString(compilerResult.moduleKind) + '): ' + testCaseFileName, getBaselineFolder(compilerResult.moduleKind) + testCaseJustName + '.errors.txt', () => {
// This is copied from tc.ts's reportError to replicate what tc does
var errors = "";
for (var i = 0; i < compilerResult.errors.length; i++) {
var error = compilerResult.errors[i];
// TODO(jfreeman): Remove assert
ts.Debug.assert(error.messageText.indexOf("{NL}") < 0);
if (error.file) {
var loc = error.file.getLineAndCharacterFromPosition(error.start);
errors += error.file.filename + "(" + loc.line + "," + loc.character + "): " + error.messageText + sys.newLine;
}
else {
errors += error.messageText + sys.newLine;
}
}
return errors;
return getErrorsBaseline(compilerResult);
});
});
}
@@ -335,6 +380,18 @@ class ProjectRunner extends RunnerBase {
});
});
}
// Verify that all the generated .d.ts files compile
if (!compilerResult.errors.length && testCase.declaration) {
var dTsCompileResult = compileCompileDTsFiles(compilerResult);
if (dTsCompileResult.errors.length) {
it('Errors in generated Dts files for (' + moduleNameToString(compilerResult.moduleKind) + '): ' + testCaseFileName, () => {
Harness.Baseline.runBaseline('Errors in generated Dts files for (' + moduleNameToString(compilerResult.moduleKind) + '): ' + testCaseFileName, getBaselineFolder(compilerResult.moduleKind) + testCaseJustName + '.dts.errors.txt', () => {
return getErrorsBaseline(dTsCompileResult);
});
});
}
}
}
}
@@ -0,0 +1,8 @@
==== tests/cases/compiler/aliasInaccessibleModule.ts (1 errors) ====
module M {
module N {
}
export import X = N;
~~~~~~~~~~~~~~~~~~~~
!!! Import declaration 'X' is using private name 'N'.
}
@@ -0,0 +1,12 @@
==== tests/cases/compiler/aliasInaccessibleModule2.ts (1 errors) ====
module M {
module N {
class C {
}
}
import R = N;
~~~~~~~~~~~~~
!!! Import declaration 'R' is using private name 'N'.
export import X = R;
}
@@ -1,30 +0,0 @@
==== tests/cases/compiler/aliasUsage1_main.ts (2 errors) ====
import Backbone = require("aliasUsage1_backbone");
import moduleA = require("aliasUsage1_moduleA");
interface IHasVisualizationModel {
VisualizationModel: typeof Backbone.Model;
}
class C2 {
x: IHasVisualizationModel;
get A() {
~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
return this.x;
}
set A(x) {
~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
x = moduleA;
}
}
==== tests/cases/compiler/aliasUsage1_backbone.ts (0 errors) ====
export class Model {
public someData: string;
}
==== tests/cases/compiler/aliasUsage1_moduleA.ts (0 errors) ====
import Backbone = require("aliasUsage1_backbone");
export class VisualizationModel extends Backbone.Model {
// interesting stuff here
}
@@ -0,0 +1,69 @@
//// [tests/cases/compiler/aliasUsageInAccessorsOfClass.ts] ////
//// [aliasUsage1_backbone.ts]
export class Model {
public someData: string;
}
//// [aliasUsage1_moduleA.ts]
import Backbone = require("aliasUsage1_backbone");
export class VisualizationModel extends Backbone.Model {
// interesting stuff here
}
//// [aliasUsage1_main.ts]
import Backbone = require("aliasUsage1_backbone");
import moduleA = require("aliasUsage1_moduleA");
interface IHasVisualizationModel {
VisualizationModel: typeof Backbone.Model;
}
class C2 {
x: IHasVisualizationModel;
get A() {
return this.x;
}
set A(x) {
x = moduleA;
}
}
//// [aliasUsage1_backbone.js]
var Model = (function () {
function Model() {
}
return Model;
})();
exports.Model = Model;
//// [aliasUsage1_moduleA.js]
var __extends = this.__extends || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
__.prototype = b.prototype;
d.prototype = new __();
};
var Backbone = require("aliasUsage1_backbone");
var VisualizationModel = (function (_super) {
__extends(VisualizationModel, _super);
function VisualizationModel() {
_super.apply(this, arguments);
}
return VisualizationModel;
})(Backbone.Model);
exports.VisualizationModel = VisualizationModel;
//// [aliasUsage1_main.js]
var moduleA = require("aliasUsage1_moduleA");
var C2 = (function () {
function C2() {
}
Object.defineProperty(C2.prototype, "A", {
get: function () {
return this.x;
},
set: function (x) {
x = moduleA;
},
enumerable: true,
configurable: true
});
return C2;
})();
@@ -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;
@@ -20,3 +20,24 @@ declare module "MainModule" {
//// [cyclicModuleImport.js]
//// [cyclicModuleImport.d.ts]
declare module "SubModule" {
import MainModule = require('MainModule');
class SubModule {
static StaticVar: number;
InstanceVar: number;
main: MainModule;
constructor();
}
export = SubModule;
}
declare module "MainModule" {
import SubModule = require('SubModule');
class MainModule {
SubModule: SubModule;
constructor();
}
export = MainModule;
}
@@ -27,28 +27,12 @@ exports.x;
declare module "SubModule" {
module m {
module m3 {
interface c {
}
}
}
}
//// [declFileAmbientExternalModuleWithSingleExportedModule_1.d.ts]
/// <reference path='declFileAmbientExternalModuleWithSingleExportedModule_0.d.ts' />
import SubModule = require('SubModule');
export declare var x: SubModule.m.m3.c;
//// [DtsFileErrors]
==== tests/cases/compiler/declFileAmbientExternalModuleWithSingleExportedModule_1.d.ts (1 errors) ====
/// <reference path='declFileAmbientExternalModuleWithSingleExportedModule_0.d.ts' />
export declare var x: SubModule.m.m3.c;
~~~~~~~~~~~~~~~~
!!! Cannot find name 'SubModule'.
==== tests/cases/compiler/declFileAmbientExternalModuleWithSingleExportedModule_0.d.ts (0 errors) ====
declare module "SubModule" {
module m {
module m3 {
}
}
}
@@ -28,20 +28,5 @@ interface Foo<T> {
}
export = Foo;
//// [declFileExportAssignmentOfGenericInterface_1.d.ts]
import a = require('declFileExportAssignmentOfGenericInterface_0');
export declare var x: a<a<string>>;
//// [DtsFileErrors]
==== tests/cases/compiler/declFileExportAssignmentOfGenericInterface_1.d.ts (1 errors) ====
export declare var x: a<a<string>>;
~~~~~~~~~~~~
!!! Cannot find name 'a'.
==== tests/cases/compiler/declFileExportAssignmentOfGenericInterface_0.d.ts (0 errors) ====
interface Foo<T> {
a: string;
}
export = Foo;
@@ -74,33 +74,5 @@ export = b;
//// [declFileExportImportChain_c.d.ts]
export import b1 = require("declFileExportImportChain_b1");
//// [declFileExportImportChain_d.d.ts]
export declare var x: m1.m2.c1;
//// [DtsFileErrors]
==== tests/cases/compiler/declFileExportImportChain_d.d.ts (1 errors) ====
export declare var x: m1.m2.c1;
~~~~~~~~
!!! Cannot find name 'm1'.
==== tests/cases/compiler/declFileExportImportChain_a.d.ts (0 errors) ====
declare module m1 {
module m2 {
class c1 {
}
}
}
export = m1;
==== tests/cases/compiler/declFileExportImportChain_b.d.ts (0 errors) ====
export import a = require("declFileExportImportChain_a");
==== tests/cases/compiler/declFileExportImportChain_b1.d.ts (0 errors) ====
import b = require("declFileExportImportChain_b");
export = b;
==== tests/cases/compiler/declFileExportImportChain_c.d.ts (0 errors) ====
export import b1 = require("declFileExportImportChain_b1");
import c = require("declFileExportImportChain_c");
export declare var x: c.b1.a.m2.c1;
@@ -65,30 +65,5 @@ export = a;
//// [declFileExportImportChain2_c.d.ts]
export import b = require("declFileExportImportChain2_b");
//// [declFileExportImportChain2_d.d.ts]
export declare var x: m1.m2.c1;
//// [DtsFileErrors]
==== tests/cases/compiler/declFileExportImportChain2_d.d.ts (1 errors) ====
export declare var x: m1.m2.c1;
~~~~~~~~
!!! Cannot find name 'm1'.
==== tests/cases/compiler/declFileExportImportChain2_a.d.ts (0 errors) ====
declare module m1 {
module m2 {
class c1 {
}
}
}
export = m1;
==== tests/cases/compiler/declFileExportImportChain2_b.d.ts (0 errors) ====
import a = require("declFileExportImportChain2_a");
export = a;
==== tests/cases/compiler/declFileExportImportChain2_c.d.ts (0 errors) ====
export import b = require("declFileExportImportChain2_b");
import c = require("declFileExportImportChain2_c");
export declare var x: c.b.m2.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;
@@ -91,12 +91,21 @@ var templa;
//// [declFileGenericType2.d.ts]
declare module templa.mvc {
interface IModel {
}
}
declare module templa.mvc {
interface IController<ModelType extends IModel> {
}
}
declare module templa.mvc {
class AbstractController<ModelType extends IModel> implements IController<ModelType> {
}
}
declare module templa.mvc.composite {
interface ICompositeControllerModel extends IModel {
getControllers(): IController<IModel>[];
}
}
declare module templa.dom.mvc {
interface IElementController<ModelType extends templa.mvc.IModel> extends templa.mvc.IController<ModelType> {
@@ -113,45 +122,3 @@ declare module templa.dom.mvc.composite {
constructor();
}
}
//// [DtsFileErrors]
==== tests/cases/compiler/declFileGenericType2.d.ts (6 errors) ====
declare module templa.mvc {
}
declare module templa.mvc {
}
declare module templa.mvc {
}
declare module templa.mvc.composite {
}
declare module templa.dom.mvc {
interface IElementController<ModelType extends templa.mvc.IModel> extends templa.mvc.IController<ModelType> {
~~~~~~~~~~~~~~~~~
!!! Module 'templa.mvc' has no exported member 'IModel'.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Module 'templa.mvc' has no exported member 'IController'.
}
}
declare module templa.dom.mvc {
class AbstractElementController<ModelType extends templa.mvc.IModel> extends templa.mvc.AbstractController<ModelType> implements IElementController<ModelType> {
~~~~~~~~~~~~~~~~~
!!! Module 'templa.mvc' has no exported member 'IModel'.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Module 'templa.mvc' has no exported member 'AbstractController'.
constructor();
}
}
declare module templa.dom.mvc.composite {
class AbstractCompositeElementController<ModelType extends templa.mvc.composite.ICompositeControllerModel> extends AbstractElementController<ModelType> {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Module 'templa.mvc.composite' has no exported member 'ICompositeControllerModel'.
_controllers: templa.mvc.IController<templa.mvc.IModel>[];
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Module 'templa.mvc' has no exported member 'IController'.
constructor();
}
}
@@ -0,0 +1,39 @@
//// [declFileImportChainInExportAssignment.ts]
module m {
export module c {
export class c {
}
}
}
import a = m.c;
import b = a;
export = b;
//// [declFileImportChainInExportAssignment.js]
var m;
(function (m) {
(function (_c) {
var c = (function () {
function c() {
}
return c;
})();
_c.c = c;
})(m.c || (m.c = {}));
var c = m.c;
})(m || (m = {}));
var a = m.c;
var b = a;
module.exports = b;
//// [declFileImportChainInExportAssignment.d.ts]
declare module m {
module c {
class c {
}
}
}
import a = m.c;
import b = a;
export = b;
@@ -52,43 +52,9 @@ declare var m2: {
};
export = m2;
//// [declFileImportModuleWithExportAssignment_1.d.ts]
import a1 = require("declFileImportModuleWithExportAssignment_0");
export declare var a: {
(): a1.connectExport;
test1: a1.connectModule;
test2(): a1.connectModule;
};
//// [DtsFileErrors]
==== tests/cases/compiler/declFileImportModuleWithExportAssignment_1.d.ts (3 errors) ====
export declare var a: {
(): a1.connectExport;
~~~~~~~~~~~~~~~~
!!! Cannot find name 'a1'.
test1: a1.connectModule;
~~~~~~~~~~~~~~~~
!!! Cannot find name 'a1'.
test2(): a1.connectModule;
~~~~~~~~~~~~~~~~
!!! Cannot find name 'a1'.
};
==== tests/cases/compiler/declFileImportModuleWithExportAssignment_0.d.ts (0 errors) ====
declare module m2 {
interface connectModule {
(res: any, req: any, next: any): void;
}
interface connectExport {
use: (mod: connectModule) => connectExport;
listen: (port: number) => void;
}
}
declare var m2: {
(): m2.connectExport;
test1: m2.connectModule;
test2(): m2.connectModule;
};
export = m2;
@@ -25,23 +25,10 @@ var List = (function () {
declare class List<T> {
}
declare module 'mod1' {
class Foo {
}
}
declare module 'moo' {
import x = require('mod1');
var p: List<x.Foo>;
}
//// [DtsFileErrors]
==== tests/cases/compiler/declFileImportedTypeUseInTypeArgPosition.d.ts (1 errors) ====
declare class List<T> {
}
declare module 'mod1' {
}
declare module 'moo' {
var p: List<x.Foo>;
~~~~~
!!! Cannot find name 'x'.
}
@@ -40,29 +40,10 @@ declare module m {
}
}
declare module m1 {
import x = m.c;
var d: x;
}
declare module m2 {
export import x = m.c;
var d: x;
}
//// [DtsFileErrors]
==== tests/cases/compiler/declFileInternalAliases.d.ts (1 errors) ====
declare module m {
class c {
}
}
declare module m1 {
var d: x;
~
!!! Cannot find name 'x'.
}
declare module m2 {
export import x = m.c;
var d: x;
}
@@ -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;
@@ -58,6 +58,8 @@ var A;
//// [declFileWithExtendsClauseThatHasItsContainerNameConflict.d.ts]
declare module A.B.C {
class B {
}
}
declare module A.B {
class EventManager {
@@ -0,0 +1,32 @@
==== tests/cases/compiler/declInput-2.ts (5 errors) ====
module M {
class C { }
export class E {}
export interface I1 {}
interface I2 {}
export class D {
private c: C; // don't generate
public m1: number;
public m2: string;
public m22: C; // don't generate
~~~~~~~~~~~~~~
!!! Public property 'm22' of exported class has or is using private name 'C'.
public m23: E;
public m24: I1;
public m25: I2; // don't generate
~~~~~~~~~~~~~~~
!!! Public property 'm25' of exported class has or is using private name 'I2'.
public m232(): E { return null;}
public m242(): I1 { return null; }
public m252(): I2 { return null; } // don't generate
~~~~
!!! Return type of public method from exported class has or is using private name 'I2'.
public m26(i:I1) {}
public m262(i:I2) {}
~~~~
!!! Parameter 'i' of public method from exported class has or is using private name 'I2'.
public m3():C { return new C(); }
~~
!!! Return type of public method from exported class has or is using private name 'C'.
}
}
-62
View File
@@ -58,65 +58,3 @@ var M;
})();
M.D = D;
})(M || (M = {}));
//// [declInput-2.d.ts]
declare module M {
class E {
}
interface I1 {
}
class D {
private c;
m1: number;
m2: string;
m22: C;
m23: E;
m24: I1;
m25: I2;
m232(): E;
m242(): I1;
m252(): I2;
m26(i: I1): void;
m262(i: I2): void;
m3(): C;
}
}
//// [DtsFileErrors]
==== tests/cases/compiler/declInput-2.d.ts (5 errors) ====
declare module M {
class E {
}
interface I1 {
}
class D {
private c;
m1: number;
m2: string;
m22: C;
~
!!! Cannot find name 'C'.
m23: E;
m24: I1;
m25: I2;
~~
!!! Cannot find name 'I2'.
m232(): E;
m242(): I1;
m252(): I2;
~~
!!! Cannot find name 'I2'.
m26(i: I1): void;
m262(i: I2): void;
~~
!!! Cannot find name 'I2'.
m3(): C;
~
!!! Cannot find name 'C'.
}
}
@@ -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
@@ -145,6 +144,7 @@ declare module f {
}
export = f;
//// [declarationEmit_nameConflicts_0.d.ts]
import im = require('declarationEmit_nameConflicts_1');
export declare module M {
function f(): void;
class C {
@@ -169,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 {
@@ -186,74 +186,10 @@ export declare module M.Q {
}
interface b extends M.C {
}
interface I extends M.N.I {
interface I extends M.c.I {
}
module c {
interface I extends M.N.I {
interface I extends M.c.I {
}
}
}
//// [DtsFileErrors]
==== tests/cases/compiler/declarationEmit_nameConflicts_0.d.ts (1 errors) ====
export declare module M {
function f(): void;
class C {
}
module N {
function g(): void;
interface I {
}
}
export import a = M.f;
export import b = M.C;
export import c = N;
export import d = im;
~~~~~~~~~~~~~~~~~~~~~
!!! Cannot find name 'im'.
}
export declare module M.P {
function f(): void;
class C {
}
module N {
function g(): void;
interface I {
}
}
export import im = M.P.f;
var a: () => void;
var b: typeof M.C;
var c: typeof M.N;
var g: () => void;
var d: typeof M.d;
}
export declare module M.Q {
function f(): void;
class C {
}
module N {
function g(): void;
interface I {
}
}
interface b extends M.C {
}
interface I extends M.N.I {
}
module c {
interface I extends M.N.I {
}
}
}
==== tests/cases/compiler/declarationEmit_nameConflicts_1.d.ts (0 errors) ====
declare module f {
class c {
}
}
export = f;
@@ -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;
}
@@ -1,5 +1,4 @@
//// [declarationEmit_nameConflictsWithAlias.ts]
// Bug 887180
export module C { export interface I { } }
export import v = C;
export module M {
+5
View File
@@ -14,4 +14,9 @@ declare module mAmbient {
//// [enumDecl1.d.ts]
declare module mAmbient {
enum e {
x,
y,
z,
}
}
+2 -20
View File
@@ -46,23 +46,5 @@ declare class Widget1 {
//// [exporter.d.ts]
export import w = require('./w1');
//// [consumer.d.ts]
export declare function w(): Widget1;
//// [DtsFileErrors]
==== tests/cases/compiler/consumer.d.ts (1 errors) ====
export declare function w(): Widget1;
~~~~~~~
!!! Cannot find name 'Widget1'.
==== tests/cases/compiler/w1.d.ts (0 errors) ====
export = Widget1;
declare class Widget1 {
name: string;
}
==== tests/cases/compiler/exporter.d.ts (0 errors) ====
export import w = require('./w1');
import e = require('./exporter');
export declare function w(): e.w;
@@ -38,23 +38,5 @@ interface Widget1 {
//// [exporter.d.ts]
export import w = require('./w1');
//// [consumer.d.ts]
export declare function w(): Widget1;
//// [DtsFileErrors]
==== tests/cases/compiler/consumer.d.ts (1 errors) ====
export declare function w(): Widget1;
~~~~~~~
!!! Cannot find name 'Widget1'.
==== tests/cases/compiler/w1.d.ts (0 errors) ====
export = Widget1;
interface Widget1 {
name: string;
}
==== tests/cases/compiler/exporter.d.ts (0 errors) ====
export import w = require('./w1');
import e = require('./exporter');
export declare function w(): e.w;
+10 -13
View File
@@ -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;
@@ -8,14 +8,4 @@ var x = function somefn() {
//// [functionExpressionReturningItself.d.ts]
declare var x: () => typeof somefn;
//// [DtsFileErrors]
==== tests/cases/compiler/functionExpressionReturningItself.d.ts (1 errors) ====
declare var x: () => typeof somefn;
~~~~~~
!!! Cannot find name 'somefn'.
declare var x: () => any;
@@ -10,4 +10,4 @@ function somefn() {
//// [functionReturningItself.d.ts]
declare function somefn(): () => typeof somefn;
declare function somefn(): typeof somefn;
@@ -1,83 +0,0 @@
==== tests/cases/compiler/importDecl_1.ts (1 errors) ====
///<reference path='importDecl_require.ts'/>
///<reference path='importDecl_require1.ts'/>
///<reference path='importDecl_require2.ts'/>
///<reference path='importDecl_require3.ts'/>
///<reference path='importDecl_require4.ts'/>
import m4 = require("importDecl_require"); // Emit used
export var x4 = m4.x;
export var d4 = m4.d;
export var f4 = m4.foo();
export module m1 {
export var x2 = m4.x;
export var d2 = m4.d;
export var f2 = m4.foo();
var x3 = m4.x;
var d3 = m4.d;
var f3 = m4.foo();
}
//Emit global only usage
import glo_m4 = require("importDecl_require1");
export var useGlo_m4_x4 = glo_m4.x;
~
!!! Property 'x' does not exist on type 'typeof "tests/cases/compiler/importDecl_require1"'.
export var useGlo_m4_d4 = glo_m4.d;
export var useGlo_m4_f4 = glo_m4.foo();
//Emit even when used just in function type
import fncOnly_m4 = require("importDecl_require2");
export var useFncOnly_m4_f4 = fncOnly_m4.foo();
// only used privately no need to emit
import private_m4 = require("importDecl_require3");
export module usePrivate_m4_m1 {
var x3 = private_m4.x;
var d3 = private_m4.d;
var f3 = private_m4.foo();
}
// Do not emit unused import
import m5 = require("importDecl_require4");
export var d = m5.foo2();
// Do not emit multiple used import statements
import multiImport_m4 = require("importDecl_require"); // Emit used
export var useMultiImport_m4_x4 = multiImport_m4.x;
export var useMultiImport_m4_d4 = multiImport_m4.d;
export var useMultiImport_m4_f4 = multiImport_m4.foo();
==== tests/cases/compiler/importDecl_require.ts (0 errors) ====
export class d {
foo: string;
}
export var x: d;
export function foo(): d { return null; }
==== tests/cases/compiler/importDecl_require1.ts (0 errors) ====
export class d {
bar: string;
}
var x: d;
export function foo(): d { return null; }
==== tests/cases/compiler/importDecl_require2.ts (0 errors) ====
export class d {
baz: string;
}
export var x: d;
export function foo(): d { return null; }
==== tests/cases/compiler/importDecl_require3.ts (0 errors) ====
export class d {
bing: string;
}
export var x: d;
export function foo(): d { return null; }
==== tests/cases/compiler/importDecl_require4.ts (0 errors) ====
import m4 = require("importDecl_require");
export function foo2(): m4.d { return null; }
+54 -2
View File
@@ -55,7 +55,6 @@ export module m1 {
//Emit global only usage
import glo_m4 = require("importDecl_require1");
export var useGlo_m4_x4 = glo_m4.x;
export var useGlo_m4_d4 = glo_m4.d;
export var useGlo_m4_f4 = glo_m4.foo();
@@ -150,7 +149,6 @@ exports.f4 = m4.foo();
})(exports.m1 || (exports.m1 = {}));
var m1 = exports.m1;
var glo_m4 = require("importDecl_require1");
exports.useGlo_m4_x4 = glo_m4.x;
exports.useGlo_m4_d4 = glo_m4.d;
exports.useGlo_m4_f4 = glo_m4.foo();
var fncOnly_m4 = require("importDecl_require2");
@@ -168,3 +166,57 @@ var multiImport_m4 = require("importDecl_require");
exports.useMultiImport_m4_x4 = multiImport_m4.x;
exports.useMultiImport_m4_d4 = multiImport_m4.d;
exports.useMultiImport_m4_f4 = multiImport_m4.foo();
//// [importDecl_require.d.ts]
export declare class d {
foo: string;
}
export declare var x: d;
export declare function foo(): d;
//// [importDecl_require1.d.ts]
export declare class d {
bar: string;
}
export declare function foo(): d;
//// [importDecl_require2.d.ts]
export declare class d {
baz: string;
}
export declare var x: d;
export declare function foo(): d;
//// [importDecl_require3.d.ts]
export declare class d {
bing: string;
}
export declare var x: d;
export declare function foo(): d;
//// [importDecl_require4.d.ts]
import m4 = require("importDecl_require");
export declare function foo2(): m4.d;
//// [importDecl_1.d.ts]
/// <reference path='importDecl_require.d.ts' />
/// <reference path='importDecl_require1.d.ts' />
/// <reference path='importDecl_require2.d.ts' />
/// <reference path='importDecl_require3.d.ts' />
/// <reference path='importDecl_require4.d.ts' />
import m4 = require("importDecl_require");
export declare var x4: m4.d;
export declare var d4: typeof m4.d;
export declare var f4: m4.d;
export declare module m1 {
var x2: m4.d;
var d2: typeof m4.d;
var f2: m4.d;
}
import glo_m4 = require("importDecl_require1");
export declare var useGlo_m4_d4: typeof glo_m4.d;
export declare var useGlo_m4_f4: glo_m4.d;
import fncOnly_m4 = require("importDecl_require2");
export declare var useFncOnly_m4_f4: fncOnly_m4.d;
export declare module usePrivate_m4_m1 {
}
export declare var d: m4.d;
export declare var useMultiImport_m4_x4: m4.d;
export declare var useMultiImport_m4_d4: typeof m4.d;
export declare var useMultiImport_m4_f4: m4.d;
@@ -28,20 +28,5 @@ export declare class B {
}
//// [importDeclarationUsedAsTypeQuery_1.d.ts]
/// <reference path='importDeclarationUsedAsTypeQuery_require.d.ts' />
import a = require('importDeclarationUsedAsTypeQuery_require');
export declare var x: typeof a;
//// [DtsFileErrors]
==== tests/cases/compiler/importDeclarationUsedAsTypeQuery_1.d.ts (1 errors) ====
/// <reference path='importDeclarationUsedAsTypeQuery_require.d.ts' />
export declare var x: typeof a;
~
!!! Cannot find name 'a'.
==== tests/cases/compiler/importDeclarationUsedAsTypeQuery_require.d.ts (0 errors) ====
export declare class B {
id: number;
}
@@ -32,21 +32,6 @@ declare module a {
}
}
declare module c {
import b = a.c;
var x: b;
}
//// [DtsFileErrors]
==== tests/cases/compiler/internalAliasClass.d.ts (1 errors) ====
declare module a {
class c {
}
}
declare module c {
var x: b;
~
!!! Cannot find name 'b'.
}
@@ -47,25 +47,7 @@ export declare module x {
}
export declare module m2 {
module m3 {
import c = x.c;
var cProp: c;
}
}
//// [DtsFileErrors]
==== tests/cases/compiler/internalAliasClassInsideLocalModuleWithoutExport.d.ts (1 errors) ====
export declare module x {
class c {
foo(a: number): number;
}
}
export declare module m2 {
module m3 {
var cProp: c;
~
!!! Cannot find name 'c'.
}
}
@@ -35,19 +35,5 @@ export declare module x {
foo(a: number): number;
}
}
import xc = x.c;
export declare var cProp: xc;
//// [DtsFileErrors]
==== tests/cases/compiler/internalAliasClassInsideTopLevelModuleWithoutExport.d.ts (1 errors) ====
export declare module x {
class c {
foo(a: number): number;
}
}
export declare var cProp: xc;
~~
!!! Cannot find name 'xc'.
+1 -19
View File
@@ -39,24 +39,6 @@ declare module a {
}
}
declare module c {
import b = a.weekend;
var bVal: b;
}
//// [DtsFileErrors]
==== tests/cases/compiler/internalAliasEnum.d.ts (1 errors) ====
declare module a {
enum weekend {
Friday = 0,
Saturday = 1,
Sunday = 2,
}
}
declare module c {
var bVal: b;
~
!!! Cannot find name 'b'.
}
@@ -39,24 +39,6 @@ export declare module a {
}
}
export declare module c {
import b = a.weekend;
var bVal: b;
}
//// [DtsFileErrors]
==== tests/cases/compiler/internalAliasEnumInsideLocalModuleWithoutExport.d.ts (1 errors) ====
export declare module a {
enum weekend {
Friday = 0,
Saturday = 1,
Sunday = 2,
}
}
export declare module c {
var bVal: b;
~
!!! Cannot find name 'b'.
}
@@ -35,21 +35,5 @@ export declare module a {
Sunday = 2,
}
}
import b = a.weekend;
export declare var bVal: b;
//// [DtsFileErrors]
==== tests/cases/compiler/internalAliasEnumInsideTopLevelModuleWithoutExport.d.ts (1 errors) ====
export declare module a {
enum weekend {
Friday = 0,
Saturday = 1,
Sunday = 2,
}
}
export declare var bVal: b;
~
!!! Cannot find name 'b'.
@@ -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;
@@ -39,23 +39,6 @@ declare module a {
}
}
declare module c {
import b = a.b;
var x: b.c;
}
//// [DtsFileErrors]
==== tests/cases/compiler/internalAliasInitializedModule.d.ts (1 errors) ====
declare module a {
module b {
class c {
}
}
}
declare module c {
var x: b.c;
~~~
!!! Cannot find name 'b'.
}
@@ -39,23 +39,6 @@ export declare module a {
}
}
export declare module c {
import b = a.b;
var x: b.c;
}
//// [DtsFileErrors]
==== tests/cases/compiler/internalAliasInitializedModuleInsideLocalModuleWithoutExport.d.ts (1 errors) ====
export declare module a {
module b {
class c {
}
}
}
export declare module c {
var x: b.c;
~~~
!!! Cannot find name 'b'.
}
@@ -35,20 +35,5 @@ export declare module a {
}
}
}
import b = a.b;
export declare var x: b.c;
//// [DtsFileErrors]
==== tests/cases/compiler/internalAliasInitializedModuleInsideTopLevelModuleWithoutExport.d.ts (1 errors) ====
export declare module a {
module b {
class c {
}
}
}
export declare var x: b.c;
~~~
!!! Cannot find name 'b'.
@@ -23,21 +23,6 @@ declare module a {
}
}
declare module c {
import b = a.I;
var x: b;
}
//// [DtsFileErrors]
==== tests/cases/compiler/internalAliasInterface.d.ts (1 errors) ====
declare module a {
interface I {
}
}
declare module c {
var x: b;
~
!!! Cannot find name 'b'.
}
@@ -25,21 +25,6 @@ export declare module a {
}
}
export declare module c {
import b = a.I;
var x: b;
}
//// [DtsFileErrors]
==== tests/cases/compiler/internalAliasInterfaceInsideLocalModuleWithoutExport.d.ts (1 errors) ====
export declare module a {
interface I {
}
}
export declare module c {
var x: b;
~
!!! Cannot find name 'b'.
}
@@ -19,18 +19,5 @@ export declare module a {
interface I {
}
}
import b = a.I;
export declare var x: b;
//// [DtsFileErrors]
==== tests/cases/compiler/internalAliasInterfaceInsideTopLevelModuleWithoutExport.d.ts (1 errors) ====
export declare module a {
interface I {
}
}
export declare var x: b;
~
!!! Cannot find name 'b'.
@@ -30,24 +30,6 @@ declare module a {
}
}
declare module c {
import b = a.b;
var x: b.I;
}
//// [DtsFileErrors]
==== tests/cases/compiler/internalAliasUninitializedModule.d.ts (1 errors) ====
declare module a {
module b {
interface I {
foo(): any;
}
}
}
declare module c {
var x: b.I;
~~~
!!! Cannot find name 'b'.
}
@@ -30,24 +30,6 @@ export declare module a {
}
}
export declare module c {
import b = a.b;
var x: b.I;
}
//// [DtsFileErrors]
==== tests/cases/compiler/internalAliasUninitializedModuleInsideLocalModuleWithoutExport.d.ts (1 errors) ====
export declare module a {
module b {
interface I {
foo(): any;
}
}
}
export declare module c {
var x: b.I;
~~~
!!! Cannot find name 'b'.
}
@@ -25,21 +25,5 @@ export declare module a {
}
}
}
import b = a.b;
export declare var x: b.I;
//// [DtsFileErrors]
==== tests/cases/compiler/internalAliasUninitializedModuleInsideTopLevelModuleWithoutExport.d.ts (1 errors) ====
export declare module a {
module b {
interface I {
foo(): any;
}
}
}
export declare var x: b.I;
~~~
!!! Cannot find name 'b'.
@@ -18,3 +18,11 @@ var a;
})(a.b || (a.b = {}));
var b = a.b;
})(a || (a = {}));
//// [internalAliasWithDottedNameEmit.d.ts]
declare module a.b.c {
var d: any;
}
declare module a.e.f {
}
@@ -44,33 +44,9 @@ declare module "SubModule" {
}
//// [missingImportAfterModuleImport_1.d.ts]
/// <reference path='missingImportAfterModuleImport_0.d.ts' />
import SubModule = require('SubModule');
declare class MainModule {
SubModule: SubModule;
constructor();
}
export = MainModule;
//// [DtsFileErrors]
==== tests/cases/compiler/missingImportAfterModuleImport_1.d.ts (1 errors) ====
/// <reference path='missingImportAfterModuleImport_0.d.ts' />
declare class MainModule {
SubModule: SubModule;
~~~~~~~~~
!!! Cannot find name 'SubModule'.
constructor();
}
export = MainModule;
==== tests/cases/compiler/missingImportAfterModuleImport_0.d.ts (0 errors) ====
declare module "SubModule" {
class SubModule {
static StaticVar: number;
InstanceVar: number;
constructor();
}
export = SubModule;
}
@@ -14,4 +14,10 @@ declare module outer {
//// [moduleOuterQualification.d.ts]
declare module outer {
interface Beta {
}
module inner {
interface Beta extends outer.Beta {
}
}
}
@@ -1,26 +0,0 @@
==== tests/cases/compiler/consumer.ts (0 errors) ====
import Drawing = require('./Drawing');
var addr = new Drawing.Math.Adder();
==== tests/cases/compiler/Drawing.ts (0 errors) ====
export import Math = require('Math/Math')
==== tests/cases/compiler/Math/Math.ts (0 errors) ====
import Adder = require('Math/Adder');
var Math = {
Adder:Adder
};
export = Math
==== tests/cases/compiler/Math/Adder.ts (1 errors) ====
class Adder {
add(a: number, b: number) {
}
}
export = Adder;
~~~~~~~~~~~~~~~
!!! Cannot compile external modules unless the '--module' flag is provided.
@@ -0,0 +1,63 @@
//// [tests/cases/compiler/multiImportExport.ts] ////
//// [consumer.ts]
import Drawing = require('./Drawing');
var addr = new Drawing.Math.Adder();
//// [Drawing.ts]
export import Math = require('Math/Math')
//// [Math.ts]
import Adder = require('Math/Adder');
var Math = {
Adder:Adder
};
export = Math
//// [Adder.ts]
class Adder {
add(a: number, b: number) {
}
}
export = Adder;
//// [Adder.js]
var Adder = (function () {
function Adder() {
}
Adder.prototype.add = function (a, b) {
};
return Adder;
})();
module.exports = Adder;
//// [Math.js]
var Adder = require('Math/Adder');
var Math = {
Adder: Adder
};
module.exports = Math;
//// [Drawing.js]
exports.Math = require('Math/Math');
//// [consumer.js]
var Drawing = require('./Drawing');
var addr = new Drawing.Math.Adder();
//// [Adder.d.ts]
declare class Adder {
add(a: number, b: number): void;
}
export = Adder;
//// [Math.d.ts]
import Adder = require('Math/Adder');
declare var Math: {
Adder: typeof Adder;
};
export = Math;
//// [Drawing.d.ts]
export import Math = require('Math/Math');
//// [consumer.d.ts]
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -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();
}
@@ -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();
}
@@ -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;
@@ -30,3 +30,7 @@ var Query;
});
}
})(Query || (Query = {}));
//// [privacyCheckAnonymousFunctionParameter.d.ts]
export declare var x: number;
@@ -31,3 +31,7 @@ define(["require", "exports"], function (require, exports) {
}
})(Q || (Q = {}));
});
//// [privacyCheckAnonymousFunctionParameter2.d.ts]
export declare var x: number;
@@ -10,3 +10,11 @@ export interface B<T> extends A<T> {
//// [privacyCheckCallbackOfInterfaceMethodWithTypeParameter.js]
define(["require", "exports"], function (require, exports) {
});
//// [privacyCheckCallbackOfInterfaceMethodWithTypeParameter.d.ts]
export interface A<T> {
f1(callback: (p: T) => any): any;
}
export interface B<T> extends A<T> {
}
@@ -11,3 +11,14 @@ export = Foo;
//// [privacyCheckExportAssignmentOnExportedGenericInterface1.js]
var Foo;
module.exports = Foo;
//// [privacyCheckExportAssignmentOnExportedGenericInterface1.d.ts]
declare module Foo {
interface A<T> {
}
}
interface Foo<T> {
}
declare var Foo: new () => Foo.A<Foo<string>>;
export = Foo;
@@ -24,3 +24,13 @@ define(["require", "exports"], function (require, exports) {
})(Foo || (Foo = {}));
return Foo;
});
//// [privacyCheckExportAssignmentOnExportedGenericInterface2.d.ts]
export = Foo;
interface Foo<T> {
}
declare function Foo<T>(array: T[]): Foo<T>;
declare module Foo {
var x: string;
}
@@ -22,3 +22,17 @@ var Foo = (function () {
})();
module.exports = Foo;
//// [privacyCheckExternalModuleExportAssignmentOfGenericClass_1.js]
//// [privacyCheckExternalModuleExportAssignmentOfGenericClass_0.d.ts]
export = Foo;
declare class Foo<A> {
a: A;
constructor(a: A);
}
//// [privacyCheckExternalModuleExportAssignmentOfGenericClass_1.d.ts]
import Foo = require("privacyCheckExternalModuleExportAssignmentOfGenericClass_0");
export = Bar;
interface Bar {
foo: Foo<number>;
}
@@ -26,3 +26,12 @@ define(["require", "exports"], function (require, exports) {
})();
exports.B = B;
});
//// [privacyCheckOnTypeParameterReferenceInConstructorParameter.d.ts]
export declare class A<T1> {
constructor(callback: (self: A<T1>) => void);
}
export declare class B<T2> {
constructor(parent: T2);
}
@@ -1,8 +1,10 @@
==== tests/cases/compiler/privacyCheckTypeOfFunction.ts (1 errors) ====
==== tests/cases/compiler/privacyCheckTypeOfFunction.ts (2 errors) ====
function foo() {
}
export var x: typeof foo;
~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Cannot compile external modules unless the '--module' flag is provided.
~
!!! Exported variable 'x' has or is using private name 'foo'.
export var b = foo;
~
!!! Exported variable 'b' has or is using private name 'foo'.
@@ -0,0 +1,12 @@
//// [privacyCheckTypeOfFunction.ts]
function foo() {
}
export var x: typeof foo;
export var b = foo;
//// [privacyCheckTypeOfFunction.js]
function foo() {
}
exports.x;
exports.b = foo;
@@ -0,0 +1,11 @@
==== tests/cases/compiler/privacyCheckTypeOfInvisibleModuleError.ts (1 errors) ====
module Outer {
module Inner {
export var m: typeof Inner;
}
export var f: typeof Inner;
~
!!! Exported variable 'f' has or is using private name 'Inner'.
}
@@ -0,0 +1,11 @@
==== tests/cases/compiler/privacyCheckTypeOfInvisibleModuleNoError.ts (1 errors) ====
module Outer {
module Inner {
export var m: number;
}
export var f: typeof Inner; // Since we dont unwind inner any more, it is error here
~
!!! Exported variable 'f' has or is using private name 'Inner'.
}
@@ -17,21 +17,3 @@ var Outer;
})(Inner || (Inner = {}));
Outer.f;
})(Outer || (Outer = {}));
//// [privacyCheckTypeOfInvisibleModuleNoError.d.ts]
declare module Outer {
var f: typeof Inner;
}
//// [DtsFileErrors]
==== tests/cases/compiler/privacyCheckTypeOfInvisibleModuleNoError.d.ts (1 errors) ====
declare module Outer {
var f: typeof Inner;
~~~~~
!!! Cannot find name 'Inner'.
}
@@ -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;
@@ -0,0 +1,805 @@
==== tests/cases/compiler/privacyFunctionParameterDeclFile_externalModule.ts (40 errors) ====
class privateClass {
}
export class publicClass {
}
export interface publicInterfaceWithPrivateParmeterTypes {
new (param: privateClass): publicClass; // Error
~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param' of constructor signature from exported interface has or is using private name 'privateClass'.
(param: privateClass): publicClass; // Error
~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param' of call signature from exported interface has or is using private name 'privateClass'.
myMethod(param: privateClass): void; // Error
~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param' of method from exported interface has or is using private name 'privateClass'.
}
export interface publicInterfaceWithPublicParmeterTypes {
new (param: publicClass): publicClass;
(param: publicClass): publicClass;
myMethod(param: publicClass): void;
}
interface privateInterfaceWithPrivateParmeterTypes {
new (param: privateClass): privateClass;
(param: privateClass): privateClass;
myMethod(param: privateClass): void;
}
interface privateInterfaceWithPublicParmeterTypes {
new (param: publicClass): publicClass;
(param: publicClass): publicClass;
myMethod(param: publicClass): void;
}
export class publicClassWithWithPrivateParmeterTypes {
static myPublicStaticMethod(param: privateClass) { // Error
~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param' of public static method from exported class has or is using private name 'privateClass'.
}
private static myPrivateStaticMethod(param: privateClass) {
}
myPublicMethod(param: privateClass) { // Error
~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param' of public method from exported class has or is using private name 'privateClass'.
}
private myPrivateMethod(param: privateClass) {
}
constructor(param: privateClass, private param1: privateClass, public param2: privateClass) { // Error
~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param' of constructor from exported class has or is using private name 'privateClass'.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param1' of constructor from exported class has or is using private name 'privateClass'.
~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param2' of constructor from exported class has or is using private name 'privateClass'.
}
}
export class publicClassWithWithPublicParmeterTypes {
static myPublicStaticMethod(param: publicClass) {
}
private static myPrivateStaticMethod(param: publicClass) {
}
myPublicMethod(param: publicClass) {
}
private myPrivateMethod(param: publicClass) {
}
constructor(param: publicClass, private param1: publicClass, public param2: publicClass) {
}
}
class privateClassWithWithPrivateParmeterTypes {
static myPublicStaticMethod(param: privateClass) {
}
private static myPrivateStaticMethod(param: privateClass) {
}
myPublicMethod(param: privateClass) {
}
private myPrivateMethod(param: privateClass) {
}
constructor(param: privateClass, private param1: privateClass, public param2: privateClass) {
}
}
class privateClassWithWithPublicParmeterTypes {
static myPublicStaticMethod(param: publicClass) {
}
private static myPrivateStaticMethod(param: publicClass) {
}
myPublicMethod(param: publicClass) {
}
private myPrivateMethod(param: publicClass) {
}
constructor(param: publicClass, private param1: publicClass, public param2: publicClass) {
}
}
export function publicFunctionWithPrivateParmeterTypes(param: privateClass) { // Error
~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param' of exported function has or is using private name 'privateClass'.
}
export function publicFunctionWithPublicParmeterTypes(param: publicClass) {
}
function privateFunctionWithPrivateParmeterTypes(param: privateClass) {
}
function privateFunctionWithPublicParmeterTypes(param: publicClass) {
}
export declare function publicAmbientFunctionWithPrivateParmeterTypes(param: privateClass): void; // Error
~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param' of exported function has or is using private name 'privateClass'.
export declare function publicAmbientFunctionWithPublicParmeterTypes(param: publicClass): void;
declare function privateAmbientFunctionWithPrivateParmeterTypes(param: privateClass): void;
declare function privateAmbientFunctionWithPublicParmeterTypes(param: publicClass): void;
export interface publicInterfaceWithPrivateModuleParameterTypes {
new (param: privateModule.publicClass): publicClass; // Error
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param' of constructor signature from exported interface has or is using name 'privateModule.publicClass' from private module 'privateModule'.
(param: privateModule.publicClass): publicClass; // Error
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param' of call signature from exported interface has or is using name 'privateModule.publicClass' from private module 'privateModule'.
myMethod(param: privateModule.publicClass): void; // Error
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param' of method from exported interface has or is using name 'privateModule.publicClass' from private module 'privateModule'.
}
export class publicClassWithPrivateModuleParameterTypes {
static myPublicStaticMethod(param: privateModule.publicClass) { // Error
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param' of public static method from exported class has or is using name 'privateModule.publicClass' from private module 'privateModule'.
}
myPublicMethod(param: privateModule.publicClass) { // Error
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param' of public method from exported class has or is using name 'privateModule.publicClass' from private module 'privateModule'.
}
constructor(param: privateModule.publicClass, private param1: privateModule.publicClass, public param2: privateModule.publicClass) { // Error
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param' of constructor from exported class has or is using name 'privateModule.publicClass' from private module 'privateModule'.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param1' of constructor from exported class has or is using name 'privateModule.publicClass' from private module 'privateModule'.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param2' of constructor from exported class has or is using name 'privateModule.publicClass' from private module 'privateModule'.
}
}
export function publicFunctionWithPrivateModuleParameterTypes(param: privateModule.publicClass) { // Error
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param' of exported function has or is using name 'privateModule.publicClass' from private module 'privateModule'.
}
export declare function publicAmbientFunctionWithPrivateModuleParameterTypes(param: privateModule.publicClass): void; // Error
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param' of exported function has or is using name 'privateModule.publicClass' from private module 'privateModule'.
interface privateInterfaceWithPrivateModuleParameterTypes {
new (param: privateModule.publicClass): publicClass;
(param: privateModule.publicClass): publicClass;
myMethod(param: privateModule.publicClass): void;
}
class privateClassWithPrivateModuleParameterTypes {
static myPublicStaticMethod(param: privateModule.publicClass) {
}
myPublicMethod(param: privateModule.publicClass) {
}
constructor(param: privateModule.publicClass, private param1: privateModule.publicClass, public param2: privateModule.publicClass) {
}
}
function privateFunctionWithPrivateModuleParameterTypes(param: privateModule.publicClass) {
}
declare function privateAmbientFunctionWithPrivateModuleParameterTypes(param: privateModule.publicClass): void;
export module publicModule {
class privateClass {
}
export class publicClass {
}
export interface publicInterfaceWithPrivateParmeterTypes {
new (param: privateClass): publicClass; // Error
~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param' of constructor signature from exported interface has or is using private name 'privateClass'.
(param: privateClass): publicClass; // Error
~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param' of call signature from exported interface has or is using private name 'privateClass'.
myMethod(param: privateClass): void; // Error
~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param' of method from exported interface has or is using private name 'privateClass'.
}
export interface publicInterfaceWithPublicParmeterTypes {
new (param: publicClass): publicClass;
(param: publicClass): publicClass;
myMethod(param: publicClass): void;
}
interface privateInterfaceWithPrivateParmeterTypes {
new (param: privateClass): privateClass;
(param: privateClass): privateClass;
myMethod(param: privateClass): void;
}
interface privateInterfaceWithPublicParmeterTypes {
new (param: publicClass): publicClass;
(param: publicClass): publicClass;
myMethod(param: publicClass): void;
}
export class publicClassWithWithPrivateParmeterTypes {
static myPublicStaticMethod(param: privateClass) { // Error
~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param' of public static method from exported class has or is using private name 'privateClass'.
}
private static myPrivateStaticMethod(param: privateClass) {
}
myPublicMethod(param: privateClass) { // Error
~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param' of public method from exported class has or is using private name 'privateClass'.
}
private myPrivateMethod(param: privateClass) {
}
constructor(param: privateClass, private param1: privateClass, public param2: privateClass) { // Error
~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param' of constructor from exported class has or is using private name 'privateClass'.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param1' of constructor from exported class has or is using private name 'privateClass'.
~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param2' of constructor from exported class has or is using private name 'privateClass'.
}
}
export class publicClassWithWithPublicParmeterTypes {
static myPublicStaticMethod(param: publicClass) {
}
private static myPrivateStaticMethod(param: publicClass) {
}
myPublicMethod(param: publicClass) {
}
private myPrivateMethod(param: publicClass) {
}
constructor(param: publicClass, private param1: publicClass, public param2: publicClass) {
}
}
class privateClassWithWithPrivateParmeterTypes {
static myPublicStaticMethod(param: privateClass) {
}
private static myPrivateStaticMethod(param: privateClass) {
}
myPublicMethod(param: privateClass) {
}
private myPrivateMethod(param: privateClass) {
}
constructor(param: privateClass, private param1: privateClass, public param2: privateClass) {
}
}
class privateClassWithWithPublicParmeterTypes {
static myPublicStaticMethod(param: publicClass) {
}
private static myPrivateStaticMethod(param: publicClass) {
}
myPublicMethod(param: publicClass) {
}
private myPrivateMethod(param: publicClass) {
}
constructor(param: publicClass, private param1: publicClass, public param2: publicClass) {
}
}
export function publicFunctionWithPrivateParmeterTypes(param: privateClass) { // Error
~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param' of exported function has or is using private name 'privateClass'.
}
export function publicFunctionWithPublicParmeterTypes(param: publicClass) {
}
function privateFunctionWithPrivateParmeterTypes(param: privateClass) {
}
function privateFunctionWithPublicParmeterTypes(param: publicClass) {
}
export declare function publicAmbientFunctionWithPrivateParmeterTypes(param: privateClass): void; // Error
~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param' of exported function has or is using private name 'privateClass'.
export declare function publicAmbientFunctionWithPublicParmeterTypes(param: publicClass): void;
declare function privateAmbientFunctionWithPrivateParmeterTypes(param: privateClass): void;
declare function privateAmbientFunctionWithPublicParmeterTypes(param: publicClass): void;
export interface publicInterfaceWithPrivateModuleParameterTypes {
new (param: privateModule.publicClass): publicClass; // Error
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param' of constructor signature from exported interface has or is using name 'privateModule.publicClass' from private module 'privateModule'.
(param: privateModule.publicClass): publicClass; // Error
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param' of call signature from exported interface has or is using name 'privateModule.publicClass' from private module 'privateModule'.
myMethod(param: privateModule.publicClass): void; // Error
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param' of method from exported interface has or is using name 'privateModule.publicClass' from private module 'privateModule'.
}
export class publicClassWithPrivateModuleParameterTypes {
static myPublicStaticMethod(param: privateModule.publicClass) { // Error
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param' of public static method from exported class has or is using name 'privateModule.publicClass' from private module 'privateModule'.
}
myPublicMethod(param: privateModule.publicClass) { // Error
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param' of public method from exported class has or is using name 'privateModule.publicClass' from private module 'privateModule'.
}
constructor(param: privateModule.publicClass, private param1: privateModule.publicClass, public param2: privateModule.publicClass) { // Error
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param' of constructor from exported class has or is using name 'privateModule.publicClass' from private module 'privateModule'.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param1' of constructor from exported class has or is using name 'privateModule.publicClass' from private module 'privateModule'.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param2' of constructor from exported class has or is using name 'privateModule.publicClass' from private module 'privateModule'.
}
}
export function publicFunctionWithPrivateModuleParameterTypes(param: privateModule.publicClass) { // Error
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param' of exported function has or is using name 'privateModule.publicClass' from private module 'privateModule'.
}
export declare function publicAmbientFunctionWithPrivateModuleParameterTypes(param: privateModule.publicClass): void; // Error
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param' of exported function has or is using name 'privateModule.publicClass' from private module 'privateModule'.
interface privateInterfaceWithPrivateModuleParameterTypes {
new (param: privateModule.publicClass): publicClass;
(param: privateModule.publicClass): publicClass;
myMethod(param: privateModule.publicClass): void;
}
class privateClassWithPrivateModuleParameterTypes {
static myPublicStaticMethod(param: privateModule.publicClass) {
}
myPublicMethod(param: privateModule.publicClass) {
}
constructor(param: privateModule.publicClass, private param1: privateModule.publicClass, public param2: privateModule.publicClass) {
}
}
function privateFunctionWithPrivateModuleParameterTypes(param: privateModule.publicClass) {
}
declare function privateAmbientFunctionWithPrivateModuleParameterTypes(param: privateModule.publicClass): void;
}
module privateModule {
class privateClass {
}
export class publicClass {
}
export interface publicInterfaceWithPrivateParmeterTypes {
new (param: privateClass): publicClass;
(param: privateClass): publicClass;
myMethod(param: privateClass): void;
}
export interface publicInterfaceWithPublicParmeterTypes {
new (param: publicClass): publicClass;
(param: publicClass): publicClass;
myMethod(param: publicClass): void;
}
interface privateInterfaceWithPrivateParmeterTypes {
new (param: privateClass): privateClass;
(param: privateClass): privateClass;
myMethod(param: privateClass): void;
}
interface privateInterfaceWithPublicParmeterTypes {
new (param: publicClass): publicClass;
(param: publicClass): publicClass;
myMethod(param: publicClass): void;
}
export class publicClassWithWithPrivateParmeterTypes {
static myPublicStaticMethod(param: privateClass) {
}
private static myPrivateStaticMethod(param: privateClass) {
}
myPublicMethod(param: privateClass) {
}
private myPrivateMethod(param: privateClass) {
}
constructor(param: privateClass, private param1: privateClass, public param2: privateClass) {
}
}
export class publicClassWithWithPublicParmeterTypes {
static myPublicStaticMethod(param: publicClass) {
}
private static myPrivateStaticMethod(param: publicClass) {
}
myPublicMethod(param: publicClass) {
}
private myPrivateMethod(param: publicClass) {
}
constructor(param: publicClass, private param1: publicClass, public param2: publicClass) {
}
}
class privateClassWithWithPrivateParmeterTypes {
static myPublicStaticMethod(param: privateClass) {
}
private static myPrivateStaticMethod(param: privateClass) {
}
myPublicMethod(param: privateClass) {
}
private myPrivateMethod(param: privateClass) {
}
constructor(param: privateClass, private param1: privateClass, public param2: privateClass) {
}
}
class privateClassWithWithPublicParmeterTypes {
static myPublicStaticMethod(param: publicClass) {
}
private static myPrivateStaticMethod(param: publicClass) {
}
myPublicMethod(param: publicClass) {
}
private myPrivateMethod(param: publicClass) {
}
constructor(param: publicClass, private param1: publicClass, public param2: publicClass) {
}
}
export function publicFunctionWithPrivateParmeterTypes(param: privateClass) {
}
export function publicFunctionWithPublicParmeterTypes(param: publicClass) {
}
function privateFunctionWithPrivateParmeterTypes(param: privateClass) {
}
function privateFunctionWithPublicParmeterTypes(param: publicClass) {
}
export declare function publicAmbientFunctionWithPrivateParmeterTypes(param: privateClass): void;
export declare function publicAmbientFunctionWithPublicParmeterTypes(param: publicClass): void;
declare function privateAmbientFunctionWithPrivateParmeterTypes(param: privateClass): void;
declare function privateAmbientFunctionWithPublicParmeterTypes(param: publicClass): void;
export interface publicInterfaceWithPrivateModuleParameterTypes {
new (param: privateModule.publicClass): publicClass;
(param: privateModule.publicClass): publicClass;
myMethod(param: privateModule.publicClass): void;
}
export class publicClassWithPrivateModuleParameterTypes {
static myPublicStaticMethod(param: privateModule.publicClass) {
}
myPublicMethod(param: privateModule.publicClass) {
}
constructor(param: privateModule.publicClass, private param1: privateModule.publicClass, public param2: privateModule.publicClass) {
}
}
export function publicFunctionWithPrivateModuleParameterTypes(param: privateModule.publicClass) {
}
export declare function publicAmbientFunctionWithPrivateModuleParameterTypes(param: privateModule.publicClass): void;
interface privateInterfaceWithPrivateModuleParameterTypes {
new (param: privateModule.publicClass): publicClass;
(param: privateModule.publicClass): publicClass;
myMethod(param: privateModule.publicClass): void;
}
class privateClassWithPrivateModuleParameterTypes {
static myPublicStaticMethod(param: privateModule.publicClass) {
}
myPublicMethod(param: privateModule.publicClass) {
}
constructor(param: privateModule.publicClass, private param1: privateModule.publicClass, public param2: privateModule.publicClass) {
}
}
function privateFunctionWithPrivateModuleParameterTypes(param: privateModule.publicClass) {
}
declare function privateAmbientFunctionWithPrivateModuleParameterTypes(param: privateModule.publicClass): void;
}
==== tests/cases/compiler/privacyFunctionParameterDeclFile_GlobalFile.ts (20 errors) ====
class publicClassInGlobal {
}
interface publicInterfaceWithPublicParmeterTypesInGlobal {
new (param: publicClassInGlobal): publicClassInGlobal;
(param: publicClassInGlobal): publicClassInGlobal;
myMethod(param: publicClassInGlobal): void;
}
class publicClassWithWithPublicParmeterTypesInGlobal {
static myPublicStaticMethod(param: publicClassInGlobal) {
}
private static myPrivateStaticMethod(param: publicClassInGlobal) {
}
myPublicMethod(param: publicClassInGlobal) {
}
private myPrivateMethod(param: publicClassInGlobal) {
}
constructor(param: publicClassInGlobal, private param1: publicClassInGlobal, public param2: publicClassInGlobal) {
}
}
function publicFunctionWithPublicParmeterTypesInGlobal(param: publicClassInGlobal) {
}
declare function publicAmbientFunctionWithPublicParmeterTypesInGlobal(param: publicClassInGlobal): void;
module publicModuleInGlobal {
class privateClass {
}
export class publicClass {
}
module privateModule {
class privateClass {
}
export class publicClass {
}
export interface publicInterfaceWithPrivateParmeterTypes {
new (param: privateClass): publicClass;
(param: privateClass): publicClass;
myMethod(param: privateClass): void;
}
export interface publicInterfaceWithPublicParmeterTypes {
new (param: publicClass): publicClass;
(param: publicClass): publicClass;
myMethod(param: publicClass): void;
}
interface privateInterfaceWithPrivateParmeterTypes {
new (param: privateClass): privateClass;
(param: privateClass): privateClass;
myMethod(param: privateClass): void;
}
interface privateInterfaceWithPublicParmeterTypes {
new (param: publicClass): publicClass;
(param: publicClass): publicClass;
myMethod(param: publicClass): void;
}
export class publicClassWithWithPrivateParmeterTypes {
static myPublicStaticMethod(param: privateClass) {
}
private static myPrivateStaticMethod(param: privateClass) {
}
myPublicMethod(param: privateClass) {
}
private myPrivateMethod(param: privateClass) {
}
constructor(param: privateClass, private param1: privateClass, public param2: privateClass) {
}
}
export class publicClassWithWithPublicParmeterTypes {
static myPublicStaticMethod(param: publicClass) {
}
private static myPrivateStaticMethod(param: publicClass) {
}
myPublicMethod(param: publicClass) {
}
private myPrivateMethod(param: publicClass) {
}
constructor(param: publicClass, private param1: publicClass, public param2: publicClass) {
}
}
class privateClassWithWithPrivateParmeterTypes {
static myPublicStaticMethod(param: privateClass) {
}
private static myPrivateStaticMethod(param: privateClass) {
}
myPublicMethod(param: privateClass) {
}
private myPrivateMethod(param: privateClass) {
}
constructor(param: privateClass, private param1: privateClass, public param2: privateClass) {
}
}
class privateClassWithWithPublicParmeterTypes {
static myPublicStaticMethod(param: publicClass) {
}
private static myPrivateStaticMethod(param: publicClass) {
}
myPublicMethod(param: publicClass) {
}
private myPrivateMethod(param: publicClass) {
}
constructor(param: publicClass, private param1: publicClass, public param2: publicClass) {
}
}
export function publicFunctionWithPrivateParmeterTypes(param: privateClass) {
}
export function publicFunctionWithPublicParmeterTypes(param: publicClass) {
}
function privateFunctionWithPrivateParmeterTypes(param: privateClass) {
}
function privateFunctionWithPublicParmeterTypes(param: publicClass) {
}
export declare function publicAmbientFunctionWithPrivateParmeterTypes(param: privateClass): void;
export declare function publicAmbientFunctionWithPublicParmeterTypes(param: publicClass): void;
declare function privateAmbientFunctionWithPrivateParmeterTypes(param: privateClass): void;
declare function privateAmbientFunctionWithPublicParmeterTypes(param: publicClass): void;
export interface publicInterfaceWithPrivateModuleParameterTypes {
new (param: privateModule.publicClass): publicClass;
(param: privateModule.publicClass): publicClass;
myMethod(param: privateModule.publicClass): void;
}
export class publicClassWithPrivateModuleParameterTypes {
static myPublicStaticMethod(param: privateModule.publicClass) {
}
myPublicMethod(param: privateModule.publicClass) {
}
constructor(param: privateModule.publicClass, private param1: privateModule.publicClass, public param2: privateModule.publicClass) {
}
}
export function publicFunctionWithPrivateModuleParameterTypes(param: privateModule.publicClass) {
}
export declare function publicAmbientFunctionWithPrivateModuleParameterTypes(param: privateModule.publicClass): void;
interface privateInterfaceWithPrivateModuleParameterTypes {
new (param: privateModule.publicClass): publicClass;
(param: privateModule.publicClass): publicClass;
myMethod(param: privateModule.publicClass): void;
}
class privateClassWithPrivateModuleParameterTypes {
static myPublicStaticMethod(param: privateModule.publicClass) {
}
myPublicMethod(param: privateModule.publicClass) {
}
constructor(param: privateModule.publicClass, private param1: privateModule.publicClass, public param2: privateModule.publicClass) {
}
}
function privateFunctionWithPrivateModuleParameterTypes(param: privateModule.publicClass) {
}
declare function privateAmbientFunctionWithPrivateModuleParameterTypes(param: privateModule.publicClass): void;
}
export interface publicInterfaceWithPrivateParmeterTypes {
new (param: privateClass): publicClass; // Error
~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param' of constructor signature from exported interface has or is using private name 'privateClass'.
(param: privateClass): publicClass; // Error
~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param' of call signature from exported interface has or is using private name 'privateClass'.
myMethod(param: privateClass): void; // Error
~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param' of method from exported interface has or is using private name 'privateClass'.
}
export interface publicInterfaceWithPublicParmeterTypes {
new (param: publicClass): publicClass;
(param: publicClass): publicClass;
myMethod(param: publicClass): void;
}
interface privateInterfaceWithPrivateParmeterTypes {
new (param: privateClass): privateClass;
(param: privateClass): privateClass;
myMethod(param: privateClass): void;
}
interface privateInterfaceWithPublicParmeterTypes {
new (param: publicClass): publicClass;
(param: publicClass): publicClass;
myMethod(param: publicClass): void;
}
export class publicClassWithWithPrivateParmeterTypes {
static myPublicStaticMethod(param: privateClass) { // Error
~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param' of public static method from exported class has or is using private name 'privateClass'.
}
private static myPrivateStaticMethod(param: privateClass) {
}
myPublicMethod(param: privateClass) { // Error
~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param' of public method from exported class has or is using private name 'privateClass'.
}
private myPrivateMethod(param: privateClass) {
}
constructor(param: privateClass, private param1: privateClass, public param2: privateClass) { // Error
~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param' of constructor from exported class has or is using private name 'privateClass'.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param1' of constructor from exported class has or is using private name 'privateClass'.
~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param2' of constructor from exported class has or is using private name 'privateClass'.
}
}
export class publicClassWithWithPublicParmeterTypes {
static myPublicStaticMethod(param: publicClass) {
}
private static myPrivateStaticMethod(param: publicClass) {
}
myPublicMethod(param: publicClass) {
}
private myPrivateMethod(param: publicClass) {
}
constructor(param: publicClass, private param1: publicClass, public param2: publicClass) {
}
}
class privateClassWithWithPrivateParmeterTypes {
static myPublicStaticMethod(param: privateClass) {
}
private static myPrivateStaticMethod(param: privateClass) {
}
myPublicMethod(param: privateClass) {
}
private myPrivateMethod(param: privateClass) {
}
constructor(param: privateClass, private param1: privateClass, public param2: privateClass) {
}
}
class privateClassWithWithPublicParmeterTypes {
static myPublicStaticMethod(param: publicClass) {
}
private static myPrivateStaticMethod(param: publicClass) {
}
myPublicMethod(param: publicClass) {
}
private myPrivateMethod(param: publicClass) {
}
constructor(param: publicClass, private param1: publicClass, public param2: publicClass) {
}
}
export function publicFunctionWithPrivateParmeterTypes(param: privateClass) { // Error
~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param' of exported function has or is using private name 'privateClass'.
}
export function publicFunctionWithPublicParmeterTypes(param: publicClass) {
}
function privateFunctionWithPrivateParmeterTypes(param: privateClass) {
}
function privateFunctionWithPublicParmeterTypes(param: publicClass) {
}
export declare function publicAmbientFunctionWithPrivateParmeterTypes(param: privateClass): void; // Error
~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param' of exported function has or is using private name 'privateClass'.
export declare function publicAmbientFunctionWithPublicParmeterTypes(param: publicClass): void;
declare function privateAmbientFunctionWithPrivateParmeterTypes(param: privateClass): void;
declare function privateAmbientFunctionWithPublicParmeterTypes(param: publicClass): void;
export interface publicInterfaceWithPrivateModuleParameterTypes {
new (param: privateModule.publicClass): publicClass; // Error
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param' of constructor signature from exported interface has or is using name 'privateModule.publicClass' from private module 'privateModule'.
(param: privateModule.publicClass): publicClass; // Error
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param' of call signature from exported interface has or is using name 'privateModule.publicClass' from private module 'privateModule'.
myMethod(param: privateModule.publicClass): void; // Error
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param' of method from exported interface has or is using name 'privateModule.publicClass' from private module 'privateModule'.
}
export class publicClassWithPrivateModuleParameterTypes {
static myPublicStaticMethod(param: privateModule.publicClass) { // Error
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param' of public static method from exported class has or is using name 'privateModule.publicClass' from private module 'privateModule'.
}
myPublicMethod(param: privateModule.publicClass) { // Error
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param' of public method from exported class has or is using name 'privateModule.publicClass' from private module 'privateModule'.
}
constructor(param: privateModule.publicClass, private param1: privateModule.publicClass, public param2: privateModule.publicClass) { // Error
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param' of constructor from exported class has or is using name 'privateModule.publicClass' from private module 'privateModule'.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param1' of constructor from exported class has or is using name 'privateModule.publicClass' from private module 'privateModule'.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param2' of constructor from exported class has or is using name 'privateModule.publicClass' from private module 'privateModule'.
}
}
export function publicFunctionWithPrivateModuleParameterTypes(param: privateModule.publicClass) { // Error
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param' of exported function has or is using name 'privateModule.publicClass' from private module 'privateModule'.
}
export declare function publicAmbientFunctionWithPrivateModuleParameterTypes(param: privateModule.publicClass): void; // Error
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Parameter 'param' of exported function has or is using name 'privateModule.publicClass' from private module 'privateModule'.
interface privateInterfaceWithPrivateModuleParameterTypes {
new (param: privateModule.publicClass): publicClass;
(param: privateModule.publicClass): publicClass;
myMethod(param: privateModule.publicClass): void;
}
class privateClassWithPrivateModuleParameterTypes {
static myPublicStaticMethod(param: privateModule.publicClass) {
}
myPublicMethod(param: privateModule.publicClass) {
}
constructor(param: privateModule.publicClass, private param1: privateModule.publicClass, public param2: privateModule.publicClass) {
}
}
function privateFunctionWithPrivateModuleParameterTypes(param: privateModule.publicClass) {
}
declare function privateAmbientFunctionWithPrivateModuleParameterTypes(param: privateModule.publicClass): void;
}
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -1,304 +0,0 @@
==== tests/cases/compiler/privacyGetter.ts (48 errors) ====
export module m1 {
export class C1_public {
private f1() {
}
}
class C2_private {
}
export class C3_public {
private get p1_private() {
~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
return new C1_public();
}
private set p1_private(m1_c3_p1_arg: C1_public) {
~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
}
private get p2_private() {
~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
return new C1_public();
}
private set p2_private(m1_c3_p2_arg: C1_public) {
~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
}
private get p3_private() {
~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
return new C2_private();
}
private set p3_private(m1_c3_p3_arg: C2_private) {
~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
}
public get p4_public(): C2_private { // error
~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
return new C2_private(); //error
}
public set p4_public(m1_c3_p4_arg: C2_private) { // error
~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
}
}
class C4_private {
private get p1_private() {
~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
return new C1_public();
}
private set p1_private(m1_c3_p1_arg: C1_public) {
~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
}
private get p2_private() {
~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
return new C1_public();
}
private set p2_private(m1_c3_p2_arg: C1_public) {
~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
}
private get p3_private() {
~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
return new C2_private();
}
private set p3_private(m1_c3_p3_arg: C2_private) {
~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
}
public get p4_public(): C2_private {
~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
return new C2_private();
}
public set p4_public(m1_c3_p4_arg: C2_private) {
~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
}
}
}
module m2 {
export class m2_C1_public {
private f1() {
}
}
class m2_C2_private {
}
export class m2_C3_public {
private get p1_private() {
~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
return new m2_C1_public();
}
private set p1_private(m2_c3_p1_arg: m2_C1_public) {
~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
}
private get p2_private() {
~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
return new m2_C1_public();
}
private set p2_private(m2_c3_p2_arg: m2_C1_public) {
~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
}
private get p3_private() {
~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
return new m2_C2_private();
}
private set p3_private(m2_c3_p3_arg: m2_C2_private) {
~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
}
public get p4_public(): m2_C2_private {
~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
return new m2_C2_private();
}
public set p4_public(m2_c3_p4_arg: m2_C2_private) {
~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
}
}
class m2_C4_private {
private get p1_private() {
~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
return new m2_C1_public();
}
private set p1_private(m2_c3_p1_arg: m2_C1_public) {
~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
}
private get p2_private() {
~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
return new m2_C1_public();
}
private set p2_private(m2_c3_p2_arg: m2_C1_public) {
~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
}
private get p3_private() {
~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
return new m2_C2_private();
}
private set p3_private(m2_c3_p3_arg: m2_C2_private) {
~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
}
public get p4_public(): m2_C2_private {
~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
return new m2_C2_private();
}
public set p4_public(m2_c3_p4_arg: m2_C2_private) {
~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
}
}
}
class C5_private {
private f() {
}
}
export class C6_public {
}
export class C7_public {
private get p1_private() {
~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
return new C6_public();
}
private set p1_private(m1_c3_p1_arg: C6_public) {
~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
}
private get p2_private() {
~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
return new C6_public();
}
private set p2_private(m1_c3_p2_arg: C6_public) {
~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
}
private get p3_private() {
~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
return new C5_private();
}
private set p3_private(m1_c3_p3_arg: C5_private) {
~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
}
public get p4_public(): C5_private { // error
~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
return new C5_private(); //error
}
public set p4_public(m1_c3_p4_arg: C5_private) { // error
~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
}
}
class C8_private {
private get p1_private() {
~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
return new C6_public();
}
private set p1_private(m1_c3_p1_arg: C6_public) {
~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
}
private get p2_private() {
~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
return new C6_public();
}
private set p2_private(m1_c3_p2_arg: C6_public) {
~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
}
private get p3_private() {
~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
return new C5_private();
}
private set p3_private(m1_c3_p3_arg: C5_private) {
~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
}
public get p4_public(): C5_private {
~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
return new C5_private();
}
public set p4_public(m1_c3_p4_arg: C5_private) {
~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
}
}
+506
View File
@@ -0,0 +1,506 @@
//// [privacyGetter.ts]
export module m1 {
export class C1_public {
private f1() {
}
}
class C2_private {
}
export class C3_public {
private get p1_private() {
return new C1_public();
}
private set p1_private(m1_c3_p1_arg: C1_public) {
}
private get p2_private() {
return new C1_public();
}
private set p2_private(m1_c3_p2_arg: C1_public) {
}
private get p3_private() {
return new C2_private();
}
private set p3_private(m1_c3_p3_arg: C2_private) {
}
public get p4_public(): C2_private { // error
return new C2_private(); //error
}
public set p4_public(m1_c3_p4_arg: C2_private) { // error
}
}
class C4_private {
private get p1_private() {
return new C1_public();
}
private set p1_private(m1_c3_p1_arg: C1_public) {
}
private get p2_private() {
return new C1_public();
}
private set p2_private(m1_c3_p2_arg: C1_public) {
}
private get p3_private() {
return new C2_private();
}
private set p3_private(m1_c3_p3_arg: C2_private) {
}
public get p4_public(): C2_private {
return new C2_private();
}
public set p4_public(m1_c3_p4_arg: C2_private) {
}
}
}
module m2 {
export class m2_C1_public {
private f1() {
}
}
class m2_C2_private {
}
export class m2_C3_public {
private get p1_private() {
return new m2_C1_public();
}
private set p1_private(m2_c3_p1_arg: m2_C1_public) {
}
private get p2_private() {
return new m2_C1_public();
}
private set p2_private(m2_c3_p2_arg: m2_C1_public) {
}
private get p3_private() {
return new m2_C2_private();
}
private set p3_private(m2_c3_p3_arg: m2_C2_private) {
}
public get p4_public(): m2_C2_private {
return new m2_C2_private();
}
public set p4_public(m2_c3_p4_arg: m2_C2_private) {
}
}
class m2_C4_private {
private get p1_private() {
return new m2_C1_public();
}
private set p1_private(m2_c3_p1_arg: m2_C1_public) {
}
private get p2_private() {
return new m2_C1_public();
}
private set p2_private(m2_c3_p2_arg: m2_C1_public) {
}
private get p3_private() {
return new m2_C2_private();
}
private set p3_private(m2_c3_p3_arg: m2_C2_private) {
}
public get p4_public(): m2_C2_private {
return new m2_C2_private();
}
public set p4_public(m2_c3_p4_arg: m2_C2_private) {
}
}
}
class C5_private {
private f() {
}
}
export class C6_public {
}
export class C7_public {
private get p1_private() {
return new C6_public();
}
private set p1_private(m1_c3_p1_arg: C6_public) {
}
private get p2_private() {
return new C6_public();
}
private set p2_private(m1_c3_p2_arg: C6_public) {
}
private get p3_private() {
return new C5_private();
}
private set p3_private(m1_c3_p3_arg: C5_private) {
}
public get p4_public(): C5_private { // error
return new C5_private(); //error
}
public set p4_public(m1_c3_p4_arg: C5_private) { // error
}
}
class C8_private {
private get p1_private() {
return new C6_public();
}
private set p1_private(m1_c3_p1_arg: C6_public) {
}
private get p2_private() {
return new C6_public();
}
private set p2_private(m1_c3_p2_arg: C6_public) {
}
private get p3_private() {
return new C5_private();
}
private set p3_private(m1_c3_p3_arg: C5_private) {
}
public get p4_public(): C5_private {
return new C5_private();
}
public set p4_public(m1_c3_p4_arg: C5_private) {
}
}
//// [privacyGetter.js]
define(["require", "exports"], function (require, exports) {
(function (m1) {
var C1_public = (function () {
function C1_public() {
}
C1_public.prototype.f1 = function () {
};
return C1_public;
})();
m1.C1_public = C1_public;
var C2_private = (function () {
function C2_private() {
}
return C2_private;
})();
var C3_public = (function () {
function C3_public() {
}
Object.defineProperty(C3_public.prototype, "p1_private", {
get: function () {
return new C1_public();
},
set: function (m1_c3_p1_arg) {
},
enumerable: true,
configurable: true
});
Object.defineProperty(C3_public.prototype, "p2_private", {
get: function () {
return new C1_public();
},
set: function (m1_c3_p2_arg) {
},
enumerable: true,
configurable: true
});
Object.defineProperty(C3_public.prototype, "p3_private", {
get: function () {
return new C2_private();
},
set: function (m1_c3_p3_arg) {
},
enumerable: true,
configurable: true
});
Object.defineProperty(C3_public.prototype, "p4_public", {
get: function () {
return new C2_private();
},
set: function (m1_c3_p4_arg) {
},
enumerable: true,
configurable: true
});
return C3_public;
})();
m1.C3_public = C3_public;
var C4_private = (function () {
function C4_private() {
}
Object.defineProperty(C4_private.prototype, "p1_private", {
get: function () {
return new C1_public();
},
set: function (m1_c3_p1_arg) {
},
enumerable: true,
configurable: true
});
Object.defineProperty(C4_private.prototype, "p2_private", {
get: function () {
return new C1_public();
},
set: function (m1_c3_p2_arg) {
},
enumerable: true,
configurable: true
});
Object.defineProperty(C4_private.prototype, "p3_private", {
get: function () {
return new C2_private();
},
set: function (m1_c3_p3_arg) {
},
enumerable: true,
configurable: true
});
Object.defineProperty(C4_private.prototype, "p4_public", {
get: function () {
return new C2_private();
},
set: function (m1_c3_p4_arg) {
},
enumerable: true,
configurable: true
});
return C4_private;
})();
})(exports.m1 || (exports.m1 = {}));
var m1 = exports.m1;
var m2;
(function (m2) {
var m2_C1_public = (function () {
function m2_C1_public() {
}
m2_C1_public.prototype.f1 = function () {
};
return m2_C1_public;
})();
m2.m2_C1_public = m2_C1_public;
var m2_C2_private = (function () {
function m2_C2_private() {
}
return m2_C2_private;
})();
var m2_C3_public = (function () {
function m2_C3_public() {
}
Object.defineProperty(m2_C3_public.prototype, "p1_private", {
get: function () {
return new m2_C1_public();
},
set: function (m2_c3_p1_arg) {
},
enumerable: true,
configurable: true
});
Object.defineProperty(m2_C3_public.prototype, "p2_private", {
get: function () {
return new m2_C1_public();
},
set: function (m2_c3_p2_arg) {
},
enumerable: true,
configurable: true
});
Object.defineProperty(m2_C3_public.prototype, "p3_private", {
get: function () {
return new m2_C2_private();
},
set: function (m2_c3_p3_arg) {
},
enumerable: true,
configurable: true
});
Object.defineProperty(m2_C3_public.prototype, "p4_public", {
get: function () {
return new m2_C2_private();
},
set: function (m2_c3_p4_arg) {
},
enumerable: true,
configurable: true
});
return m2_C3_public;
})();
m2.m2_C3_public = m2_C3_public;
var m2_C4_private = (function () {
function m2_C4_private() {
}
Object.defineProperty(m2_C4_private.prototype, "p1_private", {
get: function () {
return new m2_C1_public();
},
set: function (m2_c3_p1_arg) {
},
enumerable: true,
configurable: true
});
Object.defineProperty(m2_C4_private.prototype, "p2_private", {
get: function () {
return new m2_C1_public();
},
set: function (m2_c3_p2_arg) {
},
enumerable: true,
configurable: true
});
Object.defineProperty(m2_C4_private.prototype, "p3_private", {
get: function () {
return new m2_C2_private();
},
set: function (m2_c3_p3_arg) {
},
enumerable: true,
configurable: true
});
Object.defineProperty(m2_C4_private.prototype, "p4_public", {
get: function () {
return new m2_C2_private();
},
set: function (m2_c3_p4_arg) {
},
enumerable: true,
configurable: true
});
return m2_C4_private;
})();
})(m2 || (m2 = {}));
var C5_private = (function () {
function C5_private() {
}
C5_private.prototype.f = function () {
};
return C5_private;
})();
var C6_public = (function () {
function C6_public() {
}
return C6_public;
})();
exports.C6_public = C6_public;
var C7_public = (function () {
function C7_public() {
}
Object.defineProperty(C7_public.prototype, "p1_private", {
get: function () {
return new C6_public();
},
set: function (m1_c3_p1_arg) {
},
enumerable: true,
configurable: true
});
Object.defineProperty(C7_public.prototype, "p2_private", {
get: function () {
return new C6_public();
},
set: function (m1_c3_p2_arg) {
},
enumerable: true,
configurable: true
});
Object.defineProperty(C7_public.prototype, "p3_private", {
get: function () {
return new C5_private();
},
set: function (m1_c3_p3_arg) {
},
enumerable: true,
configurable: true
});
Object.defineProperty(C7_public.prototype, "p4_public", {
get: function () {
return new C5_private();
},
set: function (m1_c3_p4_arg) {
},
enumerable: true,
configurable: true
});
return C7_public;
})();
exports.C7_public = C7_public;
var C8_private = (function () {
function C8_private() {
}
Object.defineProperty(C8_private.prototype, "p1_private", {
get: function () {
return new C6_public();
},
set: function (m1_c3_p1_arg) {
},
enumerable: true,
configurable: true
});
Object.defineProperty(C8_private.prototype, "p2_private", {
get: function () {
return new C6_public();
},
set: function (m1_c3_p2_arg) {
},
enumerable: true,
configurable: true
});
Object.defineProperty(C8_private.prototype, "p3_private", {
get: function () {
return new C5_private();
},
set: function (m1_c3_p3_arg) {
},
enumerable: true,
configurable: true
});
Object.defineProperty(C8_private.prototype, "p4_public", {
get: function () {
return new C5_private();
},
set: function (m1_c3_p4_arg) {
},
enumerable: true,
configurable: true
});
return C8_private;
})();
});
@@ -1,129 +0,0 @@
==== tests/cases/compiler/privacyGloGetter.ts (20 errors) ====
module m1 {
export class C1_public {
private f1() {
}
}
class C2_private {
}
export class C3_public {
private get p1_private() {
~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
return new C1_public();
}
private set p1_private(m1_c3_p1_arg: C1_public) {
~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
}
private get p2_private() {
~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
return new C1_public();
}
private set p2_private(m1_c3_p2_arg: C1_public) {
~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
}
private get p3_private() {
~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
return new C2_private();
}
private set p3_private(m1_c3_p3_arg: C2_private) {
~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
}
public get p4_public(): C2_private { // error
~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
return new C2_private(); //error
}
public set p4_public(m1_c3_p4_arg: C2_private) { // error
~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
}
}
class C4_private {
private get p1_private() {
~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
return new C1_public();
}
private set p1_private(m1_c3_p1_arg: C1_public) {
~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
}
private get p2_private() {
~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
return new C1_public();
}
private set p2_private(m1_c3_p2_arg: C1_public) {
~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
}
private get p3_private() {
~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
return new C2_private();
}
private set p3_private(m1_c3_p3_arg: C2_private) {
~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
}
public get p4_public(): C2_private {
~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
return new C2_private();
}
public set p4_public(m1_c3_p4_arg: C2_private) {
~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
}
}
}
class C6_public {
}
class C7_public {
private get p1_private() {
~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
return new C6_public();
}
private set p1_private(m1_c3_p1_arg: C6_public) {
~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
}
private get p2_private() {
~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
return new C6_public();
}
private set p2_private(m1_c3_p2_arg: C6_public) {
~~~~~~~~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
}
}
@@ -0,0 +1,218 @@
//// [privacyGloGetter.ts]
module m1 {
export class C1_public {
private f1() {
}
}
class C2_private {
}
export class C3_public {
private get p1_private() {
return new C1_public();
}
private set p1_private(m1_c3_p1_arg: C1_public) {
}
private get p2_private() {
return new C1_public();
}
private set p2_private(m1_c3_p2_arg: C1_public) {
}
private get p3_private() {
return new C2_private();
}
private set p3_private(m1_c3_p3_arg: C2_private) {
}
public get p4_public(): C2_private { // error
return new C2_private(); //error
}
public set p4_public(m1_c3_p4_arg: C2_private) { // error
}
}
class C4_private {
private get p1_private() {
return new C1_public();
}
private set p1_private(m1_c3_p1_arg: C1_public) {
}
private get p2_private() {
return new C1_public();
}
private set p2_private(m1_c3_p2_arg: C1_public) {
}
private get p3_private() {
return new C2_private();
}
private set p3_private(m1_c3_p3_arg: C2_private) {
}
public get p4_public(): C2_private {
return new C2_private();
}
public set p4_public(m1_c3_p4_arg: C2_private) {
}
}
}
class C6_public {
}
class C7_public {
private get p1_private() {
return new C6_public();
}
private set p1_private(m1_c3_p1_arg: C6_public) {
}
private get p2_private() {
return new C6_public();
}
private set p2_private(m1_c3_p2_arg: C6_public) {
}
}
//// [privacyGloGetter.js]
var m1;
(function (m1) {
var C1_public = (function () {
function C1_public() {
}
C1_public.prototype.f1 = function () {
};
return C1_public;
})();
m1.C1_public = C1_public;
var C2_private = (function () {
function C2_private() {
}
return C2_private;
})();
var C3_public = (function () {
function C3_public() {
}
Object.defineProperty(C3_public.prototype, "p1_private", {
get: function () {
return new C1_public();
},
set: function (m1_c3_p1_arg) {
},
enumerable: true,
configurable: true
});
Object.defineProperty(C3_public.prototype, "p2_private", {
get: function () {
return new C1_public();
},
set: function (m1_c3_p2_arg) {
},
enumerable: true,
configurable: true
});
Object.defineProperty(C3_public.prototype, "p3_private", {
get: function () {
return new C2_private();
},
set: function (m1_c3_p3_arg) {
},
enumerable: true,
configurable: true
});
Object.defineProperty(C3_public.prototype, "p4_public", {
get: function () {
return new C2_private();
},
set: function (m1_c3_p4_arg) {
},
enumerable: true,
configurable: true
});
return C3_public;
})();
m1.C3_public = C3_public;
var C4_private = (function () {
function C4_private() {
}
Object.defineProperty(C4_private.prototype, "p1_private", {
get: function () {
return new C1_public();
},
set: function (m1_c3_p1_arg) {
},
enumerable: true,
configurable: true
});
Object.defineProperty(C4_private.prototype, "p2_private", {
get: function () {
return new C1_public();
},
set: function (m1_c3_p2_arg) {
},
enumerable: true,
configurable: true
});
Object.defineProperty(C4_private.prototype, "p3_private", {
get: function () {
return new C2_private();
},
set: function (m1_c3_p3_arg) {
},
enumerable: true,
configurable: true
});
Object.defineProperty(C4_private.prototype, "p4_public", {
get: function () {
return new C2_private();
},
set: function (m1_c3_p4_arg) {
},
enumerable: true,
configurable: true
});
return C4_private;
})();
})(m1 || (m1 = {}));
var C6_public = (function () {
function C6_public() {
}
return C6_public;
})();
var C7_public = (function () {
function C7_public() {
}
Object.defineProperty(C7_public.prototype, "p1_private", {
get: function () {
return new C6_public();
},
set: function (m1_c3_p1_arg) {
},
enumerable: true,
configurable: true
});
Object.defineProperty(C7_public.prototype, "p2_private", {
get: function () {
return new C6_public();
},
set: function (m1_c3_p2_arg) {
},
enumerable: true,
configurable: true
});
return C7_public;
})();
@@ -1,4 +1,4 @@
==== tests/cases/compiler/privacyGloImport.ts (21 errors) ====
==== tests/cases/compiler/privacyGloImport.ts (2 errors) ====
module m1 {
export module m1_M1_public {
export class c1 {
@@ -20,27 +20,21 @@
export var v2: c1;
}
declare export module "m1_M3_public" {
~~~~~~
!!! 'export' modifier must precede 'declare' modifier.
~~~~~~~~~~~~~~
!!! Ambient external modules cannot be nested in other modules.
export function f1();
export class c1 {
}
export var v1: { new (): c1; };
export var v2: c1;
}
//export declare module "m1_M3_public" {
// export function f1();
// export class c1 {
// }
// export var v1: { new (): c1; };
// export var v2: c1;
//}
declare module "m1_M4_private" {
~~~~~~~~~~~~~~~
!!! Ambient external modules cannot be nested in other modules.
export function f1();
export class c1 {
}
export var v1: { new (): c1; };
export var v2: c1;
}
//declare module "m1_M4_private" {
// export function f1();
// export class c1 {
// }
// export var v1: { new (): c1; };
// export var v2: c1;
//}
import m1_im1_private = m1_M1_public;
export var m1_im1_private_v1_public = m1_im1_private.c1;
@@ -54,6 +48,8 @@
import m1_im2_private = m1_M2_private;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Import declaration 'm1_im2_private' is using private name 'm1_M2_private'.
export var m1_im2_private_v1_public = m1_im2_private.c1;
export var m1_im2_private_v2_public = new m1_im2_private.c1();
export var m1_im2_private_v3_public = m1_im2_private.f1;
@@ -63,43 +59,32 @@
var m1_im2_private_v3_private = m1_im2_private.f1;
var m1_im2_private_v4_private = m1_im2_private.f1();
import m1_im3_private = require("m1_M3_public");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Import declarations in an internal module cannot reference an external module.
~~~~~~~~~~~~~~
!!! Cannot find external module 'm1_M3_public'.
export var m1_im3_private_v1_public = m1_im3_private.c1;
export var m1_im3_private_v2_public = new m1_im3_private.c1();
export var m1_im3_private_v3_public = m1_im3_private.f1;
export var m1_im3_private_v4_public = m1_im3_private.f1();
var m1_im3_private_v1_private = m1_im3_private.c1;
var m1_im3_private_v2_private = new m1_im3_private.c1();
var m1_im3_private_v3_private = m1_im3_private.f1;
var m1_im3_private_v4_private = m1_im3_private.f1();
//import m1_im3_private = require("m1_M3_public");
//export var m1_im3_private_v1_public = m1_im3_private.c1;
//export var m1_im3_private_v2_public = new m1_im3_private.c1();
//export var m1_im3_private_v3_public = m1_im3_private.f1;
//export var m1_im3_private_v4_public = m1_im3_private.f1();
//var m1_im3_private_v1_private = m1_im3_private.c1;
//var m1_im3_private_v2_private = new m1_im3_private.c1();
//var m1_im3_private_v3_private = m1_im3_private.f1;
//var m1_im3_private_v4_private = m1_im3_private.f1();
import m1_im4_private = require("m1_M4_private");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Import declarations in an internal module cannot reference an external module.
~~~~~~~~~~~~~~~
!!! Cannot find external module 'm1_M4_private'.
export var m1_im4_private_v1_public = m1_im4_private.c1;
export var m1_im4_private_v2_public = new m1_im4_private.c1();
export var m1_im4_private_v3_public = m1_im4_private.f1;
export var m1_im4_private_v4_public = m1_im4_private.f1();
var m1_im4_private_v1_private = m1_im4_private.c1;
var m1_im4_private_v2_private = new m1_im4_private.c1();
var m1_im4_private_v3_private = m1_im4_private.f1;
var m1_im4_private_v4_private = m1_im4_private.f1();
//import m1_im4_private = require("m1_M4_private");
//export var m1_im4_private_v1_public = m1_im4_private.c1;
//export var m1_im4_private_v2_public = new m1_im4_private.c1();
//export var m1_im4_private_v3_public = m1_im4_private.f1;
//export var m1_im4_private_v4_public = m1_im4_private.f1();
//var m1_im4_private_v1_private = m1_im4_private.c1;
//var m1_im4_private_v2_private = new m1_im4_private.c1();
//var m1_im4_private_v3_private = m1_im4_private.f1;
//var m1_im4_private_v4_private = m1_im4_private.f1();
// Parse error to export module
export import m1_im1_public = m1_M1_public;
export import m1_im2_public = m1_M2_private;
export import m1_im3_public = require("m1_M3_public");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Import declarations in an internal module cannot reference an external module.
export import m1_im4_public = require("m1_M4_private");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Import declarations in an internal module cannot reference an external module.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Import declaration 'm1_im2_public' is using private name 'm1_M2_private'.
//export import m1_im3_public = require("m1_M3_public");
//export import m1_im4_public = require("m1_M4_private");
}
module glo_M1_public {
@@ -123,38 +108,26 @@
declare module "use_glo_M1_public" {
import use_glo_M1_public = glo_M1_public;
export var use_glo_M1_public_v1_public: { new (): use_glo_M1_public.c1; };
export var use_glo_M1_public_v2_public: use_glo_M1_public;
~~~~~~~~~~~~~~~~~
!!! Cannot find name 'use_glo_M1_public'.
export var use_glo_M1_public_v2_public: typeof use_glo_M1_public;
export var use_glo_M1_public_v3_public: ()=> use_glo_M1_public.c1;
var use_glo_M1_public_v1_private: { new (): use_glo_M1_public.c1; };
var use_glo_M1_public_v2_private: use_glo_M1_public;
~~~~~~~~~~~~~~~~~
!!! Cannot find name 'use_glo_M1_public'.
var use_glo_M1_public_v2_private: typeof use_glo_M1_public;
var use_glo_M1_public_v3_private: () => use_glo_M1_public.c1;
import use_glo_M2_public = require("glo_M2_public");
export var use_glo_M2_public_v1_public: { new (): use_glo_M2_public.c1; };
export var use_glo_M2_public_v2_public: use_glo_M2_public;
~~~~~~~~~~~~~~~~~
!!! Cannot find name 'use_glo_M2_public'.
export var use_glo_M2_public_v2_public: typeof use_glo_M2_public;
export var use_glo_M2_public_v3_public: () => use_glo_M2_public.c1;
var use_glo_M2_public_v1_private: { new (): use_glo_M2_public.c1; };
var use_glo_M2_public_v2_private: use_glo_M2_public;
~~~~~~~~~~~~~~~~~
!!! Cannot find name 'use_glo_M2_public'.
var use_glo_M2_public_v2_private: typeof use_glo_M2_public;
var use_glo_M2_public_v3_private: () => use_glo_M2_public.c1;
module m2 {
import errorImport = require("glo_M2_public");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Import declarations in an internal module cannot reference an external module.
//import errorImport = require("glo_M2_public");
import nonerrorImport = glo_M1_public;
module m5 {
import m5_errorImport = require("glo_M2_public");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Import declarations in an internal module cannot reference an external module.
//import m5_errorImport = require("glo_M2_public");
import m5_nonerrorImport = glo_M1_public;
}
}
@@ -162,35 +135,23 @@
declare module "anotherParseError" {
module m2 {
declare module "abc" {
~~~~~~~
!!! A 'declare' modifier cannot be used in an already ambient context.
~~~~~
!!! Ambient external modules cannot be nested in other modules.
}
//declare module "abc" {
//}
}
module m2 {
module "abc2" {
~~~~~~
!!! Ambient external modules cannot be nested in other modules.
}
}
module "abc3" {
~~~~~~
!!! Ambient external modules cannot be nested in other modules.
//module "abc2" {
//}
}
//module "abc3" {
//}
}
module m2 {
import m3 = require("use_glo_M1_public");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Import declarations in an internal module cannot reference an external module.
//import m3 = require("use_glo_M1_public");
module m4 {
var a = 10;
import m2 = require("use_glo_M1_public");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Import declarations in an internal module cannot reference an external module.
//import m2 = require("use_glo_M1_public");
}
}
@@ -0,0 +1,230 @@
//// [privacyGloImport.ts]
module m1 {
export module m1_M1_public {
export class c1 {
}
export function f1() {
return new c1;
}
export var v1 = c1;
export var v2: c1;
}
module m1_M2_private {
export class c1 {
}
export function f1() {
return new c1;
}
export var v1 = c1;
export var v2: c1;
}
//export declare module "m1_M3_public" {
// export function f1();
// export class c1 {
// }
// export var v1: { new (): c1; };
// export var v2: c1;
//}
//declare module "m1_M4_private" {
// export function f1();
// export class c1 {
// }
// export var v1: { new (): c1; };
// export var v2: c1;
//}
import m1_im1_private = m1_M1_public;
export var m1_im1_private_v1_public = m1_im1_private.c1;
export var m1_im1_private_v2_public = new m1_im1_private.c1();
export var m1_im1_private_v3_public = m1_im1_private.f1;
export var m1_im1_private_v4_public = m1_im1_private.f1();
var m1_im1_private_v1_private = m1_im1_private.c1;
var m1_im1_private_v2_private = new m1_im1_private.c1();
var m1_im1_private_v3_private = m1_im1_private.f1;
var m1_im1_private_v4_private = m1_im1_private.f1();
import m1_im2_private = m1_M2_private;
export var m1_im2_private_v1_public = m1_im2_private.c1;
export var m1_im2_private_v2_public = new m1_im2_private.c1();
export var m1_im2_private_v3_public = m1_im2_private.f1;
export var m1_im2_private_v4_public = m1_im2_private.f1();
var m1_im2_private_v1_private = m1_im2_private.c1;
var m1_im2_private_v2_private = new m1_im2_private.c1();
var m1_im2_private_v3_private = m1_im2_private.f1;
var m1_im2_private_v4_private = m1_im2_private.f1();
//import m1_im3_private = require("m1_M3_public");
//export var m1_im3_private_v1_public = m1_im3_private.c1;
//export var m1_im3_private_v2_public = new m1_im3_private.c1();
//export var m1_im3_private_v3_public = m1_im3_private.f1;
//export var m1_im3_private_v4_public = m1_im3_private.f1();
//var m1_im3_private_v1_private = m1_im3_private.c1;
//var m1_im3_private_v2_private = new m1_im3_private.c1();
//var m1_im3_private_v3_private = m1_im3_private.f1;
//var m1_im3_private_v4_private = m1_im3_private.f1();
//import m1_im4_private = require("m1_M4_private");
//export var m1_im4_private_v1_public = m1_im4_private.c1;
//export var m1_im4_private_v2_public = new m1_im4_private.c1();
//export var m1_im4_private_v3_public = m1_im4_private.f1;
//export var m1_im4_private_v4_public = m1_im4_private.f1();
//var m1_im4_private_v1_private = m1_im4_private.c1;
//var m1_im4_private_v2_private = new m1_im4_private.c1();
//var m1_im4_private_v3_private = m1_im4_private.f1;
//var m1_im4_private_v4_private = m1_im4_private.f1();
export import m1_im1_public = m1_M1_public;
export import m1_im2_public = m1_M2_private;
//export import m1_im3_public = require("m1_M3_public");
//export import m1_im4_public = require("m1_M4_private");
}
module glo_M1_public {
export class c1 {
}
export function f1() {
return new c1;
}
export var v1 = c1;
export var v2: c1;
}
declare module "glo_M2_public" {
export function f1();
export class c1 {
}
export var v1: { new (): c1; };
export var v2: c1;
}
declare module "use_glo_M1_public" {
import use_glo_M1_public = glo_M1_public;
export var use_glo_M1_public_v1_public: { new (): use_glo_M1_public.c1; };
export var use_glo_M1_public_v2_public: typeof use_glo_M1_public;
export var use_glo_M1_public_v3_public: ()=> use_glo_M1_public.c1;
var use_glo_M1_public_v1_private: { new (): use_glo_M1_public.c1; };
var use_glo_M1_public_v2_private: typeof use_glo_M1_public;
var use_glo_M1_public_v3_private: () => use_glo_M1_public.c1;
import use_glo_M2_public = require("glo_M2_public");
export var use_glo_M2_public_v1_public: { new (): use_glo_M2_public.c1; };
export var use_glo_M2_public_v2_public: typeof use_glo_M2_public;
export var use_glo_M2_public_v3_public: () => use_glo_M2_public.c1;
var use_glo_M2_public_v1_private: { new (): use_glo_M2_public.c1; };
var use_glo_M2_public_v2_private: typeof use_glo_M2_public;
var use_glo_M2_public_v3_private: () => use_glo_M2_public.c1;
module m2 {
//import errorImport = require("glo_M2_public");
import nonerrorImport = glo_M1_public;
module m5 {
//import m5_errorImport = require("glo_M2_public");
import m5_nonerrorImport = glo_M1_public;
}
}
}
declare module "anotherParseError" {
module m2 {
//declare module "abc" {
//}
}
module m2 {
//module "abc2" {
//}
}
//module "abc3" {
//}
}
module m2 {
//import m3 = require("use_glo_M1_public");
module m4 {
var a = 10;
//import m2 = require("use_glo_M1_public");
}
}
//// [privacyGloImport.js]
var m1;
(function (m1) {
(function (m1_M1_public) {
var c1 = (function () {
function c1() {
}
return c1;
})();
m1_M1_public.c1 = c1;
function f1() {
return new c1;
}
m1_M1_public.f1 = f1;
m1_M1_public.v1 = c1;
m1_M1_public.v2;
})(m1.m1_M1_public || (m1.m1_M1_public = {}));
var m1_M1_public = m1.m1_M1_public;
var m1_M2_private;
(function (m1_M2_private) {
var c1 = (function () {
function c1() {
}
return c1;
})();
m1_M2_private.c1 = c1;
function f1() {
return new c1;
}
m1_M2_private.f1 = f1;
m1_M2_private.v1 = c1;
m1_M2_private.v2;
})(m1_M2_private || (m1_M2_private = {}));
var m1_im1_private = m1_M1_public;
m1.m1_im1_private_v1_public = m1_im1_private.c1;
m1.m1_im1_private_v2_public = new m1_im1_private.c1();
m1.m1_im1_private_v3_public = m1_im1_private.f1;
m1.m1_im1_private_v4_public = m1_im1_private.f1();
var m1_im1_private_v1_private = m1_im1_private.c1;
var m1_im1_private_v2_private = new m1_im1_private.c1();
var m1_im1_private_v3_private = m1_im1_private.f1;
var m1_im1_private_v4_private = m1_im1_private.f1();
var m1_im2_private = m1_M2_private;
m1.m1_im2_private_v1_public = m1_im2_private.c1;
m1.m1_im2_private_v2_public = new m1_im2_private.c1();
m1.m1_im2_private_v3_public = m1_im2_private.f1;
m1.m1_im2_private_v4_public = m1_im2_private.f1();
var m1_im2_private_v1_private = m1_im2_private.c1;
var m1_im2_private_v2_private = new m1_im2_private.c1();
var m1_im2_private_v3_private = m1_im2_private.f1;
var m1_im2_private_v4_private = m1_im2_private.f1();
m1.m1_im1_public = m1_M1_public;
m1.m1_im2_public = m1_M2_private;
})(m1 || (m1 = {}));
var glo_M1_public;
(function (glo_M1_public) {
var c1 = (function () {
function c1() {
}
return c1;
})();
glo_M1_public.c1 = c1;
function f1() {
return new c1;
}
glo_M1_public.f1 = f1;
glo_M1_public.v1 = c1;
glo_M1_public.v2;
})(glo_M1_public || (glo_M1_public = {}));
var m2;
(function (m2) {
var m4;
(function (m4) {
var a = 10;
})(m4 || (m4 = {}));
})(m2 || (m2 = {}));
@@ -0,0 +1,185 @@
==== tests/cases/compiler/privacyGloImportParseErrors.ts (16 errors) ====
module m1 {
export module m1_M1_public {
export class c1 {
}
export function f1() {
return new c1;
}
export var v1 = c1;
export var v2: c1;
}
module m1_M2_private {
export class c1 {
}
export function f1() {
return new c1;
}
export var v1 = c1;
export var v2: c1;
}
export declare module "m1_M3_public" {
~~~~~~~~~~~~~~
!!! Ambient external modules cannot be nested in other modules.
export function f1();
export class c1 {
}
export var v1: { new (): c1; };
export var v2: c1;
}
declare module "m1_M4_private" {
~~~~~~~~~~~~~~~
!!! Ambient external modules cannot be nested in other modules.
export function f1();
export class c1 {
}
export var v1: { new (): c1; };
export var v2: c1;
}
import m1_im1_private = m1_M1_public;
export var m1_im1_private_v1_public = m1_im1_private.c1;
export var m1_im1_private_v2_public = new m1_im1_private.c1();
export var m1_im1_private_v3_public = m1_im1_private.f1;
export var m1_im1_private_v4_public = m1_im1_private.f1();
var m1_im1_private_v1_private = m1_im1_private.c1;
var m1_im1_private_v2_private = new m1_im1_private.c1();
var m1_im1_private_v3_private = m1_im1_private.f1;
var m1_im1_private_v4_private = m1_im1_private.f1();
import m1_im2_private = m1_M2_private;
export var m1_im2_private_v1_public = m1_im2_private.c1;
export var m1_im2_private_v2_public = new m1_im2_private.c1();
export var m1_im2_private_v3_public = m1_im2_private.f1;
export var m1_im2_private_v4_public = m1_im2_private.f1();
var m1_im2_private_v1_private = m1_im2_private.c1;
var m1_im2_private_v2_private = new m1_im2_private.c1();
var m1_im2_private_v3_private = m1_im2_private.f1;
var m1_im2_private_v4_private = m1_im2_private.f1();
import m1_im3_private = require("m1_M3_public");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Import declarations in an internal module cannot reference an external module.
~~~~~~~~~~~~~~
!!! Cannot find external module 'm1_M3_public'.
export var m1_im3_private_v1_public = m1_im3_private.c1;
export var m1_im3_private_v2_public = new m1_im3_private.c1();
export var m1_im3_private_v3_public = m1_im3_private.f1;
export var m1_im3_private_v4_public = m1_im3_private.f1();
var m1_im3_private_v1_private = m1_im3_private.c1;
var m1_im3_private_v2_private = new m1_im3_private.c1();
var m1_im3_private_v3_private = m1_im3_private.f1;
var m1_im3_private_v4_private = m1_im3_private.f1();
import m1_im4_private = require("m1_M4_private");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Import declarations in an internal module cannot reference an external module.
~~~~~~~~~~~~~~~
!!! Cannot find external module 'm1_M4_private'.
export var m1_im4_private_v1_public = m1_im4_private.c1;
export var m1_im4_private_v2_public = new m1_im4_private.c1();
export var m1_im4_private_v3_public = m1_im4_private.f1;
export var m1_im4_private_v4_public = m1_im4_private.f1();
var m1_im4_private_v1_private = m1_im4_private.c1;
var m1_im4_private_v2_private = new m1_im4_private.c1();
var m1_im4_private_v3_private = m1_im4_private.f1;
var m1_im4_private_v4_private = m1_im4_private.f1();
export import m1_im1_public = m1_M1_public;
export import m1_im2_public = m1_M2_private;
export import m1_im3_public = require("m1_M3_public");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Import declarations in an internal module cannot reference an external module.
export import m1_im4_public = require("m1_M4_private");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Import declarations in an internal module cannot reference an external module.
}
module glo_M1_public {
export class c1 {
}
export function f1() {
return new c1;
}
export var v1 = c1;
export var v2: c1;
}
declare module "glo_M2_public" {
export function f1();
export class c1 {
}
export var v1: { new (): c1; };
export var v2: c1;
}
declare module "use_glo_M1_public" {
import use_glo_M1_public = glo_M1_public;
export var use_glo_M1_public_v1_public: { new (): use_glo_M1_public.c1; };
export var use_glo_M1_public_v2_public: typeof use_glo_M1_public;
export var use_glo_M1_public_v3_public: ()=> use_glo_M1_public.c1;
var use_glo_M1_public_v1_private: { new (): use_glo_M1_public.c1; };
var use_glo_M1_public_v2_private: typeof use_glo_M1_public;
var use_glo_M1_public_v3_private: () => use_glo_M1_public.c1;
import use_glo_M2_public = require("glo_M2_public");
export var use_glo_M2_public_v1_public: { new (): use_glo_M2_public.c1; };
export var use_glo_M2_public_v2_public: typeof use_glo_M2_public;
export var use_glo_M2_public_v3_public: () => use_glo_M2_public.c1;
var use_glo_M2_public_v1_private: { new (): use_glo_M2_public.c1; };
var use_glo_M2_public_v2_private: typeof use_glo_M2_public;
var use_glo_M2_public_v3_private: () => use_glo_M2_public.c1;
module m2 {
import errorImport = require("glo_M2_public");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Import declarations in an internal module cannot reference an external module.
import nonerrorImport = glo_M1_public;
module m5 {
import m5_errorImport = require("glo_M2_public");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Import declarations in an internal module cannot reference an external module.
import m5_nonerrorImport = glo_M1_public;
}
}
}
declare module "anotherParseError" {
module m2 {
declare module "abc" {
~~~~~~~
!!! A 'declare' modifier cannot be used in an already ambient context.
~~~~~
!!! Ambient external modules cannot be nested in other modules.
}
}
module m2 {
module "abc2" {
~~~~~~
!!! Ambient external modules cannot be nested in other modules.
}
}
module "abc3" {
~~~~~~
!!! Ambient external modules cannot be nested in other modules.
}
}
module m2 {
import m3 = require("use_glo_M1_public");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Import declarations in an internal module cannot reference an external module.
module m4 {
var a = 10;
import m2 = require("use_glo_M1_public");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Import declarations in an internal module cannot reference an external module.
}
}
+183 -277
View File
@@ -1,4 +1,4 @@
==== tests/cases/compiler/privacyImport.ts (49 errors) ====
==== tests/cases/compiler/privacyImport.ts (2 errors) ====
export module m1 {
export module m1_M1_public {
export class c1 {
@@ -20,25 +20,21 @@
export var v2: c1;
}
export declare module "m1_M3_public" {
~~~~~~~~~~~~~~
!!! Ambient external modules cannot be nested in other modules.
export function f1();
export class c1 {
}
export var v1: { new (): c1; };
export var v2: c1;
}
//export declare module "m1_M3_public" {
// export function f1();
// export class c1 {
// }
// export var v1: { new (): c1; };
// export var v2: c1;
//}
declare module "m1_M4_private" {
~~~~~~~~~~~~~~~
!!! Ambient external modules cannot be nested in other modules.
export function f1();
export class c1 {
}
export var v1: { new (): c1; };
export var v2: c1;
}
//declare module "m1_M4_private" {
// export function f1();
// export class c1 {
// }
// export var v1: { new (): c1; };
// export var v2: c1;
//}
import m1_im1_private = m1_M1_public;
export var m1_im1_private_v1_public = m1_im1_private.c1;
@@ -52,6 +48,8 @@
import m1_im2_private = m1_M2_private;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Import declaration 'm1_im2_private' is using private name 'm1_M2_private'.
export var m1_im2_private_v1_public = m1_im2_private.c1;
export var m1_im2_private_v2_public = new m1_im2_private.c1();
export var m1_im2_private_v3_public = m1_im2_private.f1;
@@ -61,42 +59,32 @@
var m1_im2_private_v3_private = m1_im2_private.f1;
var m1_im2_private_v4_private = m1_im2_private.f1();
import m1_im3_private = require("m1_M3_public");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Import declarations in an internal module cannot reference an external module.
~~~~~~~~~~~~~~
!!! Cannot find external module 'm1_M3_public'.
export var m1_im3_private_v1_public = m1_im3_private.c1;
export var m1_im3_private_v2_public = new m1_im3_private.c1();
export var m1_im3_private_v3_public = m1_im3_private.f1;
export var m1_im3_private_v4_public = m1_im3_private.f1();
var m1_im3_private_v1_private = m1_im3_private.c1;
var m1_im3_private_v2_private = new m1_im3_private.c1();
var m1_im3_private_v3_private = m1_im3_private.f1;
var m1_im3_private_v4_private = m1_im3_private.f1();
//import m1_im3_private = require("m1_M3_public");
//export var m1_im3_private_v1_public = m1_im3_private.c1;
//export var m1_im3_private_v2_public = new m1_im3_private.c1();
//export var m1_im3_private_v3_public = m1_im3_private.f1;
//export var m1_im3_private_v4_public = m1_im3_private.f1();
//var m1_im3_private_v1_private = m1_im3_private.c1;
//var m1_im3_private_v2_private = new m1_im3_private.c1();
//var m1_im3_private_v3_private = m1_im3_private.f1;
//var m1_im3_private_v4_private = m1_im3_private.f1();
import m1_im4_private = require("m1_M4_private");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Import declarations in an internal module cannot reference an external module.
~~~~~~~~~~~~~~~
!!! Cannot find external module 'm1_M4_private'.
export var m1_im4_private_v1_public = m1_im4_private.c1;
export var m1_im4_private_v2_public = new m1_im4_private.c1();
export var m1_im4_private_v3_public = m1_im4_private.f1;
export var m1_im4_private_v4_public = m1_im4_private.f1();
var m1_im4_private_v1_private = m1_im4_private.c1;
var m1_im4_private_v2_private = new m1_im4_private.c1();
var m1_im4_private_v3_private = m1_im4_private.f1;
var m1_im4_private_v4_private = m1_im4_private.f1();
//import m1_im4_private = require("m1_M4_private");
//export var m1_im4_private_v1_public = m1_im4_private.c1;
//export var m1_im4_private_v2_public = new m1_im4_private.c1();
//export var m1_im4_private_v3_public = m1_im4_private.f1;
//export var m1_im4_private_v4_public = m1_im4_private.f1();
//var m1_im4_private_v1_private = m1_im4_private.c1;
//var m1_im4_private_v2_private = new m1_im4_private.c1();
//var m1_im4_private_v3_private = m1_im4_private.f1;
//var m1_im4_private_v4_private = m1_im4_private.f1();
export import m1_im1_public = m1_M1_public;
export import m1_im2_public = m1_M2_private;
export import m1_im3_public = require("m1_M3_public");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Import declarations in an internal module cannot reference an external module.
export import m1_im4_public = require("m1_M4_private");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Import declarations in an internal module cannot reference an external module.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Import declaration 'm1_im2_public' is using private name 'm1_M2_private'.
//export import m1_im3_public = require("m1_M3_public");
//export import m1_im4_public = require("m1_M4_private");
}
module m2 {
@@ -120,25 +108,21 @@
export var v2: c1;
}
export declare module "m2_M3_public" {
~~~~~~~~~~~~~~
!!! Ambient external modules cannot be nested in other modules.
export function f1();
export class c1 {
}
export var v1: { new (): c1; };
export var v2: c1;
}
//export declare module "m2_M3_public" {
// export function f1();
// export class c1 {
// }
// export var v1: { new (): c1; };
// export var v2: c1;
//}
declare module "m2_M4_private" {
~~~~~~~~~~~~~~~
!!! Ambient external modules cannot be nested in other modules.
export function f1();
export class c1 {
}
export var v1: { new (): c1; };
export var v2: c1;
}
//declare module "m2_M4_private" {
// export function f1();
// export class c1 {
// }
// export var v1: { new (): c1; };
// export var v2: c1;
//}
import m1_im1_private = m2_M1_public;
export var m1_im1_private_v1_public = m1_im1_private.c1;
@@ -161,43 +145,31 @@
var m1_im2_private_v3_private = m1_im2_private.f1;
var m1_im2_private_v4_private = m1_im2_private.f1();
import m1_im3_private = require("m2_M3_public");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Import declarations in an internal module cannot reference an external module.
~~~~~~~~~~~~~~
!!! Cannot find external module 'm2_M3_public'.
export var m1_im3_private_v1_public = m1_im3_private.c1;
export var m1_im3_private_v2_public = new m1_im3_private.c1();
export var m1_im3_private_v3_public = m1_im3_private.f1;
export var m1_im3_private_v4_public = m1_im3_private.f1();
var m1_im3_private_v1_private = m1_im3_private.c1;
var m1_im3_private_v2_private = new m1_im3_private.c1();
var m1_im3_private_v3_private = m1_im3_private.f1;
var m1_im3_private_v4_private = m1_im3_private.f1();
//import m1_im3_private = require("m2_M3_public");
//export var m1_im3_private_v1_public = m1_im3_private.c1;
//export var m1_im3_private_v2_public = new m1_im3_private.c1();
//export var m1_im3_private_v3_public = m1_im3_private.f1;
//export var m1_im3_private_v4_public = m1_im3_private.f1();
//var m1_im3_private_v1_private = m1_im3_private.c1;
//var m1_im3_private_v2_private = new m1_im3_private.c1();
//var m1_im3_private_v3_private = m1_im3_private.f1;
//var m1_im3_private_v4_private = m1_im3_private.f1();
import m1_im4_private = require("m2_M4_private");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Import declarations in an internal module cannot reference an external module.
~~~~~~~~~~~~~~~
!!! Cannot find external module 'm2_M4_private'.
export var m1_im4_private_v1_public = m1_im4_private.c1;
export var m1_im4_private_v2_public = new m1_im4_private.c1();
export var m1_im4_private_v3_public = m1_im4_private.f1;
export var m1_im4_private_v4_public = m1_im4_private.f1();
var m1_im4_private_v1_private = m1_im4_private.c1;
var m1_im4_private_v2_private = new m1_im4_private.c1();
var m1_im4_private_v3_private = m1_im4_private.f1;
var m1_im4_private_v4_private = m1_im4_private.f1();
//import m1_im4_private = require("m2_M4_private");
//export var m1_im4_private_v1_public = m1_im4_private.c1;
//export var m1_im4_private_v2_public = new m1_im4_private.c1();
//export var m1_im4_private_v3_public = m1_im4_private.f1;
//export var m1_im4_private_v4_public = m1_im4_private.f1();
//var m1_im4_private_v1_private = m1_im4_private.c1;
//var m1_im4_private_v2_private = new m1_im4_private.c1();
//var m1_im4_private_v3_private = m1_im4_private.f1;
//var m1_im4_private_v4_private = m1_im4_private.f1();
// Parse error to export module
export import m1_im1_public = m2_M1_public;
export import m1_im2_public = m2_M2_private;
export import m1_im3_public = require("m2_M3_public");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Import declarations in an internal module cannot reference an external module.
export import m1_im4_public = require("m2_M4_private");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Import declarations in an internal module cannot reference an external module.
//export import m1_im3_public = require("m2_M3_public");
//export import m1_im4_public = require("m2_M4_private");
}
export module glo_M1_public {
@@ -210,15 +182,13 @@
export var v2: c1;
}
export declare module "glo_M2_public" {
~~~~~~~~~~~~~~~
!!! Ambient external modules cannot be nested in other modules.
export function f1();
export class c1 {
}
export var v1: { new (): c1; };
export var v2: c1;
}
//export declare module "glo_M2_public" {
// export function f1();
// export class c1 {
// }
// export var v1: { new (): c1; };
// export var v2: c1;
//}
export module glo_M3_private {
export class c1 {
@@ -230,15 +200,13 @@
export var v2: c1;
}
export declare module "glo_M4_private" {
~~~~~~~~~~~~~~~~
!!! Ambient external modules cannot be nested in other modules.
export function f1();
export class c1 {
}
export var v1: { new (): c1; };
export var v2: c1;
}
//export declare module "glo_M4_private" {
// export function f1();
// export class c1 {
// }
// export var v1: { new (): c1; };
// export var v2: c1;
//}
import glo_im1_private = glo_M1_public;
@@ -252,17 +220,15 @@
var glo_im1_private_v4_private = glo_im1_private.f1();
import glo_im2_private = require("glo_M2_public");
~~~~~~~~~~~~~~~
!!! Cannot find external module 'glo_M2_public'.
export var glo_im2_private_v1_public = glo_im2_private.c1;
export var glo_im2_private_v2_public = new glo_im2_private.c1();
export var glo_im2_private_v3_public = glo_im2_private.f1;
export var glo_im2_private_v4_public = glo_im2_private.f1();
var glo_im2_private_v1_private = glo_im2_private.c1;
var glo_im2_private_v2_private = new glo_im2_private.c1();
var glo_im2_private_v3_private = glo_im2_private.f1;
var glo_im2_private_v4_private = glo_im2_private.f1();
//import glo_im2_private = require("glo_M2_public");
//export var glo_im2_private_v1_public = glo_im2_private.c1;
//export var glo_im2_private_v2_public = new glo_im2_private.c1();
//export var glo_im2_private_v3_public = glo_im2_private.f1;
//export var glo_im2_private_v4_public = glo_im2_private.f1();
//var glo_im2_private_v1_private = glo_im2_private.c1;
//var glo_im2_private_v2_private = new glo_im2_private.c1();
//var glo_im2_private_v3_private = glo_im2_private.f1;
//var glo_im2_private_v4_private = glo_im2_private.f1();
import glo_im3_private = glo_M3_private;
export var glo_im3_private_v1_public = glo_im3_private.c1;
@@ -274,182 +240,122 @@
var glo_im3_private_v3_private = glo_im3_private.f1;
var glo_im3_private_v4_private = glo_im3_private.f1();
import glo_im4_private = require("glo_M4_private");
~~~~~~~~~~~~~~~~
!!! Cannot find external module 'glo_M4_private'.
export var glo_im4_private_v1_public = glo_im4_private.c1;
export var glo_im4_private_v2_public = new glo_im4_private.c1();
export var glo_im4_private_v3_public = glo_im4_private.f1;
export var glo_im4_private_v4_public = glo_im4_private.f1();
var glo_im4_private_v1_private = glo_im4_private.c1;
var glo_im4_private_v2_private = new glo_im4_private.c1();
var glo_im4_private_v3_private = glo_im4_private.f1;
var glo_im4_private_v4_private = glo_im4_private.f1();
//import glo_im4_private = require("glo_M4_private");
//export var glo_im4_private_v1_public = glo_im4_private.c1;
//export var glo_im4_private_v2_public = new glo_im4_private.c1();
//export var glo_im4_private_v3_public = glo_im4_private.f1;
//export var glo_im4_private_v4_public = glo_im4_private.f1();
//var glo_im4_private_v1_private = glo_im4_private.c1;
//var glo_im4_private_v2_private = new glo_im4_private.c1();
//var glo_im4_private_v3_private = glo_im4_private.f1;
//var glo_im4_private_v4_private = glo_im4_private.f1();
// Parse error to export module
export import glo_im1_public = glo_M1_public;
export import glo_im2_public = glo_M3_private;
export import glo_im3_public = require("glo_M2_public");
~~~~~~~~~~~~~~~
!!! Cannot find external module 'glo_M2_public'.
export import glo_im4_public = require("glo_M4_private");
~~~~~~~~~~~~~~~~
!!! Cannot find external module 'glo_M4_private'.
//export import glo_im3_public = require("glo_M2_public");
//export import glo_im4_public = require("glo_M4_private");
export declare module "use_glo_M1_public" {
~~~~~~~~~~~~~~~~~~~
!!! Ambient external modules cannot be nested in other modules.
import use_glo_M1_public = glo_M1_public;
export var use_glo_M1_public_v1_public: { new (): use_glo_M1_public.c1; };
export var use_glo_M1_public_v2_public: use_glo_M1_public;
~~~~~~~~~~~~~~~~~
!!! Cannot find name 'use_glo_M1_public'.
export var use_glo_M1_public_v3_public: () => use_glo_M1_public.c1;
var use_glo_M1_public_v1_private: { new (): use_glo_M1_public.c1; };
var use_glo_M1_public_v2_private: use_glo_M1_public;
~~~~~~~~~~~~~~~~~
!!! Cannot find name 'use_glo_M1_public'.
var use_glo_M1_public_v3_private: () => use_glo_M1_public.c1;
//export declare module "use_glo_M1_public" {
// import use_glo_M1_public = glo_M1_public;
// export var use_glo_M1_public_v1_public: { new (): use_glo_M1_public.c1; };
// export var use_glo_M1_public_v2_public: use_glo_M1_public;
// export var use_glo_M1_public_v3_public: () => use_glo_M1_public.c1;
// var use_glo_M1_public_v1_private: { new (): use_glo_M1_public.c1; };
// var use_glo_M1_public_v2_private: use_glo_M1_public;
// var use_glo_M1_public_v3_private: () => use_glo_M1_public.c1;
import use_glo_M2_public = require("glo_M2_public");
~~~~~~~~~~~~~~~
!!! Cannot find external module 'glo_M2_public'.
export var use_glo_M2_public_v1_public: { new (): use_glo_M2_public.c1; };
export var use_glo_M2_public_v2_public: use_glo_M2_public;
export var use_glo_M2_public_v3_public: () => use_glo_M2_public.c1;
var use_glo_M2_public_v1_private: { new (): use_glo_M2_public.c1; };
var use_glo_M2_public_v2_private: use_glo_M2_public;
var use_glo_M2_public_v3_private: () => use_glo_M2_public.c1;
// import use_glo_M2_public = require("glo_M2_public");
// export var use_glo_M2_public_v1_public: { new (): use_glo_M2_public.c1; };
// export var use_glo_M2_public_v2_public: use_glo_M2_public;
// export var use_glo_M2_public_v3_public: () => use_glo_M2_public.c1;
// var use_glo_M2_public_v1_private: { new (): use_glo_M2_public.c1; };
// var use_glo_M2_public_v2_private: use_glo_M2_public;
// var use_glo_M2_public_v3_private: () => use_glo_M2_public.c1;
module m2 {
import errorImport = require("glo_M2_public");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Import declarations in an internal module cannot reference an external module.
import nonerrorImport = glo_M1_public;
// module m2 {
// import errorImport = require("glo_M2_public");
// import nonerrorImport = glo_M1_public;
module m5 {
import m5_errorImport = require("glo_M2_public");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Import declarations in an internal module cannot reference an external module.
import m5_nonerrorImport = glo_M1_public;
}
}
}
// module m5 {
// import m5_errorImport = require("glo_M2_public");
// import m5_nonerrorImport = glo_M1_public;
// }
// }
//}
declare module "use_glo_M3_private" {
~~~~~~~~~~~~~~~~~~~~
!!! Ambient external modules cannot be nested in other modules.
import use_glo_M3_private = glo_M3_private;
export var use_glo_M3_private_v1_public: { new (): use_glo_M3_private.c1; };
export var use_glo_M3_private_v2_public: use_glo_M3_private;
~~~~~~~~~~~~~~~~~~
!!! Cannot find name 'use_glo_M3_private'.
export var use_glo_M3_private_v3_public: () => use_glo_M3_private.c1;
var use_glo_M3_private_v1_private: { new (): use_glo_M3_private.c1; };
var use_glo_M3_private_v2_private: use_glo_M3_private;
~~~~~~~~~~~~~~~~~~
!!! Cannot find name 'use_glo_M3_private'.
var use_glo_M3_private_v3_private: () => use_glo_M3_private.c1;
//declare module "use_glo_M3_private" {
// import use_glo_M3_private = glo_M3_private;
// export var use_glo_M3_private_v1_public: { new (): use_glo_M3_private.c1; };
// export var use_glo_M3_private_v2_public: use_glo_M3_private;
// export var use_glo_M3_private_v3_public: () => use_glo_M3_private.c1;
// var use_glo_M3_private_v1_private: { new (): use_glo_M3_private.c1; };
// var use_glo_M3_private_v2_private: use_glo_M3_private;
// var use_glo_M3_private_v3_private: () => use_glo_M3_private.c1;
import use_glo_M4_private = require("glo_M4_private");
~~~~~~~~~~~~~~~~
!!! Cannot find external module 'glo_M4_private'.
export var use_glo_M4_private_v1_public: { new (): use_glo_M4_private.c1; };
export var use_glo_M4_private_v2_public: use_glo_M4_private;
export var use_glo_M4_private_v3_public: () => use_glo_M4_private.c1;
var use_glo_M4_private_v1_private: { new (): use_glo_M4_private.c1; };
var use_glo_M4_private_v2_private: use_glo_M4_private;
var use_glo_M4_private_v3_private: () => use_glo_M4_private.c1;
// import use_glo_M4_private = require("glo_M4_private");
// export var use_glo_M4_private_v1_public: { new (): use_glo_M4_private.c1; };
// export var use_glo_M4_private_v2_public: use_glo_M4_private;
// export var use_glo_M4_private_v3_public: () => use_glo_M4_private.c1;
// var use_glo_M4_private_v1_private: { new (): use_glo_M4_private.c1; };
// var use_glo_M4_private_v2_private: use_glo_M4_private;
// var use_glo_M4_private_v3_private: () => use_glo_M4_private.c1;
module m2 {
import errorImport = require("glo_M4_private");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Import declarations in an internal module cannot reference an external module.
import nonerrorImport = glo_M3_private;
// module m2 {
// import errorImport = require("glo_M4_private");
// import nonerrorImport = glo_M3_private;
module m5 {
import m5_errorImport = require("glo_M4_private");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Import declarations in an internal module cannot reference an external module.
import m5_nonerrorImport = glo_M3_private;
}
}
}
// module m5 {
// import m5_errorImport = require("glo_M4_private");
// import m5_nonerrorImport = glo_M3_private;
// }
// }
//}
declare module "anotherParseError" {
~~~~~~~~~~~~~~~~~~~
!!! Ambient external modules cannot be nested in other modules.
module m2 {
declare module "abc" {
~~~~~~~
!!! A 'declare' modifier cannot be used in an already ambient context.
~~~~~
!!! Ambient external modules cannot be nested in other modules.
}
}
//declare module "anotherParseError" {
// module m2 {
// declare module "abc" {
// }
// }
module m2 {
module "abc2" {
~~~~~~
!!! Ambient external modules cannot be nested in other modules.
}
}
module "abc3" {
~~~~~~
!!! Ambient external modules cannot be nested in other modules.
}
}
// module m2 {
// module "abc2" {
// }
// }
// module "abc3" {
// }
//}
declare export module "anotherParseError2" {
~~~~~~
!!! 'export' modifier must precede 'declare' modifier.
~~~~~~~~~~~~~~~~~~~~
!!! Ambient external modules cannot be nested in other modules.
module m2 {
declare module "abc" {
~~~~~~~
!!! A 'declare' modifier cannot be used in an already ambient context.
~~~~~
!!! Ambient external modules cannot be nested in other modules.
}
}
//declare export module "anotherParseError2" {
// module m2 {
// declare module "abc" {
// }
// }
module m2 {
module "abc2" {
~~~~~~
!!! Ambient external modules cannot be nested in other modules.
}
}
module "abc3" {
~~~~~~
!!! Ambient external modules cannot be nested in other modules.
}
}
// module m2 {
// module "abc2" {
// }
// }
// module "abc3" {
// }
//}
module m2 {
import m3 = require("use_glo_M1_public");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Import declarations in an internal module cannot reference an external module.
//import m3 = require("use_glo_M1_public");
module m4 {
var a = 10;
import m2 = require("use_glo_M1_public");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Import declarations in an internal module cannot reference an external module.
//import m2 = require("use_glo_M1_public");
}
}
export module m3 {
import m3 = require("use_glo_M1_public");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Import declarations in an internal module cannot reference an external module.
//import m3 = require("use_glo_M1_public");
module m4 {
var a = 10;
import m2 = require("use_glo_M1_public");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Import declarations in an internal module cannot reference an external module.
//import m2 = require("use_glo_M1_public");
}
}
Loaded 100 of 902 files, more files were not shown because too many files have changed in this diff. Show more