Merge remote-tracking branch 'upstream/master' into jsxAndAs

Conflicts:
	src/compiler/checker.ts
	src/compiler/diagnosticInformationMap.generated.ts
	src/compiler/diagnosticMessages.json
	src/services/services.ts
This commit is contained in:
Ryan Cavanaugh
2015-06-29 09:23:44 -07:00
229 changed files with 4422 additions and 1605 deletions
+1 -1
View File
@@ -103,7 +103,7 @@ var serverSources = [
"server.ts"
].map(function (f) {
return path.join(serverDirectory, f);
});
}).concat(servicesSources);
var languageServiceLibrarySources = [
"editorServices.ts",
+4
View File
@@ -1880,6 +1880,7 @@ interface Map<K, V> {
}
interface MapConstructor {
new (): Map<any, any>;
new <K, V>(): Map<K, V>;
new <K, V>(iterable: Iterable<[K, V]>): Map<K, V>;
prototype: Map<any, any>;
@@ -1896,6 +1897,7 @@ interface WeakMap<K, V> {
}
interface WeakMapConstructor {
new (): WeakMap<any, any>;
new <K, V>(): WeakMap<K, V>;
new <K, V>(iterable: Iterable<[K, V]>): WeakMap<K, V>;
prototype: WeakMap<any, any>;
@@ -1917,6 +1919,7 @@ interface Set<T> {
}
interface SetConstructor {
new (): Set<any>;
new <T>(): Set<T>;
new <T>(iterable: Iterable<T>): Set<T>;
prototype: Set<any>;
@@ -1932,6 +1935,7 @@ interface WeakSet<T> {
}
interface WeakSetConstructor {
new (): WeakSet<any>;
new <T>(): WeakSet<T>;
new <T>(iterable: Iterable<T>): WeakSet<T>;
prototype: WeakSet<any>;
+4
View File
@@ -1880,6 +1880,7 @@ interface Map<K, V> {
}
interface MapConstructor {
new (): Map<any, any>;
new <K, V>(): Map<K, V>;
new <K, V>(iterable: Iterable<[K, V]>): Map<K, V>;
prototype: Map<any, any>;
@@ -1896,6 +1897,7 @@ interface WeakMap<K, V> {
}
interface WeakMapConstructor {
new (): WeakMap<any, any>;
new <K, V>(): WeakMap<K, V>;
new <K, V>(iterable: Iterable<[K, V]>): WeakMap<K, V>;
prototype: WeakMap<any, any>;
@@ -1917,6 +1919,7 @@ interface Set<T> {
}
interface SetConstructor {
new (): Set<any>;
new <T>(): Set<T>;
new <T>(iterable: Iterable<T>): Set<T>;
prototype: Set<any>;
@@ -1932,6 +1935,7 @@ interface WeakSet<T> {
}
interface WeakSetConstructor {
new (): WeakSet<any>;
new <T>(): WeakSet<T>;
new <T>(iterable: Iterable<T>): WeakSet<T>;
prototype: WeakSet<any>;
+379 -159
View File
File diff suppressed because it is too large Load Diff
+426 -159
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -600,7 +600,7 @@ declare module "typescript" {
tag: LeftHandSideExpression;
template: LiteralExpression | TemplateExpression;
}
type CallLikeExpression = CallExpression | NewExpression | TaggedTemplateExpression;
type CallLikeExpression = CallExpression | NewExpression | TaggedTemplateExpression | Decorator;
interface TypeAssertion extends UnaryExpression {
type: TypeNode;
expression: UnaryExpression;
+567 -170
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -600,7 +600,7 @@ declare namespace ts {
tag: LeftHandSideExpression;
template: LiteralExpression | TemplateExpression;
}
type CallLikeExpression = CallExpression | NewExpression | TaggedTemplateExpression;
type CallLikeExpression = CallExpression | NewExpression | TaggedTemplateExpression | Decorator;
interface TypeAssertion extends UnaryExpression {
type: TypeNode;
expression: UnaryExpression;
+567 -170
View File
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -630,7 +630,7 @@ namespace ts {
function getStrictModeIdentifierMessage(node: Node) {
// Provide specialized messages to help the user understand why we think they're in
// strict mode.
if (getAncestor(node, SyntaxKind.ClassDeclaration) || getAncestor(node, SyntaxKind.ClassExpression)) {
if (getContainingClass(node)) {
return Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode;
}
@@ -688,7 +688,7 @@ namespace ts {
function getStrictModeEvalOrArgumentsMessage(node: Node) {
// Provide specialized messages to help the user understand why we think they're in
// strict mode.
if (getAncestor(node, SyntaxKind.ClassDeclaration) || getAncestor(node, SyntaxKind.ClassExpression)) {
if (getContainingClass(node)) {
return Diagnostics.Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode;
}
@@ -1031,7 +1031,7 @@ namespace ts {
// containing class.
if (node.flags & NodeFlags.AccessibilityModifier &&
node.parent.kind === SyntaxKind.Constructor &&
(node.parent.parent.kind === SyntaxKind.ClassDeclaration || node.parent.parent.kind === SyntaxKind.ClassExpression)) {
isClassLike(node.parent.parent)) {
let classDeclaration = <ClassLikeDeclaration>node.parent.parent;
declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, SymbolFlags.Property, SymbolFlags.PropertyExcludes);
+570 -157
View File
File diff suppressed because it is too large Load Diff
-1
View File
@@ -40,7 +40,6 @@ namespace ts {
function emitDeclarations(host: EmitHost, resolver: EmitResolver, diagnostics: Diagnostic[], jsFilePath: string, root?: SourceFile): DeclarationEmit {
let newLine = host.getNewLine();
let compilerOptions = host.getCompilerOptions();
let languageVersion = compilerOptions.target || ScriptTarget.ES3;
let write: (s: string) => void;
let writeLine: () => void;
@@ -20,22 +20,16 @@ namespace ts {
An_index_signature_must_have_a_type_annotation: { code: 1021, category: DiagnosticCategory.Error, key: "An index signature must have a type annotation." },
An_index_signature_parameter_must_have_a_type_annotation: { code: 1022, category: DiagnosticCategory.Error, key: "An index signature parameter must have a type annotation." },
An_index_signature_parameter_type_must_be_string_or_number: { code: 1023, category: DiagnosticCategory.Error, key: "An index signature parameter type must be 'string' or 'number'." },
A_class_or_interface_declaration_can_only_have_one_extends_clause: { code: 1024, category: DiagnosticCategory.Error, key: "A class or interface declaration can only have one 'extends' clause." },
An_extends_clause_must_precede_an_implements_clause: { code: 1025, category: DiagnosticCategory.Error, key: "An 'extends' clause must precede an 'implements' clause." },
A_class_can_only_extend_a_single_class: { code: 1026, category: DiagnosticCategory.Error, key: "A class can only extend a single class." },
A_class_declaration_can_only_have_one_implements_clause: { code: 1027, category: DiagnosticCategory.Error, key: "A class declaration can only have one 'implements' clause." },
Accessibility_modifier_already_seen: { code: 1028, category: DiagnosticCategory.Error, key: "Accessibility modifier already seen." },
_0_modifier_must_precede_1_modifier: { code: 1029, category: DiagnosticCategory.Error, key: "'{0}' modifier must precede '{1}' modifier." },
_0_modifier_already_seen: { code: 1030, category: DiagnosticCategory.Error, key: "'{0}' modifier already seen." },
_0_modifier_cannot_appear_on_a_class_element: { code: 1031, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot appear on a class element." },
An_interface_declaration_cannot_have_an_implements_clause: { code: 1032, category: DiagnosticCategory.Error, key: "An interface declaration cannot have an 'implements' clause." },
super_must_be_followed_by_an_argument_list_or_member_access: { code: 1034, category: DiagnosticCategory.Error, key: "'super' must be followed by an argument list or member access." },
Only_ambient_modules_can_use_quoted_names: { code: 1035, category: DiagnosticCategory.Error, key: "Only ambient modules can use quoted names." },
Statements_are_not_allowed_in_ambient_contexts: { code: 1036, category: DiagnosticCategory.Error, key: "Statements are not allowed in ambient contexts." },
A_declare_modifier_cannot_be_used_in_an_already_ambient_context: { code: 1038, category: DiagnosticCategory.Error, key: "A 'declare' modifier cannot be used in an already ambient context." },
Initializers_are_not_allowed_in_ambient_contexts: { code: 1039, category: DiagnosticCategory.Error, key: "Initializers are not allowed in ambient contexts." },
_0_modifier_cannot_appear_on_a_module_element: { code: 1044, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot appear on a module element." },
A_declare_modifier_cannot_be_used_with_an_interface_declaration: { code: 1045, category: DiagnosticCategory.Error, key: "A 'declare' modifier cannot be used with an interface declaration." },
A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: { code: 1046, category: DiagnosticCategory.Error, key: "A 'declare' modifier is required for a top level declaration in a .d.ts file." },
A_rest_parameter_cannot_be_optional: { code: 1047, category: DiagnosticCategory.Error, key: "A rest parameter cannot be optional." },
A_rest_parameter_cannot_have_an_initializer: { code: 1048, category: DiagnosticCategory.Error, key: "A rest parameter cannot have an initializer." },
@@ -94,7 +88,6 @@ namespace ts {
case_or_default_expected: { code: 1130, category: DiagnosticCategory.Error, key: "'case' or 'default' expected." },
Property_or_signature_expected: { code: 1131, category: DiagnosticCategory.Error, key: "Property or signature expected." },
Enum_member_expected: { code: 1132, category: DiagnosticCategory.Error, key: "Enum member expected." },
Type_reference_expected: { code: 1133, category: DiagnosticCategory.Error, key: "Type reference expected." },
Variable_declaration_expected: { code: 1134, category: DiagnosticCategory.Error, key: "Variable declaration expected." },
Argument_expression_expected: { code: 1135, category: DiagnosticCategory.Error, key: "Argument expression expected." },
Property_assignment_expected: { code: 1136, category: DiagnosticCategory.Error, key: "Property assignment expected." },
@@ -111,9 +104,6 @@ namespace ts {
Cannot_compile_modules_unless_the_module_flag_is_provided: { code: 1148, category: DiagnosticCategory.Error, key: "Cannot compile modules unless the '--module' flag is provided." },
File_name_0_differs_from_already_included_file_name_1_only_in_casing: { code: 1149, category: DiagnosticCategory.Error, key: "File name '{0}' differs from already included file name '{1}' only in casing" },
new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { code: 1150, category: DiagnosticCategory.Error, key: "'new T[]' cannot be used to create an array. Use 'new Array<T>()' instead." },
var_let_or_const_expected: { code: 1152, category: DiagnosticCategory.Error, key: "'var', 'let' or 'const' expected." },
let_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1153, category: DiagnosticCategory.Error, key: "'let' declarations are only available when targeting ECMAScript 6 and higher." },
const_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1154, category: DiagnosticCategory.Error, key: "'const' declarations are only available when targeting ECMAScript 6 and higher." },
const_declarations_must_be_initialized: { code: 1155, category: DiagnosticCategory.Error, key: "'const' declarations must be initialized" },
const_declarations_can_only_be_declared_inside_a_block: { code: 1156, category: DiagnosticCategory.Error, key: "'const' declarations can only be declared inside a block." },
let_declarations_can_only_be_declared_inside_a_block: { code: 1157, category: DiagnosticCategory.Error, key: "'let' declarations can only be declared inside a block." },
@@ -124,7 +114,6 @@ namespace ts {
Computed_property_names_are_not_allowed_in_enums: { code: 1164, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in enums." },
A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol: { code: 1165, category: DiagnosticCategory.Error, key: "A computed property name in an ambient context must directly refer to a built-in symbol." },
A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol: { code: 1166, category: DiagnosticCategory.Error, key: "A computed property name in a class property declaration must directly refer to a built-in symbol." },
Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1167, category: DiagnosticCategory.Error, key: "Computed property names are only available when targeting ECMAScript 6 and higher." },
A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol: { code: 1168, category: DiagnosticCategory.Error, key: "A computed property name in a method overload must directly refer to a built-in symbol." },
A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol: { code: 1169, category: DiagnosticCategory.Error, key: "A computed property name in an interface must directly refer to a built-in symbol." },
A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol: { code: 1170, category: DiagnosticCategory.Error, key: "A computed property name in a type literal must directly refer to a built-in symbol." },
@@ -140,7 +129,6 @@ namespace ts {
Property_destructuring_pattern_expected: { code: 1180, category: DiagnosticCategory.Error, key: "Property destructuring pattern expected." },
Array_element_destructuring_pattern_expected: { code: 1181, category: DiagnosticCategory.Error, key: "Array element destructuring pattern expected." },
A_destructuring_declaration_must_have_an_initializer: { code: 1182, category: DiagnosticCategory.Error, key: "A destructuring declaration must have an initializer." },
Destructuring_declarations_are_not_allowed_in_ambient_contexts: { code: 1183, category: DiagnosticCategory.Error, key: "Destructuring declarations are not allowed in ambient contexts." },
An_implementation_cannot_be_declared_in_ambient_contexts: { code: 1184, category: DiagnosticCategory.Error, key: "An implementation cannot be declared in ambient contexts." },
Modifiers_cannot_appear_here: { code: 1184, category: DiagnosticCategory.Error, key: "Modifiers cannot appear here." },
Merge_conflict_marker_encountered: { code: 1185, category: DiagnosticCategory.Error, key: "Merge conflict marker encountered." },
@@ -191,6 +179,12 @@ namespace ts {
An_export_declaration_can_only_be_used_in_a_module: { code: 1233, category: DiagnosticCategory.Error, key: "An export declaration can only be used in a module." },
An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file: { code: 1234, category: DiagnosticCategory.Error, key: "An ambient module declaration is only allowed at the top level in a file." },
A_namespace_declaration_is_only_allowed_in_a_namespace_or_module: { code: 1235, category: DiagnosticCategory.Error, key: "A namespace declaration is only allowed in a namespace or module." },
The_return_type_of_a_property_decorator_function_must_be_either_void_or_any: { code: 1236, category: DiagnosticCategory.Error, key: "The return type of a property decorator function must be either 'void' or 'any'." },
The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any: { code: 1237, category: DiagnosticCategory.Error, key: "The return type of a parameter decorator function must be either 'void' or 'any'." },
Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression: { code: 1238, category: DiagnosticCategory.Error, key: "Unable to resolve signature of class decorator when called as an expression." },
Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression: { code: 1239, category: DiagnosticCategory.Error, key: "Unable to resolve signature of parameter decorator when called as an expression." },
Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression: { code: 1240, category: DiagnosticCategory.Error, key: "Unable to resolve signature of property decorator when called as an expression." },
Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression: { code: 1241, category: DiagnosticCategory.Error, key: "Unable to resolve signature of method decorator when called as an expression." },
Duplicate_identifier_0: { code: 2300, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." },
Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: DiagnosticCategory.Error, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." },
Static_members_cannot_reference_class_type_parameters: { code: 2302, category: DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." },
@@ -199,7 +193,6 @@ namespace ts {
Module_0_has_no_exported_member_1: { code: 2305, category: DiagnosticCategory.Error, key: "Module '{0}' has no exported member '{1}'." },
File_0_is_not_a_module: { code: 2306, category: DiagnosticCategory.Error, key: "File '{0}' is not a module." },
Cannot_find_module_0: { code: 2307, category: DiagnosticCategory.Error, key: "Cannot find module '{0}'." },
A_module_cannot_have_more_than_one_export_assignment: { code: 2308, category: DiagnosticCategory.Error, key: "A module cannot have more than one export assignment." },
An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements: { code: 2309, category: DiagnosticCategory.Error, key: "An export assignment cannot be used in a module with other exported elements." },
Type_0_recursively_references_itself_as_a_base_type: { code: 2310, category: DiagnosticCategory.Error, key: "Type '{0}' recursively references itself as a base type." },
A_class_may_only_extend_another_class: { code: 2311, category: DiagnosticCategory.Error, key: "A class may only extend another class." },
@@ -535,7 +528,6 @@ namespace ts {
File_0_has_unsupported_extension_The_only_supported_extensions_are_1: { code: 6054, category: DiagnosticCategory.Error, key: "File '{0}' has unsupported extension. The only supported extensions are {1}." },
Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { code: 6055, category: DiagnosticCategory.Message, key: "Suppress noImplicitAny errors for indexing objects lacking index signatures." },
Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { code: 6056, category: DiagnosticCategory.Message, key: "Do not emit declarations for code that has an '@internal' annotation." },
Preserve_new_lines_when_emitting_code: { code: 6057, category: DiagnosticCategory.Message, key: "Preserve new-lines when emitting code." },
Specifies_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir: { code: 6058, category: DiagnosticCategory.Message, key: "Specifies the root directory of input files. Use to control the output directory structure with --outDir." },
File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files: { code: 6059, category: DiagnosticCategory.Error, key: "File '{0}' is not under 'rootDir' '{1}'. 'rootDir' is expected to contain all source files." },
Specifies_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix: { code: 6060, category: DiagnosticCategory.Message, key: "Specifies the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix)." },
+25 -56
View File
@@ -67,22 +67,6 @@
"category": "Error",
"code": 1023
},
"A class or interface declaration can only have one 'extends' clause.": {
"category": "Error",
"code": 1024
},
"An 'extends' clause must precede an 'implements' clause.": {
"category": "Error",
"code": 1025
},
"A class can only extend a single class.": {
"category": "Error",
"code": 1026
},
"A class declaration can only have one 'implements' clause.": {
"category": "Error",
"code": 1027
},
"Accessibility modifier already seen.": {
"category": "Error",
"code": 1028
@@ -99,10 +83,6 @@
"category": "Error",
"code": 1031
},
"An interface declaration cannot have an 'implements' clause.": {
"category": "Error",
"code": 1032
},
"'super' must be followed by an argument list or member access.": {
"category": "Error",
"code": 1034
@@ -127,10 +107,6 @@
"category": "Error",
"code": 1044
},
"A 'declare' modifier cannot be used with an interface declaration.": {
"category": "Error",
"code": 1045
},
"A 'declare' modifier is required for a top level declaration in a .d.ts file.": {
"category": "Error",
"code": 1046
@@ -363,10 +339,6 @@
"category": "Error",
"code": 1132
},
"Type reference expected.": {
"category": "Error",
"code": 1133
},
"Variable declaration expected.": {
"category": "Error",
"code": 1134
@@ -431,18 +403,6 @@
"category": "Error",
"code": 1150
},
"'var', 'let' or 'const' expected.": {
"category": "Error",
"code": 1152
},
"'let' declarations are only available when targeting ECMAScript 6 and higher.": {
"category": "Error",
"code": 1153
},
"'const' declarations are only available when targeting ECMAScript 6 and higher.": {
"category": "Error",
"code": 1154
},
"'const' declarations must be initialized": {
"category": "Error",
"code": 1155
@@ -483,10 +443,6 @@
"category": "Error",
"code": 1166
},
"Computed property names are only available when targeting ECMAScript 6 and higher.": {
"category": "Error",
"code": 1167
},
"A computed property name in a method overload must directly refer to a built-in symbol.": {
"category": "Error",
"code": 1168
@@ -547,10 +503,6 @@
"category": "Error",
"code": 1182
},
"Destructuring declarations are not allowed in ambient contexts.": {
"category": "Error",
"code": 1183
},
"An implementation cannot be declared in ambient contexts.": {
"category": "Error",
"code": 1184
@@ -753,6 +705,31 @@
},
"The return type of a property decorator function must be either 'void' or 'any'.": {
"category": "Error",
"code": 1236
},
"The return type of a parameter decorator function must be either 'void' or 'any'.": {
"category": "Error",
"code": 1237
},
"Unable to resolve signature of class decorator when called as an expression.": {
"category": "Error",
"code": 1238
},
"Unable to resolve signature of parameter decorator when called as an expression.": {
"category": "Error",
"code": 1239
},
"Unable to resolve signature of property decorator when called as an expression.": {
"category": "Error",
"code": 1240
},
"Unable to resolve signature of method decorator when called as an expression.": {
"category": "Error",
"code": 1241
},
"Duplicate identifier '{0}'.": {
"category": "Error",
"code": 2300
@@ -785,10 +762,6 @@
"category": "Error",
"code": 2307
},
"A module cannot have more than one export assignment.": {
"category": "Error",
"code": 2308
},
"An export assignment cannot be used in a module with other exported elements.": {
"category": "Error",
"code": 2309
@@ -2132,10 +2105,6 @@
"category": "Message",
"code": 6056
},
"Preserve new-lines when emitting code.": {
"category": "Message",
"code": 6057
},
"Specifies the root directory of input files. Use to control the output directory structure with --outDir.": {
"category": "Message",
"code": 6058
+53 -18
View File
@@ -267,6 +267,10 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
return makeUniqueName("default");
}
function generateNameForClassExpression() {
return makeUniqueName("class");
}
function generateNameForNode(node: Node) {
switch (node.kind) {
case SyntaxKind.Identifier:
@@ -279,9 +283,10 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
return generateNameForImportOrExportDeclaration(<ImportDeclaration | ExportDeclaration>node);
case SyntaxKind.FunctionDeclaration:
case SyntaxKind.ClassDeclaration:
case SyntaxKind.ClassExpression:
case SyntaxKind.ExportAssignment:
return generateNameForExportDefault();
case SyntaxKind.ClassExpression:
return generateNameForClassExpression();
}
}
@@ -2001,7 +2006,21 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
emit(node.expression);
let indentedBeforeDot = indentIfOnDifferentLines(node, node.expression, node.dotToken);
write(".");
// 1 .toString is a valid property access, emit a space after the literal
let shouldEmitSpace: boolean;
if (!indentedBeforeDot && node.expression.kind === SyntaxKind.NumericLiteral) {
let text = getSourceTextOfNodeFromSourceFile(currentSourceFile, node.expression);
shouldEmitSpace = text.indexOf(tokenToString(SyntaxKind.DotToken)) < 0;
}
if (shouldEmitSpace) {
write(" .");
}
else {
write(".");
}
let indentedAfterDot = indentIfOnDifferentLines(node, node.dotToken, node.name);
emit(node.name);
decreaseIndentIf(indentedBeforeDot, indentedAfterDot);
@@ -3358,33 +3377,49 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
function emitDefaultValueAssignments(node: FunctionLikeDeclaration) {
if (languageVersion < ScriptTarget.ES6) {
let tempIndex = 0;
forEach(node.parameters, p => {
forEach(node.parameters, parameter => {
// A rest parameter cannot have a binding pattern or an initializer,
// so let's just ignore it.
if (p.dotDotDotToken) {
if (parameter.dotDotDotToken) {
return;
}
if (isBindingPattern(p.name)) {
writeLine();
write("var ");
emitDestructuring(p, /*isAssignmentExpressionStatement*/ false, tempParameters[tempIndex]);
write(";");
tempIndex++;
let { name: paramName, initializer } = parameter;
if (isBindingPattern(paramName)) {
// In cases where a binding pattern is simply '[]' or '{}',
// we usually don't want to emit a var declaration; however, in the presence
// of an initializer, we must emit that expression to preserve side effects.
let hasBindingElements = paramName.elements.length > 0;
if (hasBindingElements || initializer) {
writeLine();
write("var ");
if (hasBindingElements) {
emitDestructuring(parameter, /*isAssignmentExpressionStatement*/ false, tempParameters[tempIndex]);
}
else {
emit(tempParameters[tempIndex]);
write(" = ");
emit(initializer);
}
write(";");
tempIndex++;
}
}
else if (p.initializer) {
else if (initializer) {
writeLine();
emitStart(p);
emitStart(parameter);
write("if (");
emitNodeWithoutSourceMap(p.name);
emitNodeWithoutSourceMap(paramName);
write(" === void 0)");
emitEnd(p);
emitEnd(parameter);
write(" { ");
emitStart(p);
emitNodeWithoutSourceMap(p.name);
emitStart(parameter);
emitNodeWithoutSourceMap(paramName);
write(" = ");
emitNodeWithoutSourceMap(p.initializer);
emitEnd(p);
emitNodeWithoutSourceMap(initializer);
emitEnd(parameter);
write("; }");
}
});
-1
View File
@@ -5618,7 +5618,6 @@ namespace ts {
let atToken = createNode(SyntaxKind.AtToken, pos - 1);
atToken.end = pos;
let startPos = pos;
let tagName = scanIdentifier();
if (!tagName) {
return;
-1
View File
@@ -337,7 +337,6 @@ namespace ts {
function processSourceFile(fileName: string, isDefaultLib: boolean, refFile?: SourceFile, refPos?: number, refEnd?: number) {
let start: number;
let length: number;
let extensions: string;
let diagnosticArgument: string[];
if (refEnd !== undefined && refPos !== undefined) {
start = refPos;
+2 -1
View File
@@ -191,7 +191,8 @@ namespace ts {
return sys.exit(ExitStatus.Success);
}
if (commandLine.options.watch) {
// Firefox has Object.prototype.watch
if (commandLine.options.watch && commandLine.options.hasOwnProperty("watch")) {
if (!sys.watchFile) {
reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_current_host_does_not_support_the_0_option, "--watch"));
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
+2 -2
View File
@@ -821,7 +821,7 @@ namespace ts {
template: LiteralExpression | TemplateExpression;
}
export type CallLikeExpression = CallExpression | NewExpression | TaggedTemplateExpression;
export type CallLikeExpression = CallExpression | NewExpression | TaggedTemplateExpression | Decorator;
export interface AsExpression extends Expression {
expression: Expression;
@@ -1971,7 +1971,7 @@ namespace ts {
CarriageReturnLineFeed = 0,
LineFeed = 1,
}
export interface LineAndCharacter {
line: number;
/*
+20 -22
View File
@@ -542,6 +542,7 @@ namespace ts {
case SyntaxKind.ModuleDeclaration:
case SyntaxKind.TypeAliasDeclaration:
case SyntaxKind.ClassDeclaration:
case SyntaxKind.ClassExpression:
// These are not allowed inside a generator now, but eventually they may be allowed
// as local types. Regardless, any yield statements contained within them should be
// skipped in this traversal.
@@ -579,26 +580,15 @@ namespace ts {
return true;
}
}
return false;
}
export function isAccessor(node: Node): boolean {
if (node) {
switch (node.kind) {
case SyntaxKind.GetAccessor:
case SyntaxKind.SetAccessor:
return true;
}
}
return false;
return node && (node.kind === SyntaxKind.GetAccessor || node.kind === SyntaxKind.SetAccessor);
}
export function isClassLike(node: Node): boolean {
if (node) {
return node.kind === SyntaxKind.ClassDeclaration || node.kind === SyntaxKind.ClassExpression;
}
return node && (node.kind === SyntaxKind.ClassDeclaration || node.kind === SyntaxKind.ClassExpression);
}
export function isFunctionLike(node: Node): boolean {
@@ -620,7 +610,6 @@ namespace ts {
return true;
}
}
return false;
}
@@ -641,6 +630,15 @@ namespace ts {
}
}
export function getContainingClass(node: Node): ClassLikeDeclaration {
while (true) {
node = node.parent;
if (!node || isClassLike(node)) {
return <ClassLikeDeclaration>node;
}
}
}
export function getThisContainer(node: Node, includeArrowFunctions: boolean): Node {
while (true) {
node = node.parent;
@@ -653,7 +651,7 @@ namespace ts {
// then the computed property is not a 'this' container.
// A computed property name in a class needs to be a this container
// so that we can error on it.
if (node.parent.parent.kind === SyntaxKind.ClassDeclaration) {
if (isClassLike(node.parent.parent)) {
return node;
}
// If this is a computed property, then the parent should not
@@ -708,7 +706,7 @@ namespace ts {
// then the computed property is not a 'super' container.
// A computed property name in a class needs to be a super container
// so that we can error on it.
if (node.parent.parent.kind === SyntaxKind.ClassDeclaration) {
if (isClassLike(node.parent.parent)) {
return node;
}
// If this is a computed property, then the parent should not
@@ -754,8 +752,8 @@ namespace ts {
return (<TaggedTemplateExpression>node).tag;
}
// Will either be a CallExpression or NewExpression.
return (<CallExpression>node).expression;
// Will either be a CallExpression, NewExpression, or Decorator.
return (<CallExpression | Decorator>node).expression;
}
export function nodeCanBeDecorated(node: Node): boolean {
@@ -1071,7 +1069,7 @@ namespace ts {
return SyntaxKind.FirstTemplateToken <= kind && kind <= SyntaxKind.LastTemplateToken;
}
export function isBindingPattern(node: Node) {
export function isBindingPattern(node: Node): node is BindingPattern {
return !!node && (node.kind === SyntaxKind.ArrayBindingPattern || node.kind === SyntaxKind.ObjectBindingPattern);
}
@@ -1091,6 +1089,7 @@ namespace ts {
case SyntaxKind.ArrowFunction:
case SyntaxKind.BindingElement:
case SyntaxKind.ClassDeclaration:
case SyntaxKind.ClassExpression:
case SyntaxKind.Constructor:
case SyntaxKind.EnumDeclaration:
case SyntaxKind.EnumMember:
@@ -1239,7 +1238,7 @@ namespace ts {
return heritageClause && heritageClause.types.length > 0 ? heritageClause.types[0] : undefined;
}
export function getClassImplementsHeritageClauseElements(node: ClassDeclaration) {
export function getClassImplementsHeritageClauseElements(node: ClassLikeDeclaration) {
let heritageClause = getHeritageClause(node.heritageClauses, SyntaxKind.ImplementsKeyword);
return heritageClause ? heritageClause.types : undefined;
}
@@ -1928,7 +1927,7 @@ namespace ts {
export function isExpressionWithTypeArgumentsInClassExtendsClause(node: Node): boolean {
return node.kind === SyntaxKind.ExpressionWithTypeArguments &&
(<HeritageClause>node.parent).token === SyntaxKind.ExtendsKeyword &&
node.parent.parent.kind === SyntaxKind.ClassDeclaration;
isClassLike(node.parent.parent);
}
// Returns false if this heritage clause element's expression contains something unsupported
@@ -1973,7 +1972,6 @@ namespace ts {
function getExpandedCharCodes(input: string): number[] {
let output: number[] = [];
let length = input.length;
let leadSurrogate: number = undefined;
for (let i = 0; i < length; i++) {
let charCode = input.charCodeAt(i);
+1 -2
View File
@@ -660,8 +660,7 @@ module FourSlash {
}
errorMsg += "]\n";
Harness.IO.log(errorMsg);
this.raiseError("Member list is not empty at Caret");
this.raiseError("Member list is not empty at Caret: " + errorMsg);
}
}
+4
View File
@@ -694,6 +694,7 @@ interface Map<K, V> {
}
interface MapConstructor {
new (): Map<any, any>;
new <K, V>(): Map<K, V>;
new <K, V>(iterable: Iterable<[K, V]>): Map<K, V>;
prototype: Map<any, any>;
@@ -710,6 +711,7 @@ interface WeakMap<K, V> {
}
interface WeakMapConstructor {
new (): WeakMap<any, any>;
new <K, V>(): WeakMap<K, V>;
new <K, V>(iterable: Iterable<[K, V]>): WeakMap<K, V>;
prototype: WeakMap<any, any>;
@@ -731,6 +733,7 @@ interface Set<T> {
}
interface SetConstructor {
new (): Set<any>;
new <T>(): Set<T>;
new <T>(iterable: Iterable<T>): Set<T>;
prototype: Set<any>;
@@ -746,6 +749,7 @@ interface WeakSet<T> {
}
interface WeakSetConstructor {
new (): WeakSet<any>;
new <T>(): WeakSet<T>;
new <T>(iterable: Iterable<T>): WeakSet<T>;
prototype: WeakSet<any>;
+1 -1
View File
@@ -318,7 +318,7 @@ namespace ts.formatting {
this.NoSpaceAfterModuleImport = new Rule(RuleDescriptor.create2(Shared.TokenRange.FromTokens([SyntaxKind.ModuleKeyword, SyntaxKind.RequireKeyword]), SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
// Add a space around certain TypeScript keywords
this.SpaceAfterCertainTypeScriptKeywords = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.ClassKeyword, SyntaxKind.DeclareKeyword, SyntaxKind.EnumKeyword, SyntaxKind.ExportKeyword, SyntaxKind.ExtendsKeyword, SyntaxKind.GetKeyword, SyntaxKind.ImplementsKeyword, SyntaxKind.ImportKeyword, SyntaxKind.InterfaceKeyword, SyntaxKind.ModuleKeyword, SyntaxKind.NamespaceKeyword, SyntaxKind.PrivateKeyword, SyntaxKind.PublicKeyword, SyntaxKind.SetKeyword, SyntaxKind.StaticKeyword]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
this.SpaceAfterCertainTypeScriptKeywords = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.ClassKeyword, SyntaxKind.DeclareKeyword, SyntaxKind.DefaultKeyword, SyntaxKind.EnumKeyword, SyntaxKind.ExportKeyword, SyntaxKind.ExtendsKeyword, SyntaxKind.GetKeyword, SyntaxKind.ImplementsKeyword, SyntaxKind.ImportKeyword, SyntaxKind.InterfaceKeyword, SyntaxKind.ModuleKeyword, SyntaxKind.NamespaceKeyword, SyntaxKind.PrivateKeyword, SyntaxKind.PublicKeyword, SyntaxKind.ProtectedKeyword, SyntaxKind.SetKeyword, SyntaxKind.StaticKeyword]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
this.SpaceBeforeCertainTypeScriptKeywords = new Rule(RuleDescriptor.create4(Shared.TokenRange.Any, Shared.TokenRange.FromTokens([SyntaxKind.ExtendsKeyword, SyntaxKind.ImplementsKeyword])), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
// Treat string literals in module names as identifiers, and add a space between the literal and the opening Brace braces, e.g.: module "m2" {
+58 -1
View File
@@ -26,7 +26,7 @@ namespace ts.formatting {
precedingToken.kind === SyntaxKind.TemplateHead ||
precedingToken.kind === SyntaxKind.TemplateMiddle ||
precedingToken.kind === SyntaxKind.TemplateTail;
if (precedingTokenIsLiteral && precedingToken.getStart(sourceFile) <= position && precedingToken.end > position) {
if (precedingTokenIsLiteral && precedingToken.getStart(sourceFile) <= position && precedingToken.end > position) {
return 0;
}
@@ -66,6 +66,10 @@ namespace ts.formatting {
if (actualIndentation !== Value.Unknown) {
return actualIndentation;
}
actualIndentation = getLineIndentationWhenExpressionIsInMultiLine(current, sourceFile, options);
if (actualIndentation !== Value.Unknown) {
return actualIndentation + options.IndentSize;
}
previous = current;
current = current.parent;
@@ -122,6 +126,10 @@ namespace ts.formatting {
if (actualIndentation !== Value.Unknown) {
return actualIndentation + indentationDelta;
}
actualIndentation = getLineIndentationWhenExpressionIsInMultiLine(current, sourceFile, options);
if (actualIndentation !== Value.Unknown) {
return actualIndentation + indentationDelta;
}
}
// increase indentation if parent node wants its content to be indented and parent and child nodes don't start on the same line
@@ -287,6 +295,55 @@ namespace ts.formatting {
}
}
function getLineIndentationWhenExpressionIsInMultiLine(node: Node, sourceFile: SourceFile, options: EditorOptions): number {
// actual indentation should not be used when:
// - node is close parenthesis - this is the end of the expression
if (node.kind === SyntaxKind.CloseParenToken) {
return Value.Unknown;
}
if (node.parent && (
node.parent.kind === SyntaxKind.CallExpression ||
node.parent.kind === SyntaxKind.NewExpression) &&
(<CallExpression>node.parent).expression !== node) {
let fullCallOrNewExpression = (<CallExpression | NewExpression>node.parent).expression;
let startingExpression = getStartingExpression(<PropertyAccessExpression | CallExpression | ElementAccessExpression>fullCallOrNewExpression);
if (fullCallOrNewExpression === startingExpression) {
return Value.Unknown;
}
let fullCallOrNewExpressionEnd = sourceFile.getLineAndCharacterOfPosition(fullCallOrNewExpression.end);
let startingExpressionEnd = sourceFile.getLineAndCharacterOfPosition(startingExpression.end);
if (fullCallOrNewExpressionEnd.line === startingExpressionEnd.line) {
return Value.Unknown;
}
return findColumnForFirstNonWhitespaceCharacterInLine(fullCallOrNewExpressionEnd, sourceFile, options);
}
return Value.Unknown;
function getStartingExpression(node: PropertyAccessExpression | CallExpression | ElementAccessExpression) {
while (true) {
switch (node.kind) {
case SyntaxKind.CallExpression:
case SyntaxKind.NewExpression:
case SyntaxKind.PropertyAccessExpression:
case SyntaxKind.ElementAccessExpression:
node = <PropertyAccessExpression | CallExpression | ElementAccessExpression | PropertyAccessExpression>node.expression;
break;
default:
return node;
}
}
return node;
}
}
function deriveActualIndentationFromList(list: Node[], index: number, sourceFile: SourceFile, options: EditorOptions): number {
Debug.assert(index >= 0 && index < list.length);
let node = list[index];
+82 -57
View File
@@ -95,7 +95,6 @@ namespace ts {
export module ScriptSnapshot {
class StringScriptSnapshot implements IScriptSnapshot {
private _lineStartPositions: number[] = undefined;
constructor(private text: string) {
}
@@ -1800,7 +1799,7 @@ namespace ts {
let outputText: string;
// Create a compilerHost object to allow the compiler to read and write files
var compilerHost: CompilerHost = {
let compilerHost: CompilerHost = {
getSourceFile: (fileName, target) => fileName === inputFileName ? sourceFile : undefined,
writeFile: (name, text, writeByteOrderMark) => {
Debug.assert(outputText === undefined, "Unexpected multiple outputs for the file: " + name);
@@ -1813,7 +1812,7 @@ namespace ts {
getNewLine: () => newLine
};
var program = createProgram([inputFileName], options, compilerHost);
let program = createProgram([inputFileName], options, compilerHost);
addRange(/*to*/ diagnostics, /*from*/ program.getSyntacticDiagnostics(sourceFile));
addRange(/*to*/ diagnostics, /*from*/ program.getOptionsDiagnostics());
@@ -2897,7 +2896,6 @@ namespace ts {
return undefined;
}
let location = getTouchingPropertyName(sourceFile, position);
let options = program.getCompilerOptions();
let jsx = options.jsx !== JsxEmit.None;
let target = options.target;
@@ -2909,6 +2907,7 @@ namespace ts {
let isRightOfDot = false;
let isRightOfOpenTag = false;
let location = getTouchingPropertyName(sourceFile, position);
if(contextToken) {
let kind = contextToken.kind;
if (kind === SyntaxKind.DotToken && contextToken.parent.kind === SyntaxKind.PropertyAccessExpression) {
@@ -3009,22 +3008,32 @@ namespace ts {
}
function tryGetGlobalSymbols(): boolean {
let containingObjectLiteral = getContainingObjectLiteralApplicableForCompletion(contextToken);
if (containingObjectLiteral) {
let objectLikeContainer = tryGetObjectLikeCompletionContainer(contextToken);
if (objectLikeContainer) {
// Object literal expression, look up possible property names from contextual type
isMemberCompletion = true;
isNewIdentifierLocation = true;
let contextualType = typeChecker.getContextualType(containingObjectLiteral);
if (!contextualType) {
let typeForObject: Type;
let existingMembers: Declaration[];
if (objectLikeContainer.kind === SyntaxKind.ObjectLiteralExpression) {
typeForObject = typeChecker.getContextualType(<ObjectLiteralExpression>objectLikeContainer);
existingMembers = (<ObjectLiteralExpression>objectLikeContainer).properties;
}
else {
typeForObject = typeChecker.getTypeAtLocation(objectLikeContainer);
existingMembers = (<BindingPattern>objectLikeContainer).elements;
}
if (!typeForObject) {
return false;
}
let contextualTypeMembers = typeChecker.getPropertiesOfType(contextualType);
if (contextualTypeMembers && contextualTypeMembers.length > 0) {
let typeMembers = typeChecker.getPropertiesOfType(typeForObject);
if (typeMembers && typeMembers.length > 0) {
// Add filtered items to the completion list
symbols = filterContextualMembersList(contextualTypeMembers, containingObjectLiteral.properties);
symbols = filterObjectMembersList(typeMembers, existingMembers);
}
return true;
}
@@ -3127,7 +3136,7 @@ namespace ts {
* accurately aggregate locals from the closest containing scope.
*/
function getScopeNode(initialToken: Node, position: number, sourceFile: SourceFile) {
var scope = initialToken;
let scope = initialToken;
while (scope && !positionBelongsToNode(scope, position, sourceFile)) {
scope = scope.parent;
}
@@ -3239,17 +3248,18 @@ namespace ts {
return false;
}
function getContainingObjectLiteralApplicableForCompletion(previousToken: Node): ObjectLiteralExpression {
// The locations in an object literal expression that are applicable for completion are property name definition locations.
if (previousToken) {
let parent = previousToken.parent;
switch (previousToken.kind) {
/**
* Returns the immediate owning object literal or binding pattern of a context token,
* on the condition that one exists and that the context implies completion should be given.
*/
function tryGetObjectLikeCompletionContainer(contextToken: Node): ObjectLiteralExpression | BindingPattern {
if (contextToken) {
switch (contextToken.kind) {
case SyntaxKind.OpenBraceToken: // let x = { |
case SyntaxKind.CommaToken: // let x = { a: 0, |
if (parent && parent.kind === SyntaxKind.ObjectLiteralExpression) {
return <ObjectLiteralExpression>parent;
let parent = contextToken.parent;
if (parent && (parent.kind === SyntaxKind.ObjectLiteralExpression || parent.kind === SyntaxKind.ObjectBindingPattern)) {
return <ObjectLiteralExpression | BindingPattern>parent;
}
break;
}
@@ -3288,8 +3298,7 @@ namespace ts {
containingNodeKind === SyntaxKind.ClassDeclaration || // class A<T, |
containingNodeKind === SyntaxKind.FunctionDeclaration || // function A<T, |
containingNodeKind === SyntaxKind.InterfaceDeclaration || // interface A<T, |
containingNodeKind === SyntaxKind.ArrayBindingPattern || // var [x, y|
containingNodeKind === SyntaxKind.ObjectBindingPattern; // function func({ x, y|
containingNodeKind === SyntaxKind.ArrayBindingPattern; // var [x, y|
case SyntaxKind.DotToken:
return containingNodeKind === SyntaxKind.ArrayBindingPattern; // var [.|
@@ -3307,8 +3316,7 @@ namespace ts {
case SyntaxKind.OpenBraceToken:
return containingNodeKind === SyntaxKind.EnumDeclaration || // enum a { |
containingNodeKind === SyntaxKind.InterfaceDeclaration || // interface a { |
containingNodeKind === SyntaxKind.TypeLiteral || // let x : { |
containingNodeKind === SyntaxKind.ObjectBindingPattern; // function func({ x|
containingNodeKind === SyntaxKind.TypeLiteral; // let x : { |
case SyntaxKind.SemicolonToken:
return containingNodeKind === SyntaxKind.PropertySignature &&
@@ -3400,26 +3408,39 @@ namespace ts {
return filter(exports, e => !lookUp(exisingImports, e.name));
}
function filterContextualMembersList(contextualMemberSymbols: Symbol[], existingMembers: Declaration[]): Symbol[] {
function filterObjectMembersList(contextualMemberSymbols: Symbol[], existingMembers: Declaration[]): Symbol[] {
if (!existingMembers || existingMembers.length === 0) {
return contextualMemberSymbols;
}
let existingMemberNames: Map<boolean> = {};
forEach(existingMembers, m => {
if (m.kind !== SyntaxKind.PropertyAssignment && m.kind !== SyntaxKind.ShorthandPropertyAssignment) {
// Ignore omitted expressions for missing members in the object literal
return;
for (let m of existingMembers) {
// Ignore omitted expressions for missing members
if (m.kind !== SyntaxKind.PropertyAssignment &&
m.kind !== SyntaxKind.ShorthandPropertyAssignment &&
m.kind !== SyntaxKind.BindingElement) {
continue;
}
// If this is the current item we are editing right now, do not filter it out
if (m.getStart() <= position && position <= m.getEnd()) {
// If this is the current item we are editing right now, do not filter it out
return;
continue;
}
// TODO(jfreeman): Account for computed property name
existingMemberNames[(<Identifier>m.name).text] = true;
});
let existingName: string;
if (m.kind === SyntaxKind.BindingElement && (<BindingElement>m).propertyName) {
existingName = (<BindingElement>m).propertyName.text;
}
else {
// TODO(jfreeman): Account for computed property name
// NOTE: if one only performs this step when m.name is an identifier,
// things like '__proto__' are not filtered out.
existingName = (<Identifier>m.name).text;
}
existingMemberNames[existingName] = true;
}
let filteredMembers: Symbol[] = [];
forEach(contextualMemberSymbols, s => {
@@ -3516,10 +3537,10 @@ namespace ts {
function getCompletionEntriesFromSymbols(symbols: Symbol[]): CompletionEntry[] {
let start = new Date().getTime();
var entries: CompletionEntry[] = [];
let entries: CompletionEntry[] = [];
if (symbols) {
var nameToSymbol: Map<Symbol> = {};
let nameToSymbol: Map<Symbol> = {};
for (let symbol of symbols) {
let entry = createCompletionEntry(symbol, location);
if (entry) {
@@ -3553,13 +3574,13 @@ namespace ts {
let symbol = forEach(symbols, s => getCompletionEntryDisplayNameForSymbol(s, target, /*performCharacterChecks:*/ false) === entryName ? s : undefined);
if (symbol) {
let displayPartsDocumentationsAndSymbolKind = getSymbolDisplayPartsDocumentationAndSymbolKind(symbol, getValidSourceFile(fileName), location, location, SemanticMeaning.All);
let { displayParts, documentation, symbolKind } = getSymbolDisplayPartsDocumentationAndSymbolKind(symbol, getValidSourceFile(fileName), location, location, SemanticMeaning.All);
return {
name: entryName,
kind: displayPartsDocumentationsAndSymbolKind.symbolKind,
kindModifiers: getSymbolModifiers(symbol),
displayParts: displayPartsDocumentationsAndSymbolKind.displayParts,
documentation: displayPartsDocumentationsAndSymbolKind.documentation
kind: symbolKind,
displayParts,
documentation
};
}
}
@@ -4234,7 +4255,7 @@ namespace ts {
}
if (type.flags & TypeFlags.Union) {
var result: DefinitionInfo[] = [];
let result: DefinitionInfo[] = [];
forEach((<UnionType>type).types, t => {
if (t.symbol) {
addRange(/*to*/ result, /*from*/ getDefinitionFromSymbol(t.symbol, node));
@@ -4334,7 +4355,7 @@ namespace ts {
function getSyntacticDocumentHighlights(node: Node): DocumentHighlights[] {
let fileName = sourceFile.fileName;
var highlightSpans = getHighlightSpans(node);
let highlightSpans = getHighlightSpans(node);
if (!highlightSpans || highlightSpans.length === 0) {
return undefined;
}
@@ -4912,17 +4933,17 @@ namespace ts {
}
function findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): RenameLocation[] {
var referencedSymbols = findReferencedSymbols(fileName, position, findInStrings, findInComments);
let referencedSymbols = findReferencedSymbols(fileName, position, findInStrings, findInComments);
return convertReferences(referencedSymbols);
}
function getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[] {
var referencedSymbols = findReferencedSymbols(fileName, position, /*findInStrings:*/ false, /*findInComments:*/ false);
let referencedSymbols = findReferencedSymbols(fileName, position, /*findInStrings:*/ false, /*findInComments:*/ false);
return convertReferences(referencedSymbols);
}
function findReferences(fileName: string, position: number): ReferencedSymbol[] {
var referencedSymbols = findReferencedSymbols(fileName, position, /*findInStrings:*/ false, /*findInComments:*/ false);
function findReferences(fileName: string, position: number): ReferencedSymbol[]{
let referencedSymbols = findReferencedSymbols(fileName, position, /*findInStrings:*/ false, /*findInComments:*/ false);
// Only include referenced symbols that have a valid definition.
return filter(referencedSymbols, rs => !!rs.definition);
@@ -5221,7 +5242,7 @@ namespace ts {
}
});
var definition: DefinitionInfo = {
let definition: DefinitionInfo = {
containerKind: "",
containerName: "",
fileName: targetLabel.getSourceFile().fileName,
@@ -5317,10 +5338,10 @@ namespace ts {
if (referenceSymbol) {
let referenceSymbolDeclaration = referenceSymbol.valueDeclaration;
let shorthandValueSymbol = typeChecker.getShorthandAssignmentValueSymbol(referenceSymbolDeclaration);
var relatedSymbol = getRelatedSymbol(searchSymbols, referenceSymbol, referenceLocation);
let relatedSymbol = getRelatedSymbol(searchSymbols, referenceSymbol, referenceLocation);
if (relatedSymbol) {
var referencedSymbol = getReferencedSymbol(relatedSymbol);
let referencedSymbol = getReferencedSymbol(relatedSymbol);
referencedSymbol.references.push(getReferenceEntryFromNode(referenceLocation));
}
/* Because in short-hand property assignment, an identifier which stored as name of the short-hand property assignment
@@ -5330,7 +5351,7 @@ namespace ts {
* position of property accessing, the referenceEntry of such position will be handled in the first case.
*/
else if (!(referenceSymbol.flags & SymbolFlags.Transient) && searchSymbols.indexOf(shorthandValueSymbol) >= 0) {
var referencedSymbol = getReferencedSymbol(shorthandValueSymbol);
let referencedSymbol = getReferencedSymbol(shorthandValueSymbol);
referencedSymbol.references.push(getReferenceEntryFromNode(referenceSymbolDeclaration.name));
}
}
@@ -5340,8 +5361,8 @@ namespace ts {
return;
function getReferencedSymbol(symbol: Symbol): ReferencedSymbol {
var symbolId = getSymbolId(symbol);
var index = symbolToIndex[symbolId];
let symbolId = getSymbolId(symbol);
let index = symbolToIndex[symbolId];
if (index === undefined) {
index = result.length;
symbolToIndex[symbolId] = index;
@@ -5428,7 +5449,7 @@ namespace ts {
}
});
var definition = getDefinition(searchSpaceNode.symbol);
let definition = getDefinition(searchSpaceNode.symbol);
return [{ definition, references }];
}
@@ -5623,7 +5644,7 @@ namespace ts {
// If the reference symbol is an alias, check if what it is aliasing is one of the search
// symbols.
if (isImportOrExportSpecifierImportSymbol(referenceSymbol)) {
var aliasedSymbol = typeChecker.getAliasedSymbol(referenceSymbol);
let aliasedSymbol = typeChecker.getAliasedSymbol(referenceSymbol);
if (searchSymbols.indexOf(aliasedSymbol) >= 0) {
return aliasedSymbol;
}
@@ -6352,6 +6373,10 @@ namespace ts {
}
function classifyToken(token: Node): void {
if (nodeIsMissing(token)) {
return;
}
let tokenStart = classifyLeadingTriviaAndGetTokenStart(token);
let tokenWidth = token.end - tokenStart;
@@ -6936,7 +6961,7 @@ namespace ts {
}
function convertClassifications(classifications: Classifications, text: string): ClassificationResult {
var entries: ClassificationInfo[] = [];
let entries: ClassificationInfo[] = [];
let dense = classifications.spans;
let lastEnd = 0;
@@ -1,9 +0,0 @@
tests/cases/compiler/anonymousClassExpression1.ts(2,19): error TS9003: 'class' expressions are not currently supported.
==== tests/cases/compiler/anonymousClassExpression1.ts (1 errors) ====
function f() {
return typeof class {} === "function";
~~~~~
!!! error TS9003: 'class' expressions are not currently supported.
}
@@ -6,8 +6,8 @@ function f() {
//// [anonymousClassExpression1.js]
function f() {
return typeof (function () {
function default_1() {
function class_1() {
}
return default_1;
return class_1;
})() === "function";
}
@@ -0,0 +1,6 @@
=== tests/cases/compiler/anonymousClassExpression1.ts ===
function f() {
>f : Symbol(f, Decl(anonymousClassExpression1.ts, 0, 0))
return typeof class {} === "function";
}
@@ -0,0 +1,10 @@
=== tests/cases/compiler/anonymousClassExpression1.ts ===
function f() {
>f : () => boolean
return typeof class {} === "function";
>typeof class {} === "function" : boolean
>typeof class {} : string
>class {} : typeof (Anonymous class)
>"function" : string
}
@@ -1,24 +0,0 @@
tests/cases/conformance/classes/classExpression.ts(1,15): error TS9003: 'class' expressions are not currently supported.
tests/cases/conformance/classes/classExpression.ts(5,16): error TS9003: 'class' expressions are not currently supported.
tests/cases/conformance/classes/classExpression.ts(10,19): error TS9003: 'class' expressions are not currently supported.
==== tests/cases/conformance/classes/classExpression.ts (3 errors) ====
var x = class C {
~
!!! error TS9003: 'class' expressions are not currently supported.
}
var y = {
foo: class C2 {
~~
!!! error TS9003: 'class' expressions are not currently supported.
}
}
module M {
var z = class C4 {
~~
!!! error TS9003: 'class' expressions are not currently supported.
}
}
@@ -0,0 +1,23 @@
=== tests/cases/conformance/classes/classExpression.ts ===
var x = class C {
>x : Symbol(x, Decl(classExpression.ts, 0, 3))
>C : Symbol(C, Decl(classExpression.ts, 0, 7))
}
var y = {
>y : Symbol(y, Decl(classExpression.ts, 3, 3))
foo: class C2 {
>foo : Symbol(foo, Decl(classExpression.ts, 3, 9))
>C2 : Symbol(C2, Decl(classExpression.ts, 4, 8))
}
}
module M {
>M : Symbol(M, Decl(classExpression.ts, 6, 1))
var z = class C4 {
>z : Symbol(z, Decl(classExpression.ts, 9, 7))
>C4 : Symbol(C4, Decl(classExpression.ts, 9, 11))
}
}
@@ -0,0 +1,27 @@
=== tests/cases/conformance/classes/classExpression.ts ===
var x = class C {
>x : typeof C
>class C {} : typeof C
>C : typeof C
}
var y = {
>y : { foo: typeof C2; }
>{ foo: class C2 { }} : { foo: typeof C2; }
foo: class C2 {
>foo : typeof C2
>class C2 { } : typeof C2
>C2 : typeof C2
}
}
module M {
>M : typeof M
var z = class C4 {
>z : typeof C4
>class C4 { } : typeof C4
>C4 : typeof C4
}
}
@@ -1,7 +0,0 @@
tests/cases/conformance/classes/classExpressions/classExpression1.ts(1,15): error TS9003: 'class' expressions are not currently supported.
==== tests/cases/conformance/classes/classExpressions/classExpression1.ts (1 errors) ====
var v = class C {};
~
!!! error TS9003: 'class' expressions are not currently supported.
@@ -0,0 +1,5 @@
=== tests/cases/conformance/classes/classExpressions/classExpression1.ts ===
var v = class C {};
>v : Symbol(v, Decl(classExpression1.ts, 0, 3))
>C : Symbol(C, Decl(classExpression1.ts, 0, 7))
@@ -0,0 +1,6 @@
=== tests/cases/conformance/classes/classExpressions/classExpression1.ts ===
var v = class C {};
>v : typeof C
>class C {} : typeof C
>C : typeof C
@@ -1,8 +0,0 @@
tests/cases/conformance/classes/classExpressions/classExpression2.ts(2,15): error TS9003: 'class' expressions are not currently supported.
==== tests/cases/conformance/classes/classExpressions/classExpression2.ts (1 errors) ====
class D { }
var v = class C extends D {};
~
!!! error TS9003: 'class' expressions are not currently supported.
@@ -3,6 +3,11 @@ class D { }
var v = class C extends D {};
//// [classExpression2.js]
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var D = (function () {
function D() {
}
@@ -0,0 +1,9 @@
=== tests/cases/conformance/classes/classExpressions/classExpression2.ts ===
class D { }
>D : Symbol(D, Decl(classExpression2.ts, 0, 0))
var v = class C extends D {};
>v : Symbol(v, Decl(classExpression2.ts, 1, 3))
>C : Symbol(C, Decl(classExpression2.ts, 1, 7))
>D : Symbol(D, Decl(classExpression2.ts, 0, 0))
@@ -0,0 +1,10 @@
=== tests/cases/conformance/classes/classExpressions/classExpression2.ts ===
class D { }
>D : D
var v = class C extends D {};
>v : typeof C
>class C extends D {} : typeof C
>C : typeof C
>D : D
@@ -0,0 +1,38 @@
//// [classExpression3.ts]
let C = class extends class extends class { a = 1 } { b = 2 } { c = 3 };
let c = new C();
c.a;
c.b;
c.c;
//// [classExpression3.js]
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var C = (function (_super) {
__extends(class_1, _super);
function class_1() {
_super.apply(this, arguments);
this.c = 3;
}
return class_1;
})((function (_super) {
__extends(class_2, _super);
function class_2() {
_super.apply(this, arguments);
this.b = 2;
}
return class_2;
})((function () {
function class_3() {
this.a = 1;
}
return class_3;
})()));
var c = new C();
c.a;
c.b;
c.c;
@@ -0,0 +1,26 @@
=== tests/cases/conformance/classes/classExpressions/classExpression3.ts ===
let C = class extends class extends class { a = 1 } { b = 2 } { c = 3 };
>C : Symbol(C, Decl(classExpression3.ts, 0, 3))
>a : Symbol((Anonymous class).a, Decl(classExpression3.ts, 0, 43))
>b : Symbol((Anonymous class).b, Decl(classExpression3.ts, 0, 53))
>c : Symbol((Anonymous class).c, Decl(classExpression3.ts, 0, 63))
let c = new C();
>c : Symbol(c, Decl(classExpression3.ts, 1, 3))
>C : Symbol(C, Decl(classExpression3.ts, 0, 3))
c.a;
>c.a : Symbol((Anonymous class).a, Decl(classExpression3.ts, 0, 43))
>c : Symbol(c, Decl(classExpression3.ts, 1, 3))
>a : Symbol((Anonymous class).a, Decl(classExpression3.ts, 0, 43))
c.b;
>c.b : Symbol((Anonymous class).b, Decl(classExpression3.ts, 0, 53))
>c : Symbol(c, Decl(classExpression3.ts, 1, 3))
>b : Symbol((Anonymous class).b, Decl(classExpression3.ts, 0, 53))
c.c;
>c.c : Symbol((Anonymous class).c, Decl(classExpression3.ts, 0, 63))
>c : Symbol(c, Decl(classExpression3.ts, 1, 3))
>c : Symbol((Anonymous class).c, Decl(classExpression3.ts, 0, 63))
@@ -0,0 +1,33 @@
=== tests/cases/conformance/classes/classExpressions/classExpression3.ts ===
let C = class extends class extends class { a = 1 } { b = 2 } { c = 3 };
>C : typeof (Anonymous class)
>class extends class extends class { a = 1 } { b = 2 } { c = 3 } : typeof (Anonymous class)
>class extends class { a = 1 } { b = 2 } : (Anonymous class)
>class { a = 1 } : (Anonymous class)
>a : number
>1 : number
>b : number
>2 : number
>c : number
>3 : number
let c = new C();
>c : (Anonymous class)
>new C() : (Anonymous class)
>C : typeof (Anonymous class)
c.a;
>c.a : number
>c : (Anonymous class)
>a : number
c.b;
>c.b : number
>c : (Anonymous class)
>b : number
c.c;
>c.c : number
>c : (Anonymous class)
>c : number
@@ -0,0 +1,19 @@
//// [classExpression4.ts]
let C = class {
foo() {
return new C();
}
};
let x = (new C).foo();
//// [classExpression4.js]
var C = (function () {
function class_1() {
}
class_1.prototype.foo = function () {
return new C();
};
return class_1;
})();
var x = (new C).foo();
@@ -0,0 +1,17 @@
=== tests/cases/conformance/classes/classExpressions/classExpression4.ts ===
let C = class {
>C : Symbol(C, Decl(classExpression4.ts, 0, 3))
foo() {
>foo : Symbol((Anonymous class).foo, Decl(classExpression4.ts, 0, 15))
return new C();
>C : Symbol(C, Decl(classExpression4.ts, 0, 3))
}
};
let x = (new C).foo();
>x : Symbol(x, Decl(classExpression4.ts, 5, 3))
>(new C).foo : Symbol((Anonymous class).foo, Decl(classExpression4.ts, 0, 15))
>C : Symbol(C, Decl(classExpression4.ts, 0, 3))
>foo : Symbol((Anonymous class).foo, Decl(classExpression4.ts, 0, 15))
@@ -0,0 +1,22 @@
=== tests/cases/conformance/classes/classExpressions/classExpression4.ts ===
let C = class {
>C : typeof (Anonymous class)
>class { foo() { return new C(); }} : typeof (Anonymous class)
foo() {
>foo : () => (Anonymous class)
return new C();
>new C() : (Anonymous class)
>C : typeof (Anonymous class)
}
};
let x = (new C).foo();
>x : (Anonymous class)
>(new C).foo() : (Anonymous class)
>(new C).foo : () => (Anonymous class)
>(new C) : (Anonymous class)
>new C : (Anonymous class)
>C : typeof (Anonymous class)
>foo : () => (Anonymous class)
@@ -1,7 +0,0 @@
tests/cases/conformance/es6/classExpressions/classExpressionES61.ts(1,15): error TS9003: 'class' expressions are not currently supported.
==== tests/cases/conformance/es6/classExpressions/classExpressionES61.ts (1 errors) ====
var v = class C {};
~
!!! error TS9003: 'class' expressions are not currently supported.
@@ -0,0 +1,5 @@
=== tests/cases/conformance/es6/classExpressions/classExpressionES61.ts ===
var v = class C {};
>v : Symbol(v, Decl(classExpressionES61.ts, 0, 3))
>C : Symbol(C, Decl(classExpressionES61.ts, 0, 7))
@@ -0,0 +1,6 @@
=== tests/cases/conformance/es6/classExpressions/classExpressionES61.ts ===
var v = class C {};
>v : typeof C
>class C {} : typeof C
>C : typeof C
@@ -1,8 +0,0 @@
tests/cases/conformance/es6/classExpressions/classExpressionES62.ts(2,15): error TS9003: 'class' expressions are not currently supported.
==== tests/cases/conformance/es6/classExpressions/classExpressionES62.ts (1 errors) ====
class D { }
var v = class C extends D {};
~
!!! error TS9003: 'class' expressions are not currently supported.
@@ -0,0 +1,9 @@
=== tests/cases/conformance/es6/classExpressions/classExpressionES62.ts ===
class D { }
>D : Symbol(D, Decl(classExpressionES62.ts, 0, 0))
var v = class C extends D {};
>v : Symbol(v, Decl(classExpressionES62.ts, 1, 3))
>C : Symbol(C, Decl(classExpressionES62.ts, 1, 7))
>D : Symbol(D, Decl(classExpressionES62.ts, 0, 0))
@@ -0,0 +1,10 @@
=== tests/cases/conformance/es6/classExpressions/classExpressionES62.ts ===
class D { }
>D : D
var v = class C extends D {};
>v : typeof C
>class C extends D {} : typeof C
>C : typeof C
>D : D
@@ -0,0 +1,31 @@
//// [classExpressionES63.ts]
let C = class extends class extends class { a = 1 } { b = 2 } { c = 3 };
let c = new C();
c.a;
c.b;
c.c;
//// [classExpressionES63.js]
let C = class class_1 extends class class_2 extends class class_3 {
constructor() {
this.a = 1;
}
}
{
constructor(...args) {
super(...args);
this.b = 2;
}
}
{
constructor(...args) {
super(...args);
this.c = 3;
}
}
;
let c = new C();
c.a;
c.b;
c.c;
@@ -0,0 +1,26 @@
=== tests/cases/conformance/es6/classExpressions/classExpressionES63.ts ===
let C = class extends class extends class { a = 1 } { b = 2 } { c = 3 };
>C : Symbol(C, Decl(classExpressionES63.ts, 0, 3))
>a : Symbol((Anonymous class).a, Decl(classExpressionES63.ts, 0, 43))
>b : Symbol((Anonymous class).b, Decl(classExpressionES63.ts, 0, 53))
>c : Symbol((Anonymous class).c, Decl(classExpressionES63.ts, 0, 63))
let c = new C();
>c : Symbol(c, Decl(classExpressionES63.ts, 1, 3))
>C : Symbol(C, Decl(classExpressionES63.ts, 0, 3))
c.a;
>c.a : Symbol((Anonymous class).a, Decl(classExpressionES63.ts, 0, 43))
>c : Symbol(c, Decl(classExpressionES63.ts, 1, 3))
>a : Symbol((Anonymous class).a, Decl(classExpressionES63.ts, 0, 43))
c.b;
>c.b : Symbol((Anonymous class).b, Decl(classExpressionES63.ts, 0, 53))
>c : Symbol(c, Decl(classExpressionES63.ts, 1, 3))
>b : Symbol((Anonymous class).b, Decl(classExpressionES63.ts, 0, 53))
c.c;
>c.c : Symbol((Anonymous class).c, Decl(classExpressionES63.ts, 0, 63))
>c : Symbol(c, Decl(classExpressionES63.ts, 1, 3))
>c : Symbol((Anonymous class).c, Decl(classExpressionES63.ts, 0, 63))
@@ -0,0 +1,33 @@
=== tests/cases/conformance/es6/classExpressions/classExpressionES63.ts ===
let C = class extends class extends class { a = 1 } { b = 2 } { c = 3 };
>C : typeof (Anonymous class)
>class extends class extends class { a = 1 } { b = 2 } { c = 3 } : typeof (Anonymous class)
>class extends class { a = 1 } { b = 2 } : (Anonymous class)
>class { a = 1 } : (Anonymous class)
>a : number
>1 : number
>b : number
>2 : number
>c : number
>3 : number
let c = new C();
>c : (Anonymous class)
>new C() : (Anonymous class)
>C : typeof (Anonymous class)
c.a;
>c.a : number
>c : (Anonymous class)
>a : number
c.b;
>c.b : number
>c : (Anonymous class)
>b : number
c.c;
>c.c : number
>c : (Anonymous class)
>c : number
@@ -1,21 +0,0 @@
tests/cases/compiler/classExpressionTest2.ts(2,19): error TS9003: 'class' expressions are not currently supported.
tests/cases/compiler/classExpressionTest2.ts(5,20): error TS2304: Cannot find name 'X'.
==== tests/cases/compiler/classExpressionTest2.ts (2 errors) ====
function M() {
var m = class C<X> {
~
!!! error TS9003: 'class' expressions are not currently supported.
f<T>() {
var t: T;
var x: X;
~
!!! error TS2304: Cannot find name 'X'.
return { t, x };
}
}
var v = new m<number>();
return v.f<string>();
}
@@ -0,0 +1,36 @@
=== tests/cases/compiler/classExpressionTest2.ts ===
function M() {
>M : Symbol(M, Decl(classExpressionTest2.ts, 0, 0))
var m = class C<X> {
>m : Symbol(m, Decl(classExpressionTest2.ts, 1, 7))
>C : Symbol(C, Decl(classExpressionTest2.ts, 1, 11))
>X : Symbol(X, Decl(classExpressionTest2.ts, 1, 20))
f<T>() {
>f : Symbol(C.f, Decl(classExpressionTest2.ts, 1, 24))
>T : Symbol(T, Decl(classExpressionTest2.ts, 2, 10))
var t: T;
>t : Symbol(t, Decl(classExpressionTest2.ts, 3, 15))
>T : Symbol(T, Decl(classExpressionTest2.ts, 2, 10))
var x: X;
>x : Symbol(x, Decl(classExpressionTest2.ts, 4, 15))
>X : Symbol(X, Decl(classExpressionTest2.ts, 1, 20))
return { t, x };
>t : Symbol(t, Decl(classExpressionTest2.ts, 5, 20))
>x : Symbol(x, Decl(classExpressionTest2.ts, 5, 23))
}
}
var v = new m<number>();
>v : Symbol(v, Decl(classExpressionTest2.ts, 9, 7))
>m : Symbol(m, Decl(classExpressionTest2.ts, 1, 7))
return v.f<string>();
>v.f : Symbol(C.f, Decl(classExpressionTest2.ts, 1, 24))
>v : Symbol(v, Decl(classExpressionTest2.ts, 9, 7))
>f : Symbol(C.f, Decl(classExpressionTest2.ts, 1, 24))
}
@@ -0,0 +1,40 @@
=== tests/cases/compiler/classExpressionTest2.ts ===
function M() {
>M : () => { t: string; x: number; }
var m = class C<X> {
>m : typeof C
>class C<X> { f<T>() { var t: T; var x: X; return { t, x }; } } : typeof C
>C : typeof C
>X : X
f<T>() {
>f : <T>() => { t: T; x: X; }
>T : T
var t: T;
>t : T
>T : T
var x: X;
>x : X
>X : X
return { t, x };
>{ t, x } : { t: T; x: X; }
>t : T
>x : X
}
}
var v = new m<number>();
>v : <number>
>new m<number>() : <number>
>m : typeof C
return v.f<string>();
>v.f<string>() : { t: string; x: number; }
>v.f : <T>() => { t: T; x: number; }
>v : <number>
>f : <T>() => { t: T; x: number; }
}
@@ -1,14 +0,0 @@
tests/cases/compiler/classExpressionWithResolutionOfNamespaceOfSameName01.ts(6,15): error TS9003: 'class' expressions are not currently supported.
==== tests/cases/compiler/classExpressionWithResolutionOfNamespaceOfSameName01.ts (1 errors) ====
namespace C {
export interface type {
}
}
var x = class C {
~
!!! error TS9003: 'class' expressions are not currently supported.
prop: C.type;
}
@@ -0,0 +1,18 @@
=== tests/cases/compiler/classExpressionWithResolutionOfNamespaceOfSameName01.ts ===
namespace C {
>C : Symbol(C, Decl(classExpressionWithResolutionOfNamespaceOfSameName01.ts, 0, 0))
export interface type {
>type : Symbol(type, Decl(classExpressionWithResolutionOfNamespaceOfSameName01.ts, 0, 13))
}
}
var x = class C {
>x : Symbol(x, Decl(classExpressionWithResolutionOfNamespaceOfSameName01.ts, 5, 3))
>C : Symbol(C, Decl(classExpressionWithResolutionOfNamespaceOfSameName01.ts, 5, 7))
prop: C.type;
>prop : Symbol(C.prop, Decl(classExpressionWithResolutionOfNamespaceOfSameName01.ts, 5, 17))
>C : Symbol(C, Decl(classExpressionWithResolutionOfNamespaceOfSameName01.ts, 0, 0))
>type : Symbol(C.type, Decl(classExpressionWithResolutionOfNamespaceOfSameName01.ts, 0, 13))
}
@@ -0,0 +1,19 @@
=== tests/cases/compiler/classExpressionWithResolutionOfNamespaceOfSameName01.ts ===
namespace C {
>C : any
export interface type {
>type : type
}
}
var x = class C {
>x : typeof C
>class C { prop: C.type;} : typeof C
>C : typeof C
prop: C.type;
>prop : C.type
>C : any
>type : C.type
}
@@ -1,7 +0,0 @@
tests/cases/compiler/classExpressionWithStaticProperties1.ts(1,15): error TS9003: 'class' expressions are not currently supported.
==== tests/cases/compiler/classExpressionWithStaticProperties1.ts (1 errors) ====
var v = class C { static a = 1; static b = 2 };
~
!!! error TS9003: 'class' expressions are not currently supported.
@@ -0,0 +1,7 @@
=== tests/cases/compiler/classExpressionWithStaticProperties1.ts ===
var v = class C { static a = 1; static b = 2 };
>v : Symbol(v, Decl(classExpressionWithStaticProperties1.ts, 0, 3))
>C : Symbol(C, Decl(classExpressionWithStaticProperties1.ts, 0, 7))
>a : Symbol(C.a, Decl(classExpressionWithStaticProperties1.ts, 0, 17))
>b : Symbol(C.b, Decl(classExpressionWithStaticProperties1.ts, 0, 31))
@@ -0,0 +1,10 @@
=== tests/cases/compiler/classExpressionWithStaticProperties1.ts ===
var v = class C { static a = 1; static b = 2 };
>v : typeof C
>class C { static a = 1; static b = 2 } : typeof C
>C : typeof C
>a : number
>1 : number
>b : number
>2 : number
@@ -1,7 +0,0 @@
tests/cases/compiler/classExpressionWithStaticProperties2.ts(1,15): error TS9003: 'class' expressions are not currently supported.
==== tests/cases/compiler/classExpressionWithStaticProperties2.ts (1 errors) ====
var v = class C { static a = 1; static b };
~
!!! error TS9003: 'class' expressions are not currently supported.
@@ -0,0 +1,7 @@
=== tests/cases/compiler/classExpressionWithStaticProperties2.ts ===
var v = class C { static a = 1; static b };
>v : Symbol(v, Decl(classExpressionWithStaticProperties2.ts, 0, 3))
>C : Symbol(C, Decl(classExpressionWithStaticProperties2.ts, 0, 7))
>a : Symbol(C.a, Decl(classExpressionWithStaticProperties2.ts, 0, 17))
>b : Symbol(C.b, Decl(classExpressionWithStaticProperties2.ts, 0, 31))
@@ -0,0 +1,9 @@
=== tests/cases/compiler/classExpressionWithStaticProperties2.ts ===
var v = class C { static a = 1; static b };
>v : typeof C
>class C { static a = 1; static b } : typeof C
>C : typeof C
>a : number
>1 : number
>b : any
@@ -1,7 +0,0 @@
tests/cases/compiler/classExpressionWithStaticPropertiesES61.ts(1,15): error TS9003: 'class' expressions are not currently supported.
==== tests/cases/compiler/classExpressionWithStaticPropertiesES61.ts (1 errors) ====
var v = class C { static a = 1; static b = 2 };
~
!!! error TS9003: 'class' expressions are not currently supported.
@@ -0,0 +1,7 @@
=== tests/cases/compiler/classExpressionWithStaticPropertiesES61.ts ===
var v = class C { static a = 1; static b = 2 };
>v : Symbol(v, Decl(classExpressionWithStaticPropertiesES61.ts, 0, 3))
>C : Symbol(C, Decl(classExpressionWithStaticPropertiesES61.ts, 0, 7))
>a : Symbol(C.a, Decl(classExpressionWithStaticPropertiesES61.ts, 0, 17))
>b : Symbol(C.b, Decl(classExpressionWithStaticPropertiesES61.ts, 0, 31))
@@ -0,0 +1,10 @@
=== tests/cases/compiler/classExpressionWithStaticPropertiesES61.ts ===
var v = class C { static a = 1; static b = 2 };
>v : typeof C
>class C { static a = 1; static b = 2 } : typeof C
>C : typeof C
>a : number
>1 : number
>b : number
>2 : number
@@ -1,7 +0,0 @@
tests/cases/compiler/classExpressionWithStaticPropertiesES62.ts(1,15): error TS9003: 'class' expressions are not currently supported.
==== tests/cases/compiler/classExpressionWithStaticPropertiesES62.ts (1 errors) ====
var v = class C { static a = 1; static b };
~
!!! error TS9003: 'class' expressions are not currently supported.
@@ -0,0 +1,7 @@
=== tests/cases/compiler/classExpressionWithStaticPropertiesES62.ts ===
var v = class C { static a = 1; static b };
>v : Symbol(v, Decl(classExpressionWithStaticPropertiesES62.ts, 0, 3))
>C : Symbol(C, Decl(classExpressionWithStaticPropertiesES62.ts, 0, 7))
>a : Symbol(C.a, Decl(classExpressionWithStaticPropertiesES62.ts, 0, 17))
>b : Symbol(C.b, Decl(classExpressionWithStaticPropertiesES62.ts, 0, 31))
@@ -0,0 +1,9 @@
=== tests/cases/compiler/classExpressionWithStaticPropertiesES62.ts ===
var v = class C { static a = 1; static b };
>v : typeof C
>class C { static a = 1; static b } : typeof C
>C : typeof C
>a : number
>1 : number
>b : any
@@ -15,20 +15,16 @@ function baz4({} = { x: 10 }) { }
// For an array binding pattern with empty elements,
// we will not make any modification and will emit
// the similar binding pattern users' have written
function baz(_a) {
var ;
}
function baz(_a) { }
function baz1(_a) {
var _b = _a === void 0 ? [1, 2, 3] : _a;
var _a = [1, 2, 3];
}
function baz2(_a) {
var _b = (_a === void 0 ? [[1, 2, 3]] : _a)[0];
}
function baz3(_a) {
var ;
}
function baz3(_a) { }
function baz4(_a) {
var _b = _a === void 0 ? { x: 10 } : _a;
var _a = { x: 10 };
}
@@ -1,7 +1,7 @@
//// [tests/cases/conformance/decorators/class/decoratedClassFromExternalModule.ts] ////
//// [decorated.ts]
function decorate() { }
function decorate(target: any) { }
@decorate
export default class Decorated { }
@@ -18,7 +18,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
}
};
function decorate() { }
function decorate(target) { }
let Decorated = class {
};
Decorated = __decorate([
@@ -1,12 +1,13 @@
=== tests/cases/conformance/decorators/class/decorated.ts ===
function decorate() { }
function decorate(target: any) { }
>decorate : Symbol(decorate, Decl(decorated.ts, 0, 0))
>target : Symbol(target, Decl(decorated.ts, 0, 18))
@decorate
>decorate : Symbol(decorate, Decl(decorated.ts, 0, 0))
export default class Decorated { }
>Decorated : Symbol(Decorated, Decl(decorated.ts, 0, 23))
>Decorated : Symbol(Decorated, Decl(decorated.ts, 0, 34))
=== tests/cases/conformance/decorators/class/undecorated.ts ===
import Decorated from 'decorated';
@@ -1,9 +1,10 @@
=== tests/cases/conformance/decorators/class/decorated.ts ===
function decorate() { }
>decorate : () => void
function decorate(target: any) { }
>decorate : (target: any) => void
>target : any
@decorate
>decorate : () => void
>decorate : (target: any) => void
export default class Decorated { }
>Decorated : Decorated
@@ -8,7 +8,7 @@ tests/cases/conformance/decorators/class/decoratorChecksFunctionBodies.ts(9,14):
}
class A {
@(x => {
@((x, p) => {
var a = 3;
func(a);
~
@@ -5,7 +5,7 @@ function func(s: string): void {
}
class A {
@(x => {
@((x, p) => {
var a = 3;
func(a);
return x;
@@ -34,7 +34,7 @@ var A = (function () {
};
Object.defineProperty(A.prototype, "m",
__decorate([
(function (x) {
(function (x, p) {
var a = 3;
func(a);
return x;
@@ -9,7 +9,7 @@ export var test = 'abc';
import { test } from './a';
function filter(handler: any) {
return function (target: any) {
return function (target: any, propertyKey: string) {
// ...
};
}
@@ -35,7 +35,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
};
var a_1 = require('./a');
function filter(handler) {
return function (target) {
return function (target, propertyKey) {
// ...
};
}
@@ -12,8 +12,9 @@ function filter(handler: any) {
>filter : Symbol(filter, Decl(b.ts, 0, 27))
>handler : Symbol(handler, Decl(b.ts, 2, 16))
return function (target: any) {
return function (target: any, propertyKey: string) {
>target : Symbol(target, Decl(b.ts, 3, 21))
>propertyKey : Symbol(propertyKey, Decl(b.ts, 3, 33))
// ...
};
@@ -10,12 +10,13 @@ import { test } from './a';
>test : string
function filter(handler: any) {
>filter : (handler: any) => (target: any) => void
>filter : (handler: any) => (target: any, propertyKey: string) => void
>handler : any
return function (target: any) {
>function (target: any) { // ... } : (target: any) => void
return function (target: any, propertyKey: string) {
>function (target: any, propertyKey: string) { // ... } : (target: any, propertyKey: string) => void
>target : any
>propertyKey : string
// ...
};
@@ -25,8 +26,8 @@ class Wat {
>Wat : Wat
@filter(() => test == 'abc')
>filter(() => test == 'abc') : (target: any) => void
>filter : (handler: any) => (target: any) => void
>filter(() => test == 'abc') : (target: any, propertyKey: string) => void
>filter : (handler: any) => (target: any, propertyKey: string) => void
>() => test == 'abc' : () => boolean
>test == 'abc' : boolean
>test : string
@@ -1,4 +1,5 @@
tests/cases/conformance/decorators/class/decoratorOnClass8.ts(3,1): error TS2322: Type '(target: Function, paramIndex: number) => void' is not assignable to type '(target: typeof C) => void | typeof C'.
tests/cases/conformance/decorators/class/decoratorOnClass8.ts(3,1): error TS1238: Unable to resolve signature of class decorator when called as an expression.
Supplied parameters do not match any signature of call target.
==== tests/cases/conformance/decorators/class/decoratorOnClass8.ts (1 errors) ====
@@ -6,6 +7,7 @@ tests/cases/conformance/decorators/class/decoratorOnClass8.ts(3,1): error TS2322
@dec()
~~~~~~
!!! error TS2322: Type '(target: Function, paramIndex: number) => void' is not assignable to type '(target: typeof C) => void | typeof C'.
!!! error TS1238: Unable to resolve signature of class decorator when called as an expression.
!!! error TS1238: Supplied parameters do not match any signature of call target.
class C {
}
@@ -1,7 +1,5 @@
tests/cases/conformance/decorators/class/method/decoratorOnClassMethod10.ts(4,5): error TS2322: Type '(target: Function, paramIndex: number) => void' is not assignable to type '(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<() => void>) => void | TypedPropertyDescriptor<() => void>'.
Types of parameters 'paramIndex' and 'propertyKey' are incompatible.
Type 'number' is not assignable to type 'string | symbol'.
Type 'number' is not assignable to type 'symbol'.
tests/cases/conformance/decorators/class/method/decoratorOnClassMethod10.ts(4,6): error TS2345: Argument of type 'C' is not assignable to parameter of type 'Function'.
Property 'apply' is missing in type 'C'.
==== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod10.ts (1 errors) ====
@@ -9,9 +7,7 @@ tests/cases/conformance/decorators/class/method/decoratorOnClassMethod10.ts(4,5)
class C {
@dec method() {}
~~~~
!!! error TS2322: Type '(target: Function, paramIndex: number) => void' is not assignable to type '(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<() => void>) => void | TypedPropertyDescriptor<() => void>'.
!!! error TS2322: Types of parameters 'paramIndex' and 'propertyKey' are incompatible.
!!! error TS2322: Type 'number' is not assignable to type 'string | symbol'.
!!! error TS2322: Type 'number' is not assignable to type 'symbol'.
~~~
!!! error TS2345: Argument of type 'C' is not assignable to parameter of type 'Function'.
!!! error TS2345: Property 'apply' is missing in type 'C'.
}
@@ -1,5 +1,5 @@
//// [decoratorOnClassMethod13.ts]
declare function dec(): <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>;
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
class C {
@dec ["1"]() { }
@@ -1,17 +1,17 @@
=== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod13.ts ===
declare function dec(): <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>;
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
>dec : Symbol(dec, Decl(decoratorOnClassMethod13.ts, 0, 0))
>T : Symbol(T, Decl(decoratorOnClassMethod13.ts, 0, 25))
>target : Symbol(target, Decl(decoratorOnClassMethod13.ts, 0, 28))
>propertyKey : Symbol(propertyKey, Decl(decoratorOnClassMethod13.ts, 0, 40))
>descriptor : Symbol(descriptor, Decl(decoratorOnClassMethod13.ts, 0, 61))
>T : Symbol(T, Decl(decoratorOnClassMethod13.ts, 0, 21))
>target : Symbol(target, Decl(decoratorOnClassMethod13.ts, 0, 24))
>propertyKey : Symbol(propertyKey, Decl(decoratorOnClassMethod13.ts, 0, 36))
>descriptor : Symbol(descriptor, Decl(decoratorOnClassMethod13.ts, 0, 57))
>TypedPropertyDescriptor : Symbol(TypedPropertyDescriptor, Decl(lib.d.ts, 1171, 36))
>T : Symbol(T, Decl(decoratorOnClassMethod13.ts, 0, 25))
>T : Symbol(T, Decl(decoratorOnClassMethod13.ts, 0, 21))
>TypedPropertyDescriptor : Symbol(TypedPropertyDescriptor, Decl(lib.d.ts, 1171, 36))
>T : Symbol(T, Decl(decoratorOnClassMethod13.ts, 0, 25))
>T : Symbol(T, Decl(decoratorOnClassMethod13.ts, 0, 21))
class C {
>C : Symbol(C, Decl(decoratorOnClassMethod13.ts, 0, 132))
>C : Symbol(C, Decl(decoratorOnClassMethod13.ts, 0, 126))
@dec ["1"]() { }
>dec : Symbol(dec, Decl(decoratorOnClassMethod13.ts, 0, 0))
@@ -1,6 +1,6 @@
=== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod13.ts ===
declare function dec(): <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>;
>dec : () => <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
>T : T
>target : any
>propertyKey : string
@@ -14,10 +14,10 @@ class C {
>C : C
@dec ["1"]() { }
>dec : () => <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
>"1" : string
@dec ["b"]() { }
>dec : () => <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
>"b" : string
}
@@ -0,0 +1,13 @@
tests/cases/conformance/decorators/class/method/decoratorOnClassMethod6.ts(4,5): error TS1241: Unable to resolve signature of method decorator when called as an expression.
Supplied parameters do not match any signature of call target.
==== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod6.ts (1 errors) ====
declare function dec(): <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>;
class C {
@dec ["method"]() {}
~~~~
!!! error TS1241: Unable to resolve signature of method decorator when called as an expression.
!!! error TS1241: Supplied parameters do not match any signature of call target.
}
@@ -1,18 +0,0 @@
=== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod6.ts ===
declare function dec(): <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>;
>dec : Symbol(dec, Decl(decoratorOnClassMethod6.ts, 0, 0))
>T : Symbol(T, Decl(decoratorOnClassMethod6.ts, 0, 25))
>target : Symbol(target, Decl(decoratorOnClassMethod6.ts, 0, 28))
>propertyKey : Symbol(propertyKey, Decl(decoratorOnClassMethod6.ts, 0, 40))
>descriptor : Symbol(descriptor, Decl(decoratorOnClassMethod6.ts, 0, 61))
>TypedPropertyDescriptor : Symbol(TypedPropertyDescriptor, Decl(lib.d.ts, 1171, 36))
>T : Symbol(T, Decl(decoratorOnClassMethod6.ts, 0, 25))
>TypedPropertyDescriptor : Symbol(TypedPropertyDescriptor, Decl(lib.d.ts, 1171, 36))
>T : Symbol(T, Decl(decoratorOnClassMethod6.ts, 0, 25))
class C {
>C : Symbol(C, Decl(decoratorOnClassMethod6.ts, 0, 132))
@dec ["method"]() {}
>dec : Symbol(dec, Decl(decoratorOnClassMethod6.ts, 0, 0))
}
@@ -1,19 +0,0 @@
=== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod6.ts ===
declare function dec(): <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>;
>dec : () => <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
>T : T
>target : any
>propertyKey : string
>descriptor : TypedPropertyDescriptor<T>
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
>T : T
class C {
>C : C
@dec ["method"]() {}
>dec : () => <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
>"method" : string
}
@@ -0,0 +1,13 @@
tests/cases/conformance/decorators/class/method/decoratorOnClassMethod8.ts(4,5): error TS1241: Unable to resolve signature of method decorator when called as an expression.
Supplied parameters do not match any signature of call target.
==== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod8.ts (1 errors) ====
declare function dec<T>(target: T): T;
class C {
@dec method() {}
~~~~
!!! error TS1241: Unable to resolve signature of method decorator when called as an expression.
!!! error TS1241: Supplied parameters do not match any signature of call target.
}
@@ -1,15 +0,0 @@
=== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod8.ts ===
declare function dec<T>(target: T): T;
>dec : Symbol(dec, Decl(decoratorOnClassMethod8.ts, 0, 0))
>T : Symbol(T, Decl(decoratorOnClassMethod8.ts, 0, 21))
>target : Symbol(target, Decl(decoratorOnClassMethod8.ts, 0, 24))
>T : Symbol(T, Decl(decoratorOnClassMethod8.ts, 0, 21))
>T : Symbol(T, Decl(decoratorOnClassMethod8.ts, 0, 21))
class C {
>C : Symbol(C, Decl(decoratorOnClassMethod8.ts, 0, 38))
@dec method() {}
>dec : Symbol(dec, Decl(decoratorOnClassMethod8.ts, 0, 0))
>method : Symbol(method, Decl(decoratorOnClassMethod8.ts, 2, 9))
}
@@ -1,15 +0,0 @@
=== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod8.ts ===
declare function dec<T>(target: T): T;
>dec : <T>(target: T) => T
>T : T
>target : T
>T : T
>T : T
class C {
>C : C
@dec method() {}
>dec : <T>(target: T) => T
>method : () => void
}
@@ -1,5 +1,5 @@
//// [decoratorOnClassMethodParameter1.ts]
declare function dec(target: Function, propertyKey: string | symbol, parameterIndex: number): void;
declare function dec(target: Object, propertyKey: string | symbol, parameterIndex: number): void;
class C {
method(@dec p: number) {}
@@ -1,13 +1,13 @@
=== tests/cases/conformance/decorators/class/method/parameter/decoratorOnClassMethodParameter1.ts ===
declare function dec(target: Function, propertyKey: string | symbol, parameterIndex: number): void;
declare function dec(target: Object, propertyKey: string | symbol, parameterIndex: number): void;
>dec : Symbol(dec, Decl(decoratorOnClassMethodParameter1.ts, 0, 0))
>target : Symbol(target, Decl(decoratorOnClassMethodParameter1.ts, 0, 21))
>Function : Symbol(Function, Decl(lib.d.ts, 223, 38), Decl(lib.d.ts, 269, 11))
>propertyKey : Symbol(propertyKey, Decl(decoratorOnClassMethodParameter1.ts, 0, 38))
>parameterIndex : Symbol(parameterIndex, Decl(decoratorOnClassMethodParameter1.ts, 0, 68))
>Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11))
>propertyKey : Symbol(propertyKey, Decl(decoratorOnClassMethodParameter1.ts, 0, 36))
>parameterIndex : Symbol(parameterIndex, Decl(decoratorOnClassMethodParameter1.ts, 0, 66))
class C {
>C : Symbol(C, Decl(decoratorOnClassMethodParameter1.ts, 0, 99))
>C : Symbol(C, Decl(decoratorOnClassMethodParameter1.ts, 0, 97))
method(@dec p: number) {}
>method : Symbol(method, Decl(decoratorOnClassMethodParameter1.ts, 2, 9))
@@ -1,8 +1,8 @@
=== tests/cases/conformance/decorators/class/method/parameter/decoratorOnClassMethodParameter1.ts ===
declare function dec(target: Function, propertyKey: string | symbol, parameterIndex: number): void;
>dec : (target: Function, propertyKey: string | symbol, parameterIndex: number) => void
>target : Function
>Function : Function
declare function dec(target: Object, propertyKey: string | symbol, parameterIndex: number): void;
>dec : (target: Object, propertyKey: string | symbol, parameterIndex: number) => void
>target : Object
>Object : Object
>propertyKey : string | symbol
>parameterIndex : number
@@ -11,6 +11,6 @@ class C {
method(@dec p: number) {}
>method : (p: number) => void
>dec : (target: Function, propertyKey: string | symbol, parameterIndex: number) => void
>dec : (target: Object, propertyKey: string | symbol, parameterIndex: number) => void
>p : number
}
@@ -0,0 +1,13 @@
tests/cases/conformance/decorators/class/property/decoratorOnClassProperty11.ts(4,5): error TS1240: Unable to resolve signature of property decorator when called as an expression.
Supplied parameters do not match any signature of call target.
==== tests/cases/conformance/decorators/class/property/decoratorOnClassProperty11.ts (1 errors) ====
declare function dec(): <T>(target: any, propertyKey: string) => void;
class C {
@dec prop;
~~~~
!!! error TS1240: Unable to resolve signature of property decorator when called as an expression.
!!! error TS1240: Supplied parameters do not match any signature of call target.
}
@@ -1,14 +0,0 @@
=== tests/cases/conformance/decorators/class/property/decoratorOnClassProperty11.ts ===
declare function dec(): <T>(target: any, propertyKey: string) => void;
>dec : Symbol(dec, Decl(decoratorOnClassProperty11.ts, 0, 0))
>T : Symbol(T, Decl(decoratorOnClassProperty11.ts, 0, 25))
>target : Symbol(target, Decl(decoratorOnClassProperty11.ts, 0, 28))
>propertyKey : Symbol(propertyKey, Decl(decoratorOnClassProperty11.ts, 0, 40))
class C {
>C : Symbol(C, Decl(decoratorOnClassProperty11.ts, 0, 70))
@dec prop;
>dec : Symbol(dec, Decl(decoratorOnClassProperty11.ts, 0, 0))
>prop : Symbol(prop, Decl(decoratorOnClassProperty11.ts, 2, 9))
}
@@ -1,14 +0,0 @@
=== tests/cases/conformance/decorators/class/property/decoratorOnClassProperty11.ts ===
declare function dec(): <T>(target: any, propertyKey: string) => void;
>dec : () => <T>(target: any, propertyKey: string) => void
>T : T
>target : any
>propertyKey : string
class C {
>C : C
@dec prop;
>dec : () => <T>(target: any, propertyKey: string) => void
>prop : any
}
@@ -0,0 +1,13 @@
tests/cases/conformance/decorators/class/property/decoratorOnClassProperty6.ts(4,5): error TS1240: Unable to resolve signature of property decorator when called as an expression.
Supplied parameters do not match any signature of call target.
==== tests/cases/conformance/decorators/class/property/decoratorOnClassProperty6.ts (1 errors) ====
declare function dec(target: Function): void;
class C {
@dec prop;
~~~~
!!! error TS1240: Unable to resolve signature of property decorator when called as an expression.
!!! error TS1240: Supplied parameters do not match any signature of call target.
}
@@ -1,13 +0,0 @@
=== tests/cases/conformance/decorators/class/property/decoratorOnClassProperty6.ts ===
declare function dec(target: Function): void;
>dec : Symbol(dec, Decl(decoratorOnClassProperty6.ts, 0, 0))
>target : Symbol(target, Decl(decoratorOnClassProperty6.ts, 0, 21))
>Function : Symbol(Function, Decl(lib.d.ts, 223, 38), Decl(lib.d.ts, 269, 11))
class C {
>C : Symbol(C, Decl(decoratorOnClassProperty6.ts, 0, 45))
@dec prop;
>dec : Symbol(dec, Decl(decoratorOnClassProperty6.ts, 0, 0))
>prop : Symbol(prop, Decl(decoratorOnClassProperty6.ts, 2, 9))
}

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