diff --git a/doc/TypeScript Language Specification (Change Markup).docx b/doc/TypeScript Language Specification (Change Markup).docx index b3a0384f92..ea005d5640 100644 Binary files a/doc/TypeScript Language Specification (Change Markup).docx and b/doc/TypeScript Language Specification (Change Markup).docx differ diff --git a/doc/TypeScript Language Specification (Change Markup) .pdf b/doc/TypeScript Language Specification (Change Markup).pdf similarity index 50% rename from doc/TypeScript Language Specification (Change Markup) .pdf rename to doc/TypeScript Language Specification (Change Markup).pdf index 2b37fc55f3..f732773794 100644 Binary files a/doc/TypeScript Language Specification (Change Markup) .pdf and b/doc/TypeScript Language Specification (Change Markup).pdf differ diff --git a/doc/TypeScript Language Specification.docx b/doc/TypeScript Language Specification.docx index 7fce1932d8..9a2d948ea0 100644 Binary files a/doc/TypeScript Language Specification.docx and b/doc/TypeScript Language Specification.docx differ diff --git a/doc/TypeScript Language Specification.pdf b/doc/TypeScript Language Specification.pdf index b9223f922d..fbdee39c06 100644 Binary files a/doc/TypeScript Language Specification.pdf and b/doc/TypeScript Language Specification.pdf differ diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index bae4b6abb3..3959335542 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -226,7 +226,7 @@ module ts { function bindConstructorDeclaration(node: ConstructorDeclaration) { bindDeclaration(node, SymbolFlags.Constructor, 0); forEach(node.parameters, p => { - if (p.flags & (NodeFlags.Public | NodeFlags.Private)) { + if (p.flags & (NodeFlags.Public | NodeFlags.Private | NodeFlags.Protected)) { bindDeclaration(p, SymbolFlags.Property, SymbolFlags.PropertyExcludes); } }); diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index b227939daf..953bd3de49 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1282,8 +1282,8 @@ module ts { case SyntaxKind.Property: case SyntaxKind.Method: - if (node.flags & NodeFlags.Private) { - // Private properties/methods are not visible + if (node.flags & (NodeFlags.Private | NodeFlags.Protected)) { + // Private/protected properties/methods are not visible return false; } // Public properties/methods are visible if its parents are visible, so let it fall into next case statement @@ -2708,22 +2708,19 @@ module ts { } function isPropertyIdenticalToRecursive(sourceProp: Symbol, targetProp: Symbol, reportErrors: boolean, relate: (source: Type, target: Type, reportErrors: boolean) => boolean): boolean { - Debug.assert(sourceProp); - if (!targetProp) { - return false; - } - // Two members are considered identical when // - they are public properties with identical names, optionality, and types, - // - they are private properties originating in the same declaration and having identical types - var sourcePropIsPrivate = getDeclarationFlagsFromSymbol(sourceProp) & NodeFlags.Private; - var targetPropIsPrivate = getDeclarationFlagsFromSymbol(targetProp) & NodeFlags.Private; - if (sourcePropIsPrivate !== targetPropIsPrivate) { + // - they are private or protected properties originating in the same declaration and having identical types + if (sourceProp === targetProp) { + return true; + } + var sourcePropAccessibility = getDeclarationFlagsFromSymbol(sourceProp) & (NodeFlags.Private | NodeFlags.Protected); + var targetPropAccessibility = getDeclarationFlagsFromSymbol(targetProp) & (NodeFlags.Private | NodeFlags.Protected); + if (sourcePropAccessibility !== targetPropAccessibility) { return false; } - - if (sourcePropIsPrivate) { - return (getTargetSymbol(sourceProp).parent === getTargetSymbol(targetProp).parent) && relate(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp), reportErrors); + if (sourcePropAccessibility) { + return getTargetSymbol(sourceProp) === getTargetSymbol(targetProp) && relate(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp), reportErrors); } else { return isOptionalProperty(sourceProp) === isOptionalProperty(targetProp) && relate(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp), reportErrors); @@ -2749,8 +2746,8 @@ module ts { } return result; - function reportError(message: DiagnosticMessage, arg0?: string, arg1?: string): void { - errorInfo = chainDiagnosticMessages(errorInfo, message, arg0, arg1); + function reportError(message: DiagnosticMessage, arg0?: string, arg1?: string, arg2?: string): void { + errorInfo = chainDiagnosticMessages(errorInfo, message, arg0, arg1, arg2); } function isRelatedTo(source: Type, target: Type, reportErrors: boolean): boolean { @@ -2922,25 +2919,18 @@ module ts { } function propertiesAreIdenticalTo(source: ObjectType, target: ObjectType, reportErrors: boolean): boolean { - if (source === target) { - return true; - } - var sourceProperties = getPropertiesOfType(source); var targetProperties = getPropertiesOfType(target); if (sourceProperties.length !== targetProperties.length) { return false; } - for (var i = 0, len = sourceProperties.length; i < len; ++i) { var sourceProp = sourceProperties[i]; var targetProp = getPropertyOfType(target, sourceProp.name); - - if (!isPropertyIdenticalToRecursive(sourceProp, targetProp, reportErrors, isRelatedTo)) { + if (!targetProp || !isPropertyIdenticalToRecursive(sourceProp, targetProp, reportErrors, isRelatedTo)) { return false; } } - return true; } @@ -2949,50 +2939,72 @@ module ts { for (var i = 0; i < properties.length; i++) { var targetProp = properties[i]; var sourceProp = getPropertyOfApparentType(source, targetProp.name); - if (sourceProp === targetProp) { - continue; - } - - var targetPropIsOptional = isOptionalProperty(targetProp); - if (!sourceProp) { - if (!targetPropIsOptional) { - if (reportErrors) { - reportError(Diagnostics.Property_0_is_missing_in_type_1, symbolToString(targetProp), typeToString(source)); - } - return false; - } - } - else if (sourceProp !== targetProp) { - if (targetProp.flags & SymbolFlags.Prototype) { - continue; - } - - if (getDeclarationFlagsFromSymbol(sourceProp) & NodeFlags.Private || getDeclarationFlagsFromSymbol(targetProp) & NodeFlags.Private) { - if (sourceProp.valueDeclaration !== targetProp.valueDeclaration) { + if (sourceProp !== targetProp) { + if (!sourceProp) { + if (!isOptionalProperty(targetProp)) { if (reportErrors) { - reportError(Diagnostics.Private_property_0_cannot_be_reimplemented, symbolToString(targetProp)); + reportError(Diagnostics.Property_0_is_missing_in_type_1, symbolToString(targetProp), typeToString(source)); } return false; } } - if (!isRelatedTo(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp), reportErrors)) { - if (reportErrors) { - reportError(Diagnostics.Types_of_property_0_are_incompatible_Colon, symbolToString(targetProp)); + else if (!(targetProp.flags & SymbolFlags.Prototype)) { + var sourceFlags = getDeclarationFlagsFromSymbol(sourceProp); + var targetFlags = getDeclarationFlagsFromSymbol(targetProp); + if (sourceFlags & NodeFlags.Private || targetFlags & NodeFlags.Private) { + if (sourceProp.valueDeclaration !== targetProp.valueDeclaration) { + if (reportErrors) { + if (sourceFlags & NodeFlags.Private && targetFlags & NodeFlags.Private) { + reportError(Diagnostics.Types_have_separate_declarations_of_a_private_property_0, symbolToString(targetProp)); + } + else { + reportError(Diagnostics.Property_0_is_private_in_type_1_but_not_in_type_2, symbolToString(targetProp), + typeToString(sourceFlags & NodeFlags.Private ? source : target), + typeToString(sourceFlags & NodeFlags.Private ? target : source)); + } + } + return false; + } } - return false; - } - else if (isOptionalProperty(sourceProp) && !targetPropIsOptional) { - // TypeScript 1.0 spec (April 2014): 3.8.3 - // S is a subtype of a type T, and T is a supertype of S if ... - // S' and T are object types and, for each member M in T.. - // M is a property and S' contains a property N where - // if M is a required property, N is also a required property - // (M - property in T) - // (N - property in S) - if (reportErrors) { - reportError(Diagnostics.Required_property_0_cannot_be_reimplemented_with_optional_property_in_1, targetProp.name, typeToString(source)); + else if (targetFlags & NodeFlags.Protected) { + var sourceDeclaredInClass = sourceProp.parent && sourceProp.parent.flags & SymbolFlags.Class; + var sourceClass = sourceDeclaredInClass ? getDeclaredTypeOfSymbol(sourceProp.parent) : undefined; + var targetClass = getDeclaredTypeOfSymbol(targetProp.parent); + if (!sourceClass || !hasBaseType(sourceClass, targetClass)) { + if (reportErrors) { + reportError(Diagnostics.Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2, + symbolToString(targetProp), typeToString(sourceClass || source), typeToString(targetClass)); + } + return false; + } + } + else if (sourceFlags & NodeFlags.Protected) { + if (reportErrors) { + reportError(Diagnostics.Property_0_is_protected_in_type_1_but_public_in_type_2, + symbolToString(targetProp), typeToString(source), typeToString(target)); + } + return false; + } + if (!isRelatedTo(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp), reportErrors)) { + if (reportErrors) { + reportError(Diagnostics.Types_of_property_0_are_incompatible_Colon, symbolToString(targetProp)); + } + return false; + } + if (isOptionalProperty(sourceProp) && !isOptionalProperty(targetProp)) { + // TypeScript 1.0 spec (April 2014): 3.8.3 + // S is a subtype of a type T, and T is a supertype of S if ... + // S' and T are object types and, for each member M in T.. + // M is a property and S' contains a property N where + // if M is a required property, N is also a required property + // (M - property in T) + // (N - property in S) + if (reportErrors) { + reportError(Diagnostics.Property_0_is_optional_in_type_1_but_required_in_type_2, + symbolToString(targetProp), typeToString(source), typeToString(target)); + } + return false; } - return false; } } } @@ -3970,6 +3982,44 @@ module ts { return s.valueDeclaration ? s.valueDeclaration.flags : s.flags & SymbolFlags.Prototype ? NodeFlags.Public | NodeFlags.Static : 0; } + function checkClassPropertyAccess(node: PropertyAccess, type: Type, prop: Symbol) { + var flags = getDeclarationFlagsFromSymbol(prop); + // Public properties are always accessible + if (!(flags & (NodeFlags.Private | NodeFlags.Protected))) { + return; + } + // Property is known to be private or protected at this point + // Get the declaring and enclosing class instance types + var enclosingClassDeclaration = getAncestor(node, SyntaxKind.ClassDeclaration); + var enclosingClass = enclosingClassDeclaration ? getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClassDeclaration)) : undefined; + var declaringClass = getDeclaredTypeOfSymbol(prop.parent); + // Private property is accessible if declaring and enclosing class are the same + if (flags & NodeFlags.Private) { + if (declaringClass !== enclosingClass) { + error(node, Diagnostics.Property_0_is_private_and_only_accessible_within_class_1, symbolToString(prop), typeToString(declaringClass)); + } + return; + } + // Property is known to be protected at this point + // All protected properties of a supertype are accessible in a super access + if (node.left.kind === SyntaxKind.SuperKeyword) { + return; + } + // A protected property is accessible in the declaring class and classes derived from it + if (!enclosingClass || !hasBaseType(enclosingClass, declaringClass)) { + error(node, Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses, symbolToString(prop), typeToString(declaringClass)); + return; + } + // No further restrictions for static properties + if (flags & NodeFlags.Static) { + return; + } + // An instance property must be accessed through an instance of the enclosing class + if (!(getTargetType(type).flags & (TypeFlags.Class | TypeFlags.Interface) && hasBaseType(type, enclosingClass))) { + error(node, Diagnostics.Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1, symbolToString(prop), typeToString(enclosingClass)); + } + } + function checkPropertyAccess(node: PropertyAccess) { var type = checkExpression(node.left); if (type === unknownType) return type; @@ -3988,7 +4038,6 @@ module ts { } getNodeLinks(node).resolvedSymbol = prop; if (prop.parent && prop.parent.flags & SymbolFlags.Class) { - // TS 1.0 spec (April 2014): 4.8.2 // - In a constructor, instance member function, instance member accessor, or // instance member variable initializer where this references a derived class instance, @@ -3997,13 +4046,10 @@ module ts { // where this references the constructor function object of a derived class, // a super property access is permitted and must specify a public static member function of the base class. if (node.left.kind === SyntaxKind.SuperKeyword && getDeclarationKindFromSymbol(prop) !== SyntaxKind.Method) { - error(node.right, Diagnostics.Only_public_methods_of_the_base_class_are_accessible_via_the_super_keyword); + error(node.right, Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); } - else if (getDeclarationFlagsFromSymbol(prop) & NodeFlags.Private) { - var classDeclaration = getAncestor(node, SyntaxKind.ClassDeclaration); - if (!classDeclaration || !contains(prop.parent.declarations, classDeclaration)) { - error(node, Diagnostics.Property_0_is_inaccessible, getFullyQualifiedName(prop)); - } + else { + checkClassPropertyAccess(node, type, prop); } } return getTypeOfSymbol(prop); @@ -4959,7 +5005,8 @@ module ts { if (fullTypeCheck) { checkCollisionWithIndexVariableInGeneratedCode(parameterDeclaration, parameterDeclaration.name); - if (parameterDeclaration.flags & (NodeFlags.Public | NodeFlags.Private) && !(parameterDeclaration.parent.kind === SyntaxKind.Constructor && (parameterDeclaration.parent).body)) { + if (parameterDeclaration.flags & (NodeFlags.Public | NodeFlags.Private | NodeFlags.Protected) && + !(parameterDeclaration.parent.kind === SyntaxKind.Constructor && (parameterDeclaration.parent).body)) { error(parameterDeclaration, Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } if (parameterDeclaration.flags & NodeFlags.Rest) { @@ -5152,7 +5199,7 @@ module ts { // or the containing class declares instance member variables with initializers. var superCallShouldBeFirst = forEach((node.parent).members, isInstancePropertyWithInitializer) || - forEach(node.parameters, p => p.flags & (NodeFlags.Public | NodeFlags.Private)); + forEach(node.parameters, p => p.flags & (NodeFlags.Public | NodeFlags.Private | NodeFlags.Protected)); if (superCallShouldBeFirst) { var statements = (node.body).statements; @@ -5329,8 +5376,8 @@ module ts { else if (deviation & NodeFlags.Ambient) { error(o.name, Diagnostics.Overload_signatures_must_all_be_ambient_or_non_ambient); } - else if (deviation & NodeFlags.Private) { - error(o.name, Diagnostics.Overload_signatures_must_all_be_public_or_private); + else if (deviation & (NodeFlags.Private | NodeFlags.Protected)) { + error(o.name, Diagnostics.Overload_signatures_must_all_be_public_private_or_protected); } else if (deviation & NodeFlags.QuestionMark) { error(o.name, Diagnostics.Overload_signatures_must_all_be_optional_or_required); @@ -5339,7 +5386,7 @@ module ts { } } - var flagsToCheck: NodeFlags = NodeFlags.Export | NodeFlags.Ambient | NodeFlags.Private | NodeFlags.QuestionMark; + var flagsToCheck: NodeFlags = NodeFlags.Export | NodeFlags.Ambient | NodeFlags.Private | NodeFlags.Protected | NodeFlags.QuestionMark; var someNodeFlags: NodeFlags = 0; var allNodeFlags = flagsToCheck; var hasOverloads = false; @@ -6119,7 +6166,7 @@ module ts { } function getTargetSymbol(s: Symbol) { - // if symbol is instantiated it's flags are not copied from the 'target' + // if symbol is instantiated its flags are not copied from the 'target' // so we'll need to get back original 'target' symbol to work with correct set of flags return s.flags & SymbolFlags.Instantiated ? getSymbolLinks(s).target : s; } diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 04dbafc254..ba6f742c4c 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -138,9 +138,9 @@ module ts { Type_0_is_not_assignable_to_type_1_Colon: { code: 2322, category: DiagnosticCategory.Error, key: "Type '{0}' is not assignable to type '{1}':" }, Type_0_is_not_assignable_to_type_1: { code: 2323, category: DiagnosticCategory.Error, key: "Type '{0}' is not assignable to type '{1}'." }, Property_0_is_missing_in_type_1: { code: 2324, category: DiagnosticCategory.Error, key: "Property '{0}' is missing in type '{1}'." }, - Private_property_0_cannot_be_reimplemented: { code: 2325, category: DiagnosticCategory.Error, key: "Private property '{0}' cannot be reimplemented." }, + Property_0_is_private_in_type_1_but_not_in_type_2: { code: 2325, category: DiagnosticCategory.Error, key: "Property '{0}' is private in type '{1}' but not in type '{2}'." }, Types_of_property_0_are_incompatible_Colon: { code: 2326, category: DiagnosticCategory.Error, key: "Types of property '{0}' are incompatible:" }, - Required_property_0_cannot_be_reimplemented_with_optional_property_in_1: { code: 2327, category: DiagnosticCategory.Error, key: "Required property '{0}' cannot be reimplemented with optional property in '{1}'." }, + Property_0_is_optional_in_type_1_but_required_in_type_2: { code: 2327, category: DiagnosticCategory.Error, key: "Property '{0}' is optional in type '{1}' but required in type '{2}'." }, Types_of_parameters_0_and_1_are_incompatible_Colon: { code: 2328, category: DiagnosticCategory.Error, key: "Types of parameters '{0}' and '{1}' are incompatible:" }, Index_signature_is_missing_in_type_0: { code: 2329, category: DiagnosticCategory.Error, key: "Index signature is missing in type '{0}'." }, Index_signatures_are_incompatible_Colon: { code: 2330, category: DiagnosticCategory.Error, key: "Index signatures are incompatible:" }, @@ -153,8 +153,8 @@ module ts { Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors: { code: 2337, category: DiagnosticCategory.Error, key: "Super calls are not permitted outside constructors or in nested functions inside constructors" }, super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class: { code: 2338, category: DiagnosticCategory.Error, key: "'super' property access is permitted only in a constructor, member function, or member accessor of a derived class" }, Property_0_does_not_exist_on_type_1: { code: 2339, category: DiagnosticCategory.Error, key: "Property '{0}' does not exist on type '{1}'." }, - Only_public_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: DiagnosticCategory.Error, key: "Only public methods of the base class are accessible via the 'super' keyword" }, - Property_0_is_inaccessible: { code: 2341, category: DiagnosticCategory.Error, key: "Property '{0}' is inaccessible." }, + Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: DiagnosticCategory.Error, key: "Only public and protected methods of the base class are accessible via the 'super' keyword" }, + Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: DiagnosticCategory.Error, key: "Property '{0}' is private and only accessible within class '{1}'." }, An_index_expression_argument_must_be_of_type_string_number_or_any: { code: 2342, category: DiagnosticCategory.Error, key: "An index expression argument must be of type 'string', 'number', or 'any'." }, Type_0_does_not_satisfy_the_constraint_1_Colon: { code: 2343, category: DiagnosticCategory.Error, key: "Type '{0}' does not satisfy the constraint '{1}':" }, Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: DiagnosticCategory.Error, key: "Type '{0}' does not satisfy the constraint '{1}'." }, @@ -198,7 +198,7 @@ module ts { Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature: { code: 2382, category: DiagnosticCategory.Error, key: "Specialized overload signature is not assignable to any non-specialized signature." }, Overload_signatures_must_all_be_exported_or_not_exported: { code: 2383, category: DiagnosticCategory.Error, key: "Overload signatures must all be exported or not exported." }, Overload_signatures_must_all_be_ambient_or_non_ambient: { code: 2384, category: DiagnosticCategory.Error, key: "Overload signatures must all be ambient or non-ambient." }, - Overload_signatures_must_all_be_public_or_private: { code: 2385, category: DiagnosticCategory.Error, key: "Overload signatures must all be public or private." }, + Overload_signatures_must_all_be_public_private_or_protected: { code: 2385, category: DiagnosticCategory.Error, key: "Overload signatures must all be public, private or protected." }, Overload_signatures_must_all_be_optional_or_required: { code: 2386, category: DiagnosticCategory.Error, key: "Overload signatures must all be optional or required." }, Function_overload_must_be_static: { code: 2387, category: DiagnosticCategory.Error, key: "Function overload must be static." }, Function_overload_must_not_be_static: { code: 2388, category: DiagnosticCategory.Error, key: "Function overload must not be static." }, @@ -255,6 +255,11 @@ module ts { Import_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name: { code: 2439, category: DiagnosticCategory.Error, key: "Import declaration in an ambient external module declaration cannot reference external module through relative external module name." }, Import_declaration_conflicts_with_local_declaration_of_0: { code: 2440, category: DiagnosticCategory.Error, key: "Import declaration conflicts with local declaration of '{0}'" }, Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module: { code: 2441, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of an external module." }, + Types_have_separate_declarations_of_a_private_property_0: { code: 2442, category: DiagnosticCategory.Error, key: "Types have separate declarations of a private property '{0}'." }, + Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2: { code: 2443, category: DiagnosticCategory.Error, key: "Property '{0}' is protected but type '{1}' is not a class derived from '{2}'." }, + Property_0_is_protected_in_type_1_but_public_in_type_2: { code: 2444, category: DiagnosticCategory.Error, key: "Property '{0}' is protected in type '{1}' but public in type '{2}'." }, + Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses: { code: 2445, category: DiagnosticCategory.Error, key: "Property '{0}' is protected and only accessible within class '{1}' and its subclasses." }, + Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: { code: 2446, category: DiagnosticCategory.Error, key: "Property '{0}' is protected and only accessible through an instance of class '{1}'." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4001, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using name '{1}' from private module '{2}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 6c78ec6bd5..0480cd3000 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -544,7 +544,7 @@ "category": "Error", "code": 2324 }, - "Private property '{0}' cannot be reimplemented.": { + "Property '{0}' is private in type '{1}' but not in type '{2}'.": { "category": "Error", "code": 2325 }, @@ -552,7 +552,7 @@ "category": "Error", "code": 2326 }, - "Required property '{0}' cannot be reimplemented with optional property in '{1}'.": { + "Property '{0}' is optional in type '{1}' but required in type '{2}'.": { "category": "Error", "code": 2327 }, @@ -604,11 +604,11 @@ "category": "Error", "code": 2339 }, - "Only public methods of the base class are accessible via the 'super' keyword": { + "Only public and protected methods of the base class are accessible via the 'super' keyword": { "category": "Error", "code": 2340 }, - "Property '{0}' is inaccessible.": { + "Property '{0}' is private and only accessible within class '{1}'.": { "category": "Error", "code": 2341 }, @@ -784,7 +784,7 @@ "category": "Error", "code": 2384 }, - "Overload signatures must all be public or private.": { + "Overload signatures must all be public, private or protected.": { "category": "Error", "code": 2385 }, @@ -1012,7 +1012,26 @@ "category": "Error", "code": 2441 }, - + "Types have separate declarations of a private property '{0}'.": { + "category": "Error", + "code": 2442 + }, + "Property '{0}' is protected but type '{1}' is not a class derived from '{2}'.": { + "category": "Error", + "code": 2443 + }, + "Property '{0}' is protected in type '{1}' but public in type '{2}'.": { + "category": "Error", + "code": 2444 + }, + "Property '{0}' is protected and only accessible within class '{1}' and its subclasses.": { + "category": "Error", + "code": 2445 + }, + "Property '{0}' is protected and only accessible through an instance of class '{1}'.": { + "category": "Error", + "code": 2446 + }, "Import declaration '{0}' is using private name '{1}'.": { "category": "Error", diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 73064eda69..2b4e70a000 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -2371,12 +2371,18 @@ module ts { if (node.flags & NodeFlags.Private) { write("private "); } + else if (node.flags & NodeFlags.Protected) { + write("protected "); + } write("static "); } else { if (node.flags & NodeFlags.Private) { write("private "); } + else if (node.flags & NodeFlags.Protected) { + write("protected "); + } // If the node is parented in the current source file we need to emit export declare or just export else if (node.parent === currentSourceFile) { // If the node is exported diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 61cb6628f2..c735f1bb1e 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -656,6 +656,7 @@ module ts { switch (token) { case SyntaxKind.PublicKeyword: case SyntaxKind.PrivateKeyword: + case SyntaxKind.ProtectedKeyword: case SyntaxKind.StaticKeyword: case SyntaxKind.ExportKeyword: case SyntaxKind.DeclareKeyword: @@ -2981,6 +2982,7 @@ module ts { } case SyntaxKind.PublicKeyword: case SyntaxKind.PrivateKeyword: + case SyntaxKind.ProtectedKeyword: case SyntaxKind.StaticKeyword: // When followed by an identifier or keyword, these do not start a statement but // might instead be following type members @@ -3299,6 +3301,8 @@ module ts { var lastDeclareModifierLength: number; var lastPrivateModifierStart: number; var lastPrivateModifierLength: number; + var lastProtectedModifierStart: number; + var lastProtectedModifierLength: number; while (true) { var modifierStart = scanner.getTokenPos(); @@ -3338,6 +3342,21 @@ module ts { flags |= NodeFlags.Private; break; + case SyntaxKind.ProtectedKeyword: + if (flags & NodeFlags.Public || flags & NodeFlags.Private || flags & NodeFlags.Protected) { + grammarErrorAtPos(modifierStart, modifierLength, Diagnostics.Accessibility_modifier_already_seen); + } + else if (flags & NodeFlags.Static) { + grammarErrorAtPos(modifierStart, modifierLength, Diagnostics._0_modifier_must_precede_1_modifier, "protected", "static"); + } + else if (context === ModifierContext.ModuleElements || context === ModifierContext.SourceElements) { + grammarErrorAtPos(modifierStart, modifierLength, Diagnostics._0_modifier_cannot_appear_on_a_module_element, "protected"); + } + lastProtectedModifierStart = modifierStart; + lastProtectedModifierLength = modifierLength; + flags |= NodeFlags.Protected; + break; + case SyntaxKind.StaticKeyword: if (flags & NodeFlags.Static) { grammarErrorAtPos(modifierStart, modifierLength, Diagnostics._0_modifier_already_seen, "static"); @@ -3395,6 +3414,9 @@ module ts { else if (token === SyntaxKind.ConstructorKeyword && flags & NodeFlags.Private) { grammarErrorAtPos(lastPrivateModifierStart, lastPrivateModifierLength, Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "private"); } + else if (token === SyntaxKind.ConstructorKeyword && flags & NodeFlags.Protected) { + grammarErrorAtPos(lastProtectedModifierStart, lastProtectedModifierLength, Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "protected"); + } else if (token === SyntaxKind.ImportKeyword) { if (flags & NodeFlags.Ambient) { grammarErrorAtPos(lastDeclareModifierStart, lastDeclareModifierLength, Diagnostics.A_declare_modifier_cannot_be_used_with_an_import_declaration, "declare"); @@ -3671,6 +3693,7 @@ module ts { case SyntaxKind.DeclareKeyword: case SyntaxKind.PublicKeyword: case SyntaxKind.PrivateKeyword: + case SyntaxKind.ProtectedKeyword: case SyntaxKind.StaticKeyword: // Check for modifier on source element return lookAhead(() => { nextToken(); return isDeclaration(); }); diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 8bb1cfa416..d9c2a420fb 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -238,13 +238,14 @@ module ts { Rest = 0x00000008, // Parameter Public = 0x00000010, // Property/Method Private = 0x00000020, // Property/Method - Static = 0x00000040, // Property/Method - MultiLine = 0x00000080, // Multi-line array or object literal - Synthetic = 0x00000100, // Synthetic node (for full fidelity) - DeclarationFile = 0x00000200, // Node is a .d.ts file + Protected = 0x00000040, // Property/Method + Static = 0x00000080, // Property/Method + MultiLine = 0x00000100, // Multi-line array or object literal + Synthetic = 0x00000200, // Synthetic node (for full fidelity) + DeclarationFile = 0x00000400, // Node is a .d.ts file - Modifier = Export | Ambient | Public | Private | Static, - AccessibilityModifier = Public | Private + Modifier = Export | Ambient | Public | Private | Protected | Static, + AccessibilityModifier = Public | Private | Protected } export interface Node extends TextRange { diff --git a/src/services/compiler/astWalker.ts b/src/services/compiler/astWalker.ts index 53d22142cb..9f6897c4e1 100644 --- a/src/services/compiler/astWalker.ts +++ b/src/services/compiler/astWalker.ts @@ -42,6 +42,10 @@ module TypeScript { walker.walk(preAst.typeArguments); } + function walkTupleTypeChildren(preAst: TupleTypeSyntax, walker: AstWalker): void { + walker.walk(preAst.types); + } + function walkTypeOfExpressionChildren(preAst: TypeOfExpressionSyntax, walker: AstWalker): void { walker.walk(preAst.expression); } @@ -561,6 +565,7 @@ module TypeScript { childrenWalkers[SyntaxKind.TriviaList] = null; childrenWalkers[SyntaxKind.TrueKeyword] = null; childrenWalkers[SyntaxKind.TryStatement] = walkTryStatementChildren; + childrenWalkers[SyntaxKind.TupleType] = walkTupleTypeChildren; childrenWalkers[SyntaxKind.TypeAnnotation] = walkTypeAnnotationChildren; childrenWalkers[SyntaxKind.TypeArgumentList] = walkTypeArgumentListChildren; childrenWalkers[SyntaxKind.TypeOfExpression] = walkTypeOfExpressionChildren; diff --git a/src/services/syntax/defaultSyntaxVisitor.generated.ts b/src/services/syntax/defaultSyntaxVisitor.generated.ts index 041b72b935..32a0cfad4a 100644 --- a/src/services/syntax/defaultSyntaxVisitor.generated.ts +++ b/src/services/syntax/defaultSyntaxVisitor.generated.ts @@ -42,6 +42,10 @@ module TypeScript { return this.defaultVisit(node); } + public visitTupleType(node: TupleTypeSyntax): any { + return this.defaultVisit(node); + } + public visitInterfaceDeclaration(node: InterfaceDeclarationSyntax): any { return this.defaultVisit(node); } diff --git a/src/services/syntax/parser.ts b/src/services/syntax/parser.ts index 31a87b857b..a35ddc5737 100644 --- a/src/services/syntax/parser.ts +++ b/src/services/syntax/parser.ts @@ -1048,6 +1048,7 @@ module TypeScript.Parser { case SyntaxKind.ExportKeyword: case SyntaxKind.PublicKeyword: case SyntaxKind.PrivateKeyword: + case SyntaxKind.ProtectedKeyword: case SyntaxKind.StaticKeyword: case SyntaxKind.DeclareKeyword: return true; @@ -1434,6 +1435,19 @@ module TypeScript.Parser { return new syntaxFactory.ObjectTypeSyntax(parseNodeData, openBraceToken, typeMembers, eatToken(SyntaxKind.CloseBraceToken)); } + function parseTupleType(currentToken: ISyntaxToken): TupleTypeSyntax { + var openBracket = consumeToken(currentToken); + + var types = Syntax.emptySeparatedList(); + if (openBracket.fullWidth() > 0) { + var skippedTokens: ISyntaxToken[] = getArray(); + types = parseSeparatedSyntaxList(ListParsingState.TupleType_Types, skippedTokens); + openBracket = addSkippedTokensAfterToken(openBracket, skippedTokens); + } + + return new syntaxFactory.TupleTypeSyntax(parseNodeData, openBracket, types, eatToken(SyntaxKind.CloseBracketToken)); + } + function isTypeMember(inErrorRecovery: boolean): boolean { if (SyntaxUtilities.isTypeMember(currentNode())) { return true; @@ -1663,6 +1677,7 @@ module TypeScript.Parser { // ERROR RECOVERY case SyntaxKind.PublicKeyword: case SyntaxKind.PrivateKeyword: + case SyntaxKind.ProtectedKeyword: case SyntaxKind.StaticKeyword: // None of the above are actually keywords. And they might show up in a real // statement (i.e. "public();"). However, if we see 'public ' then @@ -1731,6 +1746,7 @@ module TypeScript.Parser { // ERROR RECOVERY case SyntaxKind.PublicKeyword: case SyntaxKind.PrivateKeyword: + case SyntaxKind.ProtectedKeyword: case SyntaxKind.StaticKeyword: // None of the above are actually keywords. And they might show up in a real // statement (i.e. "public();"). However, if we see 'public ' then @@ -3133,7 +3149,7 @@ module TypeScript.Parser { token2 = peekToken(2); token2Kind = token2.kind(); - if (token1Kind === SyntaxKind.PublicKeyword || token1Kind === SyntaxKind.PrivateKeyword) { + if (SyntaxFacts.isAccessibilityModifier(token1Kind)) { if (isIdentifier(token2)) { // "(public id" or "(function id". Definitely an arrow function. Could never // be a parenthesized expression. Note: this will be an *illegal* arrow @@ -3557,11 +3573,12 @@ module TypeScript.Parser { return consumeToken(_currentToken); case SyntaxKind.OpenParenToken: - case SyntaxKind.LessThanToken: return tryParseFunctionType(); - case SyntaxKind.VoidKeyword: return consumeToken(_currentToken); - case SyntaxKind.OpenBraceToken: return parseObjectType(); - case SyntaxKind.NewKeyword: return parseConstructorType(); - case SyntaxKind.TypeOfKeyword: return parseTypeQuery(_currentToken); + case SyntaxKind.LessThanToken: return tryParseFunctionType(); + case SyntaxKind.VoidKeyword: return consumeToken(_currentToken); + case SyntaxKind.OpenBraceToken: return parseObjectType(); + case SyntaxKind.NewKeyword: return parseConstructorType(); + case SyntaxKind.TypeOfKeyword: return parseTypeQuery(_currentToken); + case SyntaxKind.OpenBracketToken: return parseTupleType(_currentToken); } return tryParseNameOrGenericType(); @@ -3973,6 +3990,7 @@ module TypeScript.Parser { case ListParsingState.IndexSignature_Parameters: return isExpectedIndexSignature_ParametersTerminator(); case ListParsingState.TypeArgumentList_Types: return isExpectedTypeArgumentList_TypesTerminator(); case ListParsingState.TypeParameterList_TypeParameters: return isExpectedTypeParameterList_TypeParametersTerminator(); + case ListParsingState.TupleType_Types: return isExpectedTupleType_TypesTerminator(); default: throw Errors.invalidOperation(); } @@ -4019,6 +4037,17 @@ module TypeScript.Parser { return false; } + function isExpectedTupleType_TypesTerminator(): boolean { + var token = currentToken(); + var tokenKind = token.kind(); + if (tokenKind === SyntaxKind.CloseBracketToken) { + return true; + } + + // TODO: add more cases as necessary for error tolerance. + return false; + } + function isExpectedTypeParameterList_TypeParametersTerminator(): boolean { var tokenKind = currentToken().kind(); if (tokenKind === SyntaxKind.GreaterThanToken) { @@ -4187,6 +4216,7 @@ module TypeScript.Parser { case ListParsingState.IndexSignature_Parameters: return isParameter(); case ListParsingState.TypeArgumentList_Types: return isType(); case ListParsingState.TypeParameterList_TypeParameters: return isTypeParameter(); + case ListParsingState.TupleType_Types: return isType(); default: throw Errors.invalidOperation(); } } @@ -4230,6 +4260,7 @@ module TypeScript.Parser { case ListParsingState.IndexSignature_Parameters: return tryParseParameter(); case ListParsingState.TypeArgumentList_Types: return tryParseType(); case ListParsingState.TypeParameterList_TypeParameters: return tryParseTypeParameter(); + case ListParsingState.TupleType_Types: return tryParseType(); default: throw Errors.invalidOperation(); } } @@ -4254,6 +4285,7 @@ module TypeScript.Parser { case ListParsingState.IndexSignature_Parameters: return getLocalizedText(DiagnosticCode.parameter, null); case ListParsingState.TypeArgumentList_Types: return getLocalizedText(DiagnosticCode.type, null); case ListParsingState.TypeParameterList_TypeParameters: return getLocalizedText(DiagnosticCode.type_parameter, null); + case ListParsingState.TupleType_Types: return getLocalizedText(DiagnosticCode.type, null); case ListParsingState.ArrayLiteralExpression_AssignmentExpressions: return getLocalizedText(DiagnosticCode.expression, null); default: throw Errors.invalidOperation(); } @@ -4376,9 +4408,10 @@ module TypeScript.Parser { IndexSignature_Parameters = 18, TypeArgumentList_Types = 19, TypeParameterList_TypeParameters = 20, + TupleType_Types = 21, FirstListParsingState = SourceUnit_ModuleElements, - LastListParsingState = TypeParameterList_TypeParameters, + LastListParsingState = TupleType_Types, } // We keep the parser around as a singleton. This is because calling createParser is actually diff --git a/src/services/syntax/prettyPrinter.ts b/src/services/syntax/prettyPrinter.ts index f19b9224f7..df22bcab55 100644 --- a/src/services/syntax/prettyPrinter.ts +++ b/src/services/syntax/prettyPrinter.ts @@ -421,6 +421,12 @@ module TypeScript.PrettyPrinter { this.appendToken(node.greaterThanToken); } + public visitTupleType(node: TupleTypeSyntax): void { + this.appendToken(node.openBracketToken); + this.appendSeparatorSpaceList(node.types); + this.appendToken(node.closeBracketToken); + } + public visitConstructorType(node: ConstructorTypeSyntax): void { this.appendToken(node.newKeyword); this.ensureSpace(); diff --git a/src/services/syntax/syntaxFacts2.ts b/src/services/syntax/syntaxFacts2.ts index ec59a583e0..99a144176a 100644 --- a/src/services/syntax/syntaxFacts2.ts +++ b/src/services/syntax/syntaxFacts2.ts @@ -26,4 +26,15 @@ module TypeScript.SyntaxFacts { var tokenKind = token.kind(); return tokenKind === SyntaxKind.IdentifierName || SyntaxFacts.isAnyKeyword(tokenKind); } + + export function isAccessibilityModifier(kind: SyntaxKind): boolean { + switch (kind) { + case SyntaxKind.PublicKeyword: + case SyntaxKind.PrivateKeyword: + case SyntaxKind.ProtectedKeyword: + return true; + } + + return false; + } } \ No newline at end of file diff --git a/src/services/syntax/syntaxGenerator.ts b/src/services/syntax/syntaxGenerator.ts index 21f65bb79e..ebc2673b98 100644 --- a/src/services/syntax/syntaxGenerator.ts +++ b/src/services/syntax/syntaxGenerator.ts @@ -354,6 +354,17 @@ var definitions:ITypeDefinition[] = [ ], isTypeScriptSpecific: true }, + { + name: 'TupleTypeSyntax', + baseType: 'ISyntaxNode', + interfaces: ['ITypeSyntax'], + children: [ + { name: 'openBracketToken', isToken: true, excludeFromAST: true }, + { name: 'types', isSeparatedList: true, elementType: 'ITypeSyntax' }, + { name: 'closeBracketToken', isToken: true, excludeFromAST: true } + ], + isTypeScriptSpecific: true + }, { name: 'TypeAnnotationSyntax', baseType: 'ISyntaxNode', diff --git a/src/services/syntax/syntaxKind.ts b/src/services/syntax/syntaxKind.ts index bcc6ab46ee..1021c2fcfd 100644 --- a/src/services/syntax/syntaxKind.ts +++ b/src/services/syntax/syntaxKind.ts @@ -158,6 +158,7 @@ module TypeScript { ConstructorType, GenericType, TypeQuery, + TupleType, // Module elements. InterfaceDeclaration, diff --git a/src/services/syntax/syntaxNodes.abstract.generated.ts b/src/services/syntax/syntaxNodes.abstract.generated.ts index 031b0363ca..9cba7f66d0 100644 --- a/src/services/syntax/syntaxNodes.abstract.generated.ts +++ b/src/services/syntax/syntaxNodes.abstract.generated.ts @@ -108,6 +108,17 @@ module TypeScript.Syntax.Abstract { name.parent = this; } } + export class TupleTypeSyntax extends SyntaxNode implements ITypeSyntax { + public openBracketToken: ISyntaxToken; + public types: ITypeSyntax[]; + public closeBracketToken: ISyntaxToken; + public _typeBrand: any; + constructor(data: number, openBracketToken: ISyntaxToken, types: ITypeSyntax[], closeBracketToken: ISyntaxToken) { + super(data); + this.types = types, + !isShared(types) && (types.parent = this); + } + } export class InterfaceDeclarationSyntax extends SyntaxNode implements IModuleElementSyntax { public modifiers: ISyntaxToken[]; public interfaceKeyword: ISyntaxToken; @@ -1190,5 +1201,5 @@ module TypeScript.Syntax.Abstract { } } - (SourceUnitSyntax).prototype.__kind = SyntaxKind.SourceUnit, (QualifiedNameSyntax).prototype.__kind = SyntaxKind.QualifiedName, (ObjectTypeSyntax).prototype.__kind = SyntaxKind.ObjectType, (FunctionTypeSyntax).prototype.__kind = SyntaxKind.FunctionType, (ArrayTypeSyntax).prototype.__kind = SyntaxKind.ArrayType, (ConstructorTypeSyntax).prototype.__kind = SyntaxKind.ConstructorType, (GenericTypeSyntax).prototype.__kind = SyntaxKind.GenericType, (TypeQuerySyntax).prototype.__kind = SyntaxKind.TypeQuery, (InterfaceDeclarationSyntax).prototype.__kind = SyntaxKind.InterfaceDeclaration, (FunctionDeclarationSyntax).prototype.__kind = SyntaxKind.FunctionDeclaration, (ModuleDeclarationSyntax).prototype.__kind = SyntaxKind.ModuleDeclaration, (ClassDeclarationSyntax).prototype.__kind = SyntaxKind.ClassDeclaration, (EnumDeclarationSyntax).prototype.__kind = SyntaxKind.EnumDeclaration, (ImportDeclarationSyntax).prototype.__kind = SyntaxKind.ImportDeclaration, (ExportAssignmentSyntax).prototype.__kind = SyntaxKind.ExportAssignment, (MemberFunctionDeclarationSyntax).prototype.__kind = SyntaxKind.MemberFunctionDeclaration, (MemberVariableDeclarationSyntax).prototype.__kind = SyntaxKind.MemberVariableDeclaration, (ConstructorDeclarationSyntax).prototype.__kind = SyntaxKind.ConstructorDeclaration, (IndexMemberDeclarationSyntax).prototype.__kind = SyntaxKind.IndexMemberDeclaration, (GetAccessorSyntax).prototype.__kind = SyntaxKind.GetAccessor, (SetAccessorSyntax).prototype.__kind = SyntaxKind.SetAccessor, (PropertySignatureSyntax).prototype.__kind = SyntaxKind.PropertySignature, (CallSignatureSyntax).prototype.__kind = SyntaxKind.CallSignature, (ConstructSignatureSyntax).prototype.__kind = SyntaxKind.ConstructSignature, (IndexSignatureSyntax).prototype.__kind = SyntaxKind.IndexSignature, (MethodSignatureSyntax).prototype.__kind = SyntaxKind.MethodSignature, (BlockSyntax).prototype.__kind = SyntaxKind.Block, (IfStatementSyntax).prototype.__kind = SyntaxKind.IfStatement, (VariableStatementSyntax).prototype.__kind = SyntaxKind.VariableStatement, (ExpressionStatementSyntax).prototype.__kind = SyntaxKind.ExpressionStatement, (ReturnStatementSyntax).prototype.__kind = SyntaxKind.ReturnStatement, (SwitchStatementSyntax).prototype.__kind = SyntaxKind.SwitchStatement, (BreakStatementSyntax).prototype.__kind = SyntaxKind.BreakStatement, (ContinueStatementSyntax).prototype.__kind = SyntaxKind.ContinueStatement, (ForStatementSyntax).prototype.__kind = SyntaxKind.ForStatement, (ForInStatementSyntax).prototype.__kind = SyntaxKind.ForInStatement, (EmptyStatementSyntax).prototype.__kind = SyntaxKind.EmptyStatement, (ThrowStatementSyntax).prototype.__kind = SyntaxKind.ThrowStatement, (WhileStatementSyntax).prototype.__kind = SyntaxKind.WhileStatement, (TryStatementSyntax).prototype.__kind = SyntaxKind.TryStatement, (LabeledStatementSyntax).prototype.__kind = SyntaxKind.LabeledStatement, (DoStatementSyntax).prototype.__kind = SyntaxKind.DoStatement, (DebuggerStatementSyntax).prototype.__kind = SyntaxKind.DebuggerStatement, (WithStatementSyntax).prototype.__kind = SyntaxKind.WithStatement, (DeleteExpressionSyntax).prototype.__kind = SyntaxKind.DeleteExpression, (TypeOfExpressionSyntax).prototype.__kind = SyntaxKind.TypeOfExpression, (VoidExpressionSyntax).prototype.__kind = SyntaxKind.VoidExpression, (ConditionalExpressionSyntax).prototype.__kind = SyntaxKind.ConditionalExpression, (MemberAccessExpressionSyntax).prototype.__kind = SyntaxKind.MemberAccessExpression, (InvocationExpressionSyntax).prototype.__kind = SyntaxKind.InvocationExpression, (ArrayLiteralExpressionSyntax).prototype.__kind = SyntaxKind.ArrayLiteralExpression, (ObjectLiteralExpressionSyntax).prototype.__kind = SyntaxKind.ObjectLiteralExpression, (ObjectCreationExpressionSyntax).prototype.__kind = SyntaxKind.ObjectCreationExpression, (ParenthesizedExpressionSyntax).prototype.__kind = SyntaxKind.ParenthesizedExpression, (ParenthesizedArrowFunctionExpressionSyntax).prototype.__kind = SyntaxKind.ParenthesizedArrowFunctionExpression, (SimpleArrowFunctionExpressionSyntax).prototype.__kind = SyntaxKind.SimpleArrowFunctionExpression, (CastExpressionSyntax).prototype.__kind = SyntaxKind.CastExpression, (ElementAccessExpressionSyntax).prototype.__kind = SyntaxKind.ElementAccessExpression, (FunctionExpressionSyntax).prototype.__kind = SyntaxKind.FunctionExpression, (OmittedExpressionSyntax).prototype.__kind = SyntaxKind.OmittedExpression, (VariableDeclarationSyntax).prototype.__kind = SyntaxKind.VariableDeclaration, (VariableDeclaratorSyntax).prototype.__kind = SyntaxKind.VariableDeclarator, (ArgumentListSyntax).prototype.__kind = SyntaxKind.ArgumentList, (ParameterListSyntax).prototype.__kind = SyntaxKind.ParameterList, (TypeArgumentListSyntax).prototype.__kind = SyntaxKind.TypeArgumentList, (TypeParameterListSyntax).prototype.__kind = SyntaxKind.TypeParameterList, (EqualsValueClauseSyntax).prototype.__kind = SyntaxKind.EqualsValueClause, (CaseSwitchClauseSyntax).prototype.__kind = SyntaxKind.CaseSwitchClause, (DefaultSwitchClauseSyntax).prototype.__kind = SyntaxKind.DefaultSwitchClause, (ElseClauseSyntax).prototype.__kind = SyntaxKind.ElseClause, (CatchClauseSyntax).prototype.__kind = SyntaxKind.CatchClause, (FinallyClauseSyntax).prototype.__kind = SyntaxKind.FinallyClause, (TypeParameterSyntax).prototype.__kind = SyntaxKind.TypeParameter, (ConstraintSyntax).prototype.__kind = SyntaxKind.Constraint, (SimplePropertyAssignmentSyntax).prototype.__kind = SyntaxKind.SimplePropertyAssignment, (FunctionPropertyAssignmentSyntax).prototype.__kind = SyntaxKind.FunctionPropertyAssignment, (ParameterSyntax).prototype.__kind = SyntaxKind.Parameter, (EnumElementSyntax).prototype.__kind = SyntaxKind.EnumElement, (TypeAnnotationSyntax).prototype.__kind = SyntaxKind.TypeAnnotation, (ExternalModuleReferenceSyntax).prototype.__kind = SyntaxKind.ExternalModuleReference, (ModuleNameModuleReferenceSyntax).prototype.__kind = SyntaxKind.ModuleNameModuleReference; + (SourceUnitSyntax).prototype.__kind = SyntaxKind.SourceUnit, (QualifiedNameSyntax).prototype.__kind = SyntaxKind.QualifiedName, (ObjectTypeSyntax).prototype.__kind = SyntaxKind.ObjectType, (FunctionTypeSyntax).prototype.__kind = SyntaxKind.FunctionType, (ArrayTypeSyntax).prototype.__kind = SyntaxKind.ArrayType, (ConstructorTypeSyntax).prototype.__kind = SyntaxKind.ConstructorType, (GenericTypeSyntax).prototype.__kind = SyntaxKind.GenericType, (TypeQuerySyntax).prototype.__kind = SyntaxKind.TypeQuery, (TupleTypeSyntax).prototype.__kind = SyntaxKind.TupleType, (InterfaceDeclarationSyntax).prototype.__kind = SyntaxKind.InterfaceDeclaration, (FunctionDeclarationSyntax).prototype.__kind = SyntaxKind.FunctionDeclaration, (ModuleDeclarationSyntax).prototype.__kind = SyntaxKind.ModuleDeclaration, (ClassDeclarationSyntax).prototype.__kind = SyntaxKind.ClassDeclaration, (EnumDeclarationSyntax).prototype.__kind = SyntaxKind.EnumDeclaration, (ImportDeclarationSyntax).prototype.__kind = SyntaxKind.ImportDeclaration, (ExportAssignmentSyntax).prototype.__kind = SyntaxKind.ExportAssignment, (MemberFunctionDeclarationSyntax).prototype.__kind = SyntaxKind.MemberFunctionDeclaration, (MemberVariableDeclarationSyntax).prototype.__kind = SyntaxKind.MemberVariableDeclaration, (ConstructorDeclarationSyntax).prototype.__kind = SyntaxKind.ConstructorDeclaration, (IndexMemberDeclarationSyntax).prototype.__kind = SyntaxKind.IndexMemberDeclaration, (GetAccessorSyntax).prototype.__kind = SyntaxKind.GetAccessor, (SetAccessorSyntax).prototype.__kind = SyntaxKind.SetAccessor, (PropertySignatureSyntax).prototype.__kind = SyntaxKind.PropertySignature, (CallSignatureSyntax).prototype.__kind = SyntaxKind.CallSignature, (ConstructSignatureSyntax).prototype.__kind = SyntaxKind.ConstructSignature, (IndexSignatureSyntax).prototype.__kind = SyntaxKind.IndexSignature, (MethodSignatureSyntax).prototype.__kind = SyntaxKind.MethodSignature, (BlockSyntax).prototype.__kind = SyntaxKind.Block, (IfStatementSyntax).prototype.__kind = SyntaxKind.IfStatement, (VariableStatementSyntax).prototype.__kind = SyntaxKind.VariableStatement, (ExpressionStatementSyntax).prototype.__kind = SyntaxKind.ExpressionStatement, (ReturnStatementSyntax).prototype.__kind = SyntaxKind.ReturnStatement, (SwitchStatementSyntax).prototype.__kind = SyntaxKind.SwitchStatement, (BreakStatementSyntax).prototype.__kind = SyntaxKind.BreakStatement, (ContinueStatementSyntax).prototype.__kind = SyntaxKind.ContinueStatement, (ForStatementSyntax).prototype.__kind = SyntaxKind.ForStatement, (ForInStatementSyntax).prototype.__kind = SyntaxKind.ForInStatement, (EmptyStatementSyntax).prototype.__kind = SyntaxKind.EmptyStatement, (ThrowStatementSyntax).prototype.__kind = SyntaxKind.ThrowStatement, (WhileStatementSyntax).prototype.__kind = SyntaxKind.WhileStatement, (TryStatementSyntax).prototype.__kind = SyntaxKind.TryStatement, (LabeledStatementSyntax).prototype.__kind = SyntaxKind.LabeledStatement, (DoStatementSyntax).prototype.__kind = SyntaxKind.DoStatement, (DebuggerStatementSyntax).prototype.__kind = SyntaxKind.DebuggerStatement, (WithStatementSyntax).prototype.__kind = SyntaxKind.WithStatement, (DeleteExpressionSyntax).prototype.__kind = SyntaxKind.DeleteExpression, (TypeOfExpressionSyntax).prototype.__kind = SyntaxKind.TypeOfExpression, (VoidExpressionSyntax).prototype.__kind = SyntaxKind.VoidExpression, (ConditionalExpressionSyntax).prototype.__kind = SyntaxKind.ConditionalExpression, (MemberAccessExpressionSyntax).prototype.__kind = SyntaxKind.MemberAccessExpression, (InvocationExpressionSyntax).prototype.__kind = SyntaxKind.InvocationExpression, (ArrayLiteralExpressionSyntax).prototype.__kind = SyntaxKind.ArrayLiteralExpression, (ObjectLiteralExpressionSyntax).prototype.__kind = SyntaxKind.ObjectLiteralExpression, (ObjectCreationExpressionSyntax).prototype.__kind = SyntaxKind.ObjectCreationExpression, (ParenthesizedExpressionSyntax).prototype.__kind = SyntaxKind.ParenthesizedExpression, (ParenthesizedArrowFunctionExpressionSyntax).prototype.__kind = SyntaxKind.ParenthesizedArrowFunctionExpression, (SimpleArrowFunctionExpressionSyntax).prototype.__kind = SyntaxKind.SimpleArrowFunctionExpression, (CastExpressionSyntax).prototype.__kind = SyntaxKind.CastExpression, (ElementAccessExpressionSyntax).prototype.__kind = SyntaxKind.ElementAccessExpression, (FunctionExpressionSyntax).prototype.__kind = SyntaxKind.FunctionExpression, (OmittedExpressionSyntax).prototype.__kind = SyntaxKind.OmittedExpression, (VariableDeclarationSyntax).prototype.__kind = SyntaxKind.VariableDeclaration, (VariableDeclaratorSyntax).prototype.__kind = SyntaxKind.VariableDeclarator, (ArgumentListSyntax).prototype.__kind = SyntaxKind.ArgumentList, (ParameterListSyntax).prototype.__kind = SyntaxKind.ParameterList, (TypeArgumentListSyntax).prototype.__kind = SyntaxKind.TypeArgumentList, (TypeParameterListSyntax).prototype.__kind = SyntaxKind.TypeParameterList, (EqualsValueClauseSyntax).prototype.__kind = SyntaxKind.EqualsValueClause, (CaseSwitchClauseSyntax).prototype.__kind = SyntaxKind.CaseSwitchClause, (DefaultSwitchClauseSyntax).prototype.__kind = SyntaxKind.DefaultSwitchClause, (ElseClauseSyntax).prototype.__kind = SyntaxKind.ElseClause, (CatchClauseSyntax).prototype.__kind = SyntaxKind.CatchClause, (FinallyClauseSyntax).prototype.__kind = SyntaxKind.FinallyClause, (TypeParameterSyntax).prototype.__kind = SyntaxKind.TypeParameter, (ConstraintSyntax).prototype.__kind = SyntaxKind.Constraint, (SimplePropertyAssignmentSyntax).prototype.__kind = SyntaxKind.SimplePropertyAssignment, (FunctionPropertyAssignmentSyntax).prototype.__kind = SyntaxKind.FunctionPropertyAssignment, (ParameterSyntax).prototype.__kind = SyntaxKind.Parameter, (EnumElementSyntax).prototype.__kind = SyntaxKind.EnumElement, (TypeAnnotationSyntax).prototype.__kind = SyntaxKind.TypeAnnotation, (ExternalModuleReferenceSyntax).prototype.__kind = SyntaxKind.ExternalModuleReference, (ModuleNameModuleReferenceSyntax).prototype.__kind = SyntaxKind.ModuleNameModuleReference; } \ No newline at end of file diff --git a/src/services/syntax/syntaxNodes.concrete.generated.ts b/src/services/syntax/syntaxNodes.concrete.generated.ts index cc493aa53a..fa593fd197 100644 --- a/src/services/syntax/syntaxNodes.concrete.generated.ts +++ b/src/services/syntax/syntaxNodes.concrete.generated.ts @@ -126,6 +126,21 @@ module TypeScript.Syntax.Concrete { name.parent = this; } } + export class TupleTypeSyntax extends SyntaxNode implements ITypeSyntax { + public openBracketToken: ISyntaxToken; + public types: ITypeSyntax[]; + public closeBracketToken: ISyntaxToken; + public _typeBrand: any; + constructor(data: number, openBracketToken: ISyntaxToken, types: ITypeSyntax[], closeBracketToken: ISyntaxToken) { + super(data); + this.openBracketToken = openBracketToken, + this.types = types, + this.closeBracketToken = closeBracketToken, + openBracketToken.parent = this, + !isShared(types) && (types.parent = this), + closeBracketToken.parent = this; + } + } export class InterfaceDeclarationSyntax extends SyntaxNode implements IModuleElementSyntax { public modifiers: ISyntaxToken[]; public interfaceKeyword: ISyntaxToken; @@ -1420,5 +1435,5 @@ module TypeScript.Syntax.Concrete { } } - (SourceUnitSyntax).prototype.__kind = SyntaxKind.SourceUnit, (QualifiedNameSyntax).prototype.__kind = SyntaxKind.QualifiedName, (ObjectTypeSyntax).prototype.__kind = SyntaxKind.ObjectType, (FunctionTypeSyntax).prototype.__kind = SyntaxKind.FunctionType, (ArrayTypeSyntax).prototype.__kind = SyntaxKind.ArrayType, (ConstructorTypeSyntax).prototype.__kind = SyntaxKind.ConstructorType, (GenericTypeSyntax).prototype.__kind = SyntaxKind.GenericType, (TypeQuerySyntax).prototype.__kind = SyntaxKind.TypeQuery, (InterfaceDeclarationSyntax).prototype.__kind = SyntaxKind.InterfaceDeclaration, (FunctionDeclarationSyntax).prototype.__kind = SyntaxKind.FunctionDeclaration, (ModuleDeclarationSyntax).prototype.__kind = SyntaxKind.ModuleDeclaration, (ClassDeclarationSyntax).prototype.__kind = SyntaxKind.ClassDeclaration, (EnumDeclarationSyntax).prototype.__kind = SyntaxKind.EnumDeclaration, (ImportDeclarationSyntax).prototype.__kind = SyntaxKind.ImportDeclaration, (ExportAssignmentSyntax).prototype.__kind = SyntaxKind.ExportAssignment, (MemberFunctionDeclarationSyntax).prototype.__kind = SyntaxKind.MemberFunctionDeclaration, (MemberVariableDeclarationSyntax).prototype.__kind = SyntaxKind.MemberVariableDeclaration, (ConstructorDeclarationSyntax).prototype.__kind = SyntaxKind.ConstructorDeclaration, (IndexMemberDeclarationSyntax).prototype.__kind = SyntaxKind.IndexMemberDeclaration, (GetAccessorSyntax).prototype.__kind = SyntaxKind.GetAccessor, (SetAccessorSyntax).prototype.__kind = SyntaxKind.SetAccessor, (PropertySignatureSyntax).prototype.__kind = SyntaxKind.PropertySignature, (CallSignatureSyntax).prototype.__kind = SyntaxKind.CallSignature, (ConstructSignatureSyntax).prototype.__kind = SyntaxKind.ConstructSignature, (IndexSignatureSyntax).prototype.__kind = SyntaxKind.IndexSignature, (MethodSignatureSyntax).prototype.__kind = SyntaxKind.MethodSignature, (BlockSyntax).prototype.__kind = SyntaxKind.Block, (IfStatementSyntax).prototype.__kind = SyntaxKind.IfStatement, (VariableStatementSyntax).prototype.__kind = SyntaxKind.VariableStatement, (ExpressionStatementSyntax).prototype.__kind = SyntaxKind.ExpressionStatement, (ReturnStatementSyntax).prototype.__kind = SyntaxKind.ReturnStatement, (SwitchStatementSyntax).prototype.__kind = SyntaxKind.SwitchStatement, (BreakStatementSyntax).prototype.__kind = SyntaxKind.BreakStatement, (ContinueStatementSyntax).prototype.__kind = SyntaxKind.ContinueStatement, (ForStatementSyntax).prototype.__kind = SyntaxKind.ForStatement, (ForInStatementSyntax).prototype.__kind = SyntaxKind.ForInStatement, (EmptyStatementSyntax).prototype.__kind = SyntaxKind.EmptyStatement, (ThrowStatementSyntax).prototype.__kind = SyntaxKind.ThrowStatement, (WhileStatementSyntax).prototype.__kind = SyntaxKind.WhileStatement, (TryStatementSyntax).prototype.__kind = SyntaxKind.TryStatement, (LabeledStatementSyntax).prototype.__kind = SyntaxKind.LabeledStatement, (DoStatementSyntax).prototype.__kind = SyntaxKind.DoStatement, (DebuggerStatementSyntax).prototype.__kind = SyntaxKind.DebuggerStatement, (WithStatementSyntax).prototype.__kind = SyntaxKind.WithStatement, (DeleteExpressionSyntax).prototype.__kind = SyntaxKind.DeleteExpression, (TypeOfExpressionSyntax).prototype.__kind = SyntaxKind.TypeOfExpression, (VoidExpressionSyntax).prototype.__kind = SyntaxKind.VoidExpression, (ConditionalExpressionSyntax).prototype.__kind = SyntaxKind.ConditionalExpression, (MemberAccessExpressionSyntax).prototype.__kind = SyntaxKind.MemberAccessExpression, (InvocationExpressionSyntax).prototype.__kind = SyntaxKind.InvocationExpression, (ArrayLiteralExpressionSyntax).prototype.__kind = SyntaxKind.ArrayLiteralExpression, (ObjectLiteralExpressionSyntax).prototype.__kind = SyntaxKind.ObjectLiteralExpression, (ObjectCreationExpressionSyntax).prototype.__kind = SyntaxKind.ObjectCreationExpression, (ParenthesizedExpressionSyntax).prototype.__kind = SyntaxKind.ParenthesizedExpression, (ParenthesizedArrowFunctionExpressionSyntax).prototype.__kind = SyntaxKind.ParenthesizedArrowFunctionExpression, (SimpleArrowFunctionExpressionSyntax).prototype.__kind = SyntaxKind.SimpleArrowFunctionExpression, (CastExpressionSyntax).prototype.__kind = SyntaxKind.CastExpression, (ElementAccessExpressionSyntax).prototype.__kind = SyntaxKind.ElementAccessExpression, (FunctionExpressionSyntax).prototype.__kind = SyntaxKind.FunctionExpression, (OmittedExpressionSyntax).prototype.__kind = SyntaxKind.OmittedExpression, (VariableDeclarationSyntax).prototype.__kind = SyntaxKind.VariableDeclaration, (VariableDeclaratorSyntax).prototype.__kind = SyntaxKind.VariableDeclarator, (ArgumentListSyntax).prototype.__kind = SyntaxKind.ArgumentList, (ParameterListSyntax).prototype.__kind = SyntaxKind.ParameterList, (TypeArgumentListSyntax).prototype.__kind = SyntaxKind.TypeArgumentList, (TypeParameterListSyntax).prototype.__kind = SyntaxKind.TypeParameterList, (EqualsValueClauseSyntax).prototype.__kind = SyntaxKind.EqualsValueClause, (CaseSwitchClauseSyntax).prototype.__kind = SyntaxKind.CaseSwitchClause, (DefaultSwitchClauseSyntax).prototype.__kind = SyntaxKind.DefaultSwitchClause, (ElseClauseSyntax).prototype.__kind = SyntaxKind.ElseClause, (CatchClauseSyntax).prototype.__kind = SyntaxKind.CatchClause, (FinallyClauseSyntax).prototype.__kind = SyntaxKind.FinallyClause, (TypeParameterSyntax).prototype.__kind = SyntaxKind.TypeParameter, (ConstraintSyntax).prototype.__kind = SyntaxKind.Constraint, (SimplePropertyAssignmentSyntax).prototype.__kind = SyntaxKind.SimplePropertyAssignment, (FunctionPropertyAssignmentSyntax).prototype.__kind = SyntaxKind.FunctionPropertyAssignment, (ParameterSyntax).prototype.__kind = SyntaxKind.Parameter, (EnumElementSyntax).prototype.__kind = SyntaxKind.EnumElement, (TypeAnnotationSyntax).prototype.__kind = SyntaxKind.TypeAnnotation, (ExternalModuleReferenceSyntax).prototype.__kind = SyntaxKind.ExternalModuleReference, (ModuleNameModuleReferenceSyntax).prototype.__kind = SyntaxKind.ModuleNameModuleReference; + (SourceUnitSyntax).prototype.__kind = SyntaxKind.SourceUnit, (QualifiedNameSyntax).prototype.__kind = SyntaxKind.QualifiedName, (ObjectTypeSyntax).prototype.__kind = SyntaxKind.ObjectType, (FunctionTypeSyntax).prototype.__kind = SyntaxKind.FunctionType, (ArrayTypeSyntax).prototype.__kind = SyntaxKind.ArrayType, (ConstructorTypeSyntax).prototype.__kind = SyntaxKind.ConstructorType, (GenericTypeSyntax).prototype.__kind = SyntaxKind.GenericType, (TypeQuerySyntax).prototype.__kind = SyntaxKind.TypeQuery, (TupleTypeSyntax).prototype.__kind = SyntaxKind.TupleType, (InterfaceDeclarationSyntax).prototype.__kind = SyntaxKind.InterfaceDeclaration, (FunctionDeclarationSyntax).prototype.__kind = SyntaxKind.FunctionDeclaration, (ModuleDeclarationSyntax).prototype.__kind = SyntaxKind.ModuleDeclaration, (ClassDeclarationSyntax).prototype.__kind = SyntaxKind.ClassDeclaration, (EnumDeclarationSyntax).prototype.__kind = SyntaxKind.EnumDeclaration, (ImportDeclarationSyntax).prototype.__kind = SyntaxKind.ImportDeclaration, (ExportAssignmentSyntax).prototype.__kind = SyntaxKind.ExportAssignment, (MemberFunctionDeclarationSyntax).prototype.__kind = SyntaxKind.MemberFunctionDeclaration, (MemberVariableDeclarationSyntax).prototype.__kind = SyntaxKind.MemberVariableDeclaration, (ConstructorDeclarationSyntax).prototype.__kind = SyntaxKind.ConstructorDeclaration, (IndexMemberDeclarationSyntax).prototype.__kind = SyntaxKind.IndexMemberDeclaration, (GetAccessorSyntax).prototype.__kind = SyntaxKind.GetAccessor, (SetAccessorSyntax).prototype.__kind = SyntaxKind.SetAccessor, (PropertySignatureSyntax).prototype.__kind = SyntaxKind.PropertySignature, (CallSignatureSyntax).prototype.__kind = SyntaxKind.CallSignature, (ConstructSignatureSyntax).prototype.__kind = SyntaxKind.ConstructSignature, (IndexSignatureSyntax).prototype.__kind = SyntaxKind.IndexSignature, (MethodSignatureSyntax).prototype.__kind = SyntaxKind.MethodSignature, (BlockSyntax).prototype.__kind = SyntaxKind.Block, (IfStatementSyntax).prototype.__kind = SyntaxKind.IfStatement, (VariableStatementSyntax).prototype.__kind = SyntaxKind.VariableStatement, (ExpressionStatementSyntax).prototype.__kind = SyntaxKind.ExpressionStatement, (ReturnStatementSyntax).prototype.__kind = SyntaxKind.ReturnStatement, (SwitchStatementSyntax).prototype.__kind = SyntaxKind.SwitchStatement, (BreakStatementSyntax).prototype.__kind = SyntaxKind.BreakStatement, (ContinueStatementSyntax).prototype.__kind = SyntaxKind.ContinueStatement, (ForStatementSyntax).prototype.__kind = SyntaxKind.ForStatement, (ForInStatementSyntax).prototype.__kind = SyntaxKind.ForInStatement, (EmptyStatementSyntax).prototype.__kind = SyntaxKind.EmptyStatement, (ThrowStatementSyntax).prototype.__kind = SyntaxKind.ThrowStatement, (WhileStatementSyntax).prototype.__kind = SyntaxKind.WhileStatement, (TryStatementSyntax).prototype.__kind = SyntaxKind.TryStatement, (LabeledStatementSyntax).prototype.__kind = SyntaxKind.LabeledStatement, (DoStatementSyntax).prototype.__kind = SyntaxKind.DoStatement, (DebuggerStatementSyntax).prototype.__kind = SyntaxKind.DebuggerStatement, (WithStatementSyntax).prototype.__kind = SyntaxKind.WithStatement, (DeleteExpressionSyntax).prototype.__kind = SyntaxKind.DeleteExpression, (TypeOfExpressionSyntax).prototype.__kind = SyntaxKind.TypeOfExpression, (VoidExpressionSyntax).prototype.__kind = SyntaxKind.VoidExpression, (ConditionalExpressionSyntax).prototype.__kind = SyntaxKind.ConditionalExpression, (MemberAccessExpressionSyntax).prototype.__kind = SyntaxKind.MemberAccessExpression, (InvocationExpressionSyntax).prototype.__kind = SyntaxKind.InvocationExpression, (ArrayLiteralExpressionSyntax).prototype.__kind = SyntaxKind.ArrayLiteralExpression, (ObjectLiteralExpressionSyntax).prototype.__kind = SyntaxKind.ObjectLiteralExpression, (ObjectCreationExpressionSyntax).prototype.__kind = SyntaxKind.ObjectCreationExpression, (ParenthesizedExpressionSyntax).prototype.__kind = SyntaxKind.ParenthesizedExpression, (ParenthesizedArrowFunctionExpressionSyntax).prototype.__kind = SyntaxKind.ParenthesizedArrowFunctionExpression, (SimpleArrowFunctionExpressionSyntax).prototype.__kind = SyntaxKind.SimpleArrowFunctionExpression, (CastExpressionSyntax).prototype.__kind = SyntaxKind.CastExpression, (ElementAccessExpressionSyntax).prototype.__kind = SyntaxKind.ElementAccessExpression, (FunctionExpressionSyntax).prototype.__kind = SyntaxKind.FunctionExpression, (OmittedExpressionSyntax).prototype.__kind = SyntaxKind.OmittedExpression, (VariableDeclarationSyntax).prototype.__kind = SyntaxKind.VariableDeclaration, (VariableDeclaratorSyntax).prototype.__kind = SyntaxKind.VariableDeclarator, (ArgumentListSyntax).prototype.__kind = SyntaxKind.ArgumentList, (ParameterListSyntax).prototype.__kind = SyntaxKind.ParameterList, (TypeArgumentListSyntax).prototype.__kind = SyntaxKind.TypeArgumentList, (TypeParameterListSyntax).prototype.__kind = SyntaxKind.TypeParameterList, (EqualsValueClauseSyntax).prototype.__kind = SyntaxKind.EqualsValueClause, (CaseSwitchClauseSyntax).prototype.__kind = SyntaxKind.CaseSwitchClause, (DefaultSwitchClauseSyntax).prototype.__kind = SyntaxKind.DefaultSwitchClause, (ElseClauseSyntax).prototype.__kind = SyntaxKind.ElseClause, (CatchClauseSyntax).prototype.__kind = SyntaxKind.CatchClause, (FinallyClauseSyntax).prototype.__kind = SyntaxKind.FinallyClause, (TypeParameterSyntax).prototype.__kind = SyntaxKind.TypeParameter, (ConstraintSyntax).prototype.__kind = SyntaxKind.Constraint, (SimplePropertyAssignmentSyntax).prototype.__kind = SyntaxKind.SimplePropertyAssignment, (FunctionPropertyAssignmentSyntax).prototype.__kind = SyntaxKind.FunctionPropertyAssignment, (ParameterSyntax).prototype.__kind = SyntaxKind.Parameter, (EnumElementSyntax).prototype.__kind = SyntaxKind.EnumElement, (TypeAnnotationSyntax).prototype.__kind = SyntaxKind.TypeAnnotation, (ExternalModuleReferenceSyntax).prototype.__kind = SyntaxKind.ExternalModuleReference, (ModuleNameModuleReferenceSyntax).prototype.__kind = SyntaxKind.ModuleNameModuleReference; } \ No newline at end of file diff --git a/src/services/syntax/syntaxNodes.interfaces.generated.ts b/src/services/syntax/syntaxNodes.interfaces.generated.ts index 0ecc9cbf9c..949141ba22 100644 --- a/src/services/syntax/syntaxNodes.interfaces.generated.ts +++ b/src/services/syntax/syntaxNodes.interfaces.generated.ts @@ -42,6 +42,11 @@ module TypeScript { typeOfKeyword: ISyntaxToken; name: INameSyntax; } + export interface TupleTypeSyntax extends ISyntaxNode, ITypeSyntax { + openBracketToken: ISyntaxToken; + types: ITypeSyntax[]; + closeBracketToken: ISyntaxToken; + } export interface InterfaceDeclarationSyntax extends ISyntaxNode, IModuleElementSyntax { modifiers: ISyntaxToken[]; interfaceKeyword: ISyntaxToken; @@ -478,7 +483,7 @@ module TypeScript { moduleName: INameSyntax; } - export var nodeMetadata: string[][] = [[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],["moduleElements","endOfFileToken"],["left","dotToken","right"],["openBraceToken","typeMembers","closeBraceToken"],["typeParameterList","parameterList","equalsGreaterThanToken","type"],["type","openBracketToken","closeBracketToken"],["newKeyword","typeParameterList","parameterList","equalsGreaterThanToken","type"],["name","typeArgumentList"],["typeOfKeyword","name"],["modifiers","interfaceKeyword","identifier","typeParameterList","heritageClauses","body"],["modifiers","functionKeyword","identifier","callSignature","block","semicolonToken"],["modifiers","moduleKeyword","name","stringLiteral","openBraceToken","moduleElements","closeBraceToken"],["modifiers","classKeyword","identifier","typeParameterList","heritageClauses","openBraceToken","classElements","closeBraceToken"],["modifiers","enumKeyword","identifier","openBraceToken","enumElements","closeBraceToken"],["modifiers","importKeyword","identifier","equalsToken","moduleReference","semicolonToken"],["exportKeyword","equalsToken","identifier","semicolonToken"],["modifiers","propertyName","callSignature","block","semicolonToken"],["modifiers","variableDeclarator","semicolonToken"],["modifiers","constructorKeyword","callSignature","block","semicolonToken"],["modifiers","indexSignature","semicolonToken"],["modifiers","getKeyword","propertyName","callSignature","block"],["modifiers","setKeyword","propertyName","callSignature","block"],["propertyName","questionToken","typeAnnotation"],["typeParameterList","parameterList","typeAnnotation"],["newKeyword","callSignature"],["openBracketToken","parameters","closeBracketToken","typeAnnotation"],["propertyName","questionToken","callSignature"],["openBraceToken","statements","closeBraceToken"],["ifKeyword","openParenToken","condition","closeParenToken","statement","elseClause"],["modifiers","variableDeclaration","semicolonToken"],["expression","semicolonToken"],["returnKeyword","expression","semicolonToken"],["switchKeyword","openParenToken","expression","closeParenToken","openBraceToken","switchClauses","closeBraceToken"],["breakKeyword","identifier","semicolonToken"],["continueKeyword","identifier","semicolonToken"],["forKeyword","openParenToken","variableDeclaration","initializer","firstSemicolonToken","condition","secondSemicolonToken","incrementor","closeParenToken","statement"],["forKeyword","openParenToken","variableDeclaration","left","inKeyword","expression","closeParenToken","statement"],["semicolonToken"],["throwKeyword","expression","semicolonToken"],["whileKeyword","openParenToken","condition","closeParenToken","statement"],["tryKeyword","block","catchClause","finallyClause"],["identifier","colonToken","statement"],["doKeyword","statement","whileKeyword","openParenToken","condition","closeParenToken","semicolonToken"],["debuggerKeyword","semicolonToken"],["withKeyword","openParenToken","condition","closeParenToken","statement"],["operatorToken","operand"],["operatorToken","operand"],["operatorToken","operand"],["operatorToken","operand"],["operatorToken","operand"],["operatorToken","operand"],["deleteKeyword","expression"],["typeOfKeyword","expression"],["voidKeyword","expression"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["condition","questionToken","whenTrue","colonToken","whenFalse"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["operand","operatorToken"],["operand","operatorToken"],["expression","dotToken","name"],["expression","argumentList"],["openBracketToken","expressions","closeBracketToken"],["openBraceToken","propertyAssignments","closeBraceToken"],["newKeyword","expression","argumentList"],["openParenToken","expression","closeParenToken"],["callSignature","equalsGreaterThanToken","block","expression"],["parameter","equalsGreaterThanToken","block","expression"],["lessThanToken","type","greaterThanToken","expression"],["expression","openBracketToken","argumentExpression","closeBracketToken"],["functionKeyword","identifier","callSignature","block"],[],["varKeyword","variableDeclarators"],["propertyName","typeAnnotation","equalsValueClause"],["typeArgumentList","openParenToken","arguments","closeParenToken"],["openParenToken","parameters","closeParenToken"],["lessThanToken","typeArguments","greaterThanToken"],["lessThanToken","typeParameters","greaterThanToken"],["extendsOrImplementsKeyword","typeNames"],["extendsOrImplementsKeyword","typeNames"],["equalsToken","value"],["caseKeyword","expression","colonToken","statements"],["defaultKeyword","colonToken","statements"],["elseKeyword","statement"],["catchKeyword","openParenToken","identifier","typeAnnotation","closeParenToken","block"],["finallyKeyword","block"],["identifier","constraint"],["extendsKeyword","typeOrExpression"],["propertyName","colonToken","expression"],["propertyName","callSignature","block"],["dotDotDotToken","modifiers","identifier","questionToken","typeAnnotation","equalsValueClause"],["propertyName","equalsValueClause"],["colonToken","type"],["requireKeyword","openParenToken","stringLiteral","closeParenToken"],["moduleName"],]; + export var nodeMetadata: string[][] = [[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],["moduleElements","endOfFileToken"],["left","dotToken","right"],["openBraceToken","typeMembers","closeBraceToken"],["typeParameterList","parameterList","equalsGreaterThanToken","type"],["type","openBracketToken","closeBracketToken"],["newKeyword","typeParameterList","parameterList","equalsGreaterThanToken","type"],["name","typeArgumentList"],["typeOfKeyword","name"],["openBracketToken","types","closeBracketToken"],["modifiers","interfaceKeyword","identifier","typeParameterList","heritageClauses","body"],["modifiers","functionKeyword","identifier","callSignature","block","semicolonToken"],["modifiers","moduleKeyword","name","stringLiteral","openBraceToken","moduleElements","closeBraceToken"],["modifiers","classKeyword","identifier","typeParameterList","heritageClauses","openBraceToken","classElements","closeBraceToken"],["modifiers","enumKeyword","identifier","openBraceToken","enumElements","closeBraceToken"],["modifiers","importKeyword","identifier","equalsToken","moduleReference","semicolonToken"],["exportKeyword","equalsToken","identifier","semicolonToken"],["modifiers","propertyName","callSignature","block","semicolonToken"],["modifiers","variableDeclarator","semicolonToken"],["modifiers","constructorKeyword","callSignature","block","semicolonToken"],["modifiers","indexSignature","semicolonToken"],["modifiers","getKeyword","propertyName","callSignature","block"],["modifiers","setKeyword","propertyName","callSignature","block"],["propertyName","questionToken","typeAnnotation"],["typeParameterList","parameterList","typeAnnotation"],["newKeyword","callSignature"],["openBracketToken","parameters","closeBracketToken","typeAnnotation"],["propertyName","questionToken","callSignature"],["openBraceToken","statements","closeBraceToken"],["ifKeyword","openParenToken","condition","closeParenToken","statement","elseClause"],["modifiers","variableDeclaration","semicolonToken"],["expression","semicolonToken"],["returnKeyword","expression","semicolonToken"],["switchKeyword","openParenToken","expression","closeParenToken","openBraceToken","switchClauses","closeBraceToken"],["breakKeyword","identifier","semicolonToken"],["continueKeyword","identifier","semicolonToken"],["forKeyword","openParenToken","variableDeclaration","initializer","firstSemicolonToken","condition","secondSemicolonToken","incrementor","closeParenToken","statement"],["forKeyword","openParenToken","variableDeclaration","left","inKeyword","expression","closeParenToken","statement"],["semicolonToken"],["throwKeyword","expression","semicolonToken"],["whileKeyword","openParenToken","condition","closeParenToken","statement"],["tryKeyword","block","catchClause","finallyClause"],["identifier","colonToken","statement"],["doKeyword","statement","whileKeyword","openParenToken","condition","closeParenToken","semicolonToken"],["debuggerKeyword","semicolonToken"],["withKeyword","openParenToken","condition","closeParenToken","statement"],["operatorToken","operand"],["operatorToken","operand"],["operatorToken","operand"],["operatorToken","operand"],["operatorToken","operand"],["operatorToken","operand"],["deleteKeyword","expression"],["typeOfKeyword","expression"],["voidKeyword","expression"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["condition","questionToken","whenTrue","colonToken","whenFalse"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["left","operatorToken","right"],["operand","operatorToken"],["operand","operatorToken"],["expression","dotToken","name"],["expression","argumentList"],["openBracketToken","expressions","closeBracketToken"],["openBraceToken","propertyAssignments","closeBraceToken"],["newKeyword","expression","argumentList"],["openParenToken","expression","closeParenToken"],["callSignature","equalsGreaterThanToken","block","expression"],["parameter","equalsGreaterThanToken","block","expression"],["lessThanToken","type","greaterThanToken","expression"],["expression","openBracketToken","argumentExpression","closeBracketToken"],["functionKeyword","identifier","callSignature","block"],[],["varKeyword","variableDeclarators"],["propertyName","typeAnnotation","equalsValueClause"],["typeArgumentList","openParenToken","arguments","closeParenToken"],["openParenToken","parameters","closeParenToken"],["lessThanToken","typeArguments","greaterThanToken"],["lessThanToken","typeParameters","greaterThanToken"],["extendsOrImplementsKeyword","typeNames"],["extendsOrImplementsKeyword","typeNames"],["equalsToken","value"],["caseKeyword","expression","colonToken","statements"],["defaultKeyword","colonToken","statements"],["elseKeyword","statement"],["catchKeyword","openParenToken","identifier","typeAnnotation","closeParenToken","block"],["finallyKeyword","block"],["identifier","constraint"],["extendsKeyword","typeOrExpression"],["propertyName","colonToken","expression"],["propertyName","callSignature","block"],["dotDotDotToken","modifiers","identifier","questionToken","typeAnnotation","equalsValueClause"],["propertyName","equalsValueClause"],["colonToken","type"],["requireKeyword","openParenToken","stringLiteral","closeParenToken"],["moduleName"],]; export module Syntax { export interface ISyntaxFactory { @@ -491,6 +496,7 @@ module TypeScript { ConstructorTypeSyntax: { new(data: number, newKeyword: ISyntaxToken, typeParameterList: TypeParameterListSyntax, parameterList: ParameterListSyntax, equalsGreaterThanToken: ISyntaxToken, type: ITypeSyntax): ConstructorTypeSyntax }; GenericTypeSyntax: { new(data: number, name: INameSyntax, typeArgumentList: TypeArgumentListSyntax): GenericTypeSyntax }; TypeQuerySyntax: { new(data: number, typeOfKeyword: ISyntaxToken, name: INameSyntax): TypeQuerySyntax }; + TupleTypeSyntax: { new(data: number, openBracketToken: ISyntaxToken, types: ITypeSyntax[], closeBracketToken: ISyntaxToken): TupleTypeSyntax }; InterfaceDeclarationSyntax: { new(data: number, modifiers: ISyntaxToken[], interfaceKeyword: ISyntaxToken, identifier: ISyntaxToken, typeParameterList: TypeParameterListSyntax, heritageClauses: HeritageClauseSyntax[], body: ObjectTypeSyntax): InterfaceDeclarationSyntax }; FunctionDeclarationSyntax: { new(data: number, modifiers: ISyntaxToken[], functionKeyword: ISyntaxToken, identifier: ISyntaxToken, callSignature: CallSignatureSyntax, block: BlockSyntax, semicolonToken: ISyntaxToken): FunctionDeclarationSyntax }; ModuleDeclarationSyntax: { new(data: number, modifiers: ISyntaxToken[], moduleKeyword: ISyntaxToken, name: INameSyntax, stringLiteral: ISyntaxToken, openBraceToken: ISyntaxToken, moduleElements: IModuleElementSyntax[], closeBraceToken: ISyntaxToken): ModuleDeclarationSyntax }; diff --git a/src/services/syntax/syntaxTree.ts b/src/services/syntax/syntaxTree.ts index 0ae43ee3a1..1e8ac95c48 100644 --- a/src/services/syntax/syntaxTree.ts +++ b/src/services/syntax/syntaxTree.ts @@ -84,6 +84,7 @@ module TypeScript { private cacheSyntaxTreeInfo(): void { // If we're not keeping around the syntax tree, store the diagnostics and line // map so they don't have to be recomputed. + var sourceUnit = this.sourceUnit(); var firstToken = firstSyntaxTreeToken(this); var leadingTrivia = firstToken.leadingTrivia(this.text); @@ -238,7 +239,7 @@ module TypeScript { } private checkParameterAccessibilityModifier(parameterList: ParameterListSyntax, modifier: ISyntaxToken, modifierIndex: number): boolean { - if (modifier.kind() !== SyntaxKind.PublicKeyword && modifier.kind() !== SyntaxKind.PrivateKeyword) { + if (!SyntaxFacts.isAccessibilityModifier(modifier.kind())) { this.pushDiagnostic(modifier, DiagnosticCode._0_modifier_cannot_appear_on_a_parameter, [modifier.text()]); return true; } @@ -320,6 +321,15 @@ module TypeScript { super.visitTypeArgumentList(node); } + public visitTupleType(node: TupleTypeSyntax): void { + if (this.checkForTrailingComma(node.types) || + this.checkForAtLeastOneElement(node, node.types, node.openBracketToken, getLocalizedText(DiagnosticCode.type, null))) { + return + } + + super.visitTupleType(node); + } + public visitTypeParameterList(node: TypeParameterListSyntax): void { if (this.checkForTrailingComma(node.typeParameters) || this.checkForAtLeastOneElement(node, node.typeParameters, node.lessThanToken, getLocalizedText(DiagnosticCode.type_parameter, null))) { @@ -514,9 +524,7 @@ module TypeScript { for (var i = 0, n = list.length; i < n; i++) { var modifier = list[i]; - if (modifier.kind() === SyntaxKind.PublicKeyword || - modifier.kind() === SyntaxKind.PrivateKeyword) { - + if (SyntaxFacts.isAccessibilityModifier(modifier.kind())) { if (seenAccessibilityModifier) { this.pushDiagnostic(modifier, DiagnosticCode.Accessibility_modifier_already_seen); return true; @@ -751,8 +759,7 @@ module TypeScript { for (var i = 0, n = modifiers.length; i < n; i++) { var modifier = modifiers[i]; - if (modifier.kind() === SyntaxKind.PublicKeyword || - modifier.kind() === SyntaxKind.PrivateKeyword || + if (SyntaxFacts.isAccessibilityModifier(modifier.kind()) || modifier.kind() === SyntaxKind.StaticKeyword) { this.pushDiagnostic(modifier, DiagnosticCode._0_modifier_cannot_appear_on_a_module_element, [modifier.text()]); return true; diff --git a/src/services/syntax/syntaxVisitor.generated.ts b/src/services/syntax/syntaxVisitor.generated.ts index 7081499105..55aaef5325 100644 --- a/src/services/syntax/syntaxVisitor.generated.ts +++ b/src/services/syntax/syntaxVisitor.generated.ts @@ -13,6 +13,7 @@ module TypeScript { case SyntaxKind.ConstructorType: return visitor.visitConstructorType(element); case SyntaxKind.GenericType: return visitor.visitGenericType(element); case SyntaxKind.TypeQuery: return visitor.visitTypeQuery(element); + case SyntaxKind.TupleType: return visitor.visitTupleType(element); case SyntaxKind.InterfaceDeclaration: return visitor.visitInterfaceDeclaration(element); case SyntaxKind.FunctionDeclaration: return visitor.visitFunctionDeclaration(element); case SyntaxKind.ModuleDeclaration: return visitor.visitModuleDeclaration(element); @@ -109,6 +110,7 @@ module TypeScript { visitConstructorType(node: ConstructorTypeSyntax): any; visitGenericType(node: GenericTypeSyntax): any; visitTypeQuery(node: TypeQuerySyntax): any; + visitTupleType(node: TupleTypeSyntax): any; visitInterfaceDeclaration(node: InterfaceDeclarationSyntax): any; visitFunctionDeclaration(node: FunctionDeclarationSyntax): any; visitModuleDeclaration(node: ModuleDeclarationSyntax): any; diff --git a/src/services/syntax/syntaxWalker.generated.ts b/src/services/syntax/syntaxWalker.generated.ts index 73f70f1834..7b33570985 100644 --- a/src/services/syntax/syntaxWalker.generated.ts +++ b/src/services/syntax/syntaxWalker.generated.ts @@ -103,6 +103,12 @@ module TypeScript { this.visitNodeOrToken(node.name); } + public visitTupleType(node: TupleTypeSyntax): void { + this.visitToken(node.openBracketToken); + this.visitSeparatedList(node.types); + this.visitToken(node.closeBracketToken); + } + public visitInterfaceDeclaration(node: InterfaceDeclarationSyntax): void { this.visitList(node.modifiers); this.visitToken(node.interfaceKeyword); diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.errors.txt b/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.errors.txt index 6121bba66f..3feee7069d 100644 --- a/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.errors.txt +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.ts(11,16): error TS2341: Property 'clodule.sfn' is inaccessible. +tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.ts(11,16): error TS2341: Property 'sfn' is private and only accessible within class 'clodule'. ==== tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.ts (1 errors) ==== @@ -14,7 +14,7 @@ tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMer export function fn(x: T, y: T): number { return clodule.sfn('a'); ~~~~~~~~~~~ -!!! error TS2341: Property 'clodule.sfn' is inaccessible. +!!! error TS2341: Property 'sfn' is private and only accessible within class 'clodule'. } } diff --git a/tests/baselines/reference/Protected1.errors.txt b/tests/baselines/reference/Protected1.errors.txt new file mode 100644 index 0000000000..561e4cfd00 --- /dev/null +++ b/tests/baselines/reference/Protected1.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript5/Protected/Protected1.ts(1,1): error TS1044: 'protected' modifier cannot appear on a module element. + + +==== tests/cases/conformance/parser/ecmascript5/Protected/Protected1.ts (1 errors) ==== + protected class C { + ~~~~~~~~~ +!!! error TS1044: 'protected' modifier cannot appear on a module element. + } \ No newline at end of file diff --git a/tests/baselines/reference/Protected2.errors.txt b/tests/baselines/reference/Protected2.errors.txt new file mode 100644 index 0000000000..0f6de4d49e --- /dev/null +++ b/tests/baselines/reference/Protected2.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript5/Protected/Protected2.ts(1,1): error TS1044: 'protected' modifier cannot appear on a module element. + + +==== tests/cases/conformance/parser/ecmascript5/Protected/Protected2.ts (1 errors) ==== + protected module M { + ~~~~~~~~~ +!!! error TS1044: 'protected' modifier cannot appear on a module element. + } \ No newline at end of file diff --git a/tests/baselines/reference/Protected3.errors.txt b/tests/baselines/reference/Protected3.errors.txt new file mode 100644 index 0000000000..688422a1e0 --- /dev/null +++ b/tests/baselines/reference/Protected3.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript5/Protected/Protected3.ts(2,3): error TS1089: 'protected' modifier cannot appear on a constructor declaration. + + +==== tests/cases/conformance/parser/ecmascript5/Protected/Protected3.ts (1 errors) ==== + class C { + protected constructor() { } + ~~~~~~~~~ +!!! error TS1089: 'protected' modifier cannot appear on a constructor declaration. + } \ No newline at end of file diff --git a/tests/baselines/reference/Protected4.errors.txt b/tests/baselines/reference/Protected4.errors.txt new file mode 100644 index 0000000000..fa4f410ab6 --- /dev/null +++ b/tests/baselines/reference/Protected4.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript5/Protected/Protected4.ts(2,13): error TS1028: Accessibility modifier already seen. + + +==== tests/cases/conformance/parser/ecmascript5/Protected/Protected4.ts (1 errors) ==== + class C { + protected public m() { } + ~~~~~~ +!!! error TS1028: Accessibility modifier already seen. + } \ No newline at end of file diff --git a/tests/baselines/reference/Protected5.js b/tests/baselines/reference/Protected5.js new file mode 100644 index 0000000000..8834cc488c --- /dev/null +++ b/tests/baselines/reference/Protected5.js @@ -0,0 +1,13 @@ +//// [Protected5.ts] +class C { + protected static m() { } +} + +//// [Protected5.js] +var C = (function () { + function C() { + } + C.m = function () { + }; + return C; +})(); diff --git a/tests/baselines/reference/Protected5.types b/tests/baselines/reference/Protected5.types new file mode 100644 index 0000000000..7ef0be949a --- /dev/null +++ b/tests/baselines/reference/Protected5.types @@ -0,0 +1,7 @@ +=== tests/cases/conformance/parser/ecmascript5/Protected/Protected5.ts === +class C { +>C : C + + protected static m() { } +>m : () => void +} diff --git a/tests/baselines/reference/Protected6.errors.txt b/tests/baselines/reference/Protected6.errors.txt new file mode 100644 index 0000000000..3b3804b0fb --- /dev/null +++ b/tests/baselines/reference/Protected6.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript5/Protected/Protected6.ts(2,10): error TS1029: 'protected' modifier must precede 'static' modifier. + + +==== tests/cases/conformance/parser/ecmascript5/Protected/Protected6.ts (1 errors) ==== + class C { + static protected m() { } + ~~~~~~~~~ +!!! error TS1029: 'protected' modifier must precede 'static' modifier. + } \ No newline at end of file diff --git a/tests/baselines/reference/Protected7.errors.txt b/tests/baselines/reference/Protected7.errors.txt new file mode 100644 index 0000000000..e95f39eb1b --- /dev/null +++ b/tests/baselines/reference/Protected7.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript5/Protected/Protected7.ts(2,13): error TS1028: Accessibility modifier already seen. + + +==== tests/cases/conformance/parser/ecmascript5/Protected/Protected7.ts (1 errors) ==== + class C { + protected private m() { } + ~~~~~~~ +!!! error TS1028: Accessibility modifier already seen. + } \ No newline at end of file diff --git a/tests/baselines/reference/Protected8.js b/tests/baselines/reference/Protected8.js new file mode 100644 index 0000000000..4a24f98dc5 --- /dev/null +++ b/tests/baselines/reference/Protected8.js @@ -0,0 +1,7 @@ +//// [Protected8.ts] +interface I { + protected + p +} + +//// [Protected8.js] diff --git a/tests/baselines/reference/Protected8.types b/tests/baselines/reference/Protected8.types new file mode 100644 index 0000000000..f29be486ee --- /dev/null +++ b/tests/baselines/reference/Protected8.types @@ -0,0 +1,10 @@ +=== tests/cases/conformance/parser/ecmascript5/Protected/Protected8.ts === +interface I { +>I : I + + protected +>protected : any + + p +>p : any +} diff --git a/tests/baselines/reference/Protected9.js b/tests/baselines/reference/Protected9.js new file mode 100644 index 0000000000..f747f18e8e --- /dev/null +++ b/tests/baselines/reference/Protected9.js @@ -0,0 +1,12 @@ +//// [Protected9.ts] +class C { + constructor(protected p) { } +} + +//// [Protected9.js] +var C = (function () { + function C(p) { + this.p = p; + } + return C; +})(); diff --git a/tests/baselines/reference/Protected9.types b/tests/baselines/reference/Protected9.types new file mode 100644 index 0000000000..d4b6e2fff8 --- /dev/null +++ b/tests/baselines/reference/Protected9.types @@ -0,0 +1,7 @@ +=== tests/cases/conformance/parser/ecmascript5/Protected/Protected9.ts === +class C { +>C : C + + constructor(protected p) { } +>p : any +} diff --git a/tests/baselines/reference/TupleType1.js b/tests/baselines/reference/TupleType1.js new file mode 100644 index 0000000000..96a1db4654 --- /dev/null +++ b/tests/baselines/reference/TupleType1.js @@ -0,0 +1,5 @@ +//// [TupleType1.ts] +var v: [number] + +//// [TupleType1.js] +var v; diff --git a/tests/baselines/reference/TupleType1.types b/tests/baselines/reference/TupleType1.types new file mode 100644 index 0000000000..39fa32d5dc --- /dev/null +++ b/tests/baselines/reference/TupleType1.types @@ -0,0 +1,4 @@ +=== tests/cases/conformance/parser/ecmascript5/TupleTypes/TupleType1.ts === +var v: [number] +>v : [number] + diff --git a/tests/baselines/reference/TupleType2.js b/tests/baselines/reference/TupleType2.js new file mode 100644 index 0000000000..e74db6f031 --- /dev/null +++ b/tests/baselines/reference/TupleType2.js @@ -0,0 +1,5 @@ +//// [TupleType2.ts] +var v: [number, string] + +//// [TupleType2.js] +var v; diff --git a/tests/baselines/reference/TupleType2.types b/tests/baselines/reference/TupleType2.types new file mode 100644 index 0000000000..0f35f60786 --- /dev/null +++ b/tests/baselines/reference/TupleType2.types @@ -0,0 +1,4 @@ +=== tests/cases/conformance/parser/ecmascript5/TupleTypes/TupleType2.ts === +var v: [number, string] +>v : [number, string] + diff --git a/tests/baselines/reference/TupleType3.errors.txt b/tests/baselines/reference/TupleType3.errors.txt new file mode 100644 index 0000000000..a7f5b11732 --- /dev/null +++ b/tests/baselines/reference/TupleType3.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/parser/ecmascript5/TupleTypes/TupleType3.ts(1,8): error TS1122: A tuple type element list cannot be empty. + + +==== tests/cases/conformance/parser/ecmascript5/TupleTypes/TupleType3.ts (1 errors) ==== + var v: [] + ~~ +!!! error TS1122: A tuple type element list cannot be empty. \ No newline at end of file diff --git a/tests/baselines/reference/TupleType4.errors.txt b/tests/baselines/reference/TupleType4.errors.txt new file mode 100644 index 0000000000..987f40b7ae --- /dev/null +++ b/tests/baselines/reference/TupleType4.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/parser/ecmascript5/TupleTypes/TupleType4.ts(1,9): error TS1005: ']' expected. + + +==== tests/cases/conformance/parser/ecmascript5/TupleTypes/TupleType4.ts (1 errors) ==== + var v: [ + +!!! error TS1005: ']' expected. \ No newline at end of file diff --git a/tests/baselines/reference/TupleType5.errors.txt b/tests/baselines/reference/TupleType5.errors.txt new file mode 100644 index 0000000000..1a6ca7f99b --- /dev/null +++ b/tests/baselines/reference/TupleType5.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/parser/ecmascript5/TupleTypes/TupleType5.ts(1,15): error TS1009: Trailing comma not allowed. + + +==== tests/cases/conformance/parser/ecmascript5/TupleTypes/TupleType5.ts (1 errors) ==== + var v: [number,] + ~ +!!! error TS1009: Trailing comma not allowed. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembersAccessibility.errors.txt b/tests/baselines/reference/assignmentCompatWithObjectMembersAccessibility.errors.txt index 75f36240e0..ab9ddb553d 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembersAccessibility.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithObjectMembersAccessibility.errors.txt @@ -1,51 +1,51 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(31,5): error TS2322: Type 'E' is not assignable to type '{ foo: string; }': - Private property 'foo' cannot be reimplemented. + Property 'foo' is private in type 'E' but not in type '{ foo: string; }'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(36,5): error TS2322: Type 'E' is not assignable to type 'Base': - Private property 'foo' cannot be reimplemented. + Property 'foo' is private in type 'E' but not in type 'Base'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(41,5): error TS2322: Type 'E' is not assignable to type 'I': - Private property 'foo' cannot be reimplemented. + Property 'foo' is private in type 'E' but not in type 'I'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(46,5): error TS2322: Type 'E' is not assignable to type 'D': - Private property 'foo' cannot be reimplemented. + Property 'foo' is private in type 'E' but not in type 'D'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(48,5): error TS2322: Type '{ foo: string; }' is not assignable to type 'E': - Private property 'foo' cannot be reimplemented. + Property 'foo' is private in type 'E' but not in type '{ foo: string; }'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(49,5): error TS2322: Type 'Base' is not assignable to type 'E': - Private property 'foo' cannot be reimplemented. + Property 'foo' is private in type 'E' but not in type 'Base'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(50,5): error TS2322: Type 'I' is not assignable to type 'E': - Private property 'foo' cannot be reimplemented. + Property 'foo' is private in type 'E' but not in type 'I'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(51,5): error TS2322: Type 'D' is not assignable to type 'E': - Private property 'foo' cannot be reimplemented. + Property 'foo' is private in type 'E' but not in type 'D'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(81,5): error TS2322: Type 'Base' is not assignable to type '{ foo: string; }': - Private property 'foo' cannot be reimplemented. + Property 'foo' is private in type 'Base' but not in type '{ foo: string; }'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(82,5): error TS2322: Type 'I' is not assignable to type '{ foo: string; }': - Private property 'foo' cannot be reimplemented. + Property 'foo' is private in type 'I' but not in type '{ foo: string; }'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(84,5): error TS2322: Type 'E' is not assignable to type '{ foo: string; }': - Private property 'foo' cannot be reimplemented. + Property 'foo' is private in type 'E' but not in type '{ foo: string; }'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(86,5): error TS2322: Type '{ foo: string; }' is not assignable to type 'Base': - Private property 'foo' cannot be reimplemented. + Property 'foo' is private in type 'Base' but not in type '{ foo: string; }'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(88,5): error TS2322: Type 'D' is not assignable to type 'Base': - Private property 'foo' cannot be reimplemented. + Property 'foo' is private in type 'Base' but not in type 'D'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(89,5): error TS2322: Type 'E' is not assignable to type 'Base': - Private property 'foo' cannot be reimplemented. + Types have separate declarations of a private property 'foo'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(92,5): error TS2322: Type '{ foo: string; }' is not assignable to type 'I': - Private property 'foo' cannot be reimplemented. + Property 'foo' is private in type 'I' but not in type '{ foo: string; }'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(94,5): error TS2322: Type 'D' is not assignable to type 'I': - Private property 'foo' cannot be reimplemented. + Property 'foo' is private in type 'I' but not in type 'D'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(95,5): error TS2322: Type 'E' is not assignable to type 'I': - Private property 'foo' cannot be reimplemented. + Types have separate declarations of a private property 'foo'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(99,5): error TS2322: Type 'Base' is not assignable to type 'D': - Private property 'foo' cannot be reimplemented. + Property 'foo' is private in type 'Base' but not in type 'D'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(100,5): error TS2322: Type 'I' is not assignable to type 'D': - Private property 'foo' cannot be reimplemented. + Property 'foo' is private in type 'I' but not in type 'D'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(101,5): error TS2322: Type 'E' is not assignable to type 'D': - Private property 'foo' cannot be reimplemented. + Property 'foo' is private in type 'E' but not in type 'D'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(103,5): error TS2322: Type '{ foo: string; }' is not assignable to type 'E': - Private property 'foo' cannot be reimplemented. + Property 'foo' is private in type 'E' but not in type '{ foo: string; }'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(104,5): error TS2322: Type 'Base' is not assignable to type 'E': - Private property 'foo' cannot be reimplemented. + Types have separate declarations of a private property 'foo'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(105,5): error TS2322: Type 'I' is not assignable to type 'E': - Private property 'foo' cannot be reimplemented. + Types have separate declarations of a private property 'foo'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(106,5): error TS2322: Type 'D' is not assignable to type 'E': - Private property 'foo' cannot be reimplemented. + Property 'foo' is private in type 'E' but not in type 'D'. ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts (24 errors) ==== @@ -82,7 +82,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme a = e; // error ~ !!! error TS2322: Type 'E' is not assignable to type '{ foo: string; }': -!!! error TS2322: Private property 'foo' cannot be reimplemented. +!!! error TS2322: Property 'foo' is private in type 'E' but not in type '{ foo: string; }'. b = a; b = i; @@ -90,7 +90,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme b = e; // error ~ !!! error TS2322: Type 'E' is not assignable to type 'Base': -!!! error TS2322: Private property 'foo' cannot be reimplemented. +!!! error TS2322: Property 'foo' is private in type 'E' but not in type 'Base'. i = a; i = b; @@ -98,7 +98,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme i = e; // error ~ !!! error TS2322: Type 'E' is not assignable to type 'I': -!!! error TS2322: Private property 'foo' cannot be reimplemented. +!!! error TS2322: Property 'foo' is private in type 'E' but not in type 'I'. d = a; d = b; @@ -106,24 +106,24 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme d = e; // error ~ !!! error TS2322: Type 'E' is not assignable to type 'D': -!!! error TS2322: Private property 'foo' cannot be reimplemented. +!!! error TS2322: Property 'foo' is private in type 'E' but not in type 'D'. e = a; // errror ~ !!! error TS2322: Type '{ foo: string; }' is not assignable to type 'E': -!!! error TS2322: Private property 'foo' cannot be reimplemented. +!!! error TS2322: Property 'foo' is private in type 'E' but not in type '{ foo: string; }'. e = b; // errror ~ !!! error TS2322: Type 'Base' is not assignable to type 'E': -!!! error TS2322: Private property 'foo' cannot be reimplemented. +!!! error TS2322: Property 'foo' is private in type 'E' but not in type 'Base'. e = i; // errror ~ !!! error TS2322: Type 'I' is not assignable to type 'E': -!!! error TS2322: Private property 'foo' cannot be reimplemented. +!!! error TS2322: Property 'foo' is private in type 'E' but not in type 'I'. e = d; // errror ~ !!! error TS2322: Type 'D' is not assignable to type 'E': -!!! error TS2322: Private property 'foo' cannot be reimplemented. +!!! error TS2322: Property 'foo' is private in type 'E' but not in type 'D'. e = e; } @@ -156,77 +156,77 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme a = b; // error ~ !!! error TS2322: Type 'Base' is not assignable to type '{ foo: string; }': -!!! error TS2322: Private property 'foo' cannot be reimplemented. +!!! error TS2322: Property 'foo' is private in type 'Base' but not in type '{ foo: string; }'. a = i; // error ~ !!! error TS2322: Type 'I' is not assignable to type '{ foo: string; }': -!!! error TS2322: Private property 'foo' cannot be reimplemented. +!!! error TS2322: Property 'foo' is private in type 'I' but not in type '{ foo: string; }'. a = d; a = e; // error ~ !!! error TS2322: Type 'E' is not assignable to type '{ foo: string; }': -!!! error TS2322: Private property 'foo' cannot be reimplemented. +!!! error TS2322: Property 'foo' is private in type 'E' but not in type '{ foo: string; }'. b = a; // error ~ !!! error TS2322: Type '{ foo: string; }' is not assignable to type 'Base': -!!! error TS2322: Private property 'foo' cannot be reimplemented. +!!! error TS2322: Property 'foo' is private in type 'Base' but not in type '{ foo: string; }'. b = i; b = d; // error ~ !!! error TS2322: Type 'D' is not assignable to type 'Base': -!!! error TS2322: Private property 'foo' cannot be reimplemented. +!!! error TS2322: Property 'foo' is private in type 'Base' but not in type 'D'. b = e; // error ~ !!! error TS2322: Type 'E' is not assignable to type 'Base': -!!! error TS2322: Private property 'foo' cannot be reimplemented. +!!! error TS2322: Types have separate declarations of a private property 'foo'. b = b; i = a; // error ~ !!! error TS2322: Type '{ foo: string; }' is not assignable to type 'I': -!!! error TS2322: Private property 'foo' cannot be reimplemented. +!!! error TS2322: Property 'foo' is private in type 'I' but not in type '{ foo: string; }'. i = b; i = d; // error ~ !!! error TS2322: Type 'D' is not assignable to type 'I': -!!! error TS2322: Private property 'foo' cannot be reimplemented. +!!! error TS2322: Property 'foo' is private in type 'I' but not in type 'D'. i = e; // error ~ !!! error TS2322: Type 'E' is not assignable to type 'I': -!!! error TS2322: Private property 'foo' cannot be reimplemented. +!!! error TS2322: Types have separate declarations of a private property 'foo'. i = i; d = a; d = b; // error ~ !!! error TS2322: Type 'Base' is not assignable to type 'D': -!!! error TS2322: Private property 'foo' cannot be reimplemented. +!!! error TS2322: Property 'foo' is private in type 'Base' but not in type 'D'. d = i; // error ~ !!! error TS2322: Type 'I' is not assignable to type 'D': -!!! error TS2322: Private property 'foo' cannot be reimplemented. +!!! error TS2322: Property 'foo' is private in type 'I' but not in type 'D'. d = e; // error ~ !!! error TS2322: Type 'E' is not assignable to type 'D': -!!! error TS2322: Private property 'foo' cannot be reimplemented. +!!! error TS2322: Property 'foo' is private in type 'E' but not in type 'D'. e = a; // errror ~ !!! error TS2322: Type '{ foo: string; }' is not assignable to type 'E': -!!! error TS2322: Private property 'foo' cannot be reimplemented. +!!! error TS2322: Property 'foo' is private in type 'E' but not in type '{ foo: string; }'. e = b; // errror ~ !!! error TS2322: Type 'Base' is not assignable to type 'E': -!!! error TS2322: Private property 'foo' cannot be reimplemented. +!!! error TS2322: Types have separate declarations of a private property 'foo'. e = i; // errror ~ !!! error TS2322: Type 'I' is not assignable to type 'E': -!!! error TS2322: Private property 'foo' cannot be reimplemented. +!!! error TS2322: Types have separate declarations of a private property 'foo'. e = d; // errror ~ !!! error TS2322: Type 'D' is not assignable to type 'E': -!!! error TS2322: Private property 'foo' cannot be reimplemented. +!!! error TS2322: Property 'foo' is private in type 'E' but not in type 'D'. e = e; } \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality.errors.txt b/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality.errors.txt index 0731e5746b..44577bf1c8 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality.errors.txt @@ -1,15 +1,15 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality.ts(73,5): error TS2322: Type 'D' is not assignable to type 'C': - Required property 'opt' cannot be reimplemented with optional property in 'D'. + Property 'opt' is optional in type 'D' but required in type 'C'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality.ts(74,5): error TS2322: Type 'E' is not assignable to type 'C': - Required property 'opt' cannot be reimplemented with optional property in 'E'. + Property 'opt' is optional in type 'E' but required in type 'C'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality.ts(78,5): error TS2322: Type 'D' is not assignable to type '{ opt: Base; }': - Required property 'opt' cannot be reimplemented with optional property in 'D'. + Property 'opt' is optional in type 'D' but required in type '{ opt: Base; }'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality.ts(79,5): error TS2322: Type 'E' is not assignable to type '{ opt: Base; }': - Required property 'opt' cannot be reimplemented with optional property in 'E'. + Property 'opt' is optional in type 'E' but required in type '{ opt: Base; }'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality.ts(83,5): error TS2322: Type 'D' is not assignable to type '{ opt: Base; }': - Required property 'opt' cannot be reimplemented with optional property in 'D'. + Property 'opt' is optional in type 'D' but required in type '{ opt: Base; }'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality.ts(84,5): error TS2322: Type 'E' is not assignable to type '{ opt: Base; }': - Required property 'opt' cannot be reimplemented with optional property in 'E'. + Property 'opt' is optional in type 'E' but required in type '{ opt: Base; }'. ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersOptionality.ts (6 errors) ==== @@ -88,33 +88,33 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme c = d; // error ~ !!! error TS2322: Type 'D' is not assignable to type 'C': -!!! error TS2322: Required property 'opt' cannot be reimplemented with optional property in 'D'. +!!! error TS2322: Property 'opt' is optional in type 'D' but required in type 'C'. c = e; // error ~ !!! error TS2322: Type 'E' is not assignable to type 'C': -!!! error TS2322: Required property 'opt' cannot be reimplemented with optional property in 'E'. +!!! error TS2322: Property 'opt' is optional in type 'E' but required in type 'C'. c = f; // ok c = a; // ok a = d; // error ~ !!! error TS2322: Type 'D' is not assignable to type '{ opt: Base; }': -!!! error TS2322: Required property 'opt' cannot be reimplemented with optional property in 'D'. +!!! error TS2322: Property 'opt' is optional in type 'D' but required in type '{ opt: Base; }'. a = e; // error ~ !!! error TS2322: Type 'E' is not assignable to type '{ opt: Base; }': -!!! error TS2322: Required property 'opt' cannot be reimplemented with optional property in 'E'. +!!! error TS2322: Property 'opt' is optional in type 'E' but required in type '{ opt: Base; }'. a = f; // ok a = c; // ok b = d; // error ~ !!! error TS2322: Type 'D' is not assignable to type '{ opt: Base; }': -!!! error TS2322: Required property 'opt' cannot be reimplemented with optional property in 'D'. +!!! error TS2322: Property 'opt' is optional in type 'D' but required in type '{ opt: Base; }'. b = e; // error ~ !!! error TS2322: Type 'E' is not assignable to type '{ opt: Base; }': -!!! error TS2322: Required property 'opt' cannot be reimplemented with optional property in 'E'. +!!! error TS2322: Property 'opt' is optional in type 'E' but required in type '{ opt: Base; }'. b = f; // ok b = a; // ok b = c; // ok diff --git a/tests/baselines/reference/assignmentCompatability10.errors.txt b/tests/baselines/reference/assignmentCompatability10.errors.txt index 26ffd267ae..f1fe353c90 100644 --- a/tests/baselines/reference/assignmentCompatability10.errors.txt +++ b/tests/baselines/reference/assignmentCompatability10.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/assignmentCompatability10.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type 'classWithPublicAndOptional': - Required property 'two' cannot be reimplemented with optional property in 'interfaceWithPublicAndOptional'. + Property 'two' is optional in type 'interfaceWithPublicAndOptional' but required in type 'classWithPublicAndOptional'. ==== tests/cases/compiler/assignmentCompatability10.ts (1 errors) ==== @@ -14,4 +14,4 @@ tests/cases/compiler/assignmentCompatability10.ts(9,1): error TS2322: Type 'inte __test2__.__val__x4 = __test1__.__val__obj4 ~~~~~~~~~~~~~~~~~~~ !!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type 'classWithPublicAndOptional': -!!! error TS2322: Required property 'two' cannot be reimplemented with optional property in 'interfaceWithPublicAndOptional'. \ No newline at end of file +!!! error TS2322: Property 'two' is optional in type 'interfaceWithPublicAndOptional' but required in type 'classWithPublicAndOptional'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability13.errors.txt b/tests/baselines/reference/assignmentCompatability13.errors.txt index bb87c72431..909193c620 100644 --- a/tests/baselines/reference/assignmentCompatability13.errors.txt +++ b/tests/baselines/reference/assignmentCompatability13.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/assignmentCompatability13.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ two: string; }': - Required property 'two' cannot be reimplemented with optional property in 'interfaceWithPublicAndOptional'. + Property 'two' is optional in type 'interfaceWithPublicAndOptional' but required in type '{ two: string; }'. ==== tests/cases/compiler/assignmentCompatability13.ts (1 errors) ==== @@ -14,4 +14,4 @@ tests/cases/compiler/assignmentCompatability13.ts(9,1): error TS2322: Type 'inte __test2__.__val__obj = __test1__.__val__obj4 ~~~~~~~~~~~~~~~~~~~~ !!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ two: string; }': -!!! error TS2322: Required property 'two' cannot be reimplemented with optional property in 'interfaceWithPublicAndOptional'. \ No newline at end of file +!!! error TS2322: Property 'two' is optional in type 'interfaceWithPublicAndOptional' but required in type '{ two: string; }'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability27.errors.txt b/tests/baselines/reference/assignmentCompatability27.errors.txt index 16870b191b..3c033c8d98 100644 --- a/tests/baselines/reference/assignmentCompatability27.errors.txt +++ b/tests/baselines/reference/assignmentCompatability27.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/assignmentCompatability27.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ two: string; }': - Required property 'two' cannot be reimplemented with optional property in 'interfaceWithPublicAndOptional'. + Property 'two' is optional in type 'interfaceWithPublicAndOptional' but required in type '{ two: string; }'. ==== tests/cases/compiler/assignmentCompatability27.ts (1 errors) ==== @@ -14,4 +14,4 @@ tests/cases/compiler/assignmentCompatability27.ts(9,1): error TS2322: Type 'inte __test2__.__val__aa = __test1__.__val__obj4 ~~~~~~~~~~~~~~~~~~~ !!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type '{ two: string; }': -!!! error TS2322: Required property 'two' cannot be reimplemented with optional property in 'interfaceWithPublicAndOptional'. \ No newline at end of file +!!! error TS2322: Property 'two' is optional in type 'interfaceWithPublicAndOptional' but required in type '{ two: string; }'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability39.errors.txt b/tests/baselines/reference/assignmentCompatability39.errors.txt index c89b63405d..3ab5cee788 100644 --- a/tests/baselines/reference/assignmentCompatability39.errors.txt +++ b/tests/baselines/reference/assignmentCompatability39.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/assignmentCompatability39.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type 'classWithTwoPublic': - Required property 'two' cannot be reimplemented with optional property in 'interfaceWithPublicAndOptional'. + Property 'two' is optional in type 'interfaceWithPublicAndOptional' but required in type 'classWithTwoPublic'. ==== tests/cases/compiler/assignmentCompatability39.ts (1 errors) ==== @@ -14,4 +14,4 @@ tests/cases/compiler/assignmentCompatability39.ts(9,1): error TS2322: Type 'inte __test2__.__val__x2 = __test1__.__val__obj4 ~~~~~~~~~~~~~~~~~~~ !!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type 'classWithTwoPublic': -!!! error TS2322: Required property 'two' cannot be reimplemented with optional property in 'interfaceWithPublicAndOptional'. \ No newline at end of file +!!! error TS2322: Property 'two' is optional in type 'interfaceWithPublicAndOptional' but required in type 'classWithTwoPublic'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability40.errors.txt b/tests/baselines/reference/assignmentCompatability40.errors.txt index b6e47c23b9..4be86ebc80 100644 --- a/tests/baselines/reference/assignmentCompatability40.errors.txt +++ b/tests/baselines/reference/assignmentCompatability40.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/assignmentCompatability40.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type 'classWithPrivate': - Private property 'one' cannot be reimplemented. + Property 'one' is private in type 'classWithPrivate' but not in type 'interfaceWithPublicAndOptional'. ==== tests/cases/compiler/assignmentCompatability40.ts (1 errors) ==== @@ -14,4 +14,4 @@ tests/cases/compiler/assignmentCompatability40.ts(9,1): error TS2322: Type 'inte __test2__.__val__x5 = __test1__.__val__obj4 ~~~~~~~~~~~~~~~~~~~ !!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type 'classWithPrivate': -!!! error TS2322: Private property 'one' cannot be reimplemented. \ No newline at end of file +!!! error TS2322: Property 'one' is private in type 'classWithPrivate' but not in type 'interfaceWithPublicAndOptional'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability41.errors.txt b/tests/baselines/reference/assignmentCompatability41.errors.txt index 535b52fe62..018beb2335 100644 --- a/tests/baselines/reference/assignmentCompatability41.errors.txt +++ b/tests/baselines/reference/assignmentCompatability41.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/assignmentCompatability41.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type 'classWithTwoPrivate': - Private property 'one' cannot be reimplemented. + Property 'one' is private in type 'classWithTwoPrivate' but not in type 'interfaceWithPublicAndOptional'. ==== tests/cases/compiler/assignmentCompatability41.ts (1 errors) ==== @@ -14,4 +14,4 @@ tests/cases/compiler/assignmentCompatability41.ts(9,1): error TS2322: Type 'inte __test2__.__val__x6 = __test1__.__val__obj4 ~~~~~~~~~~~~~~~~~~~ !!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type 'classWithTwoPrivate': -!!! error TS2322: Private property 'one' cannot be reimplemented. \ No newline at end of file +!!! error TS2322: Property 'one' is private in type 'classWithTwoPrivate' but not in type 'interfaceWithPublicAndOptional'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability42.errors.txt b/tests/baselines/reference/assignmentCompatability42.errors.txt index 2fe4689bac..de6fd79041 100644 --- a/tests/baselines/reference/assignmentCompatability42.errors.txt +++ b/tests/baselines/reference/assignmentCompatability42.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/assignmentCompatability42.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type 'classWithPublicPrivate': - Private property 'two' cannot be reimplemented. + Property 'two' is private in type 'classWithPublicPrivate' but not in type 'interfaceWithPublicAndOptional'. ==== tests/cases/compiler/assignmentCompatability42.ts (1 errors) ==== @@ -14,4 +14,4 @@ tests/cases/compiler/assignmentCompatability42.ts(9,1): error TS2322: Type 'inte __test2__.__val__x7 = __test1__.__val__obj4 ~~~~~~~~~~~~~~~~~~~ !!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type 'classWithPublicPrivate': -!!! error TS2322: Private property 'two' cannot be reimplemented. \ No newline at end of file +!!! error TS2322: Property 'two' is private in type 'classWithPublicPrivate' but not in type 'interfaceWithPublicAndOptional'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability43.errors.txt b/tests/baselines/reference/assignmentCompatability43.errors.txt index 6be9f267ac..3f5fc9789b 100644 --- a/tests/baselines/reference/assignmentCompatability43.errors.txt +++ b/tests/baselines/reference/assignmentCompatability43.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/assignmentCompatability43.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type 'interfaceTwo': - Required property 'two' cannot be reimplemented with optional property in 'interfaceWithPublicAndOptional'. + Property 'two' is optional in type 'interfaceWithPublicAndOptional' but required in type 'interfaceTwo'. ==== tests/cases/compiler/assignmentCompatability43.ts (1 errors) ==== @@ -14,4 +14,4 @@ tests/cases/compiler/assignmentCompatability43.ts(9,1): error TS2322: Type 'inte __test2__.__val__obj2 = __test1__.__val__obj4 ~~~~~~~~~~~~~~~~~~~~~ !!! error TS2322: Type 'interfaceWithPublicAndOptional' is not assignable to type 'interfaceTwo': -!!! error TS2322: Required property 'two' cannot be reimplemented with optional property in 'interfaceWithPublicAndOptional'. \ No newline at end of file +!!! error TS2322: Property 'two' is optional in type 'interfaceWithPublicAndOptional' but required in type 'interfaceTwo'. \ No newline at end of file diff --git a/tests/baselines/reference/classConstructorAccessibility.errors.txt b/tests/baselines/reference/classConstructorAccessibility.errors.txt index 783d8a3ea1..c22f3593bc 100644 --- a/tests/baselines/reference/classConstructorAccessibility.errors.txt +++ b/tests/baselines/reference/classConstructorAccessibility.errors.txt @@ -1,8 +1,10 @@ tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts(6,5): error TS1089: 'private' modifier cannot appear on a constructor declaration. -tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts(18,9): error TS1089: 'private' modifier cannot appear on a constructor declaration. +tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts(10,5): error TS1089: 'protected' modifier cannot appear on a constructor declaration. +tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts(23,9): error TS1089: 'private' modifier cannot appear on a constructor declaration. +tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts(27,9): error TS1089: 'protected' modifier cannot appear on a constructor declaration. -==== tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts (2 errors) ==== +==== tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts (4 errors) ==== class C { public constructor(public x: number) { } } @@ -13,8 +15,15 @@ tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessib !!! error TS1089: 'private' modifier cannot appear on a constructor declaration. } + class E { + protected constructor(public x: number) { } // error + ~~~~~~~~~ +!!! error TS1089: 'protected' modifier cannot appear on a constructor declaration. + } + var c = new C(1); var d = new D(1); + var e = new E(1); module Generic { class C { @@ -27,7 +36,14 @@ tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessib !!! error TS1089: 'private' modifier cannot appear on a constructor declaration. } + class E { + protected constructor(public x: T) { } // error + ~~~~~~~~~ +!!! error TS1089: 'protected' modifier cannot appear on a constructor declaration. + } + var c = new C(1); var d = new D(1); + var e = new E(1); } \ No newline at end of file diff --git a/tests/baselines/reference/classExtendsInterfaceThatExtendsClassWithPrivates1.errors.txt b/tests/baselines/reference/classExtendsInterfaceThatExtendsClassWithPrivates1.errors.txt index 07bd35d1b7..cff696696b 100644 --- a/tests/baselines/reference/classExtendsInterfaceThatExtendsClassWithPrivates1.errors.txt +++ b/tests/baselines/reference/classExtendsInterfaceThatExtendsClassWithPrivates1.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/classExtendsInterfaceThatExtendsClassWithPrivates1.ts(10,7): error TS2421: Class 'D2' incorrectly implements interface 'I': - Private property 'x' cannot be reimplemented. + Types have separate declarations of a private property 'x'. ==== tests/cases/compiler/classExtendsInterfaceThatExtendsClassWithPrivates1.ts (1 errors) ==== @@ -15,7 +15,7 @@ tests/cases/compiler/classExtendsInterfaceThatExtendsClassWithPrivates1.ts(10,7) class D2 implements I { ~~ !!! error TS2421: Class 'D2' incorrectly implements interface 'I': -!!! error TS2421: Private property 'x' cannot be reimplemented. +!!! error TS2421: Types have separate declarations of a private property 'x'. public foo(x: any) { return x } private x = 3; other(x: any) { return x } diff --git a/tests/baselines/reference/classImplementsClass5.errors.txt b/tests/baselines/reference/classImplementsClass5.errors.txt index ba0616f572..6328e595e1 100644 --- a/tests/baselines/reference/classImplementsClass5.errors.txt +++ b/tests/baselines/reference/classImplementsClass5.errors.txt @@ -1,9 +1,9 @@ tests/cases/compiler/classImplementsClass5.ts(5,7): error TS2421: Class 'C' incorrectly implements interface 'A': - Private property 'x' cannot be reimplemented. + Types have separate declarations of a private property 'x'. tests/cases/compiler/classImplementsClass5.ts(16,1): error TS2322: Type 'C2' is not assignable to type 'C': - Private property 'x' cannot be reimplemented. + Types have separate declarations of a private property 'x'. tests/cases/compiler/classImplementsClass5.ts(17,1): error TS2322: Type 'C' is not assignable to type 'C2': - Private property 'x' cannot be reimplemented. + Types have separate declarations of a private property 'x'. ==== tests/cases/compiler/classImplementsClass5.ts (3 errors) ==== @@ -14,7 +14,7 @@ tests/cases/compiler/classImplementsClass5.ts(17,1): error TS2322: Type 'C' is n class C implements A { ~ !!! error TS2421: Class 'C' incorrectly implements interface 'A': -!!! error TS2421: Private property 'x' cannot be reimplemented. +!!! error TS2421: Types have separate declarations of a private property 'x'. private x = 1; foo() { return 1; @@ -28,8 +28,8 @@ tests/cases/compiler/classImplementsClass5.ts(17,1): error TS2322: Type 'C' is n c = c2; ~ !!! error TS2322: Type 'C2' is not assignable to type 'C': -!!! error TS2322: Private property 'x' cannot be reimplemented. +!!! error TS2322: Types have separate declarations of a private property 'x'. c2 = c; ~~ !!! error TS2322: Type 'C' is not assignable to type 'C2': -!!! error TS2322: Private property 'x' cannot be reimplemented. \ No newline at end of file +!!! error TS2322: Types have separate declarations of a private property 'x'. \ No newline at end of file diff --git a/tests/baselines/reference/classIsSubtypeOfBaseType.errors.txt b/tests/baselines/reference/classIsSubtypeOfBaseType.errors.txt index e2c85ab46b..7ba816475f 100644 --- a/tests/baselines/reference/classIsSubtypeOfBaseType.errors.txt +++ b/tests/baselines/reference/classIsSubtypeOfBaseType.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classIsSubtypeOfBaseType.ts(11,7): error TS2416: Class 'Derived2' incorrectly extends base class 'Base<{ bar: string; }>': Types of property 'foo' are incompatible: Type '{ bar?: string; }' is not assignable to type '{ bar: string; }': - Required property 'bar' cannot be reimplemented with optional property in '{ bar?: string; }'. + Property 'bar' is optional in type '{ bar?: string; }' but required in type '{ bar: string; }'. ==== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classIsSubtypeOfBaseType.ts (1 errors) ==== @@ -20,7 +20,7 @@ tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/cla !!! error TS2416: Class 'Derived2' incorrectly extends base class 'Base<{ bar: string; }>': !!! error TS2416: Types of property 'foo' are incompatible: !!! error TS2416: Type '{ bar?: string; }' is not assignable to type '{ bar: string; }': -!!! error TS2416: Required property 'bar' cannot be reimplemented with optional property in '{ bar?: string; }'. +!!! error TS2416: Property 'bar' is optional in type '{ bar?: string; }' but required in type '{ bar: string; }'. foo: { bar?: string; // error } diff --git a/tests/baselines/reference/classPropertyAsPrivate.errors.txt b/tests/baselines/reference/classPropertyAsPrivate.errors.txt index 1ba10c61bd..a5fdffe091 100644 --- a/tests/baselines/reference/classPropertyAsPrivate.errors.txt +++ b/tests/baselines/reference/classPropertyAsPrivate.errors.txt @@ -2,14 +2,14 @@ tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts( tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts(4,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts(8,24): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts(9,24): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts(15,1): error TS2341: Property 'C.x' is inaccessible. -tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts(16,1): error TS2341: Property 'C.y' is inaccessible. -tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts(17,1): error TS2341: Property 'C.y' is inaccessible. -tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts(18,1): error TS2341: Property 'C.foo' is inaccessible. -tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts(20,1): error TS2341: Property 'C.a' is inaccessible. -tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts(21,1): error TS2341: Property 'C.b' is inaccessible. -tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts(22,1): error TS2341: Property 'C.b' is inaccessible. -tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts(23,1): error TS2341: Property 'C.foo' is inaccessible. +tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts(15,1): error TS2341: Property 'x' is private and only accessible within class 'C'. +tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts(16,1): error TS2341: Property 'y' is private and only accessible within class 'C'. +tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts(17,1): error TS2341: Property 'y' is private and only accessible within class 'C'. +tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts(18,1): error TS2341: Property 'foo' is private and only accessible within class 'C'. +tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts(20,1): error TS2341: Property 'a' is private and only accessible within class 'C'. +tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts(21,1): error TS2341: Property 'b' is private and only accessible within class 'C'. +tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts(22,1): error TS2341: Property 'b' is private and only accessible within class 'C'. +tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts(23,1): error TS2341: Property 'foo' is private and only accessible within class 'C'. ==== tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts (12 errors) ==== @@ -37,26 +37,26 @@ tests/cases/conformance/classes/members/accessibility/classPropertyAsPrivate.ts( // all errors c.x; ~~~ -!!! error TS2341: Property 'C.x' is inaccessible. +!!! error TS2341: Property 'x' is private and only accessible within class 'C'. c.y; ~~~ -!!! error TS2341: Property 'C.y' is inaccessible. +!!! error TS2341: Property 'y' is private and only accessible within class 'C'. c.y = 1; ~~~ -!!! error TS2341: Property 'C.y' is inaccessible. +!!! error TS2341: Property 'y' is private and only accessible within class 'C'. c.foo(); ~~~~~ -!!! error TS2341: Property 'C.foo' is inaccessible. +!!! error TS2341: Property 'foo' is private and only accessible within class 'C'. C.a; ~~~ -!!! error TS2341: Property 'C.a' is inaccessible. +!!! error TS2341: Property 'a' is private and only accessible within class 'C'. C.b(); ~~~ -!!! error TS2341: Property 'C.b' is inaccessible. +!!! error TS2341: Property 'b' is private and only accessible within class 'C'. C.b = 1; ~~~ -!!! error TS2341: Property 'C.b' is inaccessible. +!!! error TS2341: Property 'b' is private and only accessible within class 'C'. C.foo(); ~~~~~ -!!! error TS2341: Property 'C.foo' is inaccessible. \ No newline at end of file +!!! error TS2341: Property 'foo' is private and only accessible within class 'C'. \ No newline at end of file diff --git a/tests/baselines/reference/classPropertyAsProtected.errors.txt b/tests/baselines/reference/classPropertyAsProtected.errors.txt new file mode 100644 index 0000000000..570ebc718a --- /dev/null +++ b/tests/baselines/reference/classPropertyAsProtected.errors.txt @@ -0,0 +1,62 @@ +tests/cases/conformance/classes/members/accessibility/classPropertyAsProtected.ts(3,19): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/accessibility/classPropertyAsProtected.ts(4,19): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/accessibility/classPropertyAsProtected.ts(8,26): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/accessibility/classPropertyAsProtected.ts(9,26): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/classes/members/accessibility/classPropertyAsProtected.ts(15,1): error TS2445: Property 'x' is protected and only accessible within class 'C' and its subclasses. +tests/cases/conformance/classes/members/accessibility/classPropertyAsProtected.ts(16,1): error TS2445: Property 'y' is protected and only accessible within class 'C' and its subclasses. +tests/cases/conformance/classes/members/accessibility/classPropertyAsProtected.ts(17,1): error TS2445: Property 'y' is protected and only accessible within class 'C' and its subclasses. +tests/cases/conformance/classes/members/accessibility/classPropertyAsProtected.ts(18,1): error TS2445: Property 'foo' is protected and only accessible within class 'C' and its subclasses. +tests/cases/conformance/classes/members/accessibility/classPropertyAsProtected.ts(20,1): error TS2445: Property 'a' is protected and only accessible within class 'C' and its subclasses. +tests/cases/conformance/classes/members/accessibility/classPropertyAsProtected.ts(21,1): error TS2445: Property 'b' is protected and only accessible within class 'C' and its subclasses. +tests/cases/conformance/classes/members/accessibility/classPropertyAsProtected.ts(22,1): error TS2445: Property 'b' is protected and only accessible within class 'C' and its subclasses. +tests/cases/conformance/classes/members/accessibility/classPropertyAsProtected.ts(23,1): error TS2445: Property 'foo' is protected and only accessible within class 'C' and its subclasses. + + +==== tests/cases/conformance/classes/members/accessibility/classPropertyAsProtected.ts (12 errors) ==== + class C { + protected x: string; + protected get y() { return null; } + ~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + protected set y(x) { } + ~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + protected foo() { } + + protected static a: string; + protected static get b() { return null; } + ~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + protected static set b(x) { } + ~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + protected static foo() { } + } + + var c: C; + // all errors + c.x; + ~~~ +!!! error TS2445: Property 'x' is protected and only accessible within class 'C' and its subclasses. + c.y; + ~~~ +!!! error TS2445: Property 'y' is protected and only accessible within class 'C' and its subclasses. + c.y = 1; + ~~~ +!!! error TS2445: Property 'y' is protected and only accessible within class 'C' and its subclasses. + c.foo(); + ~~~~~ +!!! error TS2445: Property 'foo' is protected and only accessible within class 'C' and its subclasses. + + C.a; + ~~~ +!!! error TS2445: Property 'a' is protected and only accessible within class 'C' and its subclasses. + C.b(); + ~~~ +!!! error TS2445: Property 'b' is protected and only accessible within class 'C' and its subclasses. + C.b = 1; + ~~~ +!!! error TS2445: Property 'b' is protected and only accessible within class 'C' and its subclasses. + C.foo(); + ~~~~~ +!!! error TS2445: Property 'foo' is protected and only accessible within class 'C' and its subclasses. \ No newline at end of file diff --git a/tests/baselines/reference/classUpdateTests.errors.txt b/tests/baselines/reference/classUpdateTests.errors.txt index 660f279114..4548560df1 100644 --- a/tests/baselines/reference/classUpdateTests.errors.txt +++ b/tests/baselines/reference/classUpdateTests.errors.txt @@ -10,9 +10,9 @@ tests/cases/compiler/classUpdateTests.ts(46,17): error TS2311: A class may only tests/cases/compiler/classUpdateTests.ts(47,18): error TS2335: 'super' can only be referenced in a derived class. tests/cases/compiler/classUpdateTests.ts(57,2): error TS2376: A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties. tests/cases/compiler/classUpdateTests.ts(63,7): error TS2416: Class 'L' incorrectly extends base class 'G': - Private property 'p1' cannot be reimplemented. + Property 'p1' is private in type 'L' but not in type 'G'. tests/cases/compiler/classUpdateTests.ts(69,7): error TS2416: Class 'M' incorrectly extends base class 'G': - Private property 'p1' cannot be reimplemented. + Property 'p1' is private in type 'M' but not in type 'G'. tests/cases/compiler/classUpdateTests.ts(70,2): error TS2376: A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties. tests/cases/compiler/classUpdateTests.ts(105,15): error TS2339: Property 'p1' does not exist on type 'Q'. tests/cases/compiler/classUpdateTests.ts(111,16): error TS2339: Property 'p1' does not exist on type 'R'. @@ -97,7 +97,7 @@ tests/cases/compiler/classUpdateTests.ts(111,16): error TS2339: Property 'p1' do class L extends G { ~ !!! error TS2416: Class 'L' incorrectly extends base class 'G': -!!! error TS2416: Private property 'p1' cannot be reimplemented. +!!! error TS2416: Property 'p1' is private in type 'L' but not in type 'G'. constructor(private p1:number) { super(); // NO ERROR } @@ -106,7 +106,7 @@ tests/cases/compiler/classUpdateTests.ts(111,16): error TS2339: Property 'p1' do class M extends G { ~ !!! error TS2416: Class 'M' incorrectly extends base class 'G': -!!! error TS2416: Private property 'p1' cannot be reimplemented. +!!! error TS2416: Property 'p1' is private in type 'M' but not in type 'G'. constructor(private p1:number) { // ERROR ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ var i = 0; diff --git a/tests/baselines/reference/classWithPrivateProperty.errors.txt b/tests/baselines/reference/classWithPrivateProperty.errors.txt index 54d960a412..93a94e2107 100644 --- a/tests/baselines/reference/classWithPrivateProperty.errors.txt +++ b/tests/baselines/reference/classWithPrivateProperty.errors.txt @@ -1,11 +1,11 @@ -tests/cases/conformance/types/members/classWithPrivateProperty.ts(15,18): error TS2341: Property 'C.x' is inaccessible. -tests/cases/conformance/types/members/classWithPrivateProperty.ts(16,18): error TS2341: Property 'C.a' is inaccessible. -tests/cases/conformance/types/members/classWithPrivateProperty.ts(17,18): error TS2341: Property 'C.b' is inaccessible. -tests/cases/conformance/types/members/classWithPrivateProperty.ts(18,18): error TS2341: Property 'C.c' is inaccessible. -tests/cases/conformance/types/members/classWithPrivateProperty.ts(19,18): error TS2341: Property 'C.d' is inaccessible. -tests/cases/conformance/types/members/classWithPrivateProperty.ts(20,18): error TS2341: Property 'C.e' is inaccessible. -tests/cases/conformance/types/members/classWithPrivateProperty.ts(21,18): error TS2341: Property 'C.f' is inaccessible. -tests/cases/conformance/types/members/classWithPrivateProperty.ts(22,18): error TS2341: Property 'C.g' is inaccessible. +tests/cases/conformance/types/members/classWithPrivateProperty.ts(15,18): error TS2341: Property 'x' is private and only accessible within class 'C'. +tests/cases/conformance/types/members/classWithPrivateProperty.ts(16,18): error TS2341: Property 'a' is private and only accessible within class 'C'. +tests/cases/conformance/types/members/classWithPrivateProperty.ts(17,18): error TS2341: Property 'b' is private and only accessible within class 'C'. +tests/cases/conformance/types/members/classWithPrivateProperty.ts(18,18): error TS2341: Property 'c' is private and only accessible within class 'C'. +tests/cases/conformance/types/members/classWithPrivateProperty.ts(19,18): error TS2341: Property 'd' is private and only accessible within class 'C'. +tests/cases/conformance/types/members/classWithPrivateProperty.ts(20,18): error TS2341: Property 'e' is private and only accessible within class 'C'. +tests/cases/conformance/types/members/classWithPrivateProperty.ts(21,18): error TS2341: Property 'f' is private and only accessible within class 'C'. +tests/cases/conformance/types/members/classWithPrivateProperty.ts(22,18): error TS2341: Property 'g' is private and only accessible within class 'C'. ==== tests/cases/conformance/types/members/classWithPrivateProperty.ts (8 errors) ==== @@ -25,25 +25,25 @@ tests/cases/conformance/types/members/classWithPrivateProperty.ts(22,18): error var c = new C(); var r1: string = c.x; ~~~ -!!! error TS2341: Property 'C.x' is inaccessible. +!!! error TS2341: Property 'x' is private and only accessible within class 'C'. var r2: string = c.a; ~~~ -!!! error TS2341: Property 'C.a' is inaccessible. +!!! error TS2341: Property 'a' is private and only accessible within class 'C'. var r3: string = c.b; ~~~ -!!! error TS2341: Property 'C.b' is inaccessible. +!!! error TS2341: Property 'b' is private and only accessible within class 'C'. var r4: string = c.c(); ~~~ -!!! error TS2341: Property 'C.c' is inaccessible. +!!! error TS2341: Property 'c' is private and only accessible within class 'C'. var r5: string = c.d(); ~~~ -!!! error TS2341: Property 'C.d' is inaccessible. +!!! error TS2341: Property 'd' is private and only accessible within class 'C'. var r6: string = C.e; ~~~ -!!! error TS2341: Property 'C.e' is inaccessible. +!!! error TS2341: Property 'e' is private and only accessible within class 'C'. var r7: string = C.f(); ~~~ -!!! error TS2341: Property 'C.f' is inaccessible. +!!! error TS2341: Property 'f' is private and only accessible within class 'C'. var r8: string = C.g(); ~~~ -!!! error TS2341: Property 'C.g' is inaccessible. \ No newline at end of file +!!! error TS2341: Property 'g' is private and only accessible within class 'C'. \ No newline at end of file diff --git a/tests/baselines/reference/cloduleStaticMembers.errors.txt b/tests/baselines/reference/cloduleStaticMembers.errors.txt index 5b396c3be3..914fea7242 100644 --- a/tests/baselines/reference/cloduleStaticMembers.errors.txt +++ b/tests/baselines/reference/cloduleStaticMembers.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/cloduleStaticMembers.ts(6,13): error TS2341: Property 'Clod.x' is inaccessible. +tests/cases/compiler/cloduleStaticMembers.ts(6,13): error TS2341: Property 'x' is private and only accessible within class 'Clod'. tests/cases/compiler/cloduleStaticMembers.ts(7,13): error TS2304: Cannot find name 'x'. tests/cases/compiler/cloduleStaticMembers.ts(10,13): error TS2304: Cannot find name 'y'. @@ -11,7 +11,7 @@ tests/cases/compiler/cloduleStaticMembers.ts(10,13): error TS2304: Cannot find n module Clod { var p = Clod.x; ~~~~~~ -!!! error TS2341: Property 'Clod.x' is inaccessible. +!!! error TS2341: Property 'x' is private and only accessible within class 'Clod'. var q = x; ~ !!! error TS2304: Cannot find name 'x'. diff --git a/tests/baselines/reference/constructorParameterProperties.errors.txt b/tests/baselines/reference/constructorParameterProperties.errors.txt index ed41bec0e4..ab9bebe9d2 100644 --- a/tests/baselines/reference/constructorParameterProperties.errors.txt +++ b/tests/baselines/reference/constructorParameterProperties.errors.txt @@ -1,30 +1,39 @@ -tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties.ts(8,10): error TS2341: Property 'C.x' is inaccessible. -tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties.ts(17,10): error TS2341: Property 'D.x' is inaccessible. -tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties.ts(18,12): error TS2339: Property 'a' does not exist on type 'D'. +tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties.ts(8,10): error TS2341: Property 'x' is private and only accessible within class 'C'. +tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties.ts(9,10): error TS2445: Property 'z' is protected and only accessible within class 'C' and its subclasses. +tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties.ts(18,10): error TS2341: Property 'x' is private and only accessible within class 'D'. +tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties.ts(19,12): error TS2339: Property 'a' does not exist on type 'D'. +tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties.ts(20,10): error TS2445: Property 'z' is protected and only accessible within class 'D' and its subclasses. -==== tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties.ts (3 errors) ==== +==== tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties.ts (5 errors) ==== class C { y: string; - constructor(private x: string) { } + constructor(private x: string, protected z: string) { } } var c: C; var r = c.y; var r2 = c.x; // error ~~~ -!!! error TS2341: Property 'C.x' is inaccessible. +!!! error TS2341: Property 'x' is private and only accessible within class 'C'. + var r3 = c.z; // error + ~~~ +!!! error TS2445: Property 'z' is protected and only accessible within class 'C' and its subclasses. class D { y: T; - constructor(a: T, private x: T) { } + constructor(a: T, private x: T, protected z: T) { } } var d: D; var r = d.y; var r2 = d.x; // error ~~~ -!!! error TS2341: Property 'D.x' is inaccessible. +!!! error TS2341: Property 'x' is private and only accessible within class 'D'. var r3 = d.a; // error ~ -!!! error TS2339: Property 'a' does not exist on type 'D'. \ No newline at end of file +!!! error TS2339: Property 'a' does not exist on type 'D'. + var r4 = d.z; // error + ~~~ +!!! error TS2445: Property 'z' is protected and only accessible within class 'D' and its subclasses. + \ No newline at end of file diff --git a/tests/baselines/reference/constructorParameterProperties.js b/tests/baselines/reference/constructorParameterProperties.js index 37ba30d24b..11446a316d 100644 --- a/tests/baselines/reference/constructorParameterProperties.js +++ b/tests/baselines/reference/constructorParameterProperties.js @@ -1,36 +1,42 @@ //// [constructorParameterProperties.ts] class C { y: string; - constructor(private x: string) { } + constructor(private x: string, protected z: string) { } } var c: C; var r = c.y; var r2 = c.x; // error +var r3 = c.z; // error class D { y: T; - constructor(a: T, private x: T) { } + constructor(a: T, private x: T, protected z: T) { } } var d: D; var r = d.y; var r2 = d.x; // error -var r3 = d.a; // error +var r3 = d.a; // error +var r4 = d.z; // error + //// [constructorParameterProperties.js] var C = (function () { - function C(x) { + function C(x, z) { this.x = x; + this.z = z; } return C; })(); var c; var r = c.y; var r2 = c.x; // error +var r3 = c.z; // error var D = (function () { - function D(a, x) { + function D(a, x, z) { this.x = x; + this.z = z; } return D; })(); @@ -38,3 +44,4 @@ var d; var r = d.y; var r2 = d.x; // error var r3 = d.a; // error +var r4 = d.z; // error diff --git a/tests/baselines/reference/constructorParameterProperties2.errors.txt b/tests/baselines/reference/constructorParameterProperties2.errors.txt index e6535bbbd5..df759fbe70 100644 --- a/tests/baselines/reference/constructorParameterProperties2.errors.txt +++ b/tests/baselines/reference/constructorParameterProperties2.errors.txt @@ -1,8 +1,9 @@ tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties2.ts(11,24): error TS2300: Duplicate identifier 'y'. tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties2.ts(19,25): error TS2300: Duplicate identifier 'y'. +tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties2.ts(27,27): error TS2300: Duplicate identifier 'y'. -==== tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties2.ts (2 errors) ==== +==== tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties2.ts (3 errors) ==== class C { y: number; constructor(y: number) { } // ok @@ -29,4 +30,15 @@ tests/cases/conformance/classes/constructorDeclarations/constructorParameters/co } var e: E; - var r3 = e.y; // error \ No newline at end of file + var r3 = e.y; // error + + class F { + y: number; + constructor(protected y: number) { } // error + ~ +!!! error TS2300: Duplicate identifier 'y'. + } + + var f: F; + var r4 = f.y; // error + \ No newline at end of file diff --git a/tests/baselines/reference/constructorParameterProperties2.js b/tests/baselines/reference/constructorParameterProperties2.js index 8ad0c8b6ea..02e4cf82c8 100644 --- a/tests/baselines/reference/constructorParameterProperties2.js +++ b/tests/baselines/reference/constructorParameterProperties2.js @@ -21,7 +21,16 @@ class E { } var e: E; -var r3 = e.y; // error +var r3 = e.y; // error + +class F { + y: number; + constructor(protected y: number) { } // error +} + +var f: F; +var r4 = f.y; // error + //// [constructorParameterProperties2.js] var C = (function () { @@ -47,3 +56,11 @@ var E = (function () { })(); var e; var r3 = e.y; // error +var F = (function () { + function F(y) { + this.y = y; + } // error + return F; +})(); +var f; +var r4 = f.y; // error diff --git a/tests/baselines/reference/derivedClassOverridesPrivateFunction1.errors.txt b/tests/baselines/reference/derivedClassOverridesPrivateFunction1.errors.txt index 275701c797..ce9ec20406 100644 --- a/tests/baselines/reference/derivedClassOverridesPrivateFunction1.errors.txt +++ b/tests/baselines/reference/derivedClassOverridesPrivateFunction1.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/derivedClassOverridesPrivateFunction1.ts(8,7): error TS2416: Class 'DerivedClass' incorrectly extends base class 'BaseClass': - Private property '_init' cannot be reimplemented. + Types have separate declarations of a private property '_init'. ==== tests/cases/compiler/derivedClassOverridesPrivateFunction1.ts (1 errors) ==== @@ -13,7 +13,7 @@ tests/cases/compiler/derivedClassOverridesPrivateFunction1.ts(8,7): error TS2416 class DerivedClass extends BaseClass { ~~~~~~~~~~~~ !!! error TS2416: Class 'DerivedClass' incorrectly extends base class 'BaseClass': -!!! error TS2416: Private property '_init' cannot be reimplemented. +!!! error TS2416: Types have separate declarations of a private property '_init'. constructor() { super(); } diff --git a/tests/baselines/reference/derivedClassOverridesPrivates.errors.txt b/tests/baselines/reference/derivedClassOverridesPrivates.errors.txt index 8f12f02bc3..9e83faa9b4 100644 --- a/tests/baselines/reference/derivedClassOverridesPrivates.errors.txt +++ b/tests/baselines/reference/derivedClassOverridesPrivates.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassOverridesPrivates.ts(5,7): error TS2416: Class 'Derived' incorrectly extends base class 'Base': - Private property 'x' cannot be reimplemented. + Types have separate declarations of a private property 'x'. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassOverridesPrivates.ts(13,7): error TS2418: Class static side 'typeof Derived2' incorrectly extends base class static side 'typeof Base2': - Private property 'y' cannot be reimplemented. + Types have separate declarations of a private property 'y'. ==== tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassOverridesPrivates.ts (2 errors) ==== @@ -12,7 +12,7 @@ tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassOve class Derived extends Base { ~~~~~~~ !!! error TS2416: Class 'Derived' incorrectly extends base class 'Base': -!!! error TS2416: Private property 'x' cannot be reimplemented. +!!! error TS2416: Types have separate declarations of a private property 'x'. private x: { foo: string; bar: string; }; // error } @@ -23,6 +23,6 @@ tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassOve class Derived2 extends Base2 { ~~~~~~~~ !!! error TS2418: Class static side 'typeof Derived2' incorrectly extends base class static side 'typeof Base2': -!!! error TS2418: Private property 'y' cannot be reimplemented. +!!! error TS2418: Types have separate declarations of a private property 'y'. private static y: { foo: string; bar: string; }; // error } \ No newline at end of file diff --git a/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.errors.txt b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.errors.txt index 5bd992fa0b..f85e3be4b5 100644 --- a/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.errors.txt +++ b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.errors.txt @@ -3,7 +3,7 @@ tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWit tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateInstanceShadowingPublicInstance.ts(18,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateInstanceShadowingPublicInstance.ts(19,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateInstanceShadowingPublicInstance.ts(12,7): error TS2416: Class 'Derived' incorrectly extends base class 'Base': - Private property 'x' cannot be reimplemented. + Property 'x' is private in type 'Derived' but not in type 'Base'. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateInstanceShadowingPublicInstance.ts(22,14): error TS2339: Property 'x' does not exist on type 'typeof Base'. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateInstanceShadowingPublicInstance.ts(23,18): error TS2339: Property 'x' does not exist on type 'typeof Derived'. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateInstanceShadowingPublicInstance.ts(25,15): error TS2339: Property 'fn' does not exist on type 'typeof Base'. @@ -33,7 +33,7 @@ tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWit class Derived extends Base { ~~~~~~~ !!! error TS2416: Class 'Derived' incorrectly extends base class 'Base': -!!! error TS2416: Private property 'x' cannot be reimplemented. +!!! error TS2416: Property 'x' is private in type 'Derived' but not in type 'Base'. private x: string; private fn(): string { return ''; diff --git a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.errors.txt b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.errors.txt index 5ac30473e2..a792c8ebff 100644 --- a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.errors.txt +++ b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.errors.txt @@ -3,11 +3,11 @@ tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWit tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateStaticShadowingPublicStatic.ts(19,24): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateStaticShadowingPublicStatic.ts(20,24): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateStaticShadowingPublicStatic.ts(13,7): error TS2418: Class static side 'typeof Derived' incorrectly extends base class static side 'typeof Base': - Private property 'x' cannot be reimplemented. -tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateStaticShadowingPublicStatic.ts(24,10): error TS2341: Property 'Derived.x' is inaccessible. -tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateStaticShadowingPublicStatic.ts(27,10): error TS2341: Property 'Derived.fn' is inaccessible. -tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateStaticShadowingPublicStatic.ts(32,10): error TS2341: Property 'Derived.a' is inaccessible. -tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateStaticShadowingPublicStatic.ts(33,1): error TS2341: Property 'Derived.a' is inaccessible. + Property 'x' is private in type 'typeof Derived' but not in type 'typeof Base'. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateStaticShadowingPublicStatic.ts(24,10): error TS2341: Property 'x' is private and only accessible within class 'Derived'. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateStaticShadowingPublicStatic.ts(27,10): error TS2341: Property 'fn' is private and only accessible within class 'Derived'. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateStaticShadowingPublicStatic.ts(32,10): error TS2341: Property 'a' is private and only accessible within class 'Derived'. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateStaticShadowingPublicStatic.ts(33,1): error TS2341: Property 'a' is private and only accessible within class 'Derived'. ==== tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateStaticShadowingPublicStatic.ts (9 errors) ==== @@ -30,7 +30,7 @@ tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWit class Derived extends Base { ~~~~~~~ !!! error TS2418: Class static side 'typeof Derived' incorrectly extends base class static side 'typeof Base': -!!! error TS2418: Private property 'x' cannot be reimplemented. +!!! error TS2418: Property 'x' is private in type 'typeof Derived' but not in type 'typeof Base'. private static x: string; private static fn(): string { return ''; @@ -47,19 +47,19 @@ tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWit var r = Base.x; // ok var r2 = Derived.x; // error ~~~~~~~~~ -!!! error TS2341: Property 'Derived.x' is inaccessible. +!!! error TS2341: Property 'x' is private and only accessible within class 'Derived'. var r3 = Base.fn(); // ok var r4 = Derived.fn(); // error ~~~~~~~~~~ -!!! error TS2341: Property 'Derived.fn' is inaccessible. +!!! error TS2341: Property 'fn' is private and only accessible within class 'Derived'. var r5 = Base.a; // ok Base.a = 2; // ok var r6 = Derived.a; // error ~~~~~~~~~ -!!! error TS2341: Property 'Derived.a' is inaccessible. +!!! error TS2341: Property 'a' is private and only accessible within class 'Derived'. Derived.a = 2; // error ~~~~~~~~~ -!!! error TS2341: Property 'Derived.a' is inaccessible. \ No newline at end of file +!!! error TS2341: Property 'a' is private and only accessible within class 'Derived'. \ No newline at end of file diff --git a/tests/baselines/reference/errorSuperPropertyAccess.errors.txt b/tests/baselines/reference/errorSuperPropertyAccess.errors.txt index eba9953c34..e192e99b87 100644 --- a/tests/baselines/reference/errorSuperPropertyAccess.errors.txt +++ b/tests/baselines/reference/errorSuperPropertyAccess.errors.txt @@ -15,25 +15,25 @@ tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(21,9): error TS2335: 'super' can only be referenced in a derived class. tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(25,9): error TS2335: 'super' can only be referenced in a derived class. tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(30,9): error TS2335: 'super' can only be referenced in a derived class. -tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(57,15): error TS2340: Only public methods of the base class are accessible via the 'super' keyword -tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(61,23): error TS2340: Only public methods of the base class are accessible via the 'super' keyword -tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(65,23): error TS2340: Only public methods of the base class are accessible via the 'super' keyword -tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(69,19): error TS2340: Only public methods of the base class are accessible via the 'super' keyword +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(57,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(61,23): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(65,23): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(69,19): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(73,13): error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(76,40): error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class -tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(87,15): error TS2340: Only public methods of the base class are accessible via the 'super' keyword -tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(91,23): error TS2340: Only public methods of the base class are accessible via the 'super' keyword -tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(95,23): error TS2340: Only public methods of the base class are accessible via the 'super' keyword -tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(99,19): error TS2340: Only public methods of the base class are accessible via the 'super' keyword -tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(109,15): error TS2340: Only public methods of the base class are accessible via the 'super' keyword -tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(110,15): error TS2340: Only public methods of the base class are accessible via the 'super' keyword -tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(111,9): error TS2341: Property 'SomeBase.privateStaticFunc' is inaccessible. -tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(114,15): error TS2340: Only public methods of the base class are accessible via the 'super' keyword -tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(115,15): error TS2340: Only public methods of the base class are accessible via the 'super' keyword -tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(116,9): error TS2341: Property 'SomeBase.privateStaticFunc' is inaccessible. -tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(120,15): error TS2340: Only public methods of the base class are accessible via the 'super' keyword -tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(121,15): error TS2340: Only public methods of the base class are accessible via the 'super' keyword -tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(122,9): error TS2341: Property 'SomeBase.privateStaticFunc' is inaccessible. +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(87,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(91,23): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(95,23): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(99,19): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(109,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(110,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(111,9): error TS2341: Property 'privateStaticFunc' is private and only accessible within class 'SomeBase'. +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(114,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(115,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(116,9): error TS2341: Property 'privateStaticFunc' is private and only accessible within class 'SomeBase'. +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(120,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(121,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword +tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(122,9): error TS2341: Property 'privateStaticFunc' is private and only accessible within class 'SomeBase'. tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(127,16): error TS2335: 'super' can only be referenced in a derived class. tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(127,30): error TS2335: 'super' can only be referenced in a derived class. @@ -119,13 +119,13 @@ tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess super(); super.publicMember = 1; ~~~~~~~~~~~~ -!!! error TS2340: Only public methods of the base class are accessible via the 'super' keyword +!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword } fn() { var x = super.publicMember; ~~~~~~~~~~~~ -!!! error TS2340: Only public methods of the base class are accessible via the 'super' keyword +!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword } get a() { @@ -133,7 +133,7 @@ tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. var x = super.publicMember; ~~~~~~~~~~~~ -!!! error TS2340: Only public methods of the base class are accessible via the 'super' keyword +!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword return undefined; } set a(n) { @@ -141,7 +141,7 @@ tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. n = super.publicMember; ~~~~~~~~~~~~ -!!! error TS2340: Only public methods of the base class are accessible via the 'super' keyword +!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword } fn2() { function inner() { @@ -165,13 +165,13 @@ tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess super(); super.privateMember = 1; ~~~~~~~~~~~~~ -!!! error TS2340: Only public methods of the base class are accessible via the 'super' keyword +!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword } fn() { var x = super.privateMember; ~~~~~~~~~~~~~ -!!! error TS2340: Only public methods of the base class are accessible via the 'super' keyword +!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword } get a() { @@ -179,7 +179,7 @@ tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. var x = super.privateMember; ~~~~~~~~~~~~~ -!!! error TS2340: Only public methods of the base class are accessible via the 'super' keyword +!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword return undefined; } set a(n) { @@ -187,7 +187,7 @@ tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. n = super.privateMember; ~~~~~~~~~~~~~ -!!! error TS2340: Only public methods of the base class are accessible via the 'super' keyword +!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword } } @@ -199,26 +199,26 @@ tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess static fn() { super.publicStaticMember = 3; ~~~~~~~~~~~~~~~~~~ -!!! error TS2340: Only public methods of the base class are accessible via the 'super' keyword +!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword super.privateStaticMember = 3; ~~~~~~~~~~~~~~~~~~~ -!!! error TS2340: Only public methods of the base class are accessible via the 'super' keyword +!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword super.privateStaticFunc(); ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2341: Property 'SomeBase.privateStaticFunc' is inaccessible. +!!! error TS2341: Property 'privateStaticFunc' is private and only accessible within class 'SomeBase'. } static get a() { ~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. super.publicStaticMember = 3; ~~~~~~~~~~~~~~~~~~ -!!! error TS2340: Only public methods of the base class are accessible via the 'super' keyword +!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword super.privateStaticMember = 3; ~~~~~~~~~~~~~~~~~~~ -!!! error TS2340: Only public methods of the base class are accessible via the 'super' keyword +!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword super.privateStaticFunc(); ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2341: Property 'SomeBase.privateStaticFunc' is inaccessible. +!!! error TS2341: Property 'privateStaticFunc' is private and only accessible within class 'SomeBase'. return ''; } static set a(n) { @@ -226,13 +226,13 @@ tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. super.publicStaticMember = 3; ~~~~~~~~~~~~~~~~~~ -!!! error TS2340: Only public methods of the base class are accessible via the 'super' keyword +!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword super.privateStaticMember = 3; ~~~~~~~~~~~~~~~~~~~ -!!! error TS2340: Only public methods of the base class are accessible via the 'super' keyword +!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword super.privateStaticFunc(); ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2341: Property 'SomeBase.privateStaticFunc' is inaccessible. +!!! error TS2341: Property 'privateStaticFunc' is private and only accessible within class 'SomeBase'. } } diff --git a/tests/baselines/reference/functionOverloadErrors.errors.txt b/tests/baselines/reference/functionOverloadErrors.errors.txt index 05fafcb78c..bc4fea0a98 100644 --- a/tests/baselines/reference/functionOverloadErrors.errors.txt +++ b/tests/baselines/reference/functionOverloadErrors.errors.txt @@ -2,8 +2,8 @@ tests/cases/conformance/functions/functionOverloadErrors.ts(2,14): error TS2371: tests/cases/conformance/functions/functionOverloadErrors.ts(44,25): error TS2304: Cannot find name 'Window'. tests/cases/conformance/functions/functionOverloadErrors.ts(50,25): error TS2304: Cannot find name 'Window'. tests/cases/conformance/functions/functionOverloadErrors.ts(51,32): error TS2304: Cannot find name 'window'. -tests/cases/conformance/functions/functionOverloadErrors.ts(65,13): error TS2385: Overload signatures must all be public or private. -tests/cases/conformance/functions/functionOverloadErrors.ts(68,13): error TS2385: Overload signatures must all be public or private. +tests/cases/conformance/functions/functionOverloadErrors.ts(65,13): error TS2385: Overload signatures must all be public, private or protected. +tests/cases/conformance/functions/functionOverloadErrors.ts(68,13): error TS2385: Overload signatures must all be public, private or protected. tests/cases/conformance/functions/functionOverloadErrors.ts(75,21): error TS2383: Overload signatures must all be exported or not exported. tests/cases/conformance/functions/functionOverloadErrors.ts(79,14): error TS2383: Overload signatures must all be exported or not exported. tests/cases/conformance/functions/functionOverloadErrors.ts(85,18): error TS2384: Overload signatures must all be ambient or non-ambient. @@ -89,12 +89,12 @@ tests/cases/conformance/functions/functionOverloadErrors.ts(116,19): error TS237 public f(); private f(s: string); ~ -!!! error TS2385: Overload signatures must all be public or private. +!!! error TS2385: Overload signatures must all be public, private or protected. f() { } private g(s: string); ~ -!!! error TS2385: Overload signatures must all be public or private. +!!! error TS2385: Overload signatures must all be public, private or protected. public g(); g() { } } diff --git a/tests/baselines/reference/functionOverloads5.errors.txt b/tests/baselines/reference/functionOverloads5.errors.txt index 8c5639b87e..60a74f103e 100644 --- a/tests/baselines/reference/functionOverloads5.errors.txt +++ b/tests/baselines/reference/functionOverloads5.errors.txt @@ -1,11 +1,11 @@ -tests/cases/compiler/functionOverloads5.ts(2,10): error TS2385: Overload signatures must all be public or private. +tests/cases/compiler/functionOverloads5.ts(2,10): error TS2385: Overload signatures must all be public, private or protected. ==== tests/cases/compiler/functionOverloads5.ts (1 errors) ==== class baz { public foo(); ~~~ -!!! error TS2385: Overload signatures must all be public or private. +!!! error TS2385: Overload signatures must all be public, private or protected. private foo(bar?:any){ } } \ No newline at end of file diff --git a/tests/baselines/reference/i3.errors.txt b/tests/baselines/reference/i3.errors.txt index 5d8b3b3fab..1a03e690a2 100644 --- a/tests/baselines/reference/i3.errors.txt +++ b/tests/baselines/reference/i3.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/i3.ts(6,1): error TS2322: Type 'I3' is not assignable to type '{ one: number; }': - Required property 'one' cannot be reimplemented with optional property in 'I3'. + Property 'one' is optional in type 'I3' but required in type '{ one: number; }'. ==== tests/cases/compiler/i3.ts (1 errors) ==== @@ -11,4 +11,4 @@ tests/cases/compiler/i3.ts(6,1): error TS2322: Type 'I3' is not assignable to ty x = i; ~ !!! error TS2322: Type 'I3' is not assignable to type '{ one: number; }': -!!! error TS2322: Required property 'one' cannot be reimplemented with optional property in 'I3'. \ No newline at end of file +!!! error TS2322: Property 'one' is optional in type 'I3' but required in type '{ one: number; }'. \ No newline at end of file diff --git a/tests/baselines/reference/implementPublicPropertyAsPrivate.errors.txt b/tests/baselines/reference/implementPublicPropertyAsPrivate.errors.txt index b131ffbf33..c445403c3f 100644 --- a/tests/baselines/reference/implementPublicPropertyAsPrivate.errors.txt +++ b/tests/baselines/reference/implementPublicPropertyAsPrivate.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/implementPublicPropertyAsPrivate.ts(4,7): error TS2421: Class 'C' incorrectly implements interface 'I': - Private property 'x' cannot be reimplemented. + Property 'x' is private in type 'C' but not in type 'I'. ==== tests/cases/compiler/implementPublicPropertyAsPrivate.ts (1 errors) ==== @@ -9,6 +9,6 @@ tests/cases/compiler/implementPublicPropertyAsPrivate.ts(4,7): error TS2421: Cla class C implements I { ~ !!! error TS2421: Class 'C' incorrectly implements interface 'I': -!!! error TS2421: Private property 'x' cannot be reimplemented. +!!! error TS2421: Property 'x' is private in type 'C' but not in type 'I'. private x = 0; // should raise error at class decl } \ No newline at end of file diff --git a/tests/baselines/reference/implementingAnInterfaceExtendingClassWithPrivates.errors.txt b/tests/baselines/reference/implementingAnInterfaceExtendingClassWithPrivates.errors.txt index b2a41ed4d0..ab12cb9708 100644 --- a/tests/baselines/reference/implementingAnInterfaceExtendingClassWithPrivates.errors.txt +++ b/tests/baselines/reference/implementingAnInterfaceExtendingClassWithPrivates.errors.txt @@ -3,9 +3,9 @@ tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInte tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithPrivates.ts(12,7): error TS2421: Class 'Bar2' incorrectly implements interface 'I': Property 'x' is missing in type 'Bar2'. tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithPrivates.ts(16,7): error TS2421: Class 'Bar3' incorrectly implements interface 'I': - Private property 'x' cannot be reimplemented. + Property 'x' is private in type 'I' but not in type 'Bar3'. tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithPrivates.ts(21,7): error TS2421: Class 'Bar4' incorrectly implements interface 'I': - Private property 'x' cannot be reimplemented. + Types have separate declarations of a private property 'x'. ==== tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithPrivates.ts (4 errors) ==== @@ -33,7 +33,7 @@ tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInte class Bar3 implements I { // error ~~~~ !!! error TS2421: Class 'Bar3' incorrectly implements interface 'I': -!!! error TS2421: Private property 'x' cannot be reimplemented. +!!! error TS2421: Property 'x' is private in type 'I' but not in type 'Bar3'. x: string; y: number; } @@ -41,7 +41,7 @@ tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInte class Bar4 implements I { // error ~~~~ !!! error TS2421: Class 'Bar4' incorrectly implements interface 'I': -!!! error TS2421: Private property 'x' cannot be reimplemented. +!!! error TS2421: Types have separate declarations of a private property 'x'. private x: string; y: number; } \ No newline at end of file diff --git a/tests/baselines/reference/implementingAnInterfaceExtendingClassWithPrivates2.errors.txt b/tests/baselines/reference/implementingAnInterfaceExtendingClassWithPrivates2.errors.txt index 5333f34b98..53fc5c54be 100644 --- a/tests/baselines/reference/implementingAnInterfaceExtendingClassWithPrivates2.errors.txt +++ b/tests/baselines/reference/implementingAnInterfaceExtendingClassWithPrivates2.errors.txt @@ -1,29 +1,29 @@ tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithPrivates2.ts(13,7): error TS2416: Class 'Bar2' incorrectly extends base class 'Foo': - Private property 'x' cannot be reimplemented. + Property 'x' is private in type 'Foo' but not in type 'Bar2'. tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithPrivates2.ts(13,7): error TS2421: Class 'Bar2' incorrectly implements interface 'I': - Private property 'x' cannot be reimplemented. + Property 'x' is private in type 'I' but not in type 'Bar2'. tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithPrivates2.ts(18,7): error TS2416: Class 'Bar3' incorrectly extends base class 'Foo': - Private property 'x' cannot be reimplemented. + Types have separate declarations of a private property 'x'. tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithPrivates2.ts(18,7): error TS2421: Class 'Bar3' incorrectly implements interface 'I': - Private property 'x' cannot be reimplemented. + Types have separate declarations of a private property 'x'. tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithPrivates2.ts(42,11): error TS2416: Class 'Bar2' incorrectly extends base class 'Foo': - Private property 'x' cannot be reimplemented. + Property 'x' is private in type 'Foo' but not in type 'Bar2'. tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithPrivates2.ts(42,11): error TS2421: Class 'Bar2' incorrectly implements interface 'I': Property 'z' is missing in type 'Bar2'. tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithPrivates2.ts(47,11): error TS2416: Class 'Bar3' incorrectly extends base class 'Foo': - Private property 'x' cannot be reimplemented. + Types have separate declarations of a private property 'x'. tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithPrivates2.ts(47,11): error TS2421: Class 'Bar3' incorrectly implements interface 'I': Property 'z' is missing in type 'Bar3'. tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithPrivates2.ts(67,11): error TS2421: Class 'Bar' incorrectly implements interface 'I': Property 'y' is missing in type 'Bar'. -tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithPrivates2.ts(73,14): error TS2341: Property 'Foo.x' is inaccessible. +tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithPrivates2.ts(73,14): error TS2341: Property 'x' is private and only accessible within class 'Foo'. tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithPrivates2.ts(74,16): error TS2339: Property 'y' does not exist on type 'Bar'. tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithPrivates2.ts(76,11): error TS2416: Class 'Bar2' incorrectly extends base class 'Foo': - Private property 'x' cannot be reimplemented. + Property 'x' is private in type 'Foo' but not in type 'Bar2'. tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithPrivates2.ts(76,11): error TS2421: Class 'Bar2' incorrectly implements interface 'I': Property 'y' is missing in type 'Bar2'. tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithPrivates2.ts(81,11): error TS2416: Class 'Bar3' incorrectly extends base class 'Foo': - Private property 'x' cannot be reimplemented. + Types have separate declarations of a private property 'x'. tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithPrivates2.ts(81,11): error TS2421: Class 'Bar3' incorrectly implements interface 'I': Property 'y' is missing in type 'Bar3'. @@ -44,10 +44,10 @@ tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInte class Bar2 extends Foo implements I { // error ~~~~ !!! error TS2416: Class 'Bar2' incorrectly extends base class 'Foo': -!!! error TS2416: Private property 'x' cannot be reimplemented. +!!! error TS2416: Property 'x' is private in type 'Foo' but not in type 'Bar2'. ~~~~ !!! error TS2421: Class 'Bar2' incorrectly implements interface 'I': -!!! error TS2421: Private property 'x' cannot be reimplemented. +!!! error TS2421: Property 'x' is private in type 'I' but not in type 'Bar2'. x: string; y: number; } @@ -55,10 +55,10 @@ tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInte class Bar3 extends Foo implements I { // error ~~~~ !!! error TS2416: Class 'Bar3' incorrectly extends base class 'Foo': -!!! error TS2416: Private property 'x' cannot be reimplemented. +!!! error TS2416: Types have separate declarations of a private property 'x'. ~~~~ !!! error TS2421: Class 'Bar3' incorrectly implements interface 'I': -!!! error TS2421: Private property 'x' cannot be reimplemented. +!!! error TS2421: Types have separate declarations of a private property 'x'. private x: string; y: number; } @@ -85,7 +85,7 @@ tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInte class Bar2 extends Foo implements I { // error ~~~~ !!! error TS2416: Class 'Bar2' incorrectly extends base class 'Foo': -!!! error TS2416: Private property 'x' cannot be reimplemented. +!!! error TS2416: Property 'x' is private in type 'Foo' but not in type 'Bar2'. ~~~~ !!! error TS2421: Class 'Bar2' incorrectly implements interface 'I': !!! error TS2421: Property 'z' is missing in type 'Bar2'. @@ -96,7 +96,7 @@ tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInte class Bar3 extends Foo implements I { // error ~~~~ !!! error TS2416: Class 'Bar3' incorrectly extends base class 'Foo': -!!! error TS2416: Private property 'x' cannot be reimplemented. +!!! error TS2416: Types have separate declarations of a private property 'x'. ~~~~ !!! error TS2421: Class 'Bar3' incorrectly implements interface 'I': !!! error TS2421: Property 'z' is missing in type 'Bar3'. @@ -130,7 +130,7 @@ tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInte var r1 = b.z; var r2 = b.x; // error ~~~ -!!! error TS2341: Property 'Foo.x' is inaccessible. +!!! error TS2341: Property 'x' is private and only accessible within class 'Foo'. var r3 = b.y; // error ~ !!! error TS2339: Property 'y' does not exist on type 'Bar'. @@ -138,7 +138,7 @@ tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInte class Bar2 extends Foo implements I { // error ~~~~ !!! error TS2416: Class 'Bar2' incorrectly extends base class 'Foo': -!!! error TS2416: Private property 'x' cannot be reimplemented. +!!! error TS2416: Property 'x' is private in type 'Foo' but not in type 'Bar2'. ~~~~ !!! error TS2421: Class 'Bar2' incorrectly implements interface 'I': !!! error TS2421: Property 'y' is missing in type 'Bar2'. @@ -149,7 +149,7 @@ tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInte class Bar3 extends Foo implements I { // error ~~~~ !!! error TS2416: Class 'Bar3' incorrectly extends base class 'Foo': -!!! error TS2416: Private property 'x' cannot be reimplemented. +!!! error TS2416: Types have separate declarations of a private property 'x'. ~~~~ !!! error TS2421: Class 'Bar3' incorrectly implements interface 'I': !!! error TS2421: Property 'y' is missing in type 'Bar3'. diff --git a/tests/baselines/reference/implementingAnInterfaceExtendingClassWithProtecteds.errors.txt b/tests/baselines/reference/implementingAnInterfaceExtendingClassWithProtecteds.errors.txt new file mode 100644 index 0000000000..fc7cbbed97 --- /dev/null +++ b/tests/baselines/reference/implementingAnInterfaceExtendingClassWithProtecteds.errors.txt @@ -0,0 +1,74 @@ +tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithProtecteds.ts(9,7): error TS2421: Class 'Bar' incorrectly implements interface 'I': + Property 'y' is missing in type 'Bar'. +tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithProtecteds.ts(12,7): error TS2421: Class 'Bar2' incorrectly implements interface 'I': + Property 'x' is missing in type 'Bar2'. +tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithProtecteds.ts(16,7): error TS2421: Class 'Bar3' incorrectly implements interface 'I': + Property 'x' is protected but type 'Bar3' is not a class derived from 'Foo'. +tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithProtecteds.ts(21,7): error TS2421: Class 'Bar4' incorrectly implements interface 'I': + Property 'x' is protected but type 'Bar4' is not a class derived from 'Foo'. +tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithProtecteds.ts(26,7): error TS2421: Class 'Bar5' incorrectly implements interface 'I': + Property 'y' is missing in type 'Bar5'. +tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithProtecteds.ts(29,7): error TS2421: Class 'Bar6' incorrectly implements interface 'I': + Property 'y' is protected in type 'Bar6' but public in type 'I'. + + +==== tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithProtecteds.ts (6 errors) ==== + class Foo { + protected x: string; + } + + interface I extends Foo { + y: number; + } + + class Bar implements I { // error + ~~~ +!!! error TS2421: Class 'Bar' incorrectly implements interface 'I': +!!! error TS2421: Property 'y' is missing in type 'Bar'. + } + + class Bar2 implements I { // error + ~~~~ +!!! error TS2421: Class 'Bar2' incorrectly implements interface 'I': +!!! error TS2421: Property 'x' is missing in type 'Bar2'. + y: number; + } + + class Bar3 implements I { // error + ~~~~ +!!! error TS2421: Class 'Bar3' incorrectly implements interface 'I': +!!! error TS2421: Property 'x' is protected but type 'Bar3' is not a class derived from 'Foo'. + x: string; + y: number; + } + + class Bar4 implements I { // error + ~~~~ +!!! error TS2421: Class 'Bar4' incorrectly implements interface 'I': +!!! error TS2421: Property 'x' is protected but type 'Bar4' is not a class derived from 'Foo'. + protected x: string; + y: number; + } + + class Bar5 extends Foo implements I { // error + ~~~~ +!!! error TS2421: Class 'Bar5' incorrectly implements interface 'I': +!!! error TS2421: Property 'y' is missing in type 'Bar5'. + } + + class Bar6 extends Foo implements I { // error + ~~~~ +!!! error TS2421: Class 'Bar6' incorrectly implements interface 'I': +!!! error TS2421: Property 'y' is protected in type 'Bar6' but public in type 'I'. + protected y: number; + } + + class Bar7 extends Foo implements I { + y: number; + } + + class Bar8 extends Foo implements I { + x: string; + y: number; + } + \ No newline at end of file diff --git a/tests/baselines/reference/implementingAnInterfaceExtendingClassWithProtecteds.js b/tests/baselines/reference/implementingAnInterfaceExtendingClassWithProtecteds.js new file mode 100644 index 0000000000..1a79496bd1 --- /dev/null +++ b/tests/baselines/reference/implementingAnInterfaceExtendingClassWithProtecteds.js @@ -0,0 +1,103 @@ +//// [implementingAnInterfaceExtendingClassWithProtecteds.ts] +class Foo { + protected x: string; +} + +interface I extends Foo { + y: number; +} + +class Bar implements I { // error +} + +class Bar2 implements I { // error + y: number; +} + +class Bar3 implements I { // error + x: string; + y: number; +} + +class Bar4 implements I { // error + protected x: string; + y: number; +} + +class Bar5 extends Foo implements I { // error +} + +class Bar6 extends Foo implements I { // error + protected y: number; +} + +class Bar7 extends Foo implements I { + y: number; +} + +class Bar8 extends Foo implements I { + x: string; + y: number; +} + + +//// [implementingAnInterfaceExtendingClassWithProtecteds.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 Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Bar = (function () { + function Bar() { + } + return Bar; +})(); +var Bar2 = (function () { + function Bar2() { + } + return Bar2; +})(); +var Bar3 = (function () { + function Bar3() { + } + return Bar3; +})(); +var Bar4 = (function () { + function Bar4() { + } + return Bar4; +})(); +var Bar5 = (function (_super) { + __extends(Bar5, _super); + function Bar5() { + _super.apply(this, arguments); + } + return Bar5; +})(Foo); +var Bar6 = (function (_super) { + __extends(Bar6, _super); + function Bar6() { + _super.apply(this, arguments); + } + return Bar6; +})(Foo); +var Bar7 = (function (_super) { + __extends(Bar7, _super); + function Bar7() { + _super.apply(this, arguments); + } + return Bar7; +})(Foo); +var Bar8 = (function (_super) { + __extends(Bar8, _super); + function Bar8() { + _super.apply(this, arguments); + } + return Bar8; +})(Foo); diff --git a/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollision.errors.txt b/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollision.errors.txt index ae9c62b0f1..8bcef0e5a1 100644 --- a/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollision.errors.txt +++ b/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollision.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/inheritanceGrandParentPrivateMemberCollision.ts(7,7): error TS2416: Class 'C' incorrectly extends base class 'B': - Private property 'myMethod' cannot be reimplemented. + Types have separate declarations of a private property 'myMethod'. ==== tests/cases/compiler/inheritanceGrandParentPrivateMemberCollision.ts (1 errors) ==== @@ -12,7 +12,7 @@ tests/cases/compiler/inheritanceGrandParentPrivateMemberCollision.ts(7,7): error class C extends B { ~ !!! error TS2416: Class 'C' incorrectly extends base class 'B': -!!! error TS2416: Private property 'myMethod' cannot be reimplemented. +!!! error TS2416: Types have separate declarations of a private property 'myMethod'. private myMethod() { } } \ No newline at end of file diff --git a/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollisionWithPublicMember.errors.txt b/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollisionWithPublicMember.errors.txt index 532214638d..7676029fb8 100644 --- a/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollisionWithPublicMember.errors.txt +++ b/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollisionWithPublicMember.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/inheritanceGrandParentPrivateMemberCollisionWithPublicMember.ts(7,7): error TS2416: Class 'C' incorrectly extends base class 'B': - Private property 'myMethod' cannot be reimplemented. + Property 'myMethod' is private in type 'B' but not in type 'C'. ==== tests/cases/compiler/inheritanceGrandParentPrivateMemberCollisionWithPublicMember.ts (1 errors) ==== @@ -12,7 +12,7 @@ tests/cases/compiler/inheritanceGrandParentPrivateMemberCollisionWithPublicMembe class C extends B { ~ !!! error TS2416: Class 'C' incorrectly extends base class 'B': -!!! error TS2416: Private property 'myMethod' cannot be reimplemented. +!!! error TS2416: Property 'myMethod' is private in type 'B' but not in type 'C'. public myMethod() { } } \ No newline at end of file diff --git a/tests/baselines/reference/inheritanceGrandParentPublicMemberCollisionWithPrivateMember.errors.txt b/tests/baselines/reference/inheritanceGrandParentPublicMemberCollisionWithPrivateMember.errors.txt index 06508ede86..c5d41868fa 100644 --- a/tests/baselines/reference/inheritanceGrandParentPublicMemberCollisionWithPrivateMember.errors.txt +++ b/tests/baselines/reference/inheritanceGrandParentPublicMemberCollisionWithPrivateMember.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/inheritanceGrandParentPublicMemberCollisionWithPrivateMember.ts(7,7): error TS2416: Class 'C' incorrectly extends base class 'B': - Private property 'myMethod' cannot be reimplemented. + Property 'myMethod' is private in type 'C' but not in type 'B'. ==== tests/cases/compiler/inheritanceGrandParentPublicMemberCollisionWithPrivateMember.ts (1 errors) ==== @@ -12,7 +12,7 @@ tests/cases/compiler/inheritanceGrandParentPublicMemberCollisionWithPrivateMembe class C extends B { ~ !!! error TS2416: Class 'C' incorrectly extends base class 'B': -!!! error TS2416: Private property 'myMethod' cannot be reimplemented. +!!! error TS2416: Property 'myMethod' is private in type 'C' but not in type 'B'. private myMethod() { } } \ No newline at end of file diff --git a/tests/baselines/reference/interfaceExtendingClassWithPrivates.errors.txt b/tests/baselines/reference/interfaceExtendingClassWithPrivates.errors.txt index f7abe9cb12..93d8b7cfa5 100644 --- a/tests/baselines/reference/interfaceExtendingClassWithPrivates.errors.txt +++ b/tests/baselines/reference/interfaceExtendingClassWithPrivates.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithPrivates.ts(5,11): error TS2429: Interface 'I' incorrectly extends interface 'Foo': - Private property 'x' cannot be reimplemented. -tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithPrivates.ts(15,10): error TS2341: Property 'Foo.x' is inaccessible. + Property 'x' is private in type 'Foo' but not in type 'I'. +tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithPrivates.ts(15,10): error TS2341: Property 'x' is private and only accessible within class 'Foo'. ==== tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithPrivates.ts (2 errors) ==== @@ -11,7 +11,7 @@ tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtending interface I extends Foo { // error ~ !!! error TS2429: Interface 'I' incorrectly extends interface 'Foo': -!!! error TS2429: Private property 'x' cannot be reimplemented. +!!! error TS2429: Property 'x' is private in type 'Foo' but not in type 'I'. x: string; } @@ -23,4 +23,4 @@ tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtending var r = i.y; var r2 = i.x; // error ~~~ -!!! error TS2341: Property 'Foo.x' is inaccessible. \ No newline at end of file +!!! error TS2341: Property 'x' is private and only accessible within class 'Foo'. \ No newline at end of file diff --git a/tests/baselines/reference/interfaceExtendingClassWithPrivates2.errors.txt b/tests/baselines/reference/interfaceExtendingClassWithPrivates2.errors.txt index 77ed7a486b..f17a1ef348 100644 --- a/tests/baselines/reference/interfaceExtendingClassWithPrivates2.errors.txt +++ b/tests/baselines/reference/interfaceExtendingClassWithPrivates2.errors.txt @@ -1,11 +1,11 @@ tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithPrivates2.ts(9,11): error TS2320: Interface 'I3' cannot simultaneously extend types 'Foo' and 'Bar': Named properties 'x' of types 'Foo' and 'Bar' are not identical. tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithPrivates2.ts(12,11): error TS2429: Interface 'I4' incorrectly extends interface 'Bar': - Private property 'x' cannot be reimplemented. + Property 'x' is private in type 'Bar' but not in type 'I4'. tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithPrivates2.ts(12,11): error TS2429: Interface 'I4' incorrectly extends interface 'Foo': - Private property 'x' cannot be reimplemented. -tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithPrivates2.ts(26,10): error TS2341: Property 'Foo.x' is inaccessible. -tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithPrivates2.ts(27,10): error TS2341: Property 'Baz.y' is inaccessible. + Property 'x' is private in type 'Foo' but not in type 'I4'. +tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithPrivates2.ts(26,10): error TS2341: Property 'x' is private and only accessible within class 'Foo'. +tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithPrivates2.ts(27,10): error TS2341: Property 'y' is private and only accessible within class 'Baz'. ==== tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithPrivates2.ts (5 errors) ==== @@ -26,10 +26,10 @@ tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtending interface I4 extends Foo, Bar { // error ~~ !!! error TS2429: Interface 'I4' incorrectly extends interface 'Bar': -!!! error TS2429: Private property 'x' cannot be reimplemented. +!!! error TS2429: Property 'x' is private in type 'Bar' but not in type 'I4'. ~~ !!! error TS2429: Interface 'I4' incorrectly extends interface 'Foo': -!!! error TS2429: Private property 'x' cannot be reimplemented. +!!! error TS2429: Property 'x' is private in type 'Foo' but not in type 'I4'. x: string; } @@ -45,7 +45,7 @@ tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtending var r: string = i.z; var r2 = i.x; // error ~~~ -!!! error TS2341: Property 'Foo.x' is inaccessible. +!!! error TS2341: Property 'x' is private and only accessible within class 'Foo'. var r3 = i.y; // error ~~~ -!!! error TS2341: Property 'Baz.y' is inaccessible. \ No newline at end of file +!!! error TS2341: Property 'y' is private and only accessible within class 'Baz'. \ No newline at end of file diff --git a/tests/baselines/reference/interfaceExtendingClassWithProtecteds.errors.txt b/tests/baselines/reference/interfaceExtendingClassWithProtecteds.errors.txt new file mode 100644 index 0000000000..1cbc921e1a --- /dev/null +++ b/tests/baselines/reference/interfaceExtendingClassWithProtecteds.errors.txt @@ -0,0 +1,26 @@ +tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithProtecteds.ts(5,11): error TS2429: Interface 'I' incorrectly extends interface 'Foo': + Property 'x' is protected but type 'I' is not a class derived from 'Foo'. +tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithProtecteds.ts(15,10): error TS2445: Property 'x' is protected and only accessible within class 'Foo' and its subclasses. + + +==== tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithProtecteds.ts (2 errors) ==== + class Foo { + protected x: string; + } + + interface I extends Foo { // error + ~ +!!! error TS2429: Interface 'I' incorrectly extends interface 'Foo': +!!! error TS2429: Property 'x' is protected but type 'I' is not a class derived from 'Foo'. + x: string; + } + + interface I2 extends Foo { + y: string; + } + + var i: I2; + var r = i.y; + var r2 = i.x; // error + ~~~ +!!! error TS2445: Property 'x' is protected and only accessible within class 'Foo' and its subclasses. \ No newline at end of file diff --git a/tests/baselines/reference/interfaceExtendingClassWithProtecteds.js b/tests/baselines/reference/interfaceExtendingClassWithProtecteds.js new file mode 100644 index 0000000000..f2d95812fd --- /dev/null +++ b/tests/baselines/reference/interfaceExtendingClassWithProtecteds.js @@ -0,0 +1,26 @@ +//// [interfaceExtendingClassWithProtecteds.ts] +class Foo { + protected x: string; +} + +interface I extends Foo { // error + x: string; +} + +interface I2 extends Foo { + y: string; +} + +var i: I2; +var r = i.y; +var r2 = i.x; // error + +//// [interfaceExtendingClassWithProtecteds.js] +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var i; +var r = i.y; +var r2 = i.x; // error diff --git a/tests/baselines/reference/interfaceExtendingClassWithProtecteds2.errors.txt b/tests/baselines/reference/interfaceExtendingClassWithProtecteds2.errors.txt new file mode 100644 index 0000000000..4e5b636401 --- /dev/null +++ b/tests/baselines/reference/interfaceExtendingClassWithProtecteds2.errors.txt @@ -0,0 +1,51 @@ +tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithProtecteds2.ts(9,11): error TS2320: Interface 'I3' cannot simultaneously extend types 'Foo' and 'Bar': + Named properties 'x' of types 'Foo' and 'Bar' are not identical. +tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithProtecteds2.ts(12,11): error TS2429: Interface 'I4' incorrectly extends interface 'Bar': + Property 'x' is protected but type 'I4' is not a class derived from 'Bar'. +tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithProtecteds2.ts(12,11): error TS2429: Interface 'I4' incorrectly extends interface 'Foo': + Property 'x' is protected but type 'I4' is not a class derived from 'Foo'. +tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithProtecteds2.ts(26,10): error TS2445: Property 'x' is protected and only accessible within class 'Foo' and its subclasses. +tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithProtecteds2.ts(27,10): error TS2445: Property 'y' is protected and only accessible within class 'Baz' and its subclasses. + + +==== tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithProtecteds2.ts (5 errors) ==== + class Foo { + protected x: string; + } + + class Bar { + protected x: string; + } + + interface I3 extends Foo, Bar { // error + ~~ +!!! error TS2320: Interface 'I3' cannot simultaneously extend types 'Foo' and 'Bar': +!!! error TS2320: Named properties 'x' of types 'Foo' and 'Bar' are not identical. + } + + interface I4 extends Foo, Bar { // error + ~~ +!!! error TS2429: Interface 'I4' incorrectly extends interface 'Bar': +!!! error TS2429: Property 'x' is protected but type 'I4' is not a class derived from 'Bar'. + ~~ +!!! error TS2429: Interface 'I4' incorrectly extends interface 'Foo': +!!! error TS2429: Property 'x' is protected but type 'I4' is not a class derived from 'Foo'. + x: string; + } + + class Baz { + protected y: string; + } + + interface I5 extends Foo, Baz { + z: string; + } + + var i: I5; + var r: string = i.z; + var r2 = i.x; // error + ~~~ +!!! error TS2445: Property 'x' is protected and only accessible within class 'Foo' and its subclasses. + var r3 = i.y; // error + ~~~ +!!! error TS2445: Property 'y' is protected and only accessible within class 'Baz' and its subclasses. \ No newline at end of file diff --git a/tests/baselines/reference/interfaceExtendingClassWithProtecteds2.js b/tests/baselines/reference/interfaceExtendingClassWithProtecteds2.js new file mode 100644 index 0000000000..277c32a10c --- /dev/null +++ b/tests/baselines/reference/interfaceExtendingClassWithProtecteds2.js @@ -0,0 +1,49 @@ +//// [interfaceExtendingClassWithProtecteds2.ts] +class Foo { + protected x: string; +} + +class Bar { + protected x: string; +} + +interface I3 extends Foo, Bar { // error +} + +interface I4 extends Foo, Bar { // error + x: string; +} + +class Baz { + protected y: string; +} + +interface I5 extends Foo, Baz { + z: string; +} + +var i: I5; +var r: string = i.z; +var r2 = i.x; // error +var r3 = i.y; // error + +//// [interfaceExtendingClassWithProtecteds2.js] +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Bar = (function () { + function Bar() { + } + return Bar; +})(); +var Baz = (function () { + function Baz() { + } + return Baz; +})(); +var i; +var r = i.z; +var r2 = i.x; // error +var r3 = i.y; // error diff --git a/tests/baselines/reference/interfaceExtendsClassWithPrivate2.errors.txt b/tests/baselines/reference/interfaceExtendsClassWithPrivate2.errors.txt index 71b8b656db..a965d7003b 100644 --- a/tests/baselines/reference/interfaceExtendsClassWithPrivate2.errors.txt +++ b/tests/baselines/reference/interfaceExtendsClassWithPrivate2.errors.txt @@ -1,11 +1,11 @@ tests/cases/compiler/interfaceExtendsClassWithPrivate2.ts(10,7): error TS2416: Class 'D' incorrectly extends base class 'C': - Private property 'x' cannot be reimplemented. + Types have separate declarations of a private property 'x'. tests/cases/compiler/interfaceExtendsClassWithPrivate2.ts(10,7): error TS2421: Class 'D' incorrectly implements interface 'I': - Private property 'x' cannot be reimplemented. + Types have separate declarations of a private property 'x'. tests/cases/compiler/interfaceExtendsClassWithPrivate2.ts(18,7): error TS2416: Class 'D2' incorrectly extends base class 'C': - Private property 'x' cannot be reimplemented. + Types have separate declarations of a private property 'x'. tests/cases/compiler/interfaceExtendsClassWithPrivate2.ts(18,7): error TS2421: Class 'D2' incorrectly implements interface 'I': - Private property 'x' cannot be reimplemented. + Types have separate declarations of a private property 'x'. ==== tests/cases/compiler/interfaceExtendsClassWithPrivate2.ts (4 errors) ==== @@ -21,10 +21,10 @@ tests/cases/compiler/interfaceExtendsClassWithPrivate2.ts(18,7): error TS2421: C class D extends C implements I { // error ~ !!! error TS2416: Class 'D' incorrectly extends base class 'C': -!!! error TS2416: Private property 'x' cannot be reimplemented. +!!! error TS2416: Types have separate declarations of a private property 'x'. ~ !!! error TS2421: Class 'D' incorrectly implements interface 'I': -!!! error TS2421: Private property 'x' cannot be reimplemented. +!!! error TS2421: Types have separate declarations of a private property 'x'. public foo(x: any) { return x; } private x = 2; private y = 3; @@ -35,10 +35,10 @@ tests/cases/compiler/interfaceExtendsClassWithPrivate2.ts(18,7): error TS2421: C class D2 extends C implements I { // error ~~ !!! error TS2416: Class 'D2' incorrectly extends base class 'C': -!!! error TS2416: Private property 'x' cannot be reimplemented. +!!! error TS2416: Types have separate declarations of a private property 'x'. ~~ !!! error TS2421: Class 'D2' incorrectly implements interface 'I': -!!! error TS2421: Private property 'x' cannot be reimplemented. +!!! error TS2421: Types have separate declarations of a private property 'x'. public foo(x: any) { return x; } private x = ""; other(x: any) { return x; } diff --git a/tests/baselines/reference/interfaceImplementation1.errors.txt b/tests/baselines/reference/interfaceImplementation1.errors.txt index e0a6b311d0..59a81e6695 100644 --- a/tests/baselines/reference/interfaceImplementation1.errors.txt +++ b/tests/baselines/reference/interfaceImplementation1.errors.txt @@ -1,7 +1,7 @@ tests/cases/compiler/interfaceImplementation1.ts(12,7): error TS2421: Class 'C1' incorrectly implements interface 'I1': - Private property 'iObj' cannot be reimplemented. + Property 'iObj' is private in type 'C1' but not in type 'I1'. tests/cases/compiler/interfaceImplementation1.ts(12,7): error TS2421: Class 'C1' incorrectly implements interface 'I2': - Private property 'iFn' cannot be reimplemented. + Property 'iFn' is private in type 'C1' but not in type 'I2'. tests/cases/compiler/interfaceImplementation1.ts(34,5): error TS2323: Type '() => C2' is not assignable to type 'I4'. @@ -20,10 +20,10 @@ tests/cases/compiler/interfaceImplementation1.ts(34,5): error TS2323: Type '() = class C1 implements I1,I2 { ~~ !!! error TS2421: Class 'C1' incorrectly implements interface 'I1': -!!! error TS2421: Private property 'iObj' cannot be reimplemented. +!!! error TS2421: Property 'iObj' is private in type 'C1' but not in type 'I1'. ~~ !!! error TS2421: Class 'C1' incorrectly implements interface 'I2': -!!! error TS2421: Private property 'iFn' cannot be reimplemented. +!!! error TS2421: Property 'iFn' is private in type 'C1' but not in type 'I2'. private iFn(); private iFn(n?:number, s?:string) { } private iAny:any; diff --git a/tests/baselines/reference/interfaceImplementation6.errors.txt b/tests/baselines/reference/interfaceImplementation6.errors.txt index b076f30a22..0965a1c601 100644 --- a/tests/baselines/reference/interfaceImplementation6.errors.txt +++ b/tests/baselines/reference/interfaceImplementation6.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/interfaceImplementation6.ts(9,7): error TS2421: Class 'C2' incorrectly implements interface 'I1': - Private property 'item' cannot be reimplemented. + Property 'item' is private in type 'C2' but not in type 'I1'. tests/cases/compiler/interfaceImplementation6.ts(13,7): error TS2421: Class 'C3' incorrectly implements interface 'I1': Property 'item' is missing in type 'C3'. @@ -16,7 +16,7 @@ tests/cases/compiler/interfaceImplementation6.ts(13,7): error TS2421: Class 'C3' class C2 implements I1 { ~~ !!! error TS2421: Class 'C2' incorrectly implements interface 'I1': -!!! error TS2421: Private property 'item' cannot be reimplemented. +!!! error TS2421: Property 'item' is private in type 'C2' but not in type 'I1'. private item:number; } diff --git a/tests/baselines/reference/interfaceImplementation8.errors.txt b/tests/baselines/reference/interfaceImplementation8.errors.txt index 1e810caedd..4d0d06042a 100644 --- a/tests/baselines/reference/interfaceImplementation8.errors.txt +++ b/tests/baselines/reference/interfaceImplementation8.errors.txt @@ -1,9 +1,9 @@ tests/cases/compiler/interfaceImplementation8.ts(12,7): error TS2421: Class 'C2' incorrectly implements interface 'i1': - Private property 'name' cannot be reimplemented. + Property 'name' is private in type 'C2' but not in type 'i1'. tests/cases/compiler/interfaceImplementation8.ts(21,7): error TS2421: Class 'C5' incorrectly implements interface 'i1': - Private property 'name' cannot be reimplemented. + Property 'name' is private in type 'C5' but not in type 'i1'. tests/cases/compiler/interfaceImplementation8.ts(22,7): error TS2421: Class 'C6' incorrectly implements interface 'i1': - Private property 'name' cannot be reimplemented. + Property 'name' is private in type 'C6' but not in type 'i1'. ==== tests/cases/compiler/interfaceImplementation8.ts (3 errors) ==== @@ -21,7 +21,7 @@ tests/cases/compiler/interfaceImplementation8.ts(22,7): error TS2421: Class 'C6' class C2 implements i1 { ~~ !!! error TS2421: Class 'C2' incorrectly implements interface 'i1': -!!! error TS2421: Private property 'name' cannot be reimplemented. +!!! error TS2421: Property 'name' is private in type 'C2' but not in type 'i1'. private name:string; } @@ -33,11 +33,11 @@ tests/cases/compiler/interfaceImplementation8.ts(22,7): error TS2421: Class 'C6' class C5 extends C2 implements i1{ } ~~ !!! error TS2421: Class 'C5' incorrectly implements interface 'i1': -!!! error TS2421: Private property 'name' cannot be reimplemented. +!!! error TS2421: Property 'name' is private in type 'C5' but not in type 'i1'. class C6 extends C3 implements i1{ } ~~ !!! error TS2421: Class 'C6' incorrectly implements interface 'i1': -!!! error TS2421: Private property 'name' cannot be reimplemented. +!!! error TS2421: Property 'name' is private in type 'C6' but not in type 'i1'. /* 2 diff --git a/tests/baselines/reference/interfaceWithPropertyThatIsPrivateInBaseType.errors.txt b/tests/baselines/reference/interfaceWithPropertyThatIsPrivateInBaseType.errors.txt index 66043dc6f7..60c917d0fb 100644 --- a/tests/baselines/reference/interfaceWithPropertyThatIsPrivateInBaseType.errors.txt +++ b/tests/baselines/reference/interfaceWithPropertyThatIsPrivateInBaseType.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithPropertyThatIsPrivateInBaseType.ts(5,11): error TS2429: Interface 'Foo' incorrectly extends interface 'Base': - Private property 'x' cannot be reimplemented. + Property 'x' is private in type 'Base' but not in type 'Foo'. tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithPropertyThatIsPrivateInBaseType.ts(13,11): error TS2429: Interface 'Foo2' incorrectly extends interface 'Base2': - Private property 'x' cannot be reimplemented. + Property 'x' is private in type 'Base2' but not in type 'Foo2'. ==== tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithPropertyThatIsPrivateInBaseType.ts (2 errors) ==== @@ -12,7 +12,7 @@ tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithPropertyTh interface Foo extends Base { // error ~~~ !!! error TS2429: Interface 'Foo' incorrectly extends interface 'Base': -!!! error TS2429: Private property 'x' cannot be reimplemented. +!!! error TS2429: Property 'x' is private in type 'Base' but not in type 'Foo'. x: number; } @@ -23,6 +23,6 @@ tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithPropertyTh interface Foo2 extends Base2 { // error ~~~~ !!! error TS2429: Interface 'Foo2' incorrectly extends interface 'Base2': -!!! error TS2429: Private property 'x' cannot be reimplemented. +!!! error TS2429: Property 'x' is private in type 'Base2' but not in type 'Foo2'. x: number; } \ No newline at end of file diff --git a/tests/baselines/reference/interfaceWithPropertyThatIsPrivateInBaseType2.errors.txt b/tests/baselines/reference/interfaceWithPropertyThatIsPrivateInBaseType2.errors.txt index 3f4be2ebac..4ee4bf8709 100644 --- a/tests/baselines/reference/interfaceWithPropertyThatIsPrivateInBaseType2.errors.txt +++ b/tests/baselines/reference/interfaceWithPropertyThatIsPrivateInBaseType2.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithPropertyThatIsPrivateInBaseType2.ts(5,11): error TS2429: Interface 'Foo' incorrectly extends interface 'Base': - Private property 'x' cannot be reimplemented. + Property 'x' is private in type 'Base' but not in type 'Foo'. tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithPropertyThatIsPrivateInBaseType2.ts(13,11): error TS2429: Interface 'Foo2' incorrectly extends interface 'Base2': - Private property 'x' cannot be reimplemented. + Property 'x' is private in type 'Base2' but not in type 'Foo2'. ==== tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithPropertyThatIsPrivateInBaseType2.ts (2 errors) ==== @@ -12,7 +12,7 @@ tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithPropertyTh interface Foo extends Base { // error ~~~ !!! error TS2429: Interface 'Foo' incorrectly extends interface 'Base': -!!! error TS2429: Private property 'x' cannot be reimplemented. +!!! error TS2429: Property 'x' is private in type 'Base' but not in type 'Foo'. x(): any; } @@ -23,6 +23,6 @@ tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithPropertyTh interface Foo2 extends Base2 { // error ~~~~ !!! error TS2429: Interface 'Foo2' incorrectly extends interface 'Base2': -!!! error TS2429: Private property 'x' cannot be reimplemented. +!!! error TS2429: Property 'x' is private in type 'Base2' but not in type 'Foo2'. x(): any; } \ No newline at end of file diff --git a/tests/baselines/reference/memberFunctionsWithPrivateOverloads.errors.txt b/tests/baselines/reference/memberFunctionsWithPrivateOverloads.errors.txt index 45b1569dbf..d6c3d4a659 100644 --- a/tests/baselines/reference/memberFunctionsWithPrivateOverloads.errors.txt +++ b/tests/baselines/reference/memberFunctionsWithPrivateOverloads.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPrivateOverloads.ts(43,9): error TS2341: Property 'C.foo' is inaccessible. -tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPrivateOverloads.ts(46,10): error TS2341: Property 'D.foo' is inaccessible. -tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPrivateOverloads.ts(48,10): error TS2341: Property 'C.foo' is inaccessible. -tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPrivateOverloads.ts(49,10): error TS2341: Property 'D.bar' is inaccessible. +tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPrivateOverloads.ts(43,9): error TS2341: Property 'foo' is private and only accessible within class 'C'. +tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPrivateOverloads.ts(46,10): error TS2341: Property 'foo' is private and only accessible within class 'D'. +tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPrivateOverloads.ts(48,10): error TS2341: Property 'foo' is private and only accessible within class 'C'. +tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPrivateOverloads.ts(49,10): error TS2341: Property 'bar' is private and only accessible within class 'D'. ==== tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPrivateOverloads.ts (4 errors) ==== @@ -49,16 +49,16 @@ tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclara var c: C; var r = c.foo(1); // error ~~~~~ -!!! error TS2341: Property 'C.foo' is inaccessible. +!!! error TS2341: Property 'foo' is private and only accessible within class 'C'. var d: D; var r2 = d.foo(2); // error ~~~~~ -!!! error TS2341: Property 'D.foo' is inaccessible. +!!! error TS2341: Property 'foo' is private and only accessible within class 'D'. var r3 = C.foo(1); // error ~~~~~ -!!! error TS2341: Property 'C.foo' is inaccessible. +!!! error TS2341: Property 'foo' is private and only accessible within class 'C'. var r4 = D.bar(''); // error ~~~~~ -!!! error TS2341: Property 'D.bar' is inaccessible. \ No newline at end of file +!!! error TS2341: Property 'bar' is private and only accessible within class 'D'. \ No newline at end of file diff --git a/tests/baselines/reference/memberFunctionsWithPublicPrivateOverloads.errors.txt b/tests/baselines/reference/memberFunctionsWithPublicPrivateOverloads.errors.txt index 57d92cc969..95c12e4db0 100644 --- a/tests/baselines/reference/memberFunctionsWithPublicPrivateOverloads.errors.txt +++ b/tests/baselines/reference/memberFunctionsWithPublicPrivateOverloads.errors.txt @@ -1,13 +1,13 @@ -tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPublicPrivateOverloads.ts(3,12): error TS2385: Overload signatures must all be public or private. -tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPublicPrivateOverloads.ts(7,12): error TS2385: Overload signatures must all be public or private. -tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPublicPrivateOverloads.ts(12,19): error TS2385: Overload signatures must all be public or private. -tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPublicPrivateOverloads.ts(16,19): error TS2385: Overload signatures must all be public or private. -tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPublicPrivateOverloads.ts(23,12): error TS2385: Overload signatures must all be public or private. -tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPublicPrivateOverloads.ts(27,12): error TS2385: Overload signatures must all be public or private. -tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPublicPrivateOverloads.ts(32,19): error TS2385: Overload signatures must all be public or private. -tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPublicPrivateOverloads.ts(36,19): error TS2385: Overload signatures must all be public or private. -tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPublicPrivateOverloads.ts(42,9): error TS2341: Property 'C.foo' is inaccessible. -tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPublicPrivateOverloads.ts(45,10): error TS2341: Property 'D.foo' is inaccessible. +tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPublicPrivateOverloads.ts(3,12): error TS2385: Overload signatures must all be public, private or protected. +tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPublicPrivateOverloads.ts(7,12): error TS2385: Overload signatures must all be public, private or protected. +tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPublicPrivateOverloads.ts(12,19): error TS2385: Overload signatures must all be public, private or protected. +tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPublicPrivateOverloads.ts(16,19): error TS2385: Overload signatures must all be public, private or protected. +tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPublicPrivateOverloads.ts(23,12): error TS2385: Overload signatures must all be public, private or protected. +tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPublicPrivateOverloads.ts(27,12): error TS2385: Overload signatures must all be public, private or protected. +tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPublicPrivateOverloads.ts(32,19): error TS2385: Overload signatures must all be public, private or protected. +tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPublicPrivateOverloads.ts(36,19): error TS2385: Overload signatures must all be public, private or protected. +tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPublicPrivateOverloads.ts(42,9): error TS2341: Property 'foo' is private and only accessible within class 'C'. +tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPublicPrivateOverloads.ts(45,10): error TS2341: Property 'foo' is private and only accessible within class 'D'. ==== tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/memberFunctionsWithPublicPrivateOverloads.ts (10 errors) ==== @@ -15,26 +15,26 @@ tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclara private foo(x: number); public foo(x: number, y: string); // error ~~~ -!!! error TS2385: Overload signatures must all be public or private. +!!! error TS2385: Overload signatures must all be public, private or protected. private foo(x: any, y?: any) { } private bar(x: 'hi'); public bar(x: string); // error ~~~ -!!! error TS2385: Overload signatures must all be public or private. +!!! error TS2385: Overload signatures must all be public, private or protected. private bar(x: number, y: string); private bar(x: any, y?: any) { } private static foo(x: number); public static foo(x: number, y: string); // error ~~~ -!!! error TS2385: Overload signatures must all be public or private. +!!! error TS2385: Overload signatures must all be public, private or protected. private static foo(x: any, y?: any) { } private static bar(x: 'hi'); public static bar(x: string); // error ~~~ -!!! error TS2385: Overload signatures must all be public or private. +!!! error TS2385: Overload signatures must all be public, private or protected. private static bar(x: number, y: string); private static bar(x: any, y?: any) { } } @@ -43,26 +43,26 @@ tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclara private foo(x: number); public foo(x: T, y: T); // error ~~~ -!!! error TS2385: Overload signatures must all be public or private. +!!! error TS2385: Overload signatures must all be public, private or protected. private foo(x: any, y?: any) { } private bar(x: 'hi'); public bar(x: string); // error ~~~ -!!! error TS2385: Overload signatures must all be public or private. +!!! error TS2385: Overload signatures must all be public, private or protected. private bar(x: T, y: T); private bar(x: any, y?: any) { } private static foo(x: number); public static foo(x: number, y: string); // error ~~~ -!!! error TS2385: Overload signatures must all be public or private. +!!! error TS2385: Overload signatures must all be public, private or protected. private static foo(x: any, y?: any) { } private static bar(x: 'hi'); public static bar(x: string); // error ~~~ -!!! error TS2385: Overload signatures must all be public or private. +!!! error TS2385: Overload signatures must all be public, private or protected. private static bar(x: number, y: string); private static bar(x: any, y?: any) { } } @@ -70,9 +70,9 @@ tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclara var c: C; var r = c.foo(1); // error ~~~~~ -!!! error TS2341: Property 'C.foo' is inaccessible. +!!! error TS2341: Property 'foo' is private and only accessible within class 'C'. var d: D; var r2 = d.foo(2); // error ~~~~~ -!!! error TS2341: Property 'D.foo' is inaccessible. \ No newline at end of file +!!! error TS2341: Property 'foo' is private and only accessible within class 'D'. \ No newline at end of file diff --git a/tests/baselines/reference/mergedInterfacesWithInheritedPrivates.errors.txt b/tests/baselines/reference/mergedInterfacesWithInheritedPrivates.errors.txt index 3014b55a8c..f1ee1f383b 100644 --- a/tests/baselines/reference/mergedInterfacesWithInheritedPrivates.errors.txt +++ b/tests/baselines/reference/mergedInterfacesWithInheritedPrivates.errors.txt @@ -1,8 +1,8 @@ tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheritedPrivates.ts(13,7): error TS2421: Class 'D' incorrectly implements interface 'A': - Private property 'x' cannot be reimplemented. + Types have separate declarations of a private property 'x'. tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheritedPrivates.ts(19,7): error TS2421: Class 'E' incorrectly implements interface 'A': - Private property 'x' cannot be reimplemented. -tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheritedPrivates.ts(26,9): error TS2341: Property 'C.x' is inaccessible. + Property 'x' is private in type 'A' but not in type 'E'. +tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheritedPrivates.ts(26,9): error TS2341: Property 'x' is private and only accessible within class 'C'. ==== tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheritedPrivates.ts (3 errors) ==== @@ -21,7 +21,7 @@ tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheri class D implements A { // error ~ !!! error TS2421: Class 'D' incorrectly implements interface 'A': -!!! error TS2421: Private property 'x' cannot be reimplemented. +!!! error TS2421: Types have separate declarations of a private property 'x'. private x: number; y: string; z: string; @@ -30,7 +30,7 @@ tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheri class E implements A { // error ~ !!! error TS2421: Class 'E' incorrectly implements interface 'A': -!!! error TS2421: Private property 'x' cannot be reimplemented. +!!! error TS2421: Property 'x' is private in type 'A' but not in type 'E'. x: number; y: string; z: string; @@ -39,4 +39,4 @@ tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheri var a: A; var r = a.x; // error ~~~ -!!! error TS2341: Property 'C.x' is inaccessible. \ No newline at end of file +!!! error TS2341: Property 'x' is private and only accessible within class 'C'. \ No newline at end of file diff --git a/tests/baselines/reference/mergedInterfacesWithInheritedPrivates2.errors.txt b/tests/baselines/reference/mergedInterfacesWithInheritedPrivates2.errors.txt index 64bc61efdf..0ca3b4c3aa 100644 --- a/tests/baselines/reference/mergedInterfacesWithInheritedPrivates2.errors.txt +++ b/tests/baselines/reference/mergedInterfacesWithInheritedPrivates2.errors.txt @@ -1,11 +1,11 @@ tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheritedPrivates2.ts(17,7): error TS2421: Class 'D' incorrectly implements interface 'A': - Private property 'w' cannot be reimplemented. + Types have separate declarations of a private property 'w'. tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheritedPrivates2.ts(23,7): error TS2416: Class 'E' incorrectly extends base class 'C2': - Private property 'w' cannot be reimplemented. + Property 'w' is private in type 'C2' but not in type 'E'. tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheritedPrivates2.ts(23,7): error TS2421: Class 'E' incorrectly implements interface 'A': Property 'x' is missing in type 'E'. -tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheritedPrivates2.ts(30,9): error TS2341: Property 'C.x' is inaccessible. -tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheritedPrivates2.ts(31,10): error TS2341: Property 'C2.w' is inaccessible. +tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheritedPrivates2.ts(30,9): error TS2341: Property 'x' is private and only accessible within class 'C'. +tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheritedPrivates2.ts(31,10): error TS2341: Property 'w' is private and only accessible within class 'C2'. ==== tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheritedPrivates2.ts (5 errors) ==== @@ -28,7 +28,7 @@ tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheri class D extends C implements A { // error ~ !!! error TS2421: Class 'D' incorrectly implements interface 'A': -!!! error TS2421: Private property 'w' cannot be reimplemented. +!!! error TS2421: Types have separate declarations of a private property 'w'. private w: number; y: string; z: string; @@ -37,7 +37,7 @@ tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheri class E extends C2 implements A { // error ~ !!! error TS2416: Class 'E' incorrectly extends base class 'C2': -!!! error TS2416: Private property 'w' cannot be reimplemented. +!!! error TS2416: Property 'w' is private in type 'C2' but not in type 'E'. ~ !!! error TS2421: Class 'E' incorrectly implements interface 'A': !!! error TS2421: Property 'x' is missing in type 'E'. @@ -49,7 +49,7 @@ tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheri var a: A; var r = a.x; // error ~~~ -!!! error TS2341: Property 'C.x' is inaccessible. +!!! error TS2341: Property 'x' is private and only accessible within class 'C'. var r2 = a.w; // error ~~~ -!!! error TS2341: Property 'C2.w' is inaccessible. \ No newline at end of file +!!! error TS2341: Property 'w' is private and only accessible within class 'C2'. \ No newline at end of file diff --git a/tests/baselines/reference/optionalPropertiesTest.errors.txt b/tests/baselines/reference/optionalPropertiesTest.errors.txt index 3f32baa340..74b8dd7a73 100644 --- a/tests/baselines/reference/optionalPropertiesTest.errors.txt +++ b/tests/baselines/reference/optionalPropertiesTest.errors.txt @@ -5,7 +5,7 @@ tests/cases/compiler/optionalPropertiesTest.ts(25,5): error TS2322: Type '{}' is tests/cases/compiler/optionalPropertiesTest.ts(26,5): error TS2322: Type '{}' is not assignable to type 'i3': Property 'M' is missing in type '{}'. tests/cases/compiler/optionalPropertiesTest.ts(40,1): error TS2322: Type 'i2' is not assignable to type 'i1': - Required property 'M' cannot be reimplemented with optional property in 'i2'. + Property 'M' is optional in type 'i2' but required in type 'i1'. ==== tests/cases/compiler/optionalPropertiesTest.ts (4 errors) ==== @@ -60,4 +60,4 @@ tests/cases/compiler/optionalPropertiesTest.ts(40,1): error TS2322: Type 'i2' is test10_1 = test10_2; ~~~~~~~~ !!! error TS2322: Type 'i2' is not assignable to type 'i1': -!!! error TS2322: Required property 'M' cannot be reimplemented with optional property in 'i2'. \ No newline at end of file +!!! error TS2322: Property 'M' is optional in type 'i2' but required in type 'i1'. \ No newline at end of file diff --git a/tests/baselines/reference/overloadModifiersMustAgree.errors.txt b/tests/baselines/reference/overloadModifiersMustAgree.errors.txt index 0bfd9b4d2b..0efdbcdd1f 100644 --- a/tests/baselines/reference/overloadModifiersMustAgree.errors.txt +++ b/tests/baselines/reference/overloadModifiersMustAgree.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/overloadModifiersMustAgree.ts(2,12): error TS2385: Overload signatures must all be public or private. +tests/cases/compiler/overloadModifiersMustAgree.ts(2,12): error TS2385: Overload signatures must all be public, private or protected. tests/cases/compiler/overloadModifiersMustAgree.ts(6,18): error TS2384: Overload signatures must all be ambient or non-ambient. tests/cases/compiler/overloadModifiersMustAgree.ts(7,17): error TS2383: Overload signatures must all be exported or not exported. tests/cases/compiler/overloadModifiersMustAgree.ts(12,5): error TS2386: Overload signatures must all be optional or required. @@ -8,7 +8,7 @@ tests/cases/compiler/overloadModifiersMustAgree.ts(12,5): error TS2386: Overload class baz { public foo(); ~~~ -!!! error TS2385: Overload signatures must all be public or private. +!!! error TS2385: Overload signatures must all be public, private or protected. private foo(bar?: any) { } // error - access modifiers do not agree } diff --git a/tests/baselines/reference/overridingPrivateStaticMembers.errors.txt b/tests/baselines/reference/overridingPrivateStaticMembers.errors.txt index 87fddf0ac8..6d51014f00 100644 --- a/tests/baselines/reference/overridingPrivateStaticMembers.errors.txt +++ b/tests/baselines/reference/overridingPrivateStaticMembers.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/overridingPrivateStaticMembers.ts(5,7): error TS2418: Class static side 'typeof Derived2' incorrectly extends base class static side 'typeof Base2': - Private property 'y' cannot be reimplemented. + Types have separate declarations of a private property 'y'. ==== tests/cases/compiler/overridingPrivateStaticMembers.ts (1 errors) ==== @@ -10,6 +10,6 @@ tests/cases/compiler/overridingPrivateStaticMembers.ts(5,7): error TS2418: Class class Derived2 extends Base2 { ~~~~~~~~ !!! error TS2418: Class static side 'typeof Derived2' incorrectly extends base class static side 'typeof Base2': -!!! error TS2418: Private property 'y' cannot be reimplemented. +!!! error TS2418: Types have separate declarations of a private property 'y'. private static y: { foo: string; bar: string; }; } \ No newline at end of file diff --git a/tests/baselines/reference/parserAstSpans1.errors.txt b/tests/baselines/reference/parserAstSpans1.errors.txt index 71bc206039..e4360dafa5 100644 --- a/tests/baselines/reference/parserAstSpans1.errors.txt +++ b/tests/baselines/reference/parserAstSpans1.errors.txt @@ -4,8 +4,8 @@ tests/cases/conformance/parser/ecmascript5/parserAstSpans1.ts(94,16): error TS10 tests/cases/conformance/parser/ecmascript5/parserAstSpans1.ts(100,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/parser/ecmascript5/parserAstSpans1.ts(119,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/parser/ecmascript5/parserAstSpans1.ts(125,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/parser/ecmascript5/parserAstSpans1.ts(111,25): error TS2340: Only public methods of the base class are accessible via the 'super' keyword -tests/cases/conformance/parser/ecmascript5/parserAstSpans1.ts(217,24): error TS2340: Only public methods of the base class are accessible via the 'super' keyword +tests/cases/conformance/parser/ecmascript5/parserAstSpans1.ts(111,25): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword +tests/cases/conformance/parser/ecmascript5/parserAstSpans1.ts(217,24): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword ==== tests/cases/conformance/parser/ecmascript5/parserAstSpans1.ts (8 errors) ==== @@ -129,7 +129,7 @@ tests/cases/conformance/parser/ecmascript5/parserAstSpans1.ts(217,24): error TS2 super(10); this.p1 = super.c2_p1; ~~~~~ -!!! error TS2340: Only public methods of the base class are accessible via the 'super' keyword +!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword } /** c3 p1*/ public p1: number; @@ -241,6 +241,6 @@ tests/cases/conformance/parser/ecmascript5/parserAstSpans1.ts(217,24): error TS2 super(); this.d = super.b; ~ -!!! error TS2340: Only public methods of the base class are accessible via the 'super' keyword +!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword } } \ No newline at end of file diff --git a/tests/baselines/reference/privateAccessInSubclass1.errors.txt b/tests/baselines/reference/privateAccessInSubclass1.errors.txt index 471c938b64..5ffb876a72 100644 --- a/tests/baselines/reference/privateAccessInSubclass1.errors.txt +++ b/tests/baselines/reference/privateAccessInSubclass1.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/privateAccessInSubclass1.ts(7,5): error TS2341: Property 'Base.options' is inaccessible. +tests/cases/compiler/privateAccessInSubclass1.ts(7,5): error TS2341: Property 'options' is private and only accessible within class 'Base'. ==== tests/cases/compiler/privateAccessInSubclass1.ts (1 errors) ==== @@ -10,6 +10,6 @@ tests/cases/compiler/privateAccessInSubclass1.ts(7,5): error TS2341: Property 'B myMethod() { this.options; ~~~~~~~~~~~~ -!!! error TS2341: Property 'Base.options' is inaccessible. +!!! error TS2341: Property 'options' is private and only accessible within class 'Base'. } } \ No newline at end of file diff --git a/tests/baselines/reference/privateInstanceMemberAccessibility.errors.txt b/tests/baselines/reference/privateInstanceMemberAccessibility.errors.txt index d9b08e8271..1c173ff0fb 100644 --- a/tests/baselines/reference/privateInstanceMemberAccessibility.errors.txt +++ b/tests/baselines/reference/privateInstanceMemberAccessibility.errors.txt @@ -1,9 +1,9 @@ tests/cases/conformance/classes/members/accessibility/privateInstanceMemberAccessibility.ts(10,15): error TS1003: Identifier expected. tests/cases/conformance/classes/members/accessibility/privateInstanceMemberAccessibility.ts(12,8): error TS1110: Type expected. -tests/cases/conformance/classes/members/accessibility/privateInstanceMemberAccessibility.ts(6,15): error TS2340: Only public methods of the base class are accessible via the 'super' keyword -tests/cases/conformance/classes/members/accessibility/privateInstanceMemberAccessibility.ts(8,22): error TS2340: Only public methods of the base class are accessible via the 'super' keyword -tests/cases/conformance/classes/members/accessibility/privateInstanceMemberAccessibility.ts(10,21): error TS2340: Only public methods of the base class are accessible via the 'super' keyword -tests/cases/conformance/classes/members/accessibility/privateInstanceMemberAccessibility.ts(12,8): error TS2341: Property 'Base.foo' is inaccessible. +tests/cases/conformance/classes/members/accessibility/privateInstanceMemberAccessibility.ts(6,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword +tests/cases/conformance/classes/members/accessibility/privateInstanceMemberAccessibility.ts(8,22): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword +tests/cases/conformance/classes/members/accessibility/privateInstanceMemberAccessibility.ts(10,21): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword +tests/cases/conformance/classes/members/accessibility/privateInstanceMemberAccessibility.ts(12,8): error TS2341: Property 'foo' is private and only accessible within class 'Base'. ==== tests/cases/conformance/classes/members/accessibility/privateInstanceMemberAccessibility.ts (6 errors) ==== @@ -14,21 +14,21 @@ tests/cases/conformance/classes/members/accessibility/privateInstanceMemberAcces class Derived extends Base { x = super.foo; // error ~~~ -!!! error TS2340: Only public methods of the base class are accessible via the 'super' keyword +!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword y() { return super.foo; // error ~~~ -!!! error TS2340: Only public methods of the base class are accessible via the 'super' keyword +!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword } z: typeof super.foo; // error ~~~~~ !!! error TS1003: Identifier expected. ~~~ -!!! error TS2340: Only public methods of the base class are accessible via the 'super' keyword +!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword a: this.foo; // error ~~~~ !!! error TS1110: Type expected. ~~~~~~~~ -!!! error TS2341: Property 'Base.foo' is inaccessible. +!!! error TS2341: Property 'foo' is private and only accessible within class 'Base'. } \ No newline at end of file diff --git a/tests/baselines/reference/privateInterfaceProperties.errors.txt b/tests/baselines/reference/privateInterfaceProperties.errors.txt index fcd3cc87f1..faff968379 100644 --- a/tests/baselines/reference/privateInterfaceProperties.errors.txt +++ b/tests/baselines/reference/privateInterfaceProperties.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/privateInterfaceProperties.ts(4,7): error TS2421: Class 'c1' incorrectly implements interface 'i1': - Private property 'name' cannot be reimplemented. + Property 'name' is private in type 'c1' but not in type 'i1'. ==== tests/cases/compiler/privateInterfaceProperties.ts (1 errors) ==== @@ -9,7 +9,7 @@ tests/cases/compiler/privateInterfaceProperties.ts(4,7): error TS2421: Class 'c1 class c1 implements i1 { private name:string; } ~~ !!! error TS2421: Class 'c1' incorrectly implements interface 'i1': -!!! error TS2421: Private property 'name' cannot be reimplemented. +!!! error TS2421: Property 'name' is private in type 'c1' but not in type 'i1'. // should be ok class c2 implements i1 { public name:string; } diff --git a/tests/baselines/reference/privateStaticMemberAccessibility.errors.txt b/tests/baselines/reference/privateStaticMemberAccessibility.errors.txt index a2c2d9971b..4ec16f0204 100644 --- a/tests/baselines/reference/privateStaticMemberAccessibility.errors.txt +++ b/tests/baselines/reference/privateStaticMemberAccessibility.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/classes/members/accessibility/privateStaticMemberAccessibility.ts(6,18): error TS2341: Property 'Base.foo' is inaccessible. -tests/cases/conformance/classes/members/accessibility/privateStaticMemberAccessibility.ts(7,18): error TS2341: Property 'Base.foo' is inaccessible. +tests/cases/conformance/classes/members/accessibility/privateStaticMemberAccessibility.ts(6,18): error TS2341: Property 'foo' is private and only accessible within class 'Base'. +tests/cases/conformance/classes/members/accessibility/privateStaticMemberAccessibility.ts(7,18): error TS2341: Property 'foo' is private and only accessible within class 'Base'. ==== tests/cases/conformance/classes/members/accessibility/privateStaticMemberAccessibility.ts (2 errors) ==== @@ -10,8 +10,8 @@ tests/cases/conformance/classes/members/accessibility/privateStaticMemberAccessi class Derived extends Base { static bar = Base.foo; // error ~~~~~~~~ -!!! error TS2341: Property 'Base.foo' is inaccessible. +!!! error TS2341: Property 'foo' is private and only accessible within class 'Base'. bing = () => Base.foo; // error ~~~~~~~~ -!!! error TS2341: Property 'Base.foo' is inaccessible. +!!! error TS2341: Property 'foo' is private and only accessible within class 'Base'. } \ No newline at end of file diff --git a/tests/baselines/reference/privateStaticNotAccessibleInClodule.errors.txt b/tests/baselines/reference/privateStaticNotAccessibleInClodule.errors.txt index 48da525b55..a5834b6cd0 100644 --- a/tests/baselines/reference/privateStaticNotAccessibleInClodule.errors.txt +++ b/tests/baselines/reference/privateStaticNotAccessibleInClodule.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/classes/members/accessibility/privateStaticNotAccessibleInClodule.ts(9,20): error TS2341: Property 'C.bar' is inaccessible. +tests/cases/conformance/classes/members/accessibility/privateStaticNotAccessibleInClodule.ts(9,20): error TS2341: Property 'bar' is private and only accessible within class 'C'. ==== tests/cases/conformance/classes/members/accessibility/privateStaticNotAccessibleInClodule.ts (1 errors) ==== @@ -12,5 +12,5 @@ tests/cases/conformance/classes/members/accessibility/privateStaticNotAccessible module C { export var y = C.bar; // error ~~~~~ -!!! error TS2341: Property 'C.bar' is inaccessible. +!!! error TS2341: Property 'bar' is private and only accessible within class 'C'. } \ No newline at end of file diff --git a/tests/baselines/reference/privateStaticNotAccessibleInClodule2.errors.txt b/tests/baselines/reference/privateStaticNotAccessibleInClodule2.errors.txt index 3c58189147..950649ee4b 100644 --- a/tests/baselines/reference/privateStaticNotAccessibleInClodule2.errors.txt +++ b/tests/baselines/reference/privateStaticNotAccessibleInClodule2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/classes/members/accessibility/privateStaticNotAccessibleInClodule2.ts(13,20): error TS2341: Property 'C.bar' is inaccessible. +tests/cases/conformance/classes/members/accessibility/privateStaticNotAccessibleInClodule2.ts(13,20): error TS2341: Property 'bar' is private and only accessible within class 'C'. ==== tests/cases/conformance/classes/members/accessibility/privateStaticNotAccessibleInClodule2.ts (1 errors) ==== @@ -16,5 +16,5 @@ tests/cases/conformance/classes/members/accessibility/privateStaticNotAccessible module D { export var y = D.bar; // error ~~~~~ -!!! error TS2341: Property 'C.bar' is inaccessible. +!!! error TS2341: Property 'bar' is private and only accessible within class 'C'. } \ No newline at end of file diff --git a/tests/baselines/reference/privateVisibility.errors.txt b/tests/baselines/reference/privateVisibility.errors.txt index 9c22833835..88784706f4 100644 --- a/tests/baselines/reference/privateVisibility.errors.txt +++ b/tests/baselines/reference/privateVisibility.errors.txt @@ -1,6 +1,6 @@ -tests/cases/compiler/privateVisibility.ts(9,1): error TS2341: Property 'Foo.privMeth' is inaccessible. -tests/cases/compiler/privateVisibility.ts(10,1): error TS2341: Property 'Foo.privProp' is inaccessible. -tests/cases/compiler/privateVisibility.ts(24,1): error TS2341: Property 'M.C.priv' is inaccessible. +tests/cases/compiler/privateVisibility.ts(9,1): error TS2341: Property 'privMeth' is private and only accessible within class 'Foo'. +tests/cases/compiler/privateVisibility.ts(10,1): error TS2341: Property 'privProp' is private and only accessible within class 'Foo'. +tests/cases/compiler/privateVisibility.ts(24,1): error TS2341: Property 'priv' is private and only accessible within class 'C'. ==== tests/cases/compiler/privateVisibility.ts (3 errors) ==== @@ -14,10 +14,10 @@ tests/cases/compiler/privateVisibility.ts(24,1): error TS2341: Property 'M.C.pri var f = new Foo(); f.privMeth(); // should not work ~~~~~~~~~~ -!!! error TS2341: Property 'Foo.privMeth' is inaccessible. +!!! error TS2341: Property 'privMeth' is private and only accessible within class 'Foo'. f.privProp; // should not work ~~~~~~~~~~ -!!! error TS2341: Property 'Foo.privProp' is inaccessible. +!!! error TS2341: Property 'privProp' is private and only accessible within class 'Foo'. f.pubMeth(); // should work f.pubProp; // should work @@ -33,6 +33,6 @@ tests/cases/compiler/privateVisibility.ts(24,1): error TS2341: Property 'M.C.pri c.pub; // should work c.priv; // should not work ~~~~~~ -!!! error TS2341: Property 'M.C.priv' is inaccessible. +!!! error TS2341: Property 'priv' is private and only accessible within class 'C'. \ No newline at end of file diff --git a/tests/baselines/reference/propertyAccessibility1.errors.txt b/tests/baselines/reference/propertyAccessibility1.errors.txt index a26dd0d937..2caf251b2a 100644 --- a/tests/baselines/reference/propertyAccessibility1.errors.txt +++ b/tests/baselines/reference/propertyAccessibility1.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/propertyAccessibility1.ts(5,1): error TS2341: Property 'Foo.privProp' is inaccessible. +tests/cases/compiler/propertyAccessibility1.ts(5,1): error TS2341: Property 'privProp' is private and only accessible within class 'Foo'. ==== tests/cases/compiler/propertyAccessibility1.ts (1 errors) ==== @@ -8,5 +8,5 @@ tests/cases/compiler/propertyAccessibility1.ts(5,1): error TS2341: Property 'Foo var f = new Foo(); f.privProp; ~~~~~~~~~~ -!!! error TS2341: Property 'Foo.privProp' is inaccessible. +!!! error TS2341: Property 'privProp' is private and only accessible within class 'Foo'. \ No newline at end of file diff --git a/tests/baselines/reference/propertyAccessibility2.errors.txt b/tests/baselines/reference/propertyAccessibility2.errors.txt index fba83b50a8..7eb81d45ed 100644 --- a/tests/baselines/reference/propertyAccessibility2.errors.txt +++ b/tests/baselines/reference/propertyAccessibility2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/propertyAccessibility2.ts(4,9): error TS2341: Property 'C.x' is inaccessible. +tests/cases/compiler/propertyAccessibility2.ts(4,9): error TS2341: Property 'x' is private and only accessible within class 'C'. ==== tests/cases/compiler/propertyAccessibility2.ts (1 errors) ==== @@ -7,5 +7,5 @@ tests/cases/compiler/propertyAccessibility2.ts(4,9): error TS2341: Property 'C.x } var c = C.x; ~~~ -!!! error TS2341: Property 'C.x' is inaccessible. +!!! error TS2341: Property 'x' is private and only accessible within class 'C'. \ No newline at end of file diff --git a/tests/baselines/reference/propertyParameterWithQuestionMark.errors.txt b/tests/baselines/reference/propertyParameterWithQuestionMark.errors.txt index 31472877d0..e68922ccf3 100644 --- a/tests/baselines/reference/propertyParameterWithQuestionMark.errors.txt +++ b/tests/baselines/reference/propertyParameterWithQuestionMark.errors.txt @@ -1,7 +1,7 @@ tests/cases/compiler/propertyParameterWithQuestionMark.ts(6,5): error TS2322: Type '{}' is not assignable to type 'C': Property 'x' is missing in type '{}'. tests/cases/compiler/propertyParameterWithQuestionMark.ts(8,1): error TS2322: Type '{ x?: any; }' is not assignable to type 'C': - Required property 'x' cannot be reimplemented with optional property in '{ x?: any; }'. + Property 'x' is optional in type '{ x?: any; }' but required in type 'C'. ==== tests/cases/compiler/propertyParameterWithQuestionMark.ts (2 errors) ==== @@ -18,5 +18,5 @@ tests/cases/compiler/propertyParameterWithQuestionMark.ts(8,1): error TS2322: Ty v = v2; // Should fail ~ !!! error TS2322: Type '{ x?: any; }' is not assignable to type 'C': -!!! error TS2322: Required property 'x' cannot be reimplemented with optional property in '{ x?: any; }'. +!!! error TS2322: Property 'x' is optional in type '{ x?: any; }' but required in type 'C'. var v3: { x } = new C; // Should succeed \ No newline at end of file diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinClass.js b/tests/baselines/reference/protectedClassPropertyAccessibleWithinClass.js new file mode 100644 index 0000000000..992011ee4a --- /dev/null +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinClass.js @@ -0,0 +1,117 @@ +//// [protectedClassPropertyAccessibleWithinClass.ts] +// no errors + +class C { + protected x: string; + protected get y() { return this.x; } + protected set y(x) { this.y = this.x; } + protected foo() { return this.foo; } + + protected static x: string; + protected static get y() { return this.x; } + protected static set y(x) { this.y = this.x; } + protected static foo() { return this.foo; } + protected static bar() { this.foo(); } +} + +// added level of function nesting +class C2 { + protected x: string; + protected get y() { () => this.x; return null; } + protected set y(x) { () => { this.y = this.x; } } + protected foo() { () => this.foo; } + + protected static x: string; + protected static get y() { () => this.x; return null; } + protected static set y(x) { + () => { this.y = this.x; } + } + protected static foo() { () => this.foo; } + protected static bar() { () => this.foo(); } +} + + +//// [protectedClassPropertyAccessibleWithinClass.js] +// no errors +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "y", { + get: function () { + return this.x; + }, + set: function (x) { + this.y = this.x; + }, + enumerable: true, + configurable: true + }); + C.prototype.foo = function () { + return this.foo; + }; + Object.defineProperty(C, "y", { + get: function () { + return this.x; + }, + set: function (x) { + this.y = this.x; + }, + enumerable: true, + configurable: true + }); + C.foo = function () { + return this.foo; + }; + C.bar = function () { + this.foo(); + }; + return C; +})(); +// added level of function nesting +var C2 = (function () { + function C2() { + } + Object.defineProperty(C2.prototype, "y", { + get: function () { + var _this = this; + (function () { return _this.x; }); + return null; + }, + set: function (x) { + var _this = this; + (function () { + _this.y = _this.x; + }); + }, + enumerable: true, + configurable: true + }); + C2.prototype.foo = function () { + var _this = this; + (function () { return _this.foo; }); + }; + Object.defineProperty(C2, "y", { + get: function () { + var _this = this; + (function () { return _this.x; }); + return null; + }, + set: function (x) { + var _this = this; + (function () { + _this.y = _this.x; + }); + }, + enumerable: true, + configurable: true + }); + C2.foo = function () { + var _this = this; + (function () { return _this.foo; }); + }; + C2.bar = function () { + var _this = this; + (function () { return _this.foo(); }); + }; + return C2; +})(); diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinClass.types b/tests/baselines/reference/protectedClassPropertyAccessibleWithinClass.types new file mode 100644 index 0000000000..241b3cfc7a --- /dev/null +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinClass.types @@ -0,0 +1,139 @@ +=== tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinClass.ts === +// no errors + +class C { +>C : C + + protected x: string; +>x : string + + protected get y() { return this.x; } +>y : string +>this.x : string +>this : C +>x : string + + protected set y(x) { this.y = this.x; } +>y : string +>x : string +>this.y = this.x : string +>this.y : string +>this : C +>y : string +>this.x : string +>this : C +>x : string + + protected foo() { return this.foo; } +>foo : () => any +>this.foo : () => any +>this : C +>foo : () => any + + protected static x: string; +>x : string + + protected static get y() { return this.x; } +>y : string +>this.x : string +>this : typeof C +>x : string + + protected static set y(x) { this.y = this.x; } +>y : string +>x : string +>this.y = this.x : string +>this.y : string +>this : typeof C +>y : string +>this.x : string +>this : typeof C +>x : string + + protected static foo() { return this.foo; } +>foo : () => typeof C.foo +>this.foo : () => typeof C.foo +>this : typeof C +>foo : () => typeof C.foo + + protected static bar() { this.foo(); } +>bar : () => void +>this.foo() : () => typeof C.foo +>this.foo : () => typeof C.foo +>this : typeof C +>foo : () => typeof C.foo +} + +// added level of function nesting +class C2 { +>C2 : C2 + + protected x: string; +>x : string + + protected get y() { () => this.x; return null; } +>y : any +>() => this.x : () => string +>this.x : string +>this : C2 +>x : string + + protected set y(x) { () => { this.y = this.x; } } +>y : any +>x : any +>() => { this.y = this.x; } : () => void +>this.y = this.x : string +>this.y : any +>this : C2 +>y : any +>this.x : string +>this : C2 +>x : string + + protected foo() { () => this.foo; } +>foo : () => void +>() => this.foo : () => () => void +>this.foo : () => void +>this : C2 +>foo : () => void + + protected static x: string; +>x : string + + protected static get y() { () => this.x; return null; } +>y : any +>() => this.x : () => string +>this.x : string +>this : typeof C2 +>x : string + + protected static set y(x) { +>y : any +>x : any + + () => { this.y = this.x; } +>() => { this.y = this.x; } : () => void +>this.y = this.x : string +>this.y : any +>this : typeof C2 +>y : any +>this.x : string +>this : typeof C2 +>x : string + } + protected static foo() { () => this.foo; } +>foo : () => void +>() => this.foo : () => () => void +>this.foo : () => void +>this : typeof C2 +>foo : () => void + + protected static bar() { () => this.foo(); } +>bar : () => void +>() => this.foo() : () => void +>this.foo() : void +>this.foo : () => void +>this : typeof C2 +>foo : () => void +} + diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass.js b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass.js new file mode 100644 index 0000000000..381d10f43e --- /dev/null +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass.js @@ -0,0 +1,73 @@ +//// [protectedClassPropertyAccessibleWithinSubclass.ts] +// no errors + +class B { + protected x: string; + protected static x: string; +} + +class C extends B { + protected get y() { return this.x; } + protected set y(x) { this.y = this.x; } + protected foo() { return this.x; } + protected bar() { return this.foo(); } + + protected static get y() { return this.x; } + protected static set y(x) { this.y = this.x; } + protected static foo() { return this.x; } + protected static bar() { this.foo(); } +} + + +//// [protectedClassPropertyAccessibleWithinSubclass.js] +// no errors +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 B = (function () { + function B() { + } + return B; +})(); +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.apply(this, arguments); + } + Object.defineProperty(C.prototype, "y", { + get: function () { + return this.x; + }, + set: function (x) { + this.y = this.x; + }, + enumerable: true, + configurable: true + }); + C.prototype.foo = function () { + return this.x; + }; + C.prototype.bar = function () { + return this.foo(); + }; + Object.defineProperty(C, "y", { + get: function () { + return this.x; + }, + set: function (x) { + this.y = this.x; + }, + enumerable: true, + configurable: true + }); + C.foo = function () { + return this.x; + }; + C.bar = function () { + this.foo(); + }; + return C; +})(B); diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass.types b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass.types new file mode 100644 index 0000000000..bd230239d4 --- /dev/null +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass.types @@ -0,0 +1,78 @@ +=== tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass.ts === +// no errors + +class B { +>B : B + + protected x: string; +>x : string + + protected static x: string; +>x : string +} + +class C extends B { +>C : C +>B : B + + protected get y() { return this.x; } +>y : string +>this.x : string +>this : C +>x : string + + protected set y(x) { this.y = this.x; } +>y : string +>x : string +>this.y = this.x : string +>this.y : string +>this : C +>y : string +>this.x : string +>this : C +>x : string + + protected foo() { return this.x; } +>foo : () => string +>this.x : string +>this : C +>x : string + + protected bar() { return this.foo(); } +>bar : () => string +>this.foo() : string +>this.foo : () => string +>this : C +>foo : () => string + + protected static get y() { return this.x; } +>y : string +>this.x : string +>this : typeof C +>x : string + + protected static set y(x) { this.y = this.x; } +>y : string +>x : string +>this.y = this.x : string +>this.y : string +>this : typeof C +>y : string +>this.x : string +>this : typeof C +>x : string + + protected static foo() { return this.x; } +>foo : () => string +>this.x : string +>this : typeof C +>x : string + + protected static bar() { this.foo(); } +>bar : () => void +>this.foo() : string +>this.foo : () => string +>this : typeof C +>foo : () => string +} + diff --git a/tests/baselines/reference/protectedInstanceMemberAccessibility.errors.txt b/tests/baselines/reference/protectedInstanceMemberAccessibility.errors.txt new file mode 100644 index 0000000000..03671925fe --- /dev/null +++ b/tests/baselines/reference/protectedInstanceMemberAccessibility.errors.txt @@ -0,0 +1,86 @@ +tests/cases/conformance/classes/members/accessibility/protectedInstanceMemberAccessibility.ts(14,23): error TS2339: Property 'z' does not exist on type 'B'. +tests/cases/conformance/classes/members/accessibility/protectedInstanceMemberAccessibility.ts(16,24): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword +tests/cases/conformance/classes/members/accessibility/protectedInstanceMemberAccessibility.ts(18,24): error TS2339: Property 'y' does not exist on type 'A'. +tests/cases/conformance/classes/members/accessibility/protectedInstanceMemberAccessibility.ts(19,24): error TS2339: Property 'z' does not exist on type 'A'. +tests/cases/conformance/classes/members/accessibility/protectedInstanceMemberAccessibility.ts(22,18): error TS2446: Property 'x' is protected and only accessible through an instance of class 'B'. +tests/cases/conformance/classes/members/accessibility/protectedInstanceMemberAccessibility.ts(23,18): error TS2446: Property 'f' is protected and only accessible through an instance of class 'B'. +tests/cases/conformance/classes/members/accessibility/protectedInstanceMemberAccessibility.ts(24,20): error TS2339: Property 'y' does not exist on type 'A'. +tests/cases/conformance/classes/members/accessibility/protectedInstanceMemberAccessibility.ts(25,20): error TS2339: Property 'z' does not exist on type 'A'. +tests/cases/conformance/classes/members/accessibility/protectedInstanceMemberAccessibility.ts(31,20): error TS2339: Property 'z' does not exist on type 'B'. +tests/cases/conformance/classes/members/accessibility/protectedInstanceMemberAccessibility.ts(34,18): error TS2446: Property 'x' is protected and only accessible through an instance of class 'B'. +tests/cases/conformance/classes/members/accessibility/protectedInstanceMemberAccessibility.ts(35,18): error TS2446: Property 'f' is protected and only accessible through an instance of class 'B'. +tests/cases/conformance/classes/members/accessibility/protectedInstanceMemberAccessibility.ts(36,20): error TS2339: Property 'y' does not exist on type 'C'. +tests/cases/conformance/classes/members/accessibility/protectedInstanceMemberAccessibility.ts(37,18): error TS2445: Property 'z' is protected and only accessible within class 'C' and its subclasses. + + +==== tests/cases/conformance/classes/members/accessibility/protectedInstanceMemberAccessibility.ts (13 errors) ==== + class A { + protected x: string; + protected f(): string { + return "hello"; + } + } + + class B extends A { + protected y: string; + g() { + var t1 = this.x; + var t2 = this.f(); + var t3 = this.y; + var t4 = this.z; // error + ~ +!!! error TS2339: Property 'z' does not exist on type 'B'. + + var s1 = super.x; // error + ~ +!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword + var s2 = super.f(); + var s3 = super.y; // error + ~ +!!! error TS2339: Property 'y' does not exist on type 'A'. + var s4 = super.z; // error + ~ +!!! error TS2339: Property 'z' does not exist on type 'A'. + + var a: A; + var a1 = a.x; // error + ~~~ +!!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'B'. + var a2 = a.f(); // error + ~~~ +!!! error TS2446: Property 'f' is protected and only accessible through an instance of class 'B'. + var a3 = a.y; // error + ~ +!!! error TS2339: Property 'y' does not exist on type 'A'. + var a4 = a.z; // error + ~ +!!! error TS2339: Property 'z' does not exist on type 'A'. + + var b: B; + var b1 = b.x; + var b2 = b.f(); + var b3 = b.y; + var b4 = b.z; // error + ~ +!!! error TS2339: Property 'z' does not exist on type 'B'. + + var c: C; + var c1 = c.x; // error + ~~~ +!!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'B'. + var c2 = c.f(); // error + ~~~ +!!! error TS2446: Property 'f' is protected and only accessible through an instance of class 'B'. + var c3 = c.y; // error + ~ +!!! error TS2339: Property 'y' does not exist on type 'C'. + var c4 = c.z; // error + ~~~ +!!! error TS2445: Property 'z' is protected and only accessible within class 'C' and its subclasses. + } + } + + class C extends A { + protected z: string; + } + \ No newline at end of file diff --git a/tests/baselines/reference/protectedInstanceMemberAccessibility.js b/tests/baselines/reference/protectedInstanceMemberAccessibility.js new file mode 100644 index 0000000000..de7a6e0d00 --- /dev/null +++ b/tests/baselines/reference/protectedInstanceMemberAccessibility.js @@ -0,0 +1,100 @@ +//// [protectedInstanceMemberAccessibility.ts] +class A { + protected x: string; + protected f(): string { + return "hello"; + } +} + +class B extends A { + protected y: string; + g() { + var t1 = this.x; + var t2 = this.f(); + var t3 = this.y; + var t4 = this.z; // error + + var s1 = super.x; // error + var s2 = super.f(); + var s3 = super.y; // error + var s4 = super.z; // error + + var a: A; + var a1 = a.x; // error + var a2 = a.f(); // error + var a3 = a.y; // error + var a4 = a.z; // error + + var b: B; + var b1 = b.x; + var b2 = b.f(); + var b3 = b.y; + var b4 = b.z; // error + + var c: C; + var c1 = c.x; // error + var c2 = c.f(); // error + var c3 = c.y; // error + var c4 = c.z; // error + } +} + +class C extends A { + protected z: string; +} + + +//// [protectedInstanceMemberAccessibility.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 A = (function () { + function A() { + } + A.prototype.f = function () { + return "hello"; + }; + return A; +})(); +var B = (function (_super) { + __extends(B, _super); + function B() { + _super.apply(this, arguments); + } + B.prototype.g = function () { + var t1 = this.x; + var t2 = this.f(); + var t3 = this.y; + var t4 = this.z; // error + var s1 = _super.prototype.x; // error + var s2 = _super.prototype.f.call(this); + var s3 = _super.prototype.y; // error + var s4 = _super.prototype.z; // error + var a; + var a1 = a.x; // error + var a2 = a.f(); // error + var a3 = a.y; // error + var a4 = a.z; // error + var b; + var b1 = b.x; + var b2 = b.f(); + var b3 = b.y; + var b4 = b.z; // error + var c; + var c1 = c.x; // error + var c2 = c.f(); // error + var c3 = c.y; // error + var c4 = c.z; // error + }; + return B; +})(A); +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.apply(this, arguments); + } + return C; +})(A); diff --git a/tests/baselines/reference/protectedMembers.errors.txt b/tests/baselines/reference/protectedMembers.errors.txt new file mode 100644 index 0000000000..ce9529a7f6 --- /dev/null +++ b/tests/baselines/reference/protectedMembers.errors.txt @@ -0,0 +1,167 @@ +tests/cases/compiler/protectedMembers.ts(86,5): error TS1089: 'protected' modifier cannot appear on a constructor declaration. +tests/cases/compiler/protectedMembers.ts(40,1): error TS2445: Property 'x' is protected and only accessible within class 'C1' and its subclasses. +tests/cases/compiler/protectedMembers.ts(41,1): error TS2445: Property 'f' is protected and only accessible within class 'C1' and its subclasses. +tests/cases/compiler/protectedMembers.ts(42,1): error TS2445: Property 'sx' is protected and only accessible within class 'C1' and its subclasses. +tests/cases/compiler/protectedMembers.ts(43,1): error TS2445: Property 'sf' is protected and only accessible within class 'C1' and its subclasses. +tests/cases/compiler/protectedMembers.ts(46,1): error TS2445: Property 'x' is protected and only accessible within class 'C1' and its subclasses. +tests/cases/compiler/protectedMembers.ts(47,1): error TS2445: Property 'f' is protected and only accessible within class 'C2' and its subclasses. +tests/cases/compiler/protectedMembers.ts(48,1): error TS2445: Property 'sx' is protected and only accessible within class 'C1' and its subclasses. +tests/cases/compiler/protectedMembers.ts(49,1): error TS2445: Property 'sf' is protected and only accessible within class 'C2' and its subclasses. +tests/cases/compiler/protectedMembers.ts(68,9): error TS2446: Property 'x' is protected and only accessible through an instance of class 'C'. +tests/cases/compiler/protectedMembers.ts(69,9): error TS2446: Property 'x' is protected and only accessible through an instance of class 'C'. +tests/cases/compiler/protectedMembers.ts(98,1): error TS2322: Type 'B1' is not assignable to type 'A1': + Property 'x' is protected but type 'B1' is not a class derived from 'A1'. +tests/cases/compiler/protectedMembers.ts(99,1): error TS2322: Type 'A1' is not assignable to type 'B1': + Property 'x' is protected in type 'A1' but public in type 'B1'. +tests/cases/compiler/protectedMembers.ts(112,7): error TS2416: Class 'B3' incorrectly extends base class 'A3': + Property 'x' is protected in type 'B3' but public in type 'A3'. + + +==== tests/cases/compiler/protectedMembers.ts (14 errors) ==== + // Class with protected members + class C1 { + protected x: number; + protected static sx: number; + protected f() { + return this.x; + } + protected static sf() { + return this.sx; + } + } + + // Derived class accessing protected members + class C2 extends C1 { + protected f() { + return super.f() + this.x; + } + protected static sf() { + return super.sf() + this.sx; + } + } + + // Derived class making protected members public + class C3 extends C2 { + x: number; + static sx: number; + f() { + return super.f(); + } + static sf() { + return super.sf(); + } + } + + var c1: C1; + var c2: C2; + var c3: C3; + + // All of these should be errors + c1.x; + ~~~~ +!!! error TS2445: Property 'x' is protected and only accessible within class 'C1' and its subclasses. + c1.f(); + ~~~~ +!!! error TS2445: Property 'f' is protected and only accessible within class 'C1' and its subclasses. + C1.sx; + ~~~~~ +!!! error TS2445: Property 'sx' is protected and only accessible within class 'C1' and its subclasses. + C1.sf(); + ~~~~~ +!!! error TS2445: Property 'sf' is protected and only accessible within class 'C1' and its subclasses. + + // All of these should be errors + c2.x; + ~~~~ +!!! error TS2445: Property 'x' is protected and only accessible within class 'C1' and its subclasses. + c2.f(); + ~~~~ +!!! error TS2445: Property 'f' is protected and only accessible within class 'C2' and its subclasses. + C2.sx; + ~~~~~ +!!! error TS2445: Property 'sx' is protected and only accessible within class 'C1' and its subclasses. + C2.sf(); + ~~~~~ +!!! error TS2445: Property 'sf' is protected and only accessible within class 'C2' and its subclasses. + + // All of these should be ok + c3.x; + c3.f(); + C3.sx; + C3.sf(); + + class A { + protected x; + } + + class B extends A { + y; + } + + class C extends A { + z; + static foo(a: A, b: B, c: C, d: D, e: E) { + a.x = 1; // Error, access must be through C or type derived from C + ~~~ +!!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'C'. + b.x = 1; // Error, access must be through C or type derived from C + ~~~ +!!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'C'. + c.x = 1; + d.x = 1; + e.x = 1; + } + } + + class D extends C { + d; + } + + interface E extends C { + e; + } + + class CC { + // Error, constructor cannot be protected + protected constructor() { + ~~~~~~~~~ +!!! error TS1089: 'protected' modifier cannot appear on a constructor declaration. + } + } + + class A1 { + protected x; + } + class B1 { + x; + } + var a1: A1; + var b1: B1; + a1 = b1; // Error, B1 doesn't derive from A1 + ~~ +!!! error TS2322: Type 'B1' is not assignable to type 'A1': +!!! error TS2322: Property 'x' is protected but type 'B1' is not a class derived from 'A1'. + b1 = a1; // Error, x is protected in A1 but public in B1 + ~~ +!!! error TS2322: Type 'A1' is not assignable to type 'B1': +!!! error TS2322: Property 'x' is protected in type 'A1' but public in type 'B1'. + + class A2 { + protected x; + } + class B2 extends A2 { + x; + } + + class A3 { + x; + } + // Error x is protected in B3 but public in A3 + class B3 extends A3 { + ~~ +!!! error TS2416: Class 'B3' incorrectly extends base class 'A3': +!!! error TS2416: Property 'x' is protected in type 'B3' but public in type 'A3'. + protected x; + } + + \ No newline at end of file diff --git a/tests/baselines/reference/publicMemberImplementedAsPrivateInDerivedClass.errors.txt b/tests/baselines/reference/publicMemberImplementedAsPrivateInDerivedClass.errors.txt index 7e73338b4e..b540482321 100644 --- a/tests/baselines/reference/publicMemberImplementedAsPrivateInDerivedClass.errors.txt +++ b/tests/baselines/reference/publicMemberImplementedAsPrivateInDerivedClass.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/publicMemberImplementedAsPrivateInDerivedClass.ts(4,7): error TS2421: Class 'Foo' incorrectly implements interface 'Qux': - Private property 'Bar' cannot be reimplemented. + Property 'Bar' is private in type 'Foo' but not in type 'Qux'. ==== tests/cases/compiler/publicMemberImplementedAsPrivateInDerivedClass.ts (1 errors) ==== @@ -9,7 +9,7 @@ tests/cases/compiler/publicMemberImplementedAsPrivateInDerivedClass.ts(4,7): err class Foo implements Qux { ~~~ !!! error TS2421: Class 'Foo' incorrectly implements interface 'Qux': -!!! error TS2421: Private property 'Bar' cannot be reimplemented. +!!! error TS2421: Property 'Bar' is private in type 'Foo' but not in type 'Qux'. private Bar: number; } \ No newline at end of file diff --git a/tests/baselines/reference/scopeTests.errors.txt b/tests/baselines/reference/scopeTests.errors.txt index f8c2ec5768..59749eaf39 100644 --- a/tests/baselines/reference/scopeTests.errors.txt +++ b/tests/baselines/reference/scopeTests.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/scopeTests.ts(2,7): error TS2416: Class 'D' incorrectly extends base class 'C': - Private property 'v' cannot be reimplemented. + Property 'v' is private in type 'C' but not in type 'D'. ==== tests/cases/compiler/scopeTests.ts (1 errors) ==== @@ -7,7 +7,7 @@ tests/cases/compiler/scopeTests.ts(2,7): error TS2416: Class 'D' incorrectly ext class D extends C { ~ !!! error TS2416: Class 'D' incorrectly extends base class 'C': -!!! error TS2416: Private property 'v' cannot be reimplemented. +!!! error TS2416: Property 'v' is private in type 'C' but not in type 'D'. public v: number; public p: number constructor() { diff --git a/tests/baselines/reference/shadowPrivateMembers.errors.txt b/tests/baselines/reference/shadowPrivateMembers.errors.txt index 54ba537071..94dd577c1c 100644 --- a/tests/baselines/reference/shadowPrivateMembers.errors.txt +++ b/tests/baselines/reference/shadowPrivateMembers.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/shadowPrivateMembers.ts(2,7): error TS2416: Class 'derived' incorrectly extends base class 'base': - Private property 'n' cannot be reimplemented. + Types have separate declarations of a private property 'n'. ==== tests/cases/compiler/shadowPrivateMembers.ts (1 errors) ==== @@ -7,5 +7,5 @@ tests/cases/compiler/shadowPrivateMembers.ts(2,7): error TS2416: Class 'derived' class derived extends base { private n() {} } ~~~~~~~ !!! error TS2416: Class 'derived' incorrectly extends base class 'base': -!!! error TS2416: Private property 'n' cannot be reimplemented. +!!! error TS2416: Types have separate declarations of a private property 'n'. \ No newline at end of file diff --git a/tests/baselines/reference/subtypingWithObjectMembersAccessibility.errors.txt b/tests/baselines/reference/subtypingWithObjectMembersAccessibility.errors.txt index cf81925bdd..09dfa1696d 100644 --- a/tests/baselines/reference/subtypingWithObjectMembersAccessibility.errors.txt +++ b/tests/baselines/reference/subtypingWithObjectMembersAccessibility.errors.txt @@ -1,9 +1,9 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembersAccessibility.ts(15,7): error TS2416: Class 'B' incorrectly extends base class 'A': - Private property 'foo' cannot be reimplemented. + Property 'foo' is private in type 'B' but not in type 'A'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembersAccessibility.ts(23,7): error TS2416: Class 'B2' incorrectly extends base class 'A2': - Private property '1' cannot be reimplemented. + Property '1' is private in type 'B2' but not in type 'A2'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembersAccessibility.ts(31,7): error TS2416: Class 'B3' incorrectly extends base class 'A3': - Private property ''1'' cannot be reimplemented. + Property ''1'' is private in type 'B3' but not in type 'A3'. ==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembersAccessibility.ts (3 errors) ==== @@ -24,7 +24,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW class B extends A { ~ !!! error TS2416: Class 'B' incorrectly extends base class 'A': -!!! error TS2416: Private property 'foo' cannot be reimplemented. +!!! error TS2416: Property 'foo' is private in type 'B' but not in type 'A'. private foo: Derived; // error } @@ -35,7 +35,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW class B2 extends A2 { ~~ !!! error TS2416: Class 'B2' incorrectly extends base class 'A2': -!!! error TS2416: Private property '1' cannot be reimplemented. +!!! error TS2416: Property '1' is private in type 'B2' but not in type 'A2'. private 1: Derived; // error } @@ -46,6 +46,6 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW class B3 extends A3 { ~~ !!! error TS2416: Class 'B3' incorrectly extends base class 'A3': -!!! error TS2416: Private property ''1'' cannot be reimplemented. +!!! error TS2416: Property ''1'' is private in type 'B3' but not in type 'A3'. private '1': Derived; // error } \ No newline at end of file diff --git a/tests/baselines/reference/subtypingWithObjectMembersAccessibility2.errors.txt b/tests/baselines/reference/subtypingWithObjectMembersAccessibility2.errors.txt index dcb6674875..9af7e894b2 100644 --- a/tests/baselines/reference/subtypingWithObjectMembersAccessibility2.errors.txt +++ b/tests/baselines/reference/subtypingWithObjectMembersAccessibility2.errors.txt @@ -1,15 +1,15 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembersAccessibility2.ts(16,11): error TS2416: Class 'B' incorrectly extends base class 'A': - Private property 'foo' cannot be reimplemented. + Property 'foo' is private in type 'A' but not in type 'B'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembersAccessibility2.ts(24,11): error TS2416: Class 'B2' incorrectly extends base class 'A2': - Private property '1' cannot be reimplemented. + Property '1' is private in type 'A2' but not in type 'B2'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembersAccessibility2.ts(32,11): error TS2416: Class 'B3' incorrectly extends base class 'A3': - Private property ''1'' cannot be reimplemented. + Property ''1'' is private in type 'A3' but not in type 'B3'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembersAccessibility2.ts(42,11): error TS2416: Class 'B' incorrectly extends base class 'A': - Private property 'foo' cannot be reimplemented. + Property 'foo' is private in type 'A' but not in type 'B'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembersAccessibility2.ts(50,11): error TS2416: Class 'B2' incorrectly extends base class 'A2': - Private property '1' cannot be reimplemented. + Property '1' is private in type 'A2' but not in type 'B2'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembersAccessibility2.ts(58,11): error TS2416: Class 'B3' incorrectly extends base class 'A3': - Private property ''1'' cannot be reimplemented. + Property ''1'' is private in type 'A3' but not in type 'B3'. ==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembersAccessibility2.ts (6 errors) ==== @@ -31,7 +31,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW class B extends A { ~ !!! error TS2416: Class 'B' incorrectly extends base class 'A': -!!! error TS2416: Private property 'foo' cannot be reimplemented. +!!! error TS2416: Property 'foo' is private in type 'A' but not in type 'B'. public foo: Derived; // error } @@ -42,7 +42,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW class B2 extends A2 { ~~ !!! error TS2416: Class 'B2' incorrectly extends base class 'A2': -!!! error TS2416: Private property '1' cannot be reimplemented. +!!! error TS2416: Property '1' is private in type 'A2' but not in type 'B2'. public 1: Derived; // error } @@ -53,7 +53,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW class B3 extends A3 { ~~ !!! error TS2416: Class 'B3' incorrectly extends base class 'A3': -!!! error TS2416: Private property ''1'' cannot be reimplemented. +!!! error TS2416: Property ''1'' is private in type 'A3' but not in type 'B3'. public '1': Derived; // error } } @@ -66,7 +66,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW class B extends A { ~ !!! error TS2416: Class 'B' incorrectly extends base class 'A': -!!! error TS2416: Private property 'foo' cannot be reimplemented. +!!! error TS2416: Property 'foo' is private in type 'A' but not in type 'B'. foo: Derived; // error } @@ -77,7 +77,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW class B2 extends A2 { ~~ !!! error TS2416: Class 'B2' incorrectly extends base class 'A2': -!!! error TS2416: Private property '1' cannot be reimplemented. +!!! error TS2416: Property '1' is private in type 'A2' but not in type 'B2'. 1: Derived; // error } @@ -88,7 +88,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW class B3 extends A3 { ~~ !!! error TS2416: Class 'B3' incorrectly extends base class 'A3': -!!! error TS2416: Private property ''1'' cannot be reimplemented. +!!! error TS2416: Property ''1'' is private in type 'A3' but not in type 'B3'. '1': Derived; // error } } \ No newline at end of file diff --git a/tests/baselines/reference/subtypingWithObjectMembersOptionality2.errors.txt b/tests/baselines/reference/subtypingWithObjectMembersOptionality2.errors.txt index 8b1883588f..74d47f1256 100644 --- a/tests/baselines/reference/subtypingWithObjectMembersOptionality2.errors.txt +++ b/tests/baselines/reference/subtypingWithObjectMembersOptionality2.errors.txt @@ -1,9 +1,9 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembersOptionality2.ts(10,11): error TS2429: Interface 'S' incorrectly extends interface 'T': - Required property 'Foo' cannot be reimplemented with optional property in 'S'. + Property 'Foo' is optional in type 'S' but required in type 'T'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembersOptionality2.ts(18,11): error TS2429: Interface 'S2' incorrectly extends interface 'T2': - Required property '1' cannot be reimplemented with optional property in 'S2'. + Property '1' is optional in type 'S2' but required in type 'T2'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembersOptionality2.ts(26,11): error TS2429: Interface 'S3' incorrectly extends interface 'T3': - Required property '1' cannot be reimplemented with optional property in 'S3'. + Property ''1'' is optional in type 'S3' but required in type 'T3'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembersOptionality2.ts(33,9): error TS2367: No best common type exists between '{ Foo: Base; }' and '{ Foo?: Derived; }'. @@ -20,7 +20,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW interface S extends T { ~ !!! error TS2429: Interface 'S' incorrectly extends interface 'T': -!!! error TS2429: Required property 'Foo' cannot be reimplemented with optional property in 'S'. +!!! error TS2429: Property 'Foo' is optional in type 'S' but required in type 'T'. Foo?: Derived // error } @@ -31,7 +31,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW interface S2 extends T2 { ~~ !!! error TS2429: Interface 'S2' incorrectly extends interface 'T2': -!!! error TS2429: Required property '1' cannot be reimplemented with optional property in 'S2'. +!!! error TS2429: Property '1' is optional in type 'S2' but required in type 'T2'. 1?: Derived; // error } @@ -42,7 +42,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW interface S3 extends T3 { ~~ !!! error TS2429: Interface 'S3' incorrectly extends interface 'T3': -!!! error TS2429: Required property '1' cannot be reimplemented with optional property in 'S3'. +!!! error TS2429: Property ''1'' is optional in type 'S3' but required in type 'T3'. '1'?: Derived; // error } diff --git a/tests/baselines/reference/superAccess.errors.txt b/tests/baselines/reference/superAccess.errors.txt index b44466516d..64c921e0e7 100644 --- a/tests/baselines/reference/superAccess.errors.txt +++ b/tests/baselines/reference/superAccess.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/superAccess.ts(9,24): error TS2339: Property 'S1' does not exist on type 'MyBase'. -tests/cases/compiler/superAccess.ts(10,24): error TS2340: Only public methods of the base class are accessible via the 'super' keyword -tests/cases/compiler/superAccess.ts(11,24): error TS2340: Only public methods of the base class are accessible via the 'super' keyword +tests/cases/compiler/superAccess.ts(10,24): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword +tests/cases/compiler/superAccess.ts(11,24): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword ==== tests/cases/compiler/superAccess.ts (3 errors) ==== @@ -17,9 +17,9 @@ tests/cases/compiler/superAccess.ts(11,24): error TS2340: Only public methods of !!! error TS2339: Property 'S1' does not exist on type 'MyBase'. var l4 = super.S2; // Expected => Error: Only public instance methods of the base class are accessible via the 'super' keyword ~~ -!!! error TS2340: Only public methods of the base class are accessible via the 'super' keyword +!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword var l5 = super.f(); // Expected => Error: Only public instance methods of the base class are accessible via the 'super' keyword ~ -!!! error TS2340: Only public methods of the base class are accessible via the 'super' keyword +!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword } } \ No newline at end of file diff --git a/tests/baselines/reference/superInLambdas.errors.txt b/tests/baselines/reference/superInLambdas.errors.txt index d59036efc3..ee25873d47 100644 --- a/tests/baselines/reference/superInLambdas.errors.txt +++ b/tests/baselines/reference/superInLambdas.errors.txt @@ -1,7 +1,7 @@ tests/cases/compiler/superInLambdas.ts(61,34): error TS1034: 'super' must be followed by an argument list or member access. tests/cases/compiler/superInLambdas.ts(65,34): error TS1034: 'super' must be followed by an argument list or member access. -tests/cases/compiler/superInLambdas.ts(47,49): error TS2340: Only public methods of the base class are accessible via the 'super' keyword -tests/cases/compiler/superInLambdas.ts(51,49): error TS2340: Only public methods of the base class are accessible via the 'super' keyword +tests/cases/compiler/superInLambdas.ts(47,49): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword +tests/cases/compiler/superInLambdas.ts(51,49): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword ==== tests/cases/compiler/superInLambdas.ts (4 errors) ==== @@ -53,13 +53,13 @@ tests/cases/compiler/superInLambdas.ts(51,49): error TS2340: Only public methods // super property in a nested lambda in a constructor var superName = () => () => () => super.name; ~~~~ -!!! error TS2340: Only public methods of the base class are accessible via the 'super' keyword +!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword } sayHello(): void { // super property in a nested lambda in a method var superName = () => () => () => super.name; ~~~~ -!!! error TS2340: Only public methods of the base class are accessible via the 'super' keyword +!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword } } diff --git a/tests/baselines/reference/superPropertyAccess.errors.txt b/tests/baselines/reference/superPropertyAccess.errors.txt index e791f2ae9b..4880bf66f1 100644 --- a/tests/baselines/reference/superPropertyAccess.errors.txt +++ b/tests/baselines/reference/superPropertyAccess.errors.txt @@ -1,11 +1,11 @@ tests/cases/compiler/superPropertyAccess.ts(8,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/superPropertyAccess.ts(9,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/superPropertyAccess.ts(22,15): error TS2340: Only public methods of the base class are accessible via the 'super' keyword -tests/cases/compiler/superPropertyAccess.ts(24,9): error TS2341: Property 'MyBase.p1' is inaccessible. -tests/cases/compiler/superPropertyAccess.ts(26,24): error TS2340: Only public methods of the base class are accessible via the 'super' keyword -tests/cases/compiler/superPropertyAccess.ts(28,24): error TS2340: Only public methods of the base class are accessible via the 'super' keyword -tests/cases/compiler/superPropertyAccess.ts(32,15): error TS2340: Only public methods of the base class are accessible via the 'super' keyword -tests/cases/compiler/superPropertyAccess.ts(34,23): error TS2340: Only public methods of the base class are accessible via the 'super' keyword +tests/cases/compiler/superPropertyAccess.ts(22,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword +tests/cases/compiler/superPropertyAccess.ts(24,9): error TS2341: Property 'p1' is private and only accessible within class 'MyBase'. +tests/cases/compiler/superPropertyAccess.ts(26,24): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword +tests/cases/compiler/superPropertyAccess.ts(28,24): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword +tests/cases/compiler/superPropertyAccess.ts(32,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword +tests/cases/compiler/superPropertyAccess.ts(34,23): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword ==== tests/cases/compiler/superPropertyAccess.ts (8 errors) ==== @@ -36,28 +36,28 @@ tests/cases/compiler/superPropertyAccess.ts(34,23): error TS2340: Only public me super.m2.bind(this); // Should error, instance property, not a public instance member function ~~ -!!! error TS2340: Only public methods of the base class are accessible via the 'super' keyword +!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword super.p1(); // Should error, private not public instance member function ~~~~~~~~ -!!! error TS2341: Property 'MyBase.p1' is inaccessible. +!!! error TS2341: Property 'p1' is private and only accessible within class 'MyBase'. var l1 = super.d1; // Should error, instance data property not a public instance member function ~~ -!!! error TS2340: Only public methods of the base class are accessible via the 'super' keyword +!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword var l1 = super.d2; // Should error, instance data property not a public instance member function ~~ -!!! error TS2340: Only public methods of the base class are accessible via the 'super' keyword +!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword super.m1 = function (a: string) { return ""; }; // Should be allowed, we will not restrict assignment super.value = 0; // Should error, instance data property not a public instance member function ~~~~~ -!!! error TS2340: Only public methods of the base class are accessible via the 'super' keyword +!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword var z = super.value; // Should error, instance data property not a public instance member function ~~~~~ -!!! error TS2340: Only public methods of the base class are accessible via the 'super' keyword +!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword } } \ No newline at end of file diff --git a/tests/baselines/reference/superPropertyAccess1.errors.txt b/tests/baselines/reference/superPropertyAccess1.errors.txt index b3c65b6cda..f5b565cae6 100644 --- a/tests/baselines/reference/superPropertyAccess1.errors.txt +++ b/tests/baselines/reference/superPropertyAccess1.errors.txt @@ -1,8 +1,8 @@ tests/cases/compiler/superPropertyAccess1.ts(3,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/superPropertyAccess1.ts(22,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/superPropertyAccess1.ts(13,15): error TS2340: Only public methods of the base class are accessible via the 'super' keyword -tests/cases/compiler/superPropertyAccess1.ts(19,15): error TS2340: Only public methods of the base class are accessible via the 'super' keyword -tests/cases/compiler/superPropertyAccess1.ts(24,15): error TS2340: Only public methods of the base class are accessible via the 'super' keyword +tests/cases/compiler/superPropertyAccess1.ts(13,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword +tests/cases/compiler/superPropertyAccess1.ts(19,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword +tests/cases/compiler/superPropertyAccess1.ts(24,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword ==== tests/cases/compiler/superPropertyAccess1.ts (5 errors) ==== @@ -22,7 +22,7 @@ tests/cases/compiler/superPropertyAccess1.ts(24,15): error TS2340: Only public m super.bar(); super.x; // error ~ -!!! error TS2340: Only public methods of the base class are accessible via the 'super' keyword +!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword } constructor() { @@ -30,7 +30,7 @@ tests/cases/compiler/superPropertyAccess1.ts(24,15): error TS2340: Only public m super.bar(); super.x; // error ~ -!!! error TS2340: Only public methods of the base class are accessible via the 'super' keyword +!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword } public get y() { @@ -39,7 +39,7 @@ tests/cases/compiler/superPropertyAccess1.ts(24,15): error TS2340: Only public m super.bar(); super.x; // error ~ -!!! error TS2340: Only public methods of the base class are accessible via the 'super' keyword +!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword return 1; } } \ No newline at end of file diff --git a/tests/baselines/reference/superPropertyAccess2.errors.txt b/tests/baselines/reference/superPropertyAccess2.errors.txt index 6175f79f58..df9a5ee666 100644 --- a/tests/baselines/reference/superPropertyAccess2.errors.txt +++ b/tests/baselines/reference/superPropertyAccess2.errors.txt @@ -2,7 +2,7 @@ tests/cases/compiler/superPropertyAccess2.ts(3,16): error TS1056: Accessors are tests/cases/compiler/superPropertyAccess2.ts(22,23): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/superPropertyAccess2.ts(13,15): error TS2339: Property 'x' does not exist on type 'typeof C'. tests/cases/compiler/superPropertyAccess2.ts(18,15): error TS2339: Property 'bar' does not exist on type 'C'. -tests/cases/compiler/superPropertyAccess2.ts(19,15): error TS2340: Only public methods of the base class are accessible via the 'super' keyword +tests/cases/compiler/superPropertyAccess2.ts(19,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword tests/cases/compiler/superPropertyAccess2.ts(24,15): error TS2339: Property 'x' does not exist on type 'typeof C'. @@ -33,7 +33,7 @@ tests/cases/compiler/superPropertyAccess2.ts(24,15): error TS2339: Property 'x' !!! error TS2339: Property 'bar' does not exist on type 'C'. super.x; // error ~ -!!! error TS2340: Only public methods of the base class are accessible via the 'super' keyword +!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword } public static get y() { diff --git a/tests/baselines/reference/typeIdentityConsidersBrands.errors.txt b/tests/baselines/reference/typeIdentityConsidersBrands.errors.txt index 66337deb50..7d25976cb2 100644 --- a/tests/baselines/reference/typeIdentityConsidersBrands.errors.txt +++ b/tests/baselines/reference/typeIdentityConsidersBrands.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/typeIdentityConsidersBrands.ts(30,1): error TS2322: Type 'X_1' is not assignable to type 'Y_1': - Private property 'name' cannot be reimplemented. + Types have separate declarations of a private property 'name'. tests/cases/compiler/typeIdentityConsidersBrands.ts(31,6): error TS2345: Argument of type 'Y_1' is not assignable to parameter of type 'X_1'. @@ -36,7 +36,7 @@ tests/cases/compiler/typeIdentityConsidersBrands.ts(31,6): error TS2345: Argumen a2 = b2; // should error ~~ !!! error TS2322: Type 'X_1' is not assignable to type 'Y_1': -!!! error TS2322: Private property 'name' cannot be reimplemented. +!!! error TS2322: Types have separate declarations of a private property 'name'. foo2(a2); // should error ~~ !!! error TS2345: Argument of type 'Y_1' is not assignable to parameter of type 'X_1'. diff --git a/tests/baselines/reference/typeMatch1.errors.txt b/tests/baselines/reference/typeMatch1.errors.txt index 082679cd24..5921ba0a8d 100644 --- a/tests/baselines/reference/typeMatch1.errors.txt +++ b/tests/baselines/reference/typeMatch1.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/typeMatch1.ts(18,1): error TS2322: Type 'D' is not assignable to type 'C': - Private property 'x' cannot be reimplemented. + Types have separate declarations of a private property 'x'. tests/cases/compiler/typeMatch1.ts(19,1): error TS2322: Type 'typeof C' is not assignable to type 'C': Property 'x' is missing in type 'typeof C'. tests/cases/compiler/typeMatch1.ts(20,1): error TS2365: Operator '==' cannot be applied to types 'typeof C' and 'typeof D'. @@ -26,7 +26,7 @@ tests/cases/compiler/typeMatch1.ts(20,1): error TS2365: Operator '==' cannot be x6 = x7; ~~ !!! error TS2322: Type 'D' is not assignable to type 'C': -!!! error TS2322: Private property 'x' cannot be reimplemented. +!!! error TS2322: Types have separate declarations of a private property 'x'. x6=C; ~~ !!! error TS2322: Type 'typeof C' is not assignable to type 'C': diff --git a/tests/cases/compiler/protectedMembers.ts b/tests/cases/compiler/protectedMembers.ts new file mode 100644 index 0000000000..ae32e47242 --- /dev/null +++ b/tests/cases/compiler/protectedMembers.ts @@ -0,0 +1,115 @@ +// Class with protected members +class C1 { + protected x: number; + protected static sx: number; + protected f() { + return this.x; + } + protected static sf() { + return this.sx; + } +} + +// Derived class accessing protected members +class C2 extends C1 { + protected f() { + return super.f() + this.x; + } + protected static sf() { + return super.sf() + this.sx; + } +} + +// Derived class making protected members public +class C3 extends C2 { + x: number; + static sx: number; + f() { + return super.f(); + } + static sf() { + return super.sf(); + } +} + +var c1: C1; +var c2: C2; +var c3: C3; + +// All of these should be errors +c1.x; +c1.f(); +C1.sx; +C1.sf(); + +// All of these should be errors +c2.x; +c2.f(); +C2.sx; +C2.sf(); + +// All of these should be ok +c3.x; +c3.f(); +C3.sx; +C3.sf(); + +class A { + protected x; +} + +class B extends A { + y; +} + +class C extends A { + z; + static foo(a: A, b: B, c: C, d: D, e: E) { + a.x = 1; // Error, access must be through C or type derived from C + b.x = 1; // Error, access must be through C or type derived from C + c.x = 1; + d.x = 1; + e.x = 1; + } +} + +class D extends C { + d; +} + +interface E extends C { + e; +} + +class CC { + // Error, constructor cannot be protected + protected constructor() { + } +} + +class A1 { + protected x; +} +class B1 { + x; +} +var a1: A1; +var b1: B1; +a1 = b1; // Error, B1 doesn't derive from A1 +b1 = a1; // Error, x is protected in A1 but public in B1 + +class A2 { + protected x; +} +class B2 extends A2 { + x; +} + +class A3 { + x; +} +// Error x is protected in B3 but public in A3 +class B3 extends A3 { + protected x; +} + diff --git a/tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts b/tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts index 353ab01223..c2e4855e63 100644 --- a/tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts +++ b/tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts @@ -6,8 +6,13 @@ class D { private constructor(public x: number) { } // error } +class E { + protected constructor(public x: number) { } // error +} + var c = new C(1); var d = new D(1); +var e = new E(1); module Generic { class C { @@ -18,6 +23,11 @@ module Generic { private constructor(public x: T) { } // error } + class E { + protected constructor(public x: T) { } // error + } + var c = new C(1); var d = new D(1); + var e = new E(1); } diff --git a/tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties.ts b/tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties.ts index e3ea627f0c..f4d63da119 100644 --- a/tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties.ts +++ b/tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties.ts @@ -1,18 +1,20 @@ class C { y: string; - constructor(private x: string) { } + constructor(private x: string, protected z: string) { } } var c: C; var r = c.y; var r2 = c.x; // error +var r3 = c.z; // error class D { y: T; - constructor(a: T, private x: T) { } + constructor(a: T, private x: T, protected z: T) { } } var d: D; var r = d.y; var r2 = d.x; // error -var r3 = d.a; // error \ No newline at end of file +var r3 = d.a; // error +var r4 = d.z; // error diff --git a/tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties2.ts b/tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties2.ts index 4d14e4bafb..b95891c084 100644 --- a/tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties2.ts +++ b/tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties2.ts @@ -20,4 +20,12 @@ class E { } var e: E; -var r3 = e.y; // error \ No newline at end of file +var r3 = e.y; // error + +class F { + y: number; + constructor(protected y: number) { } // error +} + +var f: F; +var r4 = f.y; // error diff --git a/tests/cases/conformance/classes/members/accessibility/classPropertyAsProtected.ts b/tests/cases/conformance/classes/members/accessibility/classPropertyAsProtected.ts new file mode 100644 index 0000000000..7efe159c05 --- /dev/null +++ b/tests/cases/conformance/classes/members/accessibility/classPropertyAsProtected.ts @@ -0,0 +1,23 @@ +class C { + protected x: string; + protected get y() { return null; } + protected set y(x) { } + protected foo() { } + + protected static a: string; + protected static get b() { return null; } + protected static set b(x) { } + protected static foo() { } +} + +var c: C; +// all errors +c.x; +c.y; +c.y = 1; +c.foo(); + +C.a; +C.b(); +C.b = 1; +C.foo(); \ No newline at end of file diff --git a/tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinClass.ts b/tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinClass.ts new file mode 100644 index 0000000000..08f99af597 --- /dev/null +++ b/tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinClass.ts @@ -0,0 +1,31 @@ +// @target: ES5 +// no errors + +class C { + protected x: string; + protected get y() { return this.x; } + protected set y(x) { this.y = this.x; } + protected foo() { return this.foo; } + + protected static x: string; + protected static get y() { return this.x; } + protected static set y(x) { this.y = this.x; } + protected static foo() { return this.foo; } + protected static bar() { this.foo(); } +} + +// added level of function nesting +class C2 { + protected x: string; + protected get y() { () => this.x; return null; } + protected set y(x) { () => { this.y = this.x; } } + protected foo() { () => this.foo; } + + protected static x: string; + protected static get y() { () => this.x; return null; } + protected static set y(x) { + () => { this.y = this.x; } + } + protected static foo() { () => this.foo; } + protected static bar() { () => this.foo(); } +} diff --git a/tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass.ts b/tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass.ts new file mode 100644 index 0000000000..56c591f41c --- /dev/null +++ b/tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass.ts @@ -0,0 +1,19 @@ +// @target: ES5 +// no errors + +class B { + protected x: string; + protected static x: string; +} + +class C extends B { + protected get y() { return this.x; } + protected set y(x) { this.y = this.x; } + protected foo() { return this.x; } + protected bar() { return this.foo(); } + + protected static get y() { return this.x; } + protected static set y(x) { this.y = this.x; } + protected static foo() { return this.x; } + protected static bar() { this.foo(); } +} diff --git a/tests/cases/conformance/classes/members/accessibility/protectedInstanceMemberAccessibility.ts b/tests/cases/conformance/classes/members/accessibility/protectedInstanceMemberAccessibility.ts new file mode 100644 index 0000000000..b92d29d4d6 --- /dev/null +++ b/tests/cases/conformance/classes/members/accessibility/protectedInstanceMemberAccessibility.ts @@ -0,0 +1,43 @@ +class A { + protected x: string; + protected f(): string { + return "hello"; + } +} + +class B extends A { + protected y: string; + g() { + var t1 = this.x; + var t2 = this.f(); + var t3 = this.y; + var t4 = this.z; // error + + var s1 = super.x; // error + var s2 = super.f(); + var s3 = super.y; // error + var s4 = super.z; // error + + var a: A; + var a1 = a.x; // error + var a2 = a.f(); // error + var a3 = a.y; // error + var a4 = a.z; // error + + var b: B; + var b1 = b.x; + var b2 = b.f(); + var b3 = b.y; + var b4 = b.z; // error + + var c: C; + var c1 = c.x; // error + var c2 = c.f(); // error + var c3 = c.y; // error + var c4 = c.z; // error + } +} + +class C extends A { + protected z: string; +} diff --git a/tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithProtecteds.ts b/tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithProtecteds.ts new file mode 100644 index 0000000000..746ab5bc39 --- /dev/null +++ b/tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithProtecteds.ts @@ -0,0 +1,40 @@ +class Foo { + protected x: string; +} + +interface I extends Foo { + y: number; +} + +class Bar implements I { // error +} + +class Bar2 implements I { // error + y: number; +} + +class Bar3 implements I { // error + x: string; + y: number; +} + +class Bar4 implements I { // error + protected x: string; + y: number; +} + +class Bar5 extends Foo implements I { // error +} + +class Bar6 extends Foo implements I { // error + protected y: number; +} + +class Bar7 extends Foo implements I { + y: number; +} + +class Bar8 extends Foo implements I { + x: string; + y: number; +} diff --git a/tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithProtecteds.ts b/tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithProtecteds.ts new file mode 100644 index 0000000000..6a504a916d --- /dev/null +++ b/tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithProtecteds.ts @@ -0,0 +1,15 @@ +class Foo { + protected x: string; +} + +interface I extends Foo { // error + x: string; +} + +interface I2 extends Foo { + y: string; +} + +var i: I2; +var r = i.y; +var r2 = i.x; // error \ No newline at end of file diff --git a/tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithProtecteds2.ts b/tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithProtecteds2.ts new file mode 100644 index 0000000000..4663709bce --- /dev/null +++ b/tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithProtecteds2.ts @@ -0,0 +1,27 @@ +class Foo { + protected x: string; +} + +class Bar { + protected x: string; +} + +interface I3 extends Foo, Bar { // error +} + +interface I4 extends Foo, Bar { // error + x: string; +} + +class Baz { + protected y: string; +} + +interface I5 extends Foo, Baz { + z: string; +} + +var i: I5; +var r: string = i.z; +var r2 = i.x; // error +var r3 = i.y; // error \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Protected/Protected1.ts b/tests/cases/conformance/parser/ecmascript5/Protected/Protected1.ts new file mode 100644 index 0000000000..9a23ee5d20 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Protected/Protected1.ts @@ -0,0 +1,2 @@ +protected class C { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Protected/Protected2.ts b/tests/cases/conformance/parser/ecmascript5/Protected/Protected2.ts new file mode 100644 index 0000000000..d2598a1c48 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Protected/Protected2.ts @@ -0,0 +1,2 @@ +protected module M { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Protected/Protected3.ts b/tests/cases/conformance/parser/ecmascript5/Protected/Protected3.ts new file mode 100644 index 0000000000..2b07e1ca9a --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Protected/Protected3.ts @@ -0,0 +1,3 @@ +class C { + protected constructor() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Protected/Protected4.ts b/tests/cases/conformance/parser/ecmascript5/Protected/Protected4.ts new file mode 100644 index 0000000000..e464330f1d --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Protected/Protected4.ts @@ -0,0 +1,3 @@ +class C { + protected public m() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Protected/Protected5.ts b/tests/cases/conformance/parser/ecmascript5/Protected/Protected5.ts new file mode 100644 index 0000000000..f0bf235a03 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Protected/Protected5.ts @@ -0,0 +1,3 @@ +class C { + protected static m() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Protected/Protected6.ts b/tests/cases/conformance/parser/ecmascript5/Protected/Protected6.ts new file mode 100644 index 0000000000..4461885ab5 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Protected/Protected6.ts @@ -0,0 +1,3 @@ +class C { + static protected m() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Protected/Protected7.ts b/tests/cases/conformance/parser/ecmascript5/Protected/Protected7.ts new file mode 100644 index 0000000000..c3aef0d764 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Protected/Protected7.ts @@ -0,0 +1,3 @@ +class C { + protected private m() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Protected/Protected8.ts b/tests/cases/conformance/parser/ecmascript5/Protected/Protected8.ts new file mode 100644 index 0000000000..5337751fb1 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Protected/Protected8.ts @@ -0,0 +1,4 @@ +interface I { + protected + p +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Protected/Protected9.ts b/tests/cases/conformance/parser/ecmascript5/Protected/Protected9.ts new file mode 100644 index 0000000000..4e24e28ec1 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Protected/Protected9.ts @@ -0,0 +1,3 @@ +class C { + constructor(protected p) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/TupleTypes/TupleType1.ts b/tests/cases/conformance/parser/ecmascript5/TupleTypes/TupleType1.ts new file mode 100644 index 0000000000..e05b68973c --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/TupleTypes/TupleType1.ts @@ -0,0 +1 @@ +var v: [number] \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/TupleTypes/TupleType2.ts b/tests/cases/conformance/parser/ecmascript5/TupleTypes/TupleType2.ts new file mode 100644 index 0000000000..adb1267bac --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/TupleTypes/TupleType2.ts @@ -0,0 +1 @@ +var v: [number, string] \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/TupleTypes/TupleType3.ts b/tests/cases/conformance/parser/ecmascript5/TupleTypes/TupleType3.ts new file mode 100644 index 0000000000..fcf7fa2512 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/TupleTypes/TupleType3.ts @@ -0,0 +1 @@ +var v: [] \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/TupleTypes/TupleType4.ts b/tests/cases/conformance/parser/ecmascript5/TupleTypes/TupleType4.ts new file mode 100644 index 0000000000..036960004d --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/TupleTypes/TupleType4.ts @@ -0,0 +1 @@ +var v: [ \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/TupleTypes/TupleType5.ts b/tests/cases/conformance/parser/ecmascript5/TupleTypes/TupleType5.ts new file mode 100644 index 0000000000..48d638cac9 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/TupleTypes/TupleType5.ts @@ -0,0 +1 @@ +var v: [number,] \ No newline at end of file