Merge branch 'master' into classifier

This commit is contained in:
Mohamed Hegazy 2014-08-18 14:33:30 -07:00
commit 54d8722189
910 changed files with 25472 additions and 3720 deletions

1
.gitignore vendored
View File

@ -35,3 +35,4 @@ tests/*.d.ts
*.config
scripts/debug.bat
scripts/run.bat
coverage/

File diff suppressed because it is too large Load Diff

View File

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

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

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

View File

@ -1554,11 +1554,11 @@ module ts {
// Note: for ease of implementation we treat productions '2' and '3' as the same thing.
// (i.e. they're both BinaryExpressions with an assignment operator in it).
// First, check if we have production '4' (an arrow function). Note that if we do, we
// must *not* recurse for productsion 1, 2 or 3. An ArrowFunction is not a
// LeftHandSideExpression, nor does it start a ConditionalExpression. So we are done
// First, check if we have an arrow function (production '4') that starts with a parenthesized
// parameter list. If we do, we must *not* recurse for productsion 1, 2 or 3. An ArrowFunction is
// not a LeftHandSideExpression, nor does it start a ConditionalExpression. So we are done
// with AssignmentExpression if we see one.
var arrowExpression = tryParseArrowFunctionExpression();
var arrowExpression = tryParseParenthesizedArrowFunctionExpression();
if (arrowExpression) {
return arrowExpression;
}
@ -1567,6 +1567,13 @@ module ts {
// including a conditional expression.
var expr = parseConditionalExpression(noIn);
// To avoid a look-ahead, we did not handle the case of an arrow function with a single un-parenthesized
// parameter ('x => ...') above. We handle it here by checking if the parsed expression was a single
// identifier and the current token is an arrow.
if (expr.kind === SyntaxKind.Identifier && token === SyntaxKind.EqualsGreaterThanToken) {
return parseSimpleArrowFunctionExpression(<Identifier>expr);
}
// Now see if we might be in cases '2' or '3'.
// If the expression was a LHS expression, and we have an assignment operator, then
// we're in '2' or '3'. Consume the assignment and return.
@ -1613,39 +1620,7 @@ module ts {
return false;
}
function tryParseArrowFunctionExpression(): Expression {
return isSimpleArrowFunctionExpression()
? parseSimpleArrowFunctionExpression()
: tryParseParenthesizedArrowFunctionExpression();
}
function isSimpleArrowFunctionExpression(): boolean {
if (token === SyntaxKind.EqualsGreaterThanToken) {
// ERROR RECOVERY TWEAK:
// If we see a standalone => try to parse it as an arrow function expression as that's
// likely whatthe user intended to write.
return true;
}
if (token === SyntaxKind.Identifier) {
// if we see: a =>
// then this is clearly an arrow function expression.
return lookAhead(() => {
return nextToken() === SyntaxKind.EqualsGreaterThanToken;
});
}
// Definitely not a simple arrow function expression.
return false;
}
function parseSimpleArrowFunctionExpression(): Expression {
Debug.assert(token === SyntaxKind.Identifier || token === SyntaxKind.EqualsGreaterThanToken);
// Get the identifier for the simple arrow. If one isn't there then we'll report a useful
// message that it is missing.
var identifier = parseIdentifier();
function parseSimpleArrowFunctionExpression(identifier: Identifier): Expression {
Debug.assert(token === SyntaxKind.EqualsGreaterThanToken, "parseSimpleArrowFunctionExpression should only have been called if we had a =>");
parseExpected(SyntaxKind.EqualsGreaterThanToken);
@ -1664,8 +1639,6 @@ module ts {
}
function tryParseParenthesizedArrowFunctionExpression(): Expression {
var pos = getNodePos();
// Indicates whether we are certain that we should parse an arrow expression.
var triState = isParenthesizedArrowFunctionExpression();
@ -1673,6 +1646,8 @@ module ts {
return undefined;
}
var pos = getNodePos();
if (triState === Tristate.True) {
var sig = parseSignature(SyntaxKind.CallSignature, SyntaxKind.ColonToken);
@ -1765,7 +1740,12 @@ module ts {
}
});
}
if (token === SyntaxKind.EqualsGreaterThanToken) {
// ERROR RECOVERY TWEAK:
// If we see a standalone => try to parse it as an arrow function expression as that's
// likely whatthe user intended to write.
return Tristate.True;
}
// Definitely not a parenthesized arrow function.
return Tristate.False;
}
@ -3582,7 +3562,7 @@ module ts {
getCompilerHost: () => host,
getDiagnostics: getDiagnostics,
getGlobalDiagnostics: getGlobalDiagnostics,
getTypeChecker: () => createTypeChecker(program),
getTypeChecker: fullTypeCheckMode => createTypeChecker(program, fullTypeCheckMode),
getCommonSourceDirectory: () => commonSourceDirectory,
};
return program;

View File

@ -14,7 +14,7 @@ interface System {
createDirectory(directoryName: string): void;
getExecutingFilePath(): string;
getCurrentDirectory(): string;
getMemoryUsage(): number;
getMemoryUsage?(): number;
exit(exitCode?: number): void;
}
@ -128,9 +128,6 @@ var sys: System = (function () {
getCurrentDirectory() {
return new ActiveXObject("WScript.Shell").CurrentDirectory;
},
getMemoryUsage() {
return 0;
},
exit(exitCode?: number): void {
try {
WScript.Quit(exitCode);
@ -234,7 +231,9 @@ var sys: System = (function () {
return (<any>process).cwd();
},
getMemoryUsage() {
global.gc();
if (global.gc) {
global.gc();
}
return process.memoryUsage().heapUsed;
},
exit(exitCode?: number): void {

View File

@ -38,7 +38,7 @@ module ts {
}
function trySetLanguageAndTerritory(language: string, territory: string, errors: Diagnostic[]): boolean {
var compilerFilePath = sys.getExecutingFilePath();
var compilerFilePath = normalizePath(sys.getExecutingFilePath());
var containingDirectoryPath = getDirectoryPath(compilerFilePath);
var filePath = combinePaths(containingDirectoryPath, language);
@ -62,7 +62,7 @@ module ts {
return false;
}
try {
localizedDiagnosticMessages = JSON.parse(fileContents);
ts.localizedDiagnosticMessages = JSON.parse(fileContents);
}
catch (e) {
errors.push(createCompilerDiagnostic(Diagnostics.Corrupted_locale_file_0, filePath));
@ -326,7 +326,7 @@ module ts {
var reportStart = bindStart;
}
else {
var checker = program.getTypeChecker();
var checker = program.getTypeChecker(/*fullTypeCheckMode*/ true);
var checkStart = new Date().getTime();
var semanticErrors = checker.getDiagnostics();
var emitStart = new Date().getTime();
@ -337,12 +337,16 @@ module ts {
reportDiagnostics(errors);
if (commandLine.options.diagnostics) {
var memoryUsed = sys.getMemoryUsage ? sys.getMemoryUsage() : -1;
reportCountStatistic("Files", program.getSourceFiles().length);
reportCountStatistic("Lines", countLines(program));
reportCountStatistic("Nodes", checker ? checker.getNodeCount() : 0);
reportCountStatistic("Identifiers", checker ? checker.getIdentifierCount() : 0);
reportCountStatistic("Symbols", checker ? checker.getSymbolCount() : 0);
reportCountStatistic("Types", checker ? checker.getTypeCount() : 0);
if (memoryUsed >= 0) {
reportStatisticalValue("Memory used", Math.round(memoryUsed / 1000) + "K");
}
reportTimeStatistic("Parse time", bindStart - parseStart);
reportTimeStatistic("Bind time", checkStart - bindStart);
reportTimeStatistic("Check time", emitStart - checkStart);

View File

@ -539,7 +539,7 @@ module ts {
getCompilerHost(): CompilerHost;
getDiagnostics(sourceFile?: SourceFile): Diagnostic[];
getGlobalDiagnostics(): Diagnostic[];
getTypeChecker(): TypeChecker;
getTypeChecker(fullTypeCheckMode: boolean): TypeChecker;
getCommonSourceDirectory(): string;
}
@ -627,6 +627,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 {
@ -637,8 +639,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 {
@ -658,6 +661,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 {

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;

View File

@ -1904,7 +1904,7 @@ module FourSlash {
var host = Harness.Compiler.createCompilerHost(files, (fn, contents) => result = contents);
var program = ts.createProgram([fourslashFilename, fileName], { out: "fourslashTestOutput.js" }, host);
var checker = ts.createTypeChecker(program);
var checker = ts.createTypeChecker(program, /*fullTypeCheckMode*/ true);
checker.checkProgram();
var errs = checker.getDiagnostics(files[fileName]);

View File

@ -736,7 +736,7 @@ module Harness {
var hadParseErrors = program.getDiagnostics().length > 0;
var checker = program.getTypeChecker();
var checker = program.getTypeChecker(/*fullTypeCheckMode*/ true);
checker.checkProgram();
// only emit if there weren't parse errors
@ -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;

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(/*fullTypeCheck*/ true);
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);
}
}
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);
});
});
}
}
}
}

View File

@ -1256,7 +1256,11 @@ module ts {
var formattingRulesProvider: TypeScript.Services.Formatting.RulesProvider;
var hostCache: HostCache; // A cache of all the information about the files on the host side.
var program: Program;
var typeChecker: TypeChecker;
// this checker is used to answer all LS questions except errors
var typeInfoResolver: TypeChecker;
// the sole purpose of this checkes is to reutrn semantic diagnostics
// creation is deferred - use getFullTypeCheckChecker to get instance
var fullTypeCheckChecker_doNotAccessDirectly: TypeChecker;
var useCaseSensitivefilenames = false;
var sourceFilesByName: Map<SourceFile> = {};
var documentRegistry = documentRegistry;
@ -1272,6 +1276,10 @@ module ts {
return lookUp(sourceFilesByName, filename);
}
function getFullTypeCheckChecker() {
return fullTypeCheckChecker_doNotAccessDirectly || (fullTypeCheckChecker_doNotAccessDirectly = program.getTypeChecker(/*fullTypeCheck*/ true));
}
function createCompilerHost(): CompilerHost {
return {
getSourceFile: (filename, languageVersion) => {
@ -1403,7 +1411,8 @@ module ts {
// Now create a new compiler
program = createProgram(hostfilenames, compilationSettings, createCompilerHost());
typeChecker = program.getTypeChecker();
typeInfoResolver = program.getTypeChecker(/*fullTypeCheckMode*/ false);
fullTypeCheckChecker_doNotAccessDirectly = undefined;
}
/// Clean up any semantic caches that are not needed.
@ -1411,7 +1420,8 @@ module ts {
/// We will just dump the typeChecker and recreate a new one. this should have the effect of destroying all the semantic caches.
function cleanupSemanticCache(): void {
if (program) {
typeChecker = program.getTypeChecker();
typeInfoResolver = program.getTypeChecker(/*fullTypeCheckMode*/ false);
fullTypeCheckChecker_doNotAccessDirectly = undefined;
}
}
@ -1436,7 +1446,7 @@ module ts {
filename = TypeScript.switchToForwardSlashes(filename)
return typeChecker.getDiagnostics(getSourceFile(filename).getSourceFile());
return getFullTypeCheckChecker().getDiagnostics(getSourceFile(filename));
}
function getCompilerOptionsDiagnostics() {
@ -1678,12 +1688,12 @@ module ts {
entries: [],
symbols: {},
location: mappedNode,
typeChecker: typeChecker
typeChecker: typeInfoResolver
};
// Right of dot member completion list
if (isRightOfDot) {
var type: Type = typeChecker.getTypeOfExpression(mappedNode);
var type: Type = typeInfoResolver.getTypeOfExpression(mappedNode);
if (!type) {
return undefined;
}
@ -1731,7 +1741,7 @@ module ts {
isMemberCompletion = false;
/// TODO filter meaning based on the current context
var symbolMeanings = SymbolFlags.Type | SymbolFlags.Value | SymbolFlags.Namespace;
var symbols = typeChecker.getSymbolsInScope(mappedNode, symbolMeanings);
var symbols = typeInfoResolver.getSymbolsInScope(mappedNode, symbolMeanings);
getCompletionEntriesFromSymbols(symbols, activeCompletionSession);
}
@ -1770,7 +1780,7 @@ module ts {
kind: completionEntry.kind,
kindModifiers: completionEntry.kindModifiers,
type: session.typeChecker.typeToString(type, session.location),
fullSymbolName: typeChecker.symbolToString(symbol, session.location),
fullSymbolName: typeInfoResolver.symbolToString(symbol, session.location),
docComment: ""
};
}
@ -1882,13 +1892,13 @@ module ts {
var node = getNodeAtPosition(sourceFile.getSourceFile(), position);
if (!node) return undefined;
var symbol = typeChecker.getSymbolInfo(node);
var type = symbol && typeChecker.getTypeOfSymbol(symbol);
var symbol = typeInfoResolver.getSymbolInfo(node);
var type = symbol && typeInfoResolver.getTypeOfSymbol(symbol);
if (type) {
return {
memberName: new TypeScript.MemberNameString(typeChecker.typeToString(type)),
memberName: new TypeScript.MemberNameString(typeInfoResolver.typeToString(type)),
docComment: "",
fullSymbolName: typeChecker.symbolToString(symbol, getContainerNode(node)),
fullSymbolName: typeInfoResolver.symbolToString(symbol, getContainerNode(node)),
kind: getSymbolKind(symbol),
minChar: node.pos,
limChar: node.end
@ -2034,7 +2044,7 @@ module ts {
return undefined;
}
var symbol = typeChecker.getSymbolInfo(node);
var symbol = typeInfoResolver.getSymbolInfo(node);
// Could not find a symbol e.g. node is string or number keyword,
// or the symbol was an internal symbol and does not have a declaration e.g. undefined symbol
@ -2045,10 +2055,10 @@ module ts {
var result: DefinitionInfo[] = [];
var declarations = symbol.getDeclarations();
var symbolName = typeChecker.symbolToString(symbol, node);
var symbolName = typeInfoResolver.symbolToString(symbol, node);
var symbolKind = getSymbolKind(symbol);
var containerSymbol = symbol.parent;
var containerName = containerSymbol ? typeChecker.symbolToString(containerSymbol, node) : "";
var containerName = containerSymbol ? typeInfoResolver.symbolToString(containerSymbol, node) : "";
var containerKind = containerSymbol ? getSymbolKind(symbol) : "";
if (!tryAddConstructSignature(symbol, node, symbolKind, symbolName, containerName, result) &&

View File

@ -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'.
}

View File

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

View File

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

View File

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

View File

@ -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;

View File

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

View File

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

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

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

View File

@ -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;

View File

@ -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;

View File

@ -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'.
}

View File

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

View File

@ -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;

View File

@ -58,6 +58,8 @@ var A;
//// [declFileWithExtendsClauseThatHasItsContainerNameConflict.d.ts]
declare module A.B.C {
class B {
}
}
declare module A.B {
class EventManager {

View File

@ -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'.
}
}

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'.
}
}

View File

@ -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;

View File

@ -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;

View File

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

View File

@ -1,5 +1,4 @@
//// [declarationEmit_nameConflictsWithAlias.ts]
// Bug 887180
export module C { export interface I { } }
export import v = C;
export module M {

View File

@ -14,4 +14,9 @@ declare module mAmbient {
//// [enumDecl1.d.ts]
declare module mAmbient {
enum e {
x,
y,
z,
}
}

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;

View File

@ -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;

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;

View File

@ -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;

View File

@ -10,4 +10,4 @@ function somefn() {
//// [functionReturningItself.d.ts]
declare function somefn(): () => typeof somefn;
declare function somefn(): typeof somefn;

View File

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

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;

View File

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

View File

@ -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'.
}

View File

@ -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'.
}
}

View File

@ -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'.

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'.
}

View File

@ -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'.
}

View File

@ -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'.

View File

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

View File

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

View File

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

View File

@ -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;

View File

@ -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;

View File

@ -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'.
}

View File

@ -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'.
}

View File

@ -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'.

View File

@ -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'.
}

View File

@ -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'.
}

View File

@ -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'.

View File

@ -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'.
}

View File

@ -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'.
}

View File

@ -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'.

View File

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

View File

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

View File

@ -14,4 +14,10 @@ declare module outer {
//// [moduleOuterQualification.d.ts]
declare module outer {
interface Beta {
}
module inner {
interface Beta extends outer.Beta {
}
}
}

View File

@ -0,0 +1,42 @@
//// [tests/cases/compiler/moduleSymbolMerging.ts] ////
//// [A.ts]
module A { export interface I {} }
//// [B.ts]
///<reference path="A.ts" />
module A { ; }
module B {
export function f(): A.I { return null; }
}
//// [A.js]
//// [B.js]
var A;
(function (A) {
;
})(A || (A = {}));
var B;
(function (B) {
function f() {
return null;
}
B.f = f;
})(B || (B = {}));
//// [A.d.ts]
declare module A {
interface I {
}
}
//// [B.d.ts]
/// <reference path='A.d.ts' />
declare module A {
}
declare module B {
function f(): A.I;
}

View File

@ -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.

View File

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

View File

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

View File

@ -0,0 +1,410 @@
//// [tests/cases/compiler/privacyCannotNameAccessorDeclFile.ts] ////
//// [privacyCannotNameAccessorDeclFile_GlobalWidgets.ts]
declare module "GlobalWidgets" {
export class Widget3 {
name: string;
}
export function createWidget3(): Widget3;
export module SpecializedGlobalWidget {
export class Widget4 {
name: string;
}
function createWidget4(): Widget4;
}
}
//// [privacyCannotNameAccessorDeclFile_Widgets.ts]
export class Widget1 {
name = 'one';
}
export function createWidget1() {
return new Widget1();
}
export module SpecializedWidget {
export class Widget2 {
name = 'one';
}
export function createWidget2() {
return new Widget2();
}
}
//// [privacyCannotNameAccessorDeclFile_exporter.ts]
///<reference path='privacyCannotNameAccessorDeclFile_GlobalWidgets.ts'/>
import Widgets = require("privacyCannotNameAccessorDeclFile_Widgets");
import Widgets1 = require("GlobalWidgets");
export function createExportedWidget1() {
return Widgets.createWidget1();
}
export function createExportedWidget2() {
return Widgets.SpecializedWidget.createWidget2();
}
export function createExportedWidget3() {
return Widgets1.createWidget3();
}
export function createExportedWidget4() {
return Widgets1.SpecializedGlobalWidget.createWidget4();
}
//// [privacyCannotNameAccessorDeclFile_consumer.ts]
import exporter = require("privacyCannotNameAccessorDeclFile_exporter");
export class publicClassWithWithPrivateGetAccessorTypes {
static get myPublicStaticMethod() { // Error
return exporter.createExportedWidget1();
}
private static get myPrivateStaticMethod() {
return exporter.createExportedWidget1();
}
get myPublicMethod() { // Error
return exporter.createExportedWidget1();
}
private get myPrivateMethod() {
return exporter.createExportedWidget1();
}
static get myPublicStaticMethod1() { // Error
return exporter.createExportedWidget3();
}
private static get myPrivateStaticMethod1() {
return exporter.createExportedWidget3();
}
get myPublicMethod1() { // Error
return exporter.createExportedWidget3();
}
private get myPrivateMethod1() {
return exporter.createExportedWidget3();
}
}
class privateClassWithWithPrivateGetAccessorTypes {
static get myPublicStaticMethod() {
return exporter.createExportedWidget1();
}
private static get myPrivateStaticMethod() {
return exporter.createExportedWidget1();
}
get myPublicMethod() {
return exporter.createExportedWidget1();
}
private get myPrivateMethod() {
return exporter.createExportedWidget1();
}
static get myPublicStaticMethod1() {
return exporter.createExportedWidget3();
}
private static get myPrivateStaticMethod1() {
return exporter.createExportedWidget3();
}
get myPublicMethod1() {
return exporter.createExportedWidget3();
}
private get myPrivateMethod1() {
return exporter.createExportedWidget3();
}
}
export class publicClassWithPrivateModuleGetAccessorTypes {
static get myPublicStaticMethod() { // Error
return exporter.createExportedWidget2();
}
get myPublicMethod() { // Error
return exporter.createExportedWidget2();
}
static get myPublicStaticMethod1() { // Error
return exporter.createExportedWidget4();
}
get myPublicMethod1() { // Error
return exporter.createExportedWidget4();
}
}
class privateClassWithPrivateModuleGetAccessorTypes {
static get myPublicStaticMethod() {
return exporter.createExportedWidget2();
}
get myPublicMethod() {
return exporter.createExportedWidget2();
}
static get myPublicStaticMethod1() {
return exporter.createExportedWidget4();
}
get myPublicMethod1() {
return exporter.createExportedWidget4();
}
}
//// [privacyCannotNameAccessorDeclFile_GlobalWidgets.js]
//// [privacyCannotNameAccessorDeclFile_Widgets.js]
var Widget1 = (function () {
function Widget1() {
this.name = 'one';
}
return Widget1;
})();
exports.Widget1 = Widget1;
function createWidget1() {
return new Widget1();
}
exports.createWidget1 = createWidget1;
(function (SpecializedWidget) {
var Widget2 = (function () {
function Widget2() {
this.name = 'one';
}
return Widget2;
})();
SpecializedWidget.Widget2 = Widget2;
function createWidget2() {
return new Widget2();
}
SpecializedWidget.createWidget2 = createWidget2;
})(exports.SpecializedWidget || (exports.SpecializedWidget = {}));
var SpecializedWidget = exports.SpecializedWidget;
//// [privacyCannotNameAccessorDeclFile_exporter.js]
var Widgets = require("privacyCannotNameAccessorDeclFile_Widgets");
var Widgets1 = require("GlobalWidgets");
function createExportedWidget1() {
return Widgets.createWidget1();
}
exports.createExportedWidget1 = createExportedWidget1;
function createExportedWidget2() {
return Widgets.SpecializedWidget.createWidget2();
}
exports.createExportedWidget2 = createExportedWidget2;
function createExportedWidget3() {
return Widgets1.createWidget3();
}
exports.createExportedWidget3 = createExportedWidget3;
function createExportedWidget4() {
return Widgets1.SpecializedGlobalWidget.createWidget4();
}
exports.createExportedWidget4 = createExportedWidget4;
//// [privacyCannotNameAccessorDeclFile_consumer.js]
var exporter = require("privacyCannotNameAccessorDeclFile_exporter");
var publicClassWithWithPrivateGetAccessorTypes = (function () {
function publicClassWithWithPrivateGetAccessorTypes() {
}
Object.defineProperty(publicClassWithWithPrivateGetAccessorTypes, "myPublicStaticMethod", {
get: function () {
return exporter.createExportedWidget1();
},
enumerable: true,
configurable: true
});
Object.defineProperty(publicClassWithWithPrivateGetAccessorTypes, "myPrivateStaticMethod", {
get: function () {
return exporter.createExportedWidget1();
},
enumerable: true,
configurable: true
});
Object.defineProperty(publicClassWithWithPrivateGetAccessorTypes.prototype, "myPublicMethod", {
get: function () {
return exporter.createExportedWidget1();
},
enumerable: true,
configurable: true
});
Object.defineProperty(publicClassWithWithPrivateGetAccessorTypes.prototype, "myPrivateMethod", {
get: function () {
return exporter.createExportedWidget1();
},
enumerable: true,
configurable: true
});
Object.defineProperty(publicClassWithWithPrivateGetAccessorTypes, "myPublicStaticMethod1", {
get: function () {
return exporter.createExportedWidget3();
},
enumerable: true,
configurable: true
});
Object.defineProperty(publicClassWithWithPrivateGetAccessorTypes, "myPrivateStaticMethod1", {
get: function () {
return exporter.createExportedWidget3();
},
enumerable: true,
configurable: true
});
Object.defineProperty(publicClassWithWithPrivateGetAccessorTypes.prototype, "myPublicMethod1", {
get: function () {
return exporter.createExportedWidget3();
},
enumerable: true,
configurable: true
});
Object.defineProperty(publicClassWithWithPrivateGetAccessorTypes.prototype, "myPrivateMethod1", {
get: function () {
return exporter.createExportedWidget3();
},
enumerable: true,
configurable: true
});
return publicClassWithWithPrivateGetAccessorTypes;
})();
exports.publicClassWithWithPrivateGetAccessorTypes = publicClassWithWithPrivateGetAccessorTypes;
var privateClassWithWithPrivateGetAccessorTypes = (function () {
function privateClassWithWithPrivateGetAccessorTypes() {
}
Object.defineProperty(privateClassWithWithPrivateGetAccessorTypes, "myPublicStaticMethod", {
get: function () {
return exporter.createExportedWidget1();
},
enumerable: true,
configurable: true
});
Object.defineProperty(privateClassWithWithPrivateGetAccessorTypes, "myPrivateStaticMethod", {
get: function () {
return exporter.createExportedWidget1();
},
enumerable: true,
configurable: true
});
Object.defineProperty(privateClassWithWithPrivateGetAccessorTypes.prototype, "myPublicMethod", {
get: function () {
return exporter.createExportedWidget1();
},
enumerable: true,
configurable: true
});
Object.defineProperty(privateClassWithWithPrivateGetAccessorTypes.prototype, "myPrivateMethod", {
get: function () {
return exporter.createExportedWidget1();
},
enumerable: true,
configurable: true
});
Object.defineProperty(privateClassWithWithPrivateGetAccessorTypes, "myPublicStaticMethod1", {
get: function () {
return exporter.createExportedWidget3();
},
enumerable: true,
configurable: true
});
Object.defineProperty(privateClassWithWithPrivateGetAccessorTypes, "myPrivateStaticMethod1", {
get: function () {
return exporter.createExportedWidget3();
},
enumerable: true,
configurable: true
});
Object.defineProperty(privateClassWithWithPrivateGetAccessorTypes.prototype, "myPublicMethod1", {
get: function () {
return exporter.createExportedWidget3();
},
enumerable: true,
configurable: true
});
Object.defineProperty(privateClassWithWithPrivateGetAccessorTypes.prototype, "myPrivateMethod1", {
get: function () {
return exporter.createExportedWidget3();
},
enumerable: true,
configurable: true
});
return privateClassWithWithPrivateGetAccessorTypes;
})();
var publicClassWithPrivateModuleGetAccessorTypes = (function () {
function publicClassWithPrivateModuleGetAccessorTypes() {
}
Object.defineProperty(publicClassWithPrivateModuleGetAccessorTypes, "myPublicStaticMethod", {
get: function () {
return exporter.createExportedWidget2();
},
enumerable: true,
configurable: true
});
Object.defineProperty(publicClassWithPrivateModuleGetAccessorTypes.prototype, "myPublicMethod", {
get: function () {
return exporter.createExportedWidget2();
},
enumerable: true,
configurable: true
});
Object.defineProperty(publicClassWithPrivateModuleGetAccessorTypes, "myPublicStaticMethod1", {
get: function () {
return exporter.createExportedWidget4();
},
enumerable: true,
configurable: true
});
Object.defineProperty(publicClassWithPrivateModuleGetAccessorTypes.prototype, "myPublicMethod1", {
get: function () {
return exporter.createExportedWidget4();
},
enumerable: true,
configurable: true
});
return publicClassWithPrivateModuleGetAccessorTypes;
})();
exports.publicClassWithPrivateModuleGetAccessorTypes = publicClassWithPrivateModuleGetAccessorTypes;
var privateClassWithPrivateModuleGetAccessorTypes = (function () {
function privateClassWithPrivateModuleGetAccessorTypes() {
}
Object.defineProperty(privateClassWithPrivateModuleGetAccessorTypes, "myPublicStaticMethod", {
get: function () {
return exporter.createExportedWidget2();
},
enumerable: true,
configurable: true
});
Object.defineProperty(privateClassWithPrivateModuleGetAccessorTypes.prototype, "myPublicMethod", {
get: function () {
return exporter.createExportedWidget2();
},
enumerable: true,
configurable: true
});
Object.defineProperty(privateClassWithPrivateModuleGetAccessorTypes, "myPublicStaticMethod1", {
get: function () {
return exporter.createExportedWidget4();
},
enumerable: true,
configurable: true
});
Object.defineProperty(privateClassWithPrivateModuleGetAccessorTypes.prototype, "myPublicMethod1", {
get: function () {
return exporter.createExportedWidget4();
},
enumerable: true,
configurable: true
});
return privateClassWithPrivateModuleGetAccessorTypes;
})();
//// [privacyCannotNameAccessorDeclFile_GlobalWidgets.d.ts]
declare module "GlobalWidgets" {
class Widget3 {
name: string;
}
function createWidget3(): Widget3;
module SpecializedGlobalWidget {
class Widget4 {
name: string;
}
function createWidget4(): Widget4;
}
}
//// [privacyCannotNameAccessorDeclFile_Widgets.d.ts]
export declare class Widget1 {
name: string;
}
export declare function createWidget1(): Widget1;
export declare module SpecializedWidget {
class Widget2 {
name: string;
}
function createWidget2(): Widget2;
}
//// [privacyCannotNameAccessorDeclFile_exporter.d.ts]
/// <reference path='privacyCannotNameAccessorDeclFile_GlobalWidgets.d.ts' />
import Widgets = require("privacyCannotNameAccessorDeclFile_Widgets");
import Widgets1 = require("GlobalWidgets");
export declare function createExportedWidget1(): Widgets.Widget1;
export declare function createExportedWidget2(): Widgets.SpecializedWidget.Widget2;
export declare function createExportedWidget3(): Widgets1.Widget3;
export declare function createExportedWidget4(): Widgets1.SpecializedGlobalWidget.Widget4;

View File

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

View File

@ -0,0 +1,238 @@
//// [tests/cases/compiler/privacyCannotNameVarTypeDeclFile.ts] ////
//// [privacyCannotNameVarTypeDeclFile_GlobalWidgets.ts]
declare module "GlobalWidgets" {
export class Widget3 {
name: string;
}
export function createWidget3(): Widget3;
export module SpecializedGlobalWidget {
export class Widget4 {
name: string;
}
function createWidget4(): Widget4;
}
}
//// [privacyCannotNameVarTypeDeclFile_Widgets.ts]
export class Widget1 {
name = 'one';
}
export function createWidget1() {
return new Widget1();
}
export module SpecializedWidget {
export class Widget2 {
name = 'one';
}
export function createWidget2() {
return new Widget2();
}
}
//// [privacyCannotNameVarTypeDeclFile_exporter.ts]
///<reference path='privacyCannotNameVarTypeDeclFile_GlobalWidgets.ts'/>
import Widgets = require("privacyCannotNameVarTypeDeclFile_Widgets");
import Widgets1 = require("GlobalWidgets");
export function createExportedWidget1() {
return Widgets.createWidget1();
}
export function createExportedWidget2() {
return Widgets.SpecializedWidget.createWidget2();
}
export function createExportedWidget3() {
return Widgets1.createWidget3();
}
export function createExportedWidget4() {
return Widgets1.SpecializedGlobalWidget.createWidget4();
}
//// [privacyCannotNameVarTypeDeclFile_consumer.ts]
import exporter = require("privacyCannotNameVarTypeDeclFile_exporter");
export class publicClassWithWithPrivatePropertyTypes {
static myPublicStaticProperty = exporter.createExportedWidget1(); // Error
private static myPrivateStaticProperty = exporter.createExportedWidget1();
myPublicProperty = exporter.createExportedWidget1(); // Error
private myPrivateProperty = exporter.createExportedWidget1();
static myPublicStaticProperty1 = exporter.createExportedWidget3(); // Error
private static myPrivateStaticProperty1 = exporter.createExportedWidget3();
myPublicProperty1 = exporter.createExportedWidget3(); // Error
private myPrivateProperty1 = exporter.createExportedWidget3();
}
class privateClassWithWithPrivatePropertyTypes {
static myPublicStaticProperty = exporter.createExportedWidget1();
private static myPrivateStaticProperty = exporter.createExportedWidget1();
myPublicProperty = exporter.createExportedWidget1();
private myPrivateProperty = exporter.createExportedWidget1();
static myPublicStaticProperty1 = exporter.createExportedWidget3();
private static myPrivateStaticProperty1 = exporter.createExportedWidget3();
myPublicProperty1 = exporter.createExportedWidget3();
private myPrivateProperty1 = exporter.createExportedWidget3();
}
export var publicVarWithPrivatePropertyTypes= exporter.createExportedWidget1(); // Error
var privateVarWithPrivatePropertyTypes= exporter.createExportedWidget1();
export var publicVarWithPrivatePropertyTypes1 = exporter.createExportedWidget3(); // Error
var privateVarWithPrivatePropertyTypes1 = exporter.createExportedWidget3();
export class publicClassWithPrivateModulePropertyTypes {
static myPublicStaticProperty= exporter.createExportedWidget2(); // Error
myPublicProperty = exporter.createExportedWidget2(); // Error
static myPublicStaticProperty1 = exporter.createExportedWidget4(); // Error
myPublicProperty1 = exporter.createExportedWidget4(); // Error
}
export var publicVarWithPrivateModulePropertyTypes= exporter.createExportedWidget2(); // Error
export var publicVarWithPrivateModulePropertyTypes1 = exporter.createExportedWidget4(); // Error
class privateClassWithPrivateModulePropertyTypes {
static myPublicStaticProperty= exporter.createExportedWidget2();
myPublicProperty= exporter.createExportedWidget2();
static myPublicStaticProperty1 = exporter.createExportedWidget4();
myPublicProperty1 = exporter.createExportedWidget4();
}
var privateVarWithPrivateModulePropertyTypes= exporter.createExportedWidget2();
var privateVarWithPrivateModulePropertyTypes1 = exporter.createExportedWidget4();
//// [privacyCannotNameVarTypeDeclFile_GlobalWidgets.js]
//// [privacyCannotNameVarTypeDeclFile_Widgets.js]
var Widget1 = (function () {
function Widget1() {
this.name = 'one';
}
return Widget1;
})();
exports.Widget1 = Widget1;
function createWidget1() {
return new Widget1();
}
exports.createWidget1 = createWidget1;
(function (SpecializedWidget) {
var Widget2 = (function () {
function Widget2() {
this.name = 'one';
}
return Widget2;
})();
SpecializedWidget.Widget2 = Widget2;
function createWidget2() {
return new Widget2();
}
SpecializedWidget.createWidget2 = createWidget2;
})(exports.SpecializedWidget || (exports.SpecializedWidget = {}));
var SpecializedWidget = exports.SpecializedWidget;
//// [privacyCannotNameVarTypeDeclFile_exporter.js]
var Widgets = require("privacyCannotNameVarTypeDeclFile_Widgets");
var Widgets1 = require("GlobalWidgets");
function createExportedWidget1() {
return Widgets.createWidget1();
}
exports.createExportedWidget1 = createExportedWidget1;
function createExportedWidget2() {
return Widgets.SpecializedWidget.createWidget2();
}
exports.createExportedWidget2 = createExportedWidget2;
function createExportedWidget3() {
return Widgets1.createWidget3();
}
exports.createExportedWidget3 = createExportedWidget3;
function createExportedWidget4() {
return Widgets1.SpecializedGlobalWidget.createWidget4();
}
exports.createExportedWidget4 = createExportedWidget4;
//// [privacyCannotNameVarTypeDeclFile_consumer.js]
var exporter = require("privacyCannotNameVarTypeDeclFile_exporter");
var publicClassWithWithPrivatePropertyTypes = (function () {
function publicClassWithWithPrivatePropertyTypes() {
this.myPublicProperty = exporter.createExportedWidget1();
this.myPrivateProperty = exporter.createExportedWidget1();
this.myPublicProperty1 = exporter.createExportedWidget3();
this.myPrivateProperty1 = exporter.createExportedWidget3();
}
publicClassWithWithPrivatePropertyTypes.myPublicStaticProperty = exporter.createExportedWidget1();
publicClassWithWithPrivatePropertyTypes.myPrivateStaticProperty = exporter.createExportedWidget1();
publicClassWithWithPrivatePropertyTypes.myPublicStaticProperty1 = exporter.createExportedWidget3();
publicClassWithWithPrivatePropertyTypes.myPrivateStaticProperty1 = exporter.createExportedWidget3();
return publicClassWithWithPrivatePropertyTypes;
})();
exports.publicClassWithWithPrivatePropertyTypes = publicClassWithWithPrivatePropertyTypes;
var privateClassWithWithPrivatePropertyTypes = (function () {
function privateClassWithWithPrivatePropertyTypes() {
this.myPublicProperty = exporter.createExportedWidget1();
this.myPrivateProperty = exporter.createExportedWidget1();
this.myPublicProperty1 = exporter.createExportedWidget3();
this.myPrivateProperty1 = exporter.createExportedWidget3();
}
privateClassWithWithPrivatePropertyTypes.myPublicStaticProperty = exporter.createExportedWidget1();
privateClassWithWithPrivatePropertyTypes.myPrivateStaticProperty = exporter.createExportedWidget1();
privateClassWithWithPrivatePropertyTypes.myPublicStaticProperty1 = exporter.createExportedWidget3();
privateClassWithWithPrivatePropertyTypes.myPrivateStaticProperty1 = exporter.createExportedWidget3();
return privateClassWithWithPrivatePropertyTypes;
})();
exports.publicVarWithPrivatePropertyTypes = exporter.createExportedWidget1();
var privateVarWithPrivatePropertyTypes = exporter.createExportedWidget1();
exports.publicVarWithPrivatePropertyTypes1 = exporter.createExportedWidget3();
var privateVarWithPrivatePropertyTypes1 = exporter.createExportedWidget3();
var publicClassWithPrivateModulePropertyTypes = (function () {
function publicClassWithPrivateModulePropertyTypes() {
this.myPublicProperty = exporter.createExportedWidget2();
this.myPublicProperty1 = exporter.createExportedWidget4();
}
publicClassWithPrivateModulePropertyTypes.myPublicStaticProperty = exporter.createExportedWidget2();
publicClassWithPrivateModulePropertyTypes.myPublicStaticProperty1 = exporter.createExportedWidget4();
return publicClassWithPrivateModulePropertyTypes;
})();
exports.publicClassWithPrivateModulePropertyTypes = publicClassWithPrivateModulePropertyTypes;
exports.publicVarWithPrivateModulePropertyTypes = exporter.createExportedWidget2();
exports.publicVarWithPrivateModulePropertyTypes1 = exporter.createExportedWidget4();
var privateClassWithPrivateModulePropertyTypes = (function () {
function privateClassWithPrivateModulePropertyTypes() {
this.myPublicProperty = exporter.createExportedWidget2();
this.myPublicProperty1 = exporter.createExportedWidget4();
}
privateClassWithPrivateModulePropertyTypes.myPublicStaticProperty = exporter.createExportedWidget2();
privateClassWithPrivateModulePropertyTypes.myPublicStaticProperty1 = exporter.createExportedWidget4();
return privateClassWithPrivateModulePropertyTypes;
})();
var privateVarWithPrivateModulePropertyTypes = exporter.createExportedWidget2();
var privateVarWithPrivateModulePropertyTypes1 = exporter.createExportedWidget4();
//// [privacyCannotNameVarTypeDeclFile_GlobalWidgets.d.ts]
declare module "GlobalWidgets" {
class Widget3 {
name: string;
}
function createWidget3(): Widget3;
module SpecializedGlobalWidget {
class Widget4 {
name: string;
}
function createWidget4(): Widget4;
}
}
//// [privacyCannotNameVarTypeDeclFile_Widgets.d.ts]
export declare class Widget1 {
name: string;
}
export declare function createWidget1(): Widget1;
export declare module SpecializedWidget {
class Widget2 {
name: string;
}
function createWidget2(): Widget2;
}
//// [privacyCannotNameVarTypeDeclFile_exporter.d.ts]
/// <reference path='privacyCannotNameVarTypeDeclFile_GlobalWidgets.d.ts' />
import Widgets = require("privacyCannotNameVarTypeDeclFile_Widgets");
import Widgets1 = require("GlobalWidgets");
export declare function createExportedWidget1(): Widgets.Widget1;
export declare function createExportedWidget2(): Widgets.SpecializedWidget.Widget2;
export declare function createExportedWidget3(): Widgets1.Widget3;
export declare function createExportedWidget4(): Widgets1.SpecializedGlobalWidget.Widget4;

View File

@ -30,3 +30,7 @@ var Query;
});
}
})(Query || (Query = {}));
//// [privacyCheckAnonymousFunctionParameter.d.ts]
export declare var x: number;

View File

@ -31,3 +31,7 @@ define(["require", "exports"], function (require, exports) {
}
})(Q || (Q = {}));
});
//// [privacyCheckAnonymousFunctionParameter2.d.ts]
export declare var x: number;

View File

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

View File

@ -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;

View File

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

View File

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

View File

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

View File

@ -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'.

View File

@ -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;

View File

@ -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'.
}

View File

@ -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'.
}

View File

@ -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'.
}

View File

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

View File

@ -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;

View File

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

View File

@ -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;

View File

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

View File

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

Some files were not shown because too many files have changed in this diff Show More