Merge branch 'master' into fidelityParser

This commit is contained in:
Cyrus Najmabadi 2014-09-19 17:53:07 -07:00
commit e426c83017
112 changed files with 2163 additions and 517 deletions

View file

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

View file

@ -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 ? <InterfaceType>getDeclaredTypeOfSymbol(sourceProp.parent) : undefined;
var targetClass = <InterfaceType>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 ? <InterfaceType>getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClassDeclaration)) : undefined;
var declaringClass = <InterfaceType>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(<InterfaceType>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 && (<ConstructorDeclaration>parameterDeclaration.parent).body)) {
if (parameterDeclaration.flags & (NodeFlags.Public | NodeFlags.Private | NodeFlags.Protected) &&
!(parameterDeclaration.parent.kind === SyntaxKind.Constructor && (<ConstructorDeclaration>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((<ClassDeclaration>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 = (<Block>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;
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -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<T>'.
==== tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.ts (1 errors) ====
@ -14,7 +14,7 @@ tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMer
export function fn<T>(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<T>'.
}
}

View file

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

View file

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

View file

@ -1,5 +1,5 @@
tests/cases/compiler/assignmentCompatability10.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type 'classWithPublicAndOptional<number, string>':
Required property 'two' cannot be reimplemented with optional property in 'interfaceWithPublicAndOptional<number, string>'.
Property 'two' is optional in type 'interfaceWithPublicAndOptional<number, string>' but required in type 'classWithPublicAndOptional<number, string>'.
==== 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<number, string>' is not assignable to type 'classWithPublicAndOptional<number, string>':
!!! error TS2322: Required property 'two' cannot be reimplemented with optional property in 'interfaceWithPublicAndOptional<number, string>'.
!!! error TS2322: Property 'two' is optional in type 'interfaceWithPublicAndOptional<number, string>' but required in type 'classWithPublicAndOptional<number, string>'.

View file

@ -1,5 +1,5 @@
tests/cases/compiler/assignmentCompatability13.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '{ two: string; }':
Required property 'two' cannot be reimplemented with optional property in 'interfaceWithPublicAndOptional<number, string>'.
Property 'two' is optional in type 'interfaceWithPublicAndOptional<number, string>' 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<number, string>' is not assignable to type '{ two: string; }':
!!! error TS2322: Required property 'two' cannot be reimplemented with optional property in 'interfaceWithPublicAndOptional<number, string>'.
!!! error TS2322: Property 'two' is optional in type 'interfaceWithPublicAndOptional<number, string>' but required in type '{ two: string; }'.

View file

@ -1,5 +1,5 @@
tests/cases/compiler/assignmentCompatability27.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '{ two: string; }':
Required property 'two' cannot be reimplemented with optional property in 'interfaceWithPublicAndOptional<number, string>'.
Property 'two' is optional in type 'interfaceWithPublicAndOptional<number, string>' 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<number, string>' is not assignable to type '{ two: string; }':
!!! error TS2322: Required property 'two' cannot be reimplemented with optional property in 'interfaceWithPublicAndOptional<number, string>'.
!!! error TS2322: Property 'two' is optional in type 'interfaceWithPublicAndOptional<number, string>' but required in type '{ two: string; }'.

View file

@ -1,5 +1,5 @@
tests/cases/compiler/assignmentCompatability39.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type 'classWithTwoPublic<number, string>':
Required property 'two' cannot be reimplemented with optional property in 'interfaceWithPublicAndOptional<number, string>'.
Property 'two' is optional in type 'interfaceWithPublicAndOptional<number, string>' but required in type 'classWithTwoPublic<number, string>'.
==== 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<number, string>' is not assignable to type 'classWithTwoPublic<number, string>':
!!! error TS2322: Required property 'two' cannot be reimplemented with optional property in 'interfaceWithPublicAndOptional<number, string>'.
!!! error TS2322: Property 'two' is optional in type 'interfaceWithPublicAndOptional<number, string>' but required in type 'classWithTwoPublic<number, string>'.

View file

@ -1,5 +1,5 @@
tests/cases/compiler/assignmentCompatability40.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type 'classWithPrivate<number>':
Private property 'one' cannot be reimplemented.
Property 'one' is private in type 'classWithPrivate<number>' but not in type 'interfaceWithPublicAndOptional<number, string>'.
==== 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<number, string>' is not assignable to type 'classWithPrivate<number>':
!!! error TS2322: Private property 'one' cannot be reimplemented.
!!! error TS2322: Property 'one' is private in type 'classWithPrivate<number>' but not in type 'interfaceWithPublicAndOptional<number, string>'.

View file

@ -1,5 +1,5 @@
tests/cases/compiler/assignmentCompatability41.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type 'classWithTwoPrivate<number, string>':
Private property 'one' cannot be reimplemented.
Property 'one' is private in type 'classWithTwoPrivate<number, string>' but not in type 'interfaceWithPublicAndOptional<number, string>'.
==== 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<number, string>' is not assignable to type 'classWithTwoPrivate<number, string>':
!!! error TS2322: Private property 'one' cannot be reimplemented.
!!! error TS2322: Property 'one' is private in type 'classWithTwoPrivate<number, string>' but not in type 'interfaceWithPublicAndOptional<number, string>'.

View file

@ -1,5 +1,5 @@
tests/cases/compiler/assignmentCompatability42.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type 'classWithPublicPrivate<number, string>':
Private property 'two' cannot be reimplemented.
Property 'two' is private in type 'classWithPublicPrivate<number, string>' but not in type 'interfaceWithPublicAndOptional<number, string>'.
==== 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<number, string>' is not assignable to type 'classWithPublicPrivate<number, string>':
!!! error TS2322: Private property 'two' cannot be reimplemented.
!!! error TS2322: Property 'two' is private in type 'classWithPublicPrivate<number, string>' but not in type 'interfaceWithPublicAndOptional<number, string>'.

View file

@ -1,5 +1,5 @@
tests/cases/compiler/assignmentCompatability43.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type 'interfaceTwo<number, string>':
Required property 'two' cannot be reimplemented with optional property in 'interfaceWithPublicAndOptional<number, string>'.
Property 'two' is optional in type 'interfaceWithPublicAndOptional<number, string>' but required in type 'interfaceTwo<number, string>'.
==== 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<number, string>' is not assignable to type 'interfaceTwo<number, string>':
!!! error TS2322: Required property 'two' cannot be reimplemented with optional property in 'interfaceWithPublicAndOptional<number, string>'.
!!! error TS2322: Property 'two' is optional in type 'interfaceWithPublicAndOptional<number, string>' but required in type 'interfaceTwo<number, string>'.

View file

@ -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<T> {
@ -27,7 +36,14 @@ tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessib
!!! error TS1089: 'private' modifier cannot appear on a constructor declaration.
}
class E<T> {
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);
}

View file

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

View file

@ -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.
!!! error TS2322: Types have separate declarations of a private property 'x'.

View file

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

View file

@ -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.
!!! error TS2341: Property 'foo' is private and only accessible within class 'C'.

View file

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

View file

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

View file

@ -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.
!!! error TS2341: Property 'g' is private and only accessible within class 'C'.

View file

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

View file

@ -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<string>'.
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<T>'.
tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties.ts(19,12): error TS2339: Property 'a' does not exist on type 'D<string>'.
tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties.ts(20,10): error TS2445: Property 'z' is protected and only accessible within class 'D<T>' 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<T> {
y: T;
constructor(a: T, private x: T) { }
constructor(a: T, private x: T, protected z: T) { }
}
var d: D<string>;
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<T>'.
var r3 = d.a; // error
~
!!! error TS2339: Property 'a' does not exist on type 'D<string>'.
!!! error TS2339: Property 'a' does not exist on type 'D<string>'.
var r4 = d.z; // error
~~~
!!! error TS2445: Property 'z' is protected and only accessible within class 'D<T>' and its subclasses.

View file

@ -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<T> {
y: T;
constructor(a: T, private x: T) { }
constructor(a: T, private x: T, protected z: T) { }
}
var d: D<string>;
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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -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.
!!! error TS2341: Property 'a' is private and only accessible within class 'Derived'.

View file

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

View file

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

View file

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

View file

@ -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'.
!!! error TS2322: Property 'one' is optional in type 'I3' but required in type '{ one: number; }'.

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -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.
!!! error TS2341: Property 'x' is private and only accessible within class 'Foo'.

View file

@ -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.
!!! error TS2341: Property 'y' is private and only accessible within class 'Baz'.

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -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<T>' incorrectly extends interface 'Base2<T>':
Private property 'x' cannot be reimplemented.
Property 'x' is private in type 'Base2<T>' but not in type 'Foo2<T>'.
==== 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<T> extends Base2<T> { // error
~~~~
!!! error TS2429: Interface 'Foo2<T>' incorrectly extends interface 'Base2<T>':
!!! error TS2429: Private property 'x' cannot be reimplemented.
!!! error TS2429: Property 'x' is private in type 'Base2<T>' but not in type 'Foo2<T>'.
x: number;
}

View file

@ -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<T>' incorrectly extends interface 'Base2<T>':
Private property 'x' cannot be reimplemented.
Property 'x' is private in type 'Base2<T>' but not in type 'Foo2<T>'.
==== 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<T> extends Base2<T> { // error
~~~~
!!! error TS2429: Interface 'Foo2<T>' incorrectly extends interface 'Base2<T>':
!!! error TS2429: Private property 'x' cannot be reimplemented.
!!! error TS2429: Property 'x' is private in type 'Base2<T>' but not in type 'Foo2<T>'.
x(): any;
}

View file

@ -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<T>'.
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<T>'.
==== 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<number>;
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<T>'.
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.
!!! error TS2341: Property 'bar' is private and only accessible within class 'D<T>'.

View file

@ -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<T>'.
==== 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<number>;
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<T>'.

View file

@ -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.
!!! error TS2341: Property 'x' is private and only accessible within class 'C'.

View file

@ -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.
!!! error TS2341: Property 'w' is private and only accessible within class 'C2'.

View file

@ -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'.
!!! error TS2322: Property 'M' is optional in type 'i2' but required in type 'i1'.

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -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() {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -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() {

View file

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

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