diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index fe34a7c0875f6..b942d11fe9289 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -8855,7 +8855,7 @@ namespace ts { return links.type; } - function getTypeOfVariableOrParameterOrPropertyWorker(symbol: Symbol) { + function getTypeOfVariableOrParameterOrPropertyWorker(symbol: Symbol): Type { // Handle prototype property if (symbol.flags & SymbolFlags.Prototype) { return getTypeOfPrototypeProperty(symbol); @@ -8905,7 +8905,7 @@ namespace ts { } return reportCircularityError(symbol); } - let type: Type | undefined; + let type: Type; if (declaration.kind === SyntaxKind.ExportAssignment) { type = widenTypeForVariableLikeDeclaration(checkExpressionCached((declaration).expression), declaration); } @@ -8962,7 +8962,7 @@ namespace ts { type = getTypeOfEnumMember(symbol); } else if (isAccessor(declaration)) { - type = resolveTypeOfAccessors(symbol); + type = resolveTypeOfAccessors(symbol) || Debug.fail("Non-write accessor resolution must always produce a type"); } else { return Debug.fail("Unhandled declaration kind! " + Debug.formatSyntaxKind(declaration.kind) + " for " + Debug.formatSymbol(symbol)); @@ -9008,15 +9008,20 @@ namespace ts { function getTypeOfAccessors(symbol: Symbol): Type { const links = getSymbolLinks(symbol); - return links.type || (links.type = getTypeOfAccessorsWorker(symbol)); + return links.type || (links.type = getTypeOfAccessorsWorker(symbol) || Debug.fail("Read type of accessor must always produce a type")); + } + + function getTypeOfSetAccessor(symbol: Symbol): Type | undefined { + const links = getSymbolLinks(symbol); + return links.writeType || (links.writeType = getTypeOfAccessorsWorker(symbol, /*isWrite*/ true)); } - function getTypeOfAccessorsWorker(symbol: Symbol): Type { + function getTypeOfAccessorsWorker(symbol: Symbol, writing = false): Type | undefined { if (!pushTypeResolution(symbol, TypeSystemPropertyName.Type)) { return errorType; } - let type = resolveTypeOfAccessors(symbol); + let type = resolveTypeOfAccessors(symbol, writing); if (!popTypeResolution()) { type = anyType; @@ -9028,49 +9033,63 @@ namespace ts { return type; } - function resolveTypeOfAccessors(symbol: Symbol) { + function resolveTypeOfAccessors(symbol: Symbol, isWrite = false) { const getter = getDeclarationOfKind(symbol, SyntaxKind.GetAccessor); const setter = getDeclarationOfKind(symbol, SyntaxKind.SetAccessor); + // For write operations, prioritize type annotations on the setter + if (isWrite) { + const setterParameterType = getAnnotatedAccessorType(setter); + if (setterParameterType) { + const flags = getCheckFlags(symbol); + if (flags & CheckFlags.Instantiated) { + const links = getSymbolLinks(symbol); + return instantiateType(setterParameterType, links.mapper); + } + return setterParameterType; + } + } + // Else defer to the getter type + if (getter && isInJSFile(getter)) { const jsDocType = getTypeForDeclarationFromJSDocComment(getter); if (jsDocType) { return jsDocType; } } - // First try to see if the user specified a return type on the get-accessor. + + // Try to see if the user specified a return type on the get-accessor. const getterReturnType = getAnnotatedAccessorType(getter); if (getterReturnType) { return getterReturnType; } - else { - // If the user didn't specify a return type, try to use the set-accessor's parameter type. - const setterParameterType = getAnnotatedAccessorType(setter); - if (setterParameterType) { - return setterParameterType; + + // If the user didn't specify a return type, try to use the set-accessor's parameter type. + const setterParameterType = getAnnotatedAccessorType(setter); + if (setterParameterType) { + return setterParameterType; + } + + // If there are no specified types, try to infer it from the body of the get accessor if it exists. + if (getter && getter.body) { + return getReturnTypeFromBody(getter); + } + + // Otherwise, fall back to 'any'. + if (setter) { + if (!isPrivateWithinAmbient(setter)) { + errorOrSuggestion(noImplicitAny, setter, Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation, symbolToString(symbol)); } - else { - // If there are no specified types, try to infer it from the body of the get accessor if it exists. - if (getter && getter.body) { - return getReturnTypeFromBody(getter); - } - // Otherwise, fall back to 'any'. - else { - if (setter) { - if (!isPrivateWithinAmbient(setter)) { - errorOrSuggestion(noImplicitAny, setter, Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation, symbolToString(symbol)); - } - } - else { - Debug.assert(!!getter, "there must exist a getter as we are current checking either setter or getter in this function"); - if (!isPrivateWithinAmbient(getter)) { - errorOrSuggestion(noImplicitAny, getter, Diagnostics.Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation, symbolToString(symbol)); - } - } - return anyType; - } + return anyType; + } + else if (getter) { + Debug.assert(!!getter, "there must exist a getter as we are current checking either setter or getter in this function"); + if (!isPrivateWithinAmbient(getter)) { + errorOrSuggestion(noImplicitAny, getter, Diagnostics.Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation, symbolToString(symbol)); } + return anyType; } + return undefined; } function getBaseTypeVariableOfClass(symbol: Symbol) { @@ -9197,6 +9216,16 @@ namespace ts { return links.type; } + function getSetAccessorTypeOfSymbol(symbol: Symbol): Type { + if (symbol.flags & SymbolFlags.Accessor) { + const type = getTypeOfSetAccessor(symbol); + if (type) { + return type; + } + } + return getTypeOfSymbol(symbol); + } + function getTypeOfSymbol(symbol: Symbol): Type { const checkFlags = getCheckFlags(symbol); if (checkFlags & CheckFlags.DeferredType) { @@ -26589,8 +26618,9 @@ namespace ts { */ function checkPropertyAccessibility( node: PropertyAccessExpression | QualifiedName | PropertyAccessExpression | VariableDeclaration | ParameterDeclaration | ImportTypeNode | PropertyAssignment | ShorthandPropertyAssignment | BindingElement, - isSuper: boolean, type: Type, prop: Symbol, reportError = true): boolean { - const flags = getDeclarationModifierFlagsFromSymbol(prop); + isSuper: boolean, isWrite: boolean, type: Type, prop: Symbol, reportError = true): boolean { + + const flags = getDeclarationModifierFlagsFromSymbol(prop, isWrite); const errorNode = node.kind === SyntaxKind.QualifiedName ? node.right : node.kind === SyntaxKind.ImportType ? node : node.kind === SyntaxKind.BindingElement && node.propertyName ? node.propertyName : node.name; @@ -26965,13 +26995,16 @@ namespace ts { checkPropertyNotUsedBeforeDeclaration(prop, node, right); markPropertyAsReferenced(prop, node, isSelfTypeAccess(left, parentSymbol)); getNodeLinks(node).resolvedSymbol = prop; - checkPropertyAccessibility(node, left.kind === SyntaxKind.SuperKeyword, apparentType, prop); + const isWrite = isWriteAccess(node); + checkPropertyAccessibility(node, left.kind === SyntaxKind.SuperKeyword, isWrite, apparentType, prop); if (isAssignmentToReadonlyEntity(node as Expression, prop, assignmentKind)) { error(right, Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, idText(right)); return errorType; } - propType = isThisPropertyAccessInConstructor(node, prop) ? autoType : getTypeOfSymbol(prop); + + propType = isThisPropertyAccessInConstructor(node, prop) ? autoType : isWrite ? getSetAccessorTypeOfSymbol(prop) : getTypeOfSymbol(prop); } + return getFlowTypeOfAccessExpression(node, prop, propType, right, checkMode); } @@ -27361,7 +27394,7 @@ namespace ts { const declClass = getContainingClass(prop.valueDeclaration); return !isOptionalChain(node) && !!findAncestor(node, parent => parent === declClass); } - return checkPropertyAccessibility(node, isSuper, type, prop, /* reportError */ false); + return checkPropertyAccessibility(node, isSuper, /*isWrite*/ false, type, prop, /* reportError */ false); } // In js files properties of unions are allowed in completion return isInJSFile(node) && (type.flags & TypeFlags.Union) !== 0 && (type).types.some(elementType => isValidPropertyAccessWithType(node, isSuper, propertyName, elementType)); @@ -31000,7 +31033,7 @@ namespace ts { const prop = getPropertyOfType(objectLiteralType, text); if (prop) { markPropertyAsReferenced(prop, property, rightIsThis); - checkPropertyAccessibility(property, /*isSuper*/ false, objectLiteralType, prop); + checkPropertyAccessibility(property, /*isSuper*/ false, /*isWrite*/ true, objectLiteralType, prop); } } const elementType = getIndexedAccessType(objectLiteralType, exprType, /*noUncheckedIndexedAccessCandidate*/ undefined, name, /*aliasSymbol*/ undefined, /*aliasTypeArguments*/ undefined, AccessFlags.ExpressionPosition); @@ -33014,22 +33047,25 @@ namespace ts { if (hasBindableName(node)) { // TypeScript 1.0 spec (April 2014): 8.4.3 // Accessors for the same member name must specify the same accessibility. - const otherKind = node.kind === SyntaxKind.GetAccessor ? SyntaxKind.SetAccessor : SyntaxKind.GetAccessor; - const otherAccessor = getDeclarationOfKind(getSymbolOfNode(node), otherKind); - if (otherAccessor) { - const nodeFlags = getEffectiveModifierFlags(node); - const otherFlags = getEffectiveModifierFlags(otherAccessor); - if ((nodeFlags & ModifierFlags.AccessibilityModifier) !== (otherFlags & ModifierFlags.AccessibilityModifier)) { - error(node.name, Diagnostics.Getter_and_setter_accessors_do_not_agree_in_visibility); - } - if ((nodeFlags & ModifierFlags.Abstract) !== (otherFlags & ModifierFlags.Abstract)) { + const symbol = getSymbolOfNode(node); + const getter = getDeclarationOfKind(symbol, SyntaxKind.GetAccessor); + const setter = getDeclarationOfKind(symbol, SyntaxKind.SetAccessor); + if (getter && setter) { + const getterFlags = getEffectiveModifierFlags(getter); + const setterFlags = getEffectiveModifierFlags(setter); + if ((getterFlags & ModifierFlags.Abstract) !== (setterFlags & ModifierFlags.Abstract)) { error(node.name, Diagnostics.Accessors_must_both_be_abstract_or_non_abstract); } + if (((getterFlags & ModifierFlags.Protected) && !(setterFlags & (ModifierFlags.Protected | ModifierFlags.Private))) || + ((getterFlags & ModifierFlags.Private) && !(setterFlags & ModifierFlags.Private))) { + error(node.name, Diagnostics.A_get_accessor_must_be_at_least_as_accessible_as_the_setter); + } - // TypeScript 1.0 spec (April 2014): 4.5 - // If both accessors include type annotations, the specified types must be identical. - checkAccessorDeclarationTypesIdentical(node, otherAccessor, getAnnotatedAccessorType, Diagnostics.get_and_set_accessor_must_have_the_same_type); - checkAccessorDeclarationTypesIdentical(node, otherAccessor, getThisTypeOfDeclaration, Diagnostics.get_and_set_accessor_must_have_the_same_this_type); + const getterType = getAnnotatedAccessorType(getter); + const setterType = getAnnotatedAccessorType(setter); + if (getterType && setterType) { + checkTypeAssignableTo(getterType, setterType, getter, Diagnostics.The_return_type_of_a_get_accessor_must_be_assignable_to_its_set_accessor_type); + } } } const returnType = getTypeOfAccessors(getSymbolOfNode(node)); @@ -33041,14 +33077,6 @@ namespace ts { setNodeLinksForPrivateIdentifierScope(node); } - function checkAccessorDeclarationTypesIdentical(first: AccessorDeclaration, second: AccessorDeclaration, getAnnotatedType: (a: AccessorDeclaration) => Type | undefined, message: DiagnosticMessage) { - const firstType = getAnnotatedType(first); - const secondType = getAnnotatedType(second); - if (firstType && secondType && !isTypeIdenticalTo(firstType, secondType)) { - error(first, message); - } - } - function checkMissingDeclaration(node: Node) { checkDecorators(node); } @@ -34968,7 +34996,7 @@ namespace ts { const property = getPropertyOfType(parentType, nameText); if (property) { markPropertyAsReferenced(property, /*nodeForCheckWriteOnly*/ undefined, /*isSelfTypeAccess*/ false); // A destructuring is never a write-only reference. - checkPropertyAccessibility(node, !!parent.initializer && parent.initializer.kind === SyntaxKind.SuperKeyword, parentType, property); + checkPropertyAccessibility(node, !!parent.initializer && parent.initializer.kind === SyntaxKind.SuperKeyword, /*isWrite*/ false, parentType, property); } } } @@ -41056,7 +41084,7 @@ namespace ts { } function checkGrammarAccessor(accessor: AccessorDeclaration): boolean { - if (!(accessor.flags & NodeFlags.Ambient)) { + if (!(accessor.flags & NodeFlags.Ambient) && (accessor.parent.kind !== SyntaxKind.TypeLiteral) && (accessor.parent.kind !== SyntaxKind.InterfaceDeclaration)) { if (languageVersion < ScriptTarget.ES5) { return grammarErrorOnNode(accessor.name, Diagnostics.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher); } @@ -41067,8 +41095,13 @@ namespace ts { return grammarErrorAtPos(accessor, accessor.end - 1, ";".length, Diagnostics._0_expected, "{"); } } - if (accessor.body && hasSyntacticModifier(accessor, ModifierFlags.Abstract)) { - return grammarErrorOnNode(accessor, Diagnostics.An_abstract_accessor_cannot_have_an_implementation); + if (accessor.body) { + if (hasSyntacticModifier(accessor, ModifierFlags.Abstract)) { + return grammarErrorOnNode(accessor, Diagnostics.An_abstract_accessor_cannot_have_an_implementation); + } + if (accessor.parent.kind === SyntaxKind.TypeLiteral || accessor.parent.kind === SyntaxKind.InterfaceDeclaration) { + return grammarErrorOnNode(accessor.body, Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); + } } if (accessor.typeParameters) { return grammarErrorOnNode(accessor.name, Diagnostics.An_accessor_cannot_have_type_parameters); diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index b3d1b4d1f3c7f..f7d4fcc84eef2 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1706,11 +1706,7 @@ "category": "Error", "code": 2378 }, - "Getter and setter accessors do not agree in visibility.": { - "category": "Error", - "code": 2379 - }, - "'get' and 'set' accessor must have the same type.": { + "The return type of a 'get' accessor must be assignable to its 'set' accessor type": { "category": "Error", "code": 2380 }, @@ -3308,6 +3304,10 @@ "category": "Error", "code": 2807 }, + "A get accessor must be at least as accessible as the setter": { + "category": "Error", + "code": 2808 + }, "Import declaration '{0}' is using private name '{1}'.": { "category": "Error", diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 42023a26078c8..92d6848d8a92b 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -3213,7 +3213,10 @@ namespace ts { function isTypeMemberStart(): boolean { // Return true if we have the start of a signature member - if (token() === SyntaxKind.OpenParenToken || token() === SyntaxKind.LessThanToken) { + if (token() === SyntaxKind.OpenParenToken || + token() === SyntaxKind.LessThanToken || + token() === SyntaxKind.GetKeyword || + token() === SyntaxKind.SetKeyword) { return true; } let idToken = false; @@ -3254,6 +3257,14 @@ namespace ts { const pos = getNodePos(); const hasJSDoc = hasPrecedingJSDocComment(); const modifiers = parseModifiers(); + if (parseContextualModifier(SyntaxKind.GetKeyword)) { + return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, SyntaxKind.GetAccessor); + } + + if (parseContextualModifier(SyntaxKind.SetKeyword)) { + return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, SyntaxKind.SetAccessor); + } + if (isIndexSignature()) { return parseIndexSignatureDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers); } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 606dd017eae9d..0deacbe8e8a6a 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1482,9 +1482,9 @@ namespace ts { // See the comment on MethodDeclaration for the intuition behind GetAccessorDeclaration being a // ClassElement and an ObjectLiteralElement. - export interface GetAccessorDeclaration extends FunctionLikeDeclarationBase, ClassElement, ObjectLiteralElement, JSDocContainer { + export interface GetAccessorDeclaration extends FunctionLikeDeclarationBase, ClassElement, TypeElement, ObjectLiteralElement, JSDocContainer { readonly kind: SyntaxKind.GetAccessor; - readonly parent: ClassLikeDeclaration | ObjectLiteralExpression; + readonly parent: ClassLikeDeclaration | ObjectLiteralExpression | TypeLiteralNode | InterfaceDeclaration; readonly name: PropertyName; readonly body?: FunctionBody; /* @internal */ typeParameters?: NodeArray; // Present for use with reporting a grammar error @@ -1492,9 +1492,9 @@ namespace ts { // See the comment on MethodDeclaration for the intuition behind SetAccessorDeclaration being a // ClassElement and an ObjectLiteralElement. - export interface SetAccessorDeclaration extends FunctionLikeDeclarationBase, ClassElement, ObjectLiteralElement, JSDocContainer { + export interface SetAccessorDeclaration extends FunctionLikeDeclarationBase, ClassElement, TypeElement, ObjectLiteralElement, JSDocContainer { readonly kind: SyntaxKind.SetAccessor; - readonly parent: ClassLikeDeclaration | ObjectLiteralExpression; + readonly parent: ClassLikeDeclaration | ObjectLiteralExpression | TypeLiteralNode | InterfaceDeclaration; readonly name: PropertyName; readonly body?: FunctionBody; /* @internal */ typeParameters?: NodeArray; // Present for use with reporting a grammar error @@ -4776,6 +4776,7 @@ namespace ts { immediateTarget?: Symbol; // Immediate target of an alias. May be another alias. Do not access directly, use `checker.getImmediateAliasedSymbol` instead. target?: Symbol; // Resolved (non-alias) target of an alias type?: Type; // Type of value symbol + writeType?: Type; // Type of value symbol in write contexts nameType?: Type; // Type associated with a late-bound symbol uniqueESSymbolType?: Type; // UniqueESSymbol type for a symbol declaredType?: Type; // Type of class, interface, enum, type alias, or type parameter diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 190a98c0ea45d..0b7e5f2003eb9 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -5306,9 +5306,10 @@ namespace ts { return symbol.flags & SymbolFlags.Transient ? (symbol).checkFlags : 0; } - export function getDeclarationModifierFlagsFromSymbol(s: Symbol): ModifierFlags { + export function getDeclarationModifierFlagsFromSymbol(s: Symbol, isWrite = false): ModifierFlags { if (s.valueDeclaration) { - const flags = getCombinedModifierFlags(s.valueDeclaration); + const declaration = (isWrite && s.declarations && find(s.declarations, d => d.kind === SyntaxKind.SetAccessor)) || s.valueDeclaration; + const flags = getCombinedModifierFlags(declaration); return s.parent && s.parent.flags & SymbolFlags.Class ? flags : flags & ~ModifierFlags.AccessibilityModifier; } if (getCheckFlags(s) & CheckFlags.Synthetic) { diff --git a/tests/baselines/reference/abstractPropertyNegative.errors.txt b/tests/baselines/reference/abstractPropertyNegative.errors.txt index fd09b024213c4..d7b2fa592f839 100644 --- a/tests/baselines/reference/abstractPropertyNegative.errors.txt +++ b/tests/baselines/reference/abstractPropertyNegative.errors.txt @@ -1,5 +1,4 @@ -tests/cases/compiler/abstractPropertyNegative.ts(10,18): error TS2380: 'get' and 'set' accessor must have the same type. -tests/cases/compiler/abstractPropertyNegative.ts(11,18): error TS2380: 'get' and 'set' accessor must have the same type. +tests/cases/compiler/abstractPropertyNegative.ts(10,18): error TS2380: The return type of a 'get' accessor must be assignable to its 'set' accessor type tests/cases/compiler/abstractPropertyNegative.ts(13,7): error TS2515: Non-abstract class 'C' does not implement inherited abstract member 'm' from class 'B'. tests/cases/compiler/abstractPropertyNegative.ts(13,7): error TS2515: Non-abstract class 'C' does not implement inherited abstract member 'mismatch' from class 'B'. tests/cases/compiler/abstractPropertyNegative.ts(13,7): error TS2515: Non-abstract class 'C' does not implement inherited abstract member 'prop' from class 'B'. @@ -19,7 +18,7 @@ tests/cases/compiler/abstractPropertyNegative.ts(40,9): error TS2676: Accessors tests/cases/compiler/abstractPropertyNegative.ts(41,18): error TS2676: Accessors must both be abstract or non-abstract. -==== tests/cases/compiler/abstractPropertyNegative.ts (16 errors) ==== +==== tests/cases/compiler/abstractPropertyNegative.ts (15 errors) ==== interface A { prop: string; m(): string; @@ -31,10 +30,8 @@ tests/cases/compiler/abstractPropertyNegative.ts(41,18): error TS2676: Accessors abstract m(): string; abstract get mismatch(): string; ~~~~~~~~ -!!! error TS2380: 'get' and 'set' accessor must have the same type. +!!! error TS2380: The return type of a 'get' accessor must be assignable to its 'set' accessor type abstract set mismatch(val: number); // error, not same type - ~~~~~~~~ -!!! error TS2380: 'get' and 'set' accessor must have the same type. } class C extends B { ~ diff --git a/tests/baselines/reference/accessorBodyInTypeContext.errors.txt b/tests/baselines/reference/accessorBodyInTypeContext.errors.txt new file mode 100644 index 0000000000000..fad18097a98d7 --- /dev/null +++ b/tests/baselines/reference/accessorBodyInTypeContext.errors.txt @@ -0,0 +1,32 @@ +tests/cases/compiler/accessorBodyInTypeContext.ts(2,15): error TS1183: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/accessorBodyInTypeContext.ts(6,21): error TS1183: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/accessorBodyInTypeContext.ts(10,15): error TS1183: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/accessorBodyInTypeContext.ts(14,21): error TS1183: An implementation cannot be declared in ambient contexts. + + +==== tests/cases/compiler/accessorBodyInTypeContext.ts (4 errors) ==== + type A = { + get foo() { return 0 } + ~~~~~~~~~~~~ +!!! error TS1183: An implementation cannot be declared in ambient contexts. + }; + + type B = { + set foo(v: any) { } + ~~~ +!!! error TS1183: An implementation cannot be declared in ambient contexts. + }; + + interface X { + get foo() { return 0 } + ~~~~~~~~~~~~ +!!! error TS1183: An implementation cannot be declared in ambient contexts. + } + + interface Y { + set foo(v: any) { } + ~~~ +!!! error TS1183: An implementation cannot be declared in ambient contexts. + } + + \ No newline at end of file diff --git a/tests/baselines/reference/accessorBodyInTypeContext.js b/tests/baselines/reference/accessorBodyInTypeContext.js new file mode 100644 index 0000000000000..d99110e329cd0 --- /dev/null +++ b/tests/baselines/reference/accessorBodyInTypeContext.js @@ -0,0 +1,20 @@ +//// [accessorBodyInTypeContext.ts] +type A = { + get foo() { return 0 } +}; + +type B = { + set foo(v: any) { } +}; + +interface X { + get foo() { return 0 } +} + +interface Y { + set foo(v: any) { } +} + + + +//// [accessorBodyInTypeContext.js] diff --git a/tests/baselines/reference/accessorBodyInTypeContext.symbols b/tests/baselines/reference/accessorBodyInTypeContext.symbols new file mode 100644 index 0000000000000..4eb8bfd31289e --- /dev/null +++ b/tests/baselines/reference/accessorBodyInTypeContext.symbols @@ -0,0 +1,34 @@ +=== tests/cases/compiler/accessorBodyInTypeContext.ts === +type A = { +>A : Symbol(A, Decl(accessorBodyInTypeContext.ts, 0, 0)) + + get foo() { return 0 } +>foo : Symbol(foo, Decl(accessorBodyInTypeContext.ts, 0, 10)) + +}; + +type B = { +>B : Symbol(B, Decl(accessorBodyInTypeContext.ts, 2, 2)) + + set foo(v: any) { } +>foo : Symbol(foo, Decl(accessorBodyInTypeContext.ts, 4, 10)) +>v : Symbol(v, Decl(accessorBodyInTypeContext.ts, 5, 12)) + +}; + +interface X { +>X : Symbol(X, Decl(accessorBodyInTypeContext.ts, 6, 2)) + + get foo() { return 0 } +>foo : Symbol(X.foo, Decl(accessorBodyInTypeContext.ts, 8, 13)) +} + +interface Y { +>Y : Symbol(Y, Decl(accessorBodyInTypeContext.ts, 10, 1)) + + set foo(v: any) { } +>foo : Symbol(Y.foo, Decl(accessorBodyInTypeContext.ts, 12, 13)) +>v : Symbol(v, Decl(accessorBodyInTypeContext.ts, 13, 12)) +} + + diff --git a/tests/baselines/reference/accessorBodyInTypeContext.types b/tests/baselines/reference/accessorBodyInTypeContext.types new file mode 100644 index 0000000000000..ad04c25524d88 --- /dev/null +++ b/tests/baselines/reference/accessorBodyInTypeContext.types @@ -0,0 +1,32 @@ +=== tests/cases/compiler/accessorBodyInTypeContext.ts === +type A = { +>A : A + + get foo() { return 0 } +>foo : number +>0 : 0 + +}; + +type B = { +>B : B + + set foo(v: any) { } +>foo : any +>v : any + +}; + +interface X { + get foo() { return 0 } +>foo : number +>0 : 0 +} + +interface Y { + set foo(v: any) { } +>foo : any +>v : any +} + + diff --git a/tests/baselines/reference/accessorWithMismatchedAccessibilityModifiers.errors.txt b/tests/baselines/reference/accessorWithMismatchedAccessibilityModifiers.errors.txt deleted file mode 100644 index 9d1b7ca9a30b5..0000000000000 --- a/tests/baselines/reference/accessorWithMismatchedAccessibilityModifiers.errors.txt +++ /dev/null @@ -1,58 +0,0 @@ -tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/accessorWithMismatchedAccessibilityModifiers.ts(2,9): error TS2379: Getter and setter accessors do not agree in visibility. -tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/accessorWithMismatchedAccessibilityModifiers.ts(5,17): error TS2379: Getter and setter accessors do not agree in visibility. -tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/accessorWithMismatchedAccessibilityModifiers.ts(10,19): error TS2379: Getter and setter accessors do not agree in visibility. -tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/accessorWithMismatchedAccessibilityModifiers.ts(13,17): error TS2379: Getter and setter accessors do not agree in visibility. -tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/accessorWithMismatchedAccessibilityModifiers.ts(18,19): error TS2379: Getter and setter accessors do not agree in visibility. -tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/accessorWithMismatchedAccessibilityModifiers.ts(20,9): error TS2379: Getter and setter accessors do not agree in visibility. -tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/accessorWithMismatchedAccessibilityModifiers.ts(26,26): error TS2379: Getter and setter accessors do not agree in visibility. -tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/accessorWithMismatchedAccessibilityModifiers.ts(28,16): error TS2379: Getter and setter accessors do not agree in visibility. - - -==== tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/accessorWithMismatchedAccessibilityModifiers.ts (8 errors) ==== - class C { - get x() { - ~ -!!! error TS2379: Getter and setter accessors do not agree in visibility. - return 1; - } - private set x(v) { - ~ -!!! error TS2379: Getter and setter accessors do not agree in visibility. - } - } - - class D { - protected get x() { - ~ -!!! error TS2379: Getter and setter accessors do not agree in visibility. - return 1; - } - private set x(v) { - ~ -!!! error TS2379: Getter and setter accessors do not agree in visibility. - } - } - - class E { - protected set x(v) { - ~ -!!! error TS2379: Getter and setter accessors do not agree in visibility. - } - get x() { - ~ -!!! error TS2379: Getter and setter accessors do not agree in visibility. - return 1; - } - } - - class F { - protected static set x(v) { - ~ -!!! error TS2379: Getter and setter accessors do not agree in visibility. - } - static get x() { - ~ -!!! error TS2379: Getter and setter accessors do not agree in visibility. - return 1; - } - } \ No newline at end of file diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 2a9f75e881f27..a2ff8fc1ea29a 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -827,15 +827,15 @@ declare namespace ts { readonly kind: SyntaxKind.SemicolonClassElement; readonly parent: ClassLikeDeclaration; } - export interface GetAccessorDeclaration extends FunctionLikeDeclarationBase, ClassElement, ObjectLiteralElement, JSDocContainer { + export interface GetAccessorDeclaration extends FunctionLikeDeclarationBase, ClassElement, TypeElement, ObjectLiteralElement, JSDocContainer { readonly kind: SyntaxKind.GetAccessor; - readonly parent: ClassLikeDeclaration | ObjectLiteralExpression; + readonly parent: ClassLikeDeclaration | ObjectLiteralExpression | TypeLiteralNode | InterfaceDeclaration; readonly name: PropertyName; readonly body?: FunctionBody; } - export interface SetAccessorDeclaration extends FunctionLikeDeclarationBase, ClassElement, ObjectLiteralElement, JSDocContainer { + export interface SetAccessorDeclaration extends FunctionLikeDeclarationBase, ClassElement, TypeElement, ObjectLiteralElement, JSDocContainer { readonly kind: SyntaxKind.SetAccessor; - readonly parent: ClassLikeDeclaration | ObjectLiteralExpression; + readonly parent: ClassLikeDeclaration | ObjectLiteralExpression | TypeLiteralNode | InterfaceDeclaration; readonly name: PropertyName; readonly body?: FunctionBody; } diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 2fa18aa9fb9d9..0b2d291eeddb5 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -827,15 +827,15 @@ declare namespace ts { readonly kind: SyntaxKind.SemicolonClassElement; readonly parent: ClassLikeDeclaration; } - export interface GetAccessorDeclaration extends FunctionLikeDeclarationBase, ClassElement, ObjectLiteralElement, JSDocContainer { + export interface GetAccessorDeclaration extends FunctionLikeDeclarationBase, ClassElement, TypeElement, ObjectLiteralElement, JSDocContainer { readonly kind: SyntaxKind.GetAccessor; - readonly parent: ClassLikeDeclaration | ObjectLiteralExpression; + readonly parent: ClassLikeDeclaration | ObjectLiteralExpression | TypeLiteralNode | InterfaceDeclaration; readonly name: PropertyName; readonly body?: FunctionBody; } - export interface SetAccessorDeclaration extends FunctionLikeDeclarationBase, ClassElement, ObjectLiteralElement, JSDocContainer { + export interface SetAccessorDeclaration extends FunctionLikeDeclarationBase, ClassElement, TypeElement, ObjectLiteralElement, JSDocContainer { readonly kind: SyntaxKind.SetAccessor; - readonly parent: ClassLikeDeclaration | ObjectLiteralExpression; + readonly parent: ClassLikeDeclaration | ObjectLiteralExpression | TypeLiteralNode | InterfaceDeclaration; readonly name: PropertyName; readonly body?: FunctionBody; } diff --git a/tests/baselines/reference/divergentAccessors1.js b/tests/baselines/reference/divergentAccessors1.js new file mode 100644 index 0000000000000..684526d9744bb --- /dev/null +++ b/tests/baselines/reference/divergentAccessors1.js @@ -0,0 +1,39 @@ +//// [divergentAccessors1.ts] +// Accessors in interfaces/types + +{ + interface IHasGetSet { + get foo(): number; + set foo(v: number | string); + } + + const ihgs: IHasGetSet = null as any; + ihgs.foo = "32"; + let r_ihgs_foo: number = ihgs.foo; +} + +{ + type T_HasGetSet = { + get foo(): number; + set foo(v: number | string); + } + + const t_hgs: T_HasGetSet = null as any; + t_hgs.foo = "32"; + let r_t_hgs_foo: number = t_hgs.foo; +} + + +//// [divergentAccessors1.js] +"use strict"; +// Accessors in interfaces/types +{ + var ihgs = null; + ihgs.foo = "32"; + var r_ihgs_foo = ihgs.foo; +} +{ + var t_hgs = null; + t_hgs.foo = "32"; + var r_t_hgs_foo = t_hgs.foo; +} diff --git a/tests/baselines/reference/divergentAccessors1.symbols b/tests/baselines/reference/divergentAccessors1.symbols new file mode 100644 index 0000000000000..d8253a6d1f285 --- /dev/null +++ b/tests/baselines/reference/divergentAccessors1.symbols @@ -0,0 +1,59 @@ +=== tests/cases/compiler/divergentAccessors1.ts === +// Accessors in interfaces/types + +{ + interface IHasGetSet { +>IHasGetSet : Symbol(IHasGetSet, Decl(divergentAccessors1.ts, 2, 1)) + + get foo(): number; +>foo : Symbol(IHasGetSet.foo, Decl(divergentAccessors1.ts, 3, 26), Decl(divergentAccessors1.ts, 4, 26)) + + set foo(v: number | string); +>foo : Symbol(IHasGetSet.foo, Decl(divergentAccessors1.ts, 3, 26), Decl(divergentAccessors1.ts, 4, 26)) +>v : Symbol(v, Decl(divergentAccessors1.ts, 5, 16)) + } + + const ihgs: IHasGetSet = null as any; +>ihgs : Symbol(ihgs, Decl(divergentAccessors1.ts, 8, 9)) +>IHasGetSet : Symbol(IHasGetSet, Decl(divergentAccessors1.ts, 2, 1)) + + ihgs.foo = "32"; +>ihgs.foo : Symbol(IHasGetSet.foo, Decl(divergentAccessors1.ts, 3, 26), Decl(divergentAccessors1.ts, 4, 26)) +>ihgs : Symbol(ihgs, Decl(divergentAccessors1.ts, 8, 9)) +>foo : Symbol(IHasGetSet.foo, Decl(divergentAccessors1.ts, 3, 26), Decl(divergentAccessors1.ts, 4, 26)) + + let r_ihgs_foo: number = ihgs.foo; +>r_ihgs_foo : Symbol(r_ihgs_foo, Decl(divergentAccessors1.ts, 10, 7)) +>ihgs.foo : Symbol(IHasGetSet.foo, Decl(divergentAccessors1.ts, 3, 26), Decl(divergentAccessors1.ts, 4, 26)) +>ihgs : Symbol(ihgs, Decl(divergentAccessors1.ts, 8, 9)) +>foo : Symbol(IHasGetSet.foo, Decl(divergentAccessors1.ts, 3, 26), Decl(divergentAccessors1.ts, 4, 26)) +} + +{ + type T_HasGetSet = { +>T_HasGetSet : Symbol(T_HasGetSet, Decl(divergentAccessors1.ts, 13, 1)) + + get foo(): number; +>foo : Symbol(foo, Decl(divergentAccessors1.ts, 14, 24), Decl(divergentAccessors1.ts, 15, 26)) + + set foo(v: number | string); +>foo : Symbol(foo, Decl(divergentAccessors1.ts, 14, 24), Decl(divergentAccessors1.ts, 15, 26)) +>v : Symbol(v, Decl(divergentAccessors1.ts, 16, 16)) + } + + const t_hgs: T_HasGetSet = null as any; +>t_hgs : Symbol(t_hgs, Decl(divergentAccessors1.ts, 19, 9)) +>T_HasGetSet : Symbol(T_HasGetSet, Decl(divergentAccessors1.ts, 13, 1)) + + t_hgs.foo = "32"; +>t_hgs.foo : Symbol(foo, Decl(divergentAccessors1.ts, 14, 24), Decl(divergentAccessors1.ts, 15, 26)) +>t_hgs : Symbol(t_hgs, Decl(divergentAccessors1.ts, 19, 9)) +>foo : Symbol(foo, Decl(divergentAccessors1.ts, 14, 24), Decl(divergentAccessors1.ts, 15, 26)) + + let r_t_hgs_foo: number = t_hgs.foo; +>r_t_hgs_foo : Symbol(r_t_hgs_foo, Decl(divergentAccessors1.ts, 21, 7)) +>t_hgs.foo : Symbol(foo, Decl(divergentAccessors1.ts, 14, 24), Decl(divergentAccessors1.ts, 15, 26)) +>t_hgs : Symbol(t_hgs, Decl(divergentAccessors1.ts, 19, 9)) +>foo : Symbol(foo, Decl(divergentAccessors1.ts, 14, 24), Decl(divergentAccessors1.ts, 15, 26)) +} + diff --git a/tests/baselines/reference/divergentAccessors1.types b/tests/baselines/reference/divergentAccessors1.types new file mode 100644 index 0000000000000..3a9f34558f2fe --- /dev/null +++ b/tests/baselines/reference/divergentAccessors1.types @@ -0,0 +1,63 @@ +=== tests/cases/compiler/divergentAccessors1.ts === +// Accessors in interfaces/types + +{ + interface IHasGetSet { + get foo(): number; +>foo : number + + set foo(v: number | string); +>foo : number +>v : string | number + } + + const ihgs: IHasGetSet = null as any; +>ihgs : IHasGetSet +>null as any : any +>null : null + + ihgs.foo = "32"; +>ihgs.foo = "32" : "32" +>ihgs.foo : string | number +>ihgs : IHasGetSet +>foo : string | number +>"32" : "32" + + let r_ihgs_foo: number = ihgs.foo; +>r_ihgs_foo : number +>ihgs.foo : number +>ihgs : IHasGetSet +>foo : number +} + +{ + type T_HasGetSet = { +>T_HasGetSet : { foo: number; } + + get foo(): number; +>foo : number + + set foo(v: number | string); +>foo : number +>v : string | number + } + + const t_hgs: T_HasGetSet = null as any; +>t_hgs : { foo: number; } +>null as any : any +>null : null + + t_hgs.foo = "32"; +>t_hgs.foo = "32" : "32" +>t_hgs.foo : string | number +>t_hgs : { foo: number; } +>foo : string | number +>"32" : "32" + + let r_t_hgs_foo: number = t_hgs.foo; +>r_t_hgs_foo : number +>t_hgs.foo : number +>t_hgs : { foo: number; } +>foo : number +} + diff --git a/tests/baselines/reference/divergentAccessorsTypes1.js b/tests/baselines/reference/divergentAccessorsTypes1.js new file mode 100644 index 0000000000000..7f76803b1413a --- /dev/null +++ b/tests/baselines/reference/divergentAccessorsTypes1.js @@ -0,0 +1,107 @@ +//// [divergentAccessorsTypes1.ts] +class Test1 { + get foo(): string { return "" } + set foo(s: string | number) { + let a = s as string; + let b = s as number; + } + + get bar(): string | number { return "" } + set bar(s: string | number | boolean) { + } +} + +interface Test2 { + get foo(): string; + set foo(s: string | number); + + get bar(): string | number; + set bar(s: string | number | boolean); +} + +type Test3 = { + get foo(): string; + set foo(s: string | number); + + get bar(): string | number; + set bar(s: string | number | boolean); +}; + +{ + const t = new Test1(); + t.foo = 32; + let m: string = t.foo; + + // See how CFA interacts with out-of-type writes + t.bar = 42; + let n: number = t.bar; + t.bar = false; + let o = t.bar; +} + +{ + const t = {} as Test2; + t.foo = 32; + let m: string = t.foo; + + // See how CFA interacts with out-of-type writes + t.bar = 42; + let n: number = t.bar; + t.bar = false; + let o = t.bar; +} + +{ + const t = {} as Test3; + t.foo = 32; + let m: string = t.foo; + + // See how CFA interacts with out-of-type writes + t.bar = 42; + let n: number = t.bar; + t.bar = false; + let o = t.bar; +} + +//// [divergentAccessorsTypes1.js] +"use strict"; +class Test1 { + get foo() { return ""; } + set foo(s) { + let a = s; + let b = s; + } + get bar() { return ""; } + set bar(s) { + } +} +{ + const t = new Test1(); + t.foo = 32; + let m = t.foo; + // See how CFA interacts with out-of-type writes + t.bar = 42; + let n = t.bar; + t.bar = false; + let o = t.bar; +} +{ + const t = {}; + t.foo = 32; + let m = t.foo; + // See how CFA interacts with out-of-type writes + t.bar = 42; + let n = t.bar; + t.bar = false; + let o = t.bar; +} +{ + const t = {}; + t.foo = 32; + let m = t.foo; + // See how CFA interacts with out-of-type writes + t.bar = 42; + let n = t.bar; + t.bar = false; + let o = t.bar; +} diff --git a/tests/baselines/reference/divergentAccessorsTypes1.symbols b/tests/baselines/reference/divergentAccessorsTypes1.symbols new file mode 100644 index 0000000000000..3df60f476a285 --- /dev/null +++ b/tests/baselines/reference/divergentAccessorsTypes1.symbols @@ -0,0 +1,185 @@ +=== tests/cases/compiler/divergentAccessorsTypes1.ts === +class Test1 { +>Test1 : Symbol(Test1, Decl(divergentAccessorsTypes1.ts, 0, 0)) + + get foo(): string { return "" } +>foo : Symbol(Test1.foo, Decl(divergentAccessorsTypes1.ts, 0, 13), Decl(divergentAccessorsTypes1.ts, 1, 35)) + + set foo(s: string | number) { +>foo : Symbol(Test1.foo, Decl(divergentAccessorsTypes1.ts, 0, 13), Decl(divergentAccessorsTypes1.ts, 1, 35)) +>s : Symbol(s, Decl(divergentAccessorsTypes1.ts, 2, 12)) + + let a = s as string; +>a : Symbol(a, Decl(divergentAccessorsTypes1.ts, 3, 11)) +>s : Symbol(s, Decl(divergentAccessorsTypes1.ts, 2, 12)) + + let b = s as number; +>b : Symbol(b, Decl(divergentAccessorsTypes1.ts, 4, 11)) +>s : Symbol(s, Decl(divergentAccessorsTypes1.ts, 2, 12)) + } + + get bar(): string | number { return "" } +>bar : Symbol(Test1.bar, Decl(divergentAccessorsTypes1.ts, 5, 5), Decl(divergentAccessorsTypes1.ts, 7, 44)) + + set bar(s: string | number | boolean) { +>bar : Symbol(Test1.bar, Decl(divergentAccessorsTypes1.ts, 5, 5), Decl(divergentAccessorsTypes1.ts, 7, 44)) +>s : Symbol(s, Decl(divergentAccessorsTypes1.ts, 8, 12)) + } +} + +interface Test2 { +>Test2 : Symbol(Test2, Decl(divergentAccessorsTypes1.ts, 10, 1)) + + get foo(): string; +>foo : Symbol(Test2.foo, Decl(divergentAccessorsTypes1.ts, 12, 17), Decl(divergentAccessorsTypes1.ts, 13, 22)) + + set foo(s: string | number); +>foo : Symbol(Test2.foo, Decl(divergentAccessorsTypes1.ts, 12, 17), Decl(divergentAccessorsTypes1.ts, 13, 22)) +>s : Symbol(s, Decl(divergentAccessorsTypes1.ts, 14, 12)) + + get bar(): string | number; +>bar : Symbol(Test2.bar, Decl(divergentAccessorsTypes1.ts, 14, 32), Decl(divergentAccessorsTypes1.ts, 16, 31)) + + set bar(s: string | number | boolean); +>bar : Symbol(Test2.bar, Decl(divergentAccessorsTypes1.ts, 14, 32), Decl(divergentAccessorsTypes1.ts, 16, 31)) +>s : Symbol(s, Decl(divergentAccessorsTypes1.ts, 17, 12)) +} + +type Test3 = { +>Test3 : Symbol(Test3, Decl(divergentAccessorsTypes1.ts, 18, 1)) + + get foo(): string; +>foo : Symbol(foo, Decl(divergentAccessorsTypes1.ts, 20, 14), Decl(divergentAccessorsTypes1.ts, 21, 22)) + + set foo(s: string | number); +>foo : Symbol(foo, Decl(divergentAccessorsTypes1.ts, 20, 14), Decl(divergentAccessorsTypes1.ts, 21, 22)) +>s : Symbol(s, Decl(divergentAccessorsTypes1.ts, 22, 12)) + + get bar(): string | number; +>bar : Symbol(bar, Decl(divergentAccessorsTypes1.ts, 22, 32), Decl(divergentAccessorsTypes1.ts, 24, 31)) + + set bar(s: string | number | boolean); +>bar : Symbol(bar, Decl(divergentAccessorsTypes1.ts, 22, 32), Decl(divergentAccessorsTypes1.ts, 24, 31)) +>s : Symbol(s, Decl(divergentAccessorsTypes1.ts, 25, 12)) + +}; + +{ + const t = new Test1(); +>t : Symbol(t, Decl(divergentAccessorsTypes1.ts, 29, 9)) +>Test1 : Symbol(Test1, Decl(divergentAccessorsTypes1.ts, 0, 0)) + + t.foo = 32; +>t.foo : Symbol(Test1.foo, Decl(divergentAccessorsTypes1.ts, 0, 13), Decl(divergentAccessorsTypes1.ts, 1, 35)) +>t : Symbol(t, Decl(divergentAccessorsTypes1.ts, 29, 9)) +>foo : Symbol(Test1.foo, Decl(divergentAccessorsTypes1.ts, 0, 13), Decl(divergentAccessorsTypes1.ts, 1, 35)) + + let m: string = t.foo; +>m : Symbol(m, Decl(divergentAccessorsTypes1.ts, 31, 7)) +>t.foo : Symbol(Test1.foo, Decl(divergentAccessorsTypes1.ts, 0, 13), Decl(divergentAccessorsTypes1.ts, 1, 35)) +>t : Symbol(t, Decl(divergentAccessorsTypes1.ts, 29, 9)) +>foo : Symbol(Test1.foo, Decl(divergentAccessorsTypes1.ts, 0, 13), Decl(divergentAccessorsTypes1.ts, 1, 35)) + + // See how CFA interacts with out-of-type writes + t.bar = 42; +>t.bar : Symbol(Test1.bar, Decl(divergentAccessorsTypes1.ts, 5, 5), Decl(divergentAccessorsTypes1.ts, 7, 44)) +>t : Symbol(t, Decl(divergentAccessorsTypes1.ts, 29, 9)) +>bar : Symbol(Test1.bar, Decl(divergentAccessorsTypes1.ts, 5, 5), Decl(divergentAccessorsTypes1.ts, 7, 44)) + + let n: number = t.bar; +>n : Symbol(n, Decl(divergentAccessorsTypes1.ts, 35, 7)) +>t.bar : Symbol(Test1.bar, Decl(divergentAccessorsTypes1.ts, 5, 5), Decl(divergentAccessorsTypes1.ts, 7, 44)) +>t : Symbol(t, Decl(divergentAccessorsTypes1.ts, 29, 9)) +>bar : Symbol(Test1.bar, Decl(divergentAccessorsTypes1.ts, 5, 5), Decl(divergentAccessorsTypes1.ts, 7, 44)) + + t.bar = false; +>t.bar : Symbol(Test1.bar, Decl(divergentAccessorsTypes1.ts, 5, 5), Decl(divergentAccessorsTypes1.ts, 7, 44)) +>t : Symbol(t, Decl(divergentAccessorsTypes1.ts, 29, 9)) +>bar : Symbol(Test1.bar, Decl(divergentAccessorsTypes1.ts, 5, 5), Decl(divergentAccessorsTypes1.ts, 7, 44)) + + let o = t.bar; +>o : Symbol(o, Decl(divergentAccessorsTypes1.ts, 37, 7)) +>t.bar : Symbol(Test1.bar, Decl(divergentAccessorsTypes1.ts, 5, 5), Decl(divergentAccessorsTypes1.ts, 7, 44)) +>t : Symbol(t, Decl(divergentAccessorsTypes1.ts, 29, 9)) +>bar : Symbol(Test1.bar, Decl(divergentAccessorsTypes1.ts, 5, 5), Decl(divergentAccessorsTypes1.ts, 7, 44)) +} + +{ + const t = {} as Test2; +>t : Symbol(t, Decl(divergentAccessorsTypes1.ts, 41, 9)) +>Test2 : Symbol(Test2, Decl(divergentAccessorsTypes1.ts, 10, 1)) + + t.foo = 32; +>t.foo : Symbol(Test2.foo, Decl(divergentAccessorsTypes1.ts, 12, 17), Decl(divergentAccessorsTypes1.ts, 13, 22)) +>t : Symbol(t, Decl(divergentAccessorsTypes1.ts, 41, 9)) +>foo : Symbol(Test2.foo, Decl(divergentAccessorsTypes1.ts, 12, 17), Decl(divergentAccessorsTypes1.ts, 13, 22)) + + let m: string = t.foo; +>m : Symbol(m, Decl(divergentAccessorsTypes1.ts, 43, 7)) +>t.foo : Symbol(Test2.foo, Decl(divergentAccessorsTypes1.ts, 12, 17), Decl(divergentAccessorsTypes1.ts, 13, 22)) +>t : Symbol(t, Decl(divergentAccessorsTypes1.ts, 41, 9)) +>foo : Symbol(Test2.foo, Decl(divergentAccessorsTypes1.ts, 12, 17), Decl(divergentAccessorsTypes1.ts, 13, 22)) + + // See how CFA interacts with out-of-type writes + t.bar = 42; +>t.bar : Symbol(Test2.bar, Decl(divergentAccessorsTypes1.ts, 14, 32), Decl(divergentAccessorsTypes1.ts, 16, 31)) +>t : Symbol(t, Decl(divergentAccessorsTypes1.ts, 41, 9)) +>bar : Symbol(Test2.bar, Decl(divergentAccessorsTypes1.ts, 14, 32), Decl(divergentAccessorsTypes1.ts, 16, 31)) + + let n: number = t.bar; +>n : Symbol(n, Decl(divergentAccessorsTypes1.ts, 47, 7)) +>t.bar : Symbol(Test2.bar, Decl(divergentAccessorsTypes1.ts, 14, 32), Decl(divergentAccessorsTypes1.ts, 16, 31)) +>t : Symbol(t, Decl(divergentAccessorsTypes1.ts, 41, 9)) +>bar : Symbol(Test2.bar, Decl(divergentAccessorsTypes1.ts, 14, 32), Decl(divergentAccessorsTypes1.ts, 16, 31)) + + t.bar = false; +>t.bar : Symbol(Test2.bar, Decl(divergentAccessorsTypes1.ts, 14, 32), Decl(divergentAccessorsTypes1.ts, 16, 31)) +>t : Symbol(t, Decl(divergentAccessorsTypes1.ts, 41, 9)) +>bar : Symbol(Test2.bar, Decl(divergentAccessorsTypes1.ts, 14, 32), Decl(divergentAccessorsTypes1.ts, 16, 31)) + + let o = t.bar; +>o : Symbol(o, Decl(divergentAccessorsTypes1.ts, 49, 7)) +>t.bar : Symbol(Test2.bar, Decl(divergentAccessorsTypes1.ts, 14, 32), Decl(divergentAccessorsTypes1.ts, 16, 31)) +>t : Symbol(t, Decl(divergentAccessorsTypes1.ts, 41, 9)) +>bar : Symbol(Test2.bar, Decl(divergentAccessorsTypes1.ts, 14, 32), Decl(divergentAccessorsTypes1.ts, 16, 31)) +} + +{ + const t = {} as Test3; +>t : Symbol(t, Decl(divergentAccessorsTypes1.ts, 53, 9)) +>Test3 : Symbol(Test3, Decl(divergentAccessorsTypes1.ts, 18, 1)) + + t.foo = 32; +>t.foo : Symbol(foo, Decl(divergentAccessorsTypes1.ts, 20, 14), Decl(divergentAccessorsTypes1.ts, 21, 22)) +>t : Symbol(t, Decl(divergentAccessorsTypes1.ts, 53, 9)) +>foo : Symbol(foo, Decl(divergentAccessorsTypes1.ts, 20, 14), Decl(divergentAccessorsTypes1.ts, 21, 22)) + + let m: string = t.foo; +>m : Symbol(m, Decl(divergentAccessorsTypes1.ts, 55, 7)) +>t.foo : Symbol(foo, Decl(divergentAccessorsTypes1.ts, 20, 14), Decl(divergentAccessorsTypes1.ts, 21, 22)) +>t : Symbol(t, Decl(divergentAccessorsTypes1.ts, 53, 9)) +>foo : Symbol(foo, Decl(divergentAccessorsTypes1.ts, 20, 14), Decl(divergentAccessorsTypes1.ts, 21, 22)) + + // See how CFA interacts with out-of-type writes + t.bar = 42; +>t.bar : Symbol(bar, Decl(divergentAccessorsTypes1.ts, 22, 32), Decl(divergentAccessorsTypes1.ts, 24, 31)) +>t : Symbol(t, Decl(divergentAccessorsTypes1.ts, 53, 9)) +>bar : Symbol(bar, Decl(divergentAccessorsTypes1.ts, 22, 32), Decl(divergentAccessorsTypes1.ts, 24, 31)) + + let n: number = t.bar; +>n : Symbol(n, Decl(divergentAccessorsTypes1.ts, 59, 7)) +>t.bar : Symbol(bar, Decl(divergentAccessorsTypes1.ts, 22, 32), Decl(divergentAccessorsTypes1.ts, 24, 31)) +>t : Symbol(t, Decl(divergentAccessorsTypes1.ts, 53, 9)) +>bar : Symbol(bar, Decl(divergentAccessorsTypes1.ts, 22, 32), Decl(divergentAccessorsTypes1.ts, 24, 31)) + + t.bar = false; +>t.bar : Symbol(bar, Decl(divergentAccessorsTypes1.ts, 22, 32), Decl(divergentAccessorsTypes1.ts, 24, 31)) +>t : Symbol(t, Decl(divergentAccessorsTypes1.ts, 53, 9)) +>bar : Symbol(bar, Decl(divergentAccessorsTypes1.ts, 22, 32), Decl(divergentAccessorsTypes1.ts, 24, 31)) + + let o = t.bar; +>o : Symbol(o, Decl(divergentAccessorsTypes1.ts, 61, 7)) +>t.bar : Symbol(bar, Decl(divergentAccessorsTypes1.ts, 22, 32), Decl(divergentAccessorsTypes1.ts, 24, 31)) +>t : Symbol(t, Decl(divergentAccessorsTypes1.ts, 53, 9)) +>bar : Symbol(bar, Decl(divergentAccessorsTypes1.ts, 22, 32), Decl(divergentAccessorsTypes1.ts, 24, 31)) +} diff --git a/tests/baselines/reference/divergentAccessorsTypes1.types b/tests/baselines/reference/divergentAccessorsTypes1.types new file mode 100644 index 0000000000000..be4ebc6243c3a --- /dev/null +++ b/tests/baselines/reference/divergentAccessorsTypes1.types @@ -0,0 +1,208 @@ +=== tests/cases/compiler/divergentAccessorsTypes1.ts === +class Test1 { +>Test1 : Test1 + + get foo(): string { return "" } +>foo : string +>"" : "" + + set foo(s: string | number) { +>foo : string +>s : string | number + + let a = s as string; +>a : string +>s as string : string +>s : string | number + + let b = s as number; +>b : number +>s as number : number +>s : string | number + } + + get bar(): string | number { return "" } +>bar : string | number +>"" : "" + + set bar(s: string | number | boolean) { +>bar : string | number +>s : string | number | boolean + } +} + +interface Test2 { + get foo(): string; +>foo : string + + set foo(s: string | number); +>foo : string +>s : string | number + + get bar(): string | number; +>bar : string | number + + set bar(s: string | number | boolean); +>bar : string | number +>s : string | number | boolean +} + +type Test3 = { +>Test3 : Test3 + + get foo(): string; +>foo : string + + set foo(s: string | number); +>foo : string +>s : string | number + + get bar(): string | number; +>bar : string | number + + set bar(s: string | number | boolean); +>bar : string | number +>s : string | number | boolean + +}; + +{ + const t = new Test1(); +>t : Test1 +>new Test1() : Test1 +>Test1 : typeof Test1 + + t.foo = 32; +>t.foo = 32 : 32 +>t.foo : string | number +>t : Test1 +>foo : string | number +>32 : 32 + + let m: string = t.foo; +>m : string +>t.foo : string +>t : Test1 +>foo : string + + // See how CFA interacts with out-of-type writes + t.bar = 42; +>t.bar = 42 : 42 +>t.bar : string | number | boolean +>t : Test1 +>bar : string | number | boolean +>42 : 42 + + let n: number = t.bar; +>n : number +>t.bar : number +>t : Test1 +>bar : number + + t.bar = false; +>t.bar = false : false +>t.bar : string | number | boolean +>t : Test1 +>bar : string | number | boolean +>false : false + + let o = t.bar; +>o : string | number +>t.bar : string | number +>t : Test1 +>bar : string | number +} + +{ + const t = {} as Test2; +>t : Test2 +>{} as Test2 : Test2 +>{} : {} + + t.foo = 32; +>t.foo = 32 : 32 +>t.foo : string | number +>t : Test2 +>foo : string | number +>32 : 32 + + let m: string = t.foo; +>m : string +>t.foo : string +>t : Test2 +>foo : string + + // See how CFA interacts with out-of-type writes + t.bar = 42; +>t.bar = 42 : 42 +>t.bar : string | number | boolean +>t : Test2 +>bar : string | number | boolean +>42 : 42 + + let n: number = t.bar; +>n : number +>t.bar : number +>t : Test2 +>bar : number + + t.bar = false; +>t.bar = false : false +>t.bar : string | number | boolean +>t : Test2 +>bar : string | number | boolean +>false : false + + let o = t.bar; +>o : string | number +>t.bar : string | number +>t : Test2 +>bar : string | number +} + +{ + const t = {} as Test3; +>t : Test3 +>{} as Test3 : Test3 +>{} : {} + + t.foo = 32; +>t.foo = 32 : 32 +>t.foo : string | number +>t : Test3 +>foo : string | number +>32 : 32 + + let m: string = t.foo; +>m : string +>t.foo : string +>t : Test3 +>foo : string + + // See how CFA interacts with out-of-type writes + t.bar = 42; +>t.bar = 42 : 42 +>t.bar : string | number | boolean +>t : Test3 +>bar : string | number | boolean +>42 : 42 + + let n: number = t.bar; +>n : number +>t.bar : number +>t : Test3 +>bar : number + + t.bar = false; +>t.bar = false : false +>t.bar : string | number | boolean +>t : Test3 +>bar : string | number | boolean +>false : false + + let o = t.bar; +>o : string | number +>t.bar : string | number +>t : Test3 +>bar : string | number +} diff --git a/tests/baselines/reference/divergentAccessorsTypes2.errors.txt b/tests/baselines/reference/divergentAccessorsTypes2.errors.txt new file mode 100644 index 0000000000000..277630c5f11c0 --- /dev/null +++ b/tests/baselines/reference/divergentAccessorsTypes2.errors.txt @@ -0,0 +1,17 @@ +tests/cases/compiler/divergentAccessorsTypes2.ts(10,1): error TS2322: Type '42' is not assignable to type 'string | undefined'. + + +==== tests/cases/compiler/divergentAccessorsTypes2.ts (1 errors) ==== + class Test1 { + get foo(): T { return null as any } + set foo(s: T | undefined ) { + } + } + + const s = new Test1(); + s.foo = undefined; + s.foo = "hello"; + s.foo = 42; + ~~~~~ +!!! error TS2322: Type '42' is not assignable to type 'string | undefined'. + \ No newline at end of file diff --git a/tests/baselines/reference/divergentAccessorsTypes2.js b/tests/baselines/reference/divergentAccessorsTypes2.js new file mode 100644 index 0000000000000..2536c05c62640 --- /dev/null +++ b/tests/baselines/reference/divergentAccessorsTypes2.js @@ -0,0 +1,24 @@ +//// [divergentAccessorsTypes2.ts] +class Test1 { + get foo(): T { return null as any } + set foo(s: T | undefined ) { + } +} + +const s = new Test1(); +s.foo = undefined; +s.foo = "hello"; +s.foo = 42; + + +//// [divergentAccessorsTypes2.js] +"use strict"; +class Test1 { + get foo() { return null; } + set foo(s) { + } +} +const s = new Test1(); +s.foo = undefined; +s.foo = "hello"; +s.foo = 42; diff --git a/tests/baselines/reference/divergentAccessorsTypes2.symbols b/tests/baselines/reference/divergentAccessorsTypes2.symbols new file mode 100644 index 0000000000000..980f1b75dcd5d --- /dev/null +++ b/tests/baselines/reference/divergentAccessorsTypes2.symbols @@ -0,0 +1,36 @@ +=== tests/cases/compiler/divergentAccessorsTypes2.ts === +class Test1 { +>Test1 : Symbol(Test1, Decl(divergentAccessorsTypes2.ts, 0, 0)) +>T : Symbol(T, Decl(divergentAccessorsTypes2.ts, 0, 12)) + + get foo(): T { return null as any } +>foo : Symbol(Test1.foo, Decl(divergentAccessorsTypes2.ts, 0, 16), Decl(divergentAccessorsTypes2.ts, 1, 39)) +>T : Symbol(T, Decl(divergentAccessorsTypes2.ts, 0, 12)) + + set foo(s: T | undefined ) { +>foo : Symbol(Test1.foo, Decl(divergentAccessorsTypes2.ts, 0, 16), Decl(divergentAccessorsTypes2.ts, 1, 39)) +>s : Symbol(s, Decl(divergentAccessorsTypes2.ts, 2, 12)) +>T : Symbol(T, Decl(divergentAccessorsTypes2.ts, 0, 12)) + } +} + +const s = new Test1(); +>s : Symbol(s, Decl(divergentAccessorsTypes2.ts, 6, 5)) +>Test1 : Symbol(Test1, Decl(divergentAccessorsTypes2.ts, 0, 0)) + +s.foo = undefined; +>s.foo : Symbol(Test1.foo, Decl(divergentAccessorsTypes2.ts, 0, 16), Decl(divergentAccessorsTypes2.ts, 1, 39)) +>s : Symbol(s, Decl(divergentAccessorsTypes2.ts, 6, 5)) +>foo : Symbol(Test1.foo, Decl(divergentAccessorsTypes2.ts, 0, 16), Decl(divergentAccessorsTypes2.ts, 1, 39)) +>undefined : Symbol(undefined) + +s.foo = "hello"; +>s.foo : Symbol(Test1.foo, Decl(divergentAccessorsTypes2.ts, 0, 16), Decl(divergentAccessorsTypes2.ts, 1, 39)) +>s : Symbol(s, Decl(divergentAccessorsTypes2.ts, 6, 5)) +>foo : Symbol(Test1.foo, Decl(divergentAccessorsTypes2.ts, 0, 16), Decl(divergentAccessorsTypes2.ts, 1, 39)) + +s.foo = 42; +>s.foo : Symbol(Test1.foo, Decl(divergentAccessorsTypes2.ts, 0, 16), Decl(divergentAccessorsTypes2.ts, 1, 39)) +>s : Symbol(s, Decl(divergentAccessorsTypes2.ts, 6, 5)) +>foo : Symbol(Test1.foo, Decl(divergentAccessorsTypes2.ts, 0, 16), Decl(divergentAccessorsTypes2.ts, 1, 39)) + diff --git a/tests/baselines/reference/divergentAccessorsTypes2.types b/tests/baselines/reference/divergentAccessorsTypes2.types new file mode 100644 index 0000000000000..b05d04e135e1e --- /dev/null +++ b/tests/baselines/reference/divergentAccessorsTypes2.types @@ -0,0 +1,41 @@ +=== tests/cases/compiler/divergentAccessorsTypes2.ts === +class Test1 { +>Test1 : Test1 + + get foo(): T { return null as any } +>foo : T +>null as any : any +>null : null + + set foo(s: T | undefined ) { +>foo : T +>s : T | undefined + } +} + +const s = new Test1(); +>s : Test1 +>new Test1() : Test1 +>Test1 : typeof Test1 + +s.foo = undefined; +>s.foo = undefined : undefined +>s.foo : string | undefined +>s : Test1 +>foo : string | undefined +>undefined : undefined + +s.foo = "hello"; +>s.foo = "hello" : "hello" +>s.foo : string | undefined +>s : Test1 +>foo : string | undefined +>"hello" : "hello" + +s.foo = 42; +>s.foo = 42 : 42 +>s.foo : string | undefined +>s : Test1 +>foo : string | undefined +>42 : 42 + diff --git a/tests/baselines/reference/divergentAccessorsVisibility1.errors.txt b/tests/baselines/reference/divergentAccessorsVisibility1.errors.txt new file mode 100644 index 0000000000000..6de7cc11630c8 --- /dev/null +++ b/tests/baselines/reference/divergentAccessorsVisibility1.errors.txt @@ -0,0 +1,314 @@ +tests/cases/compiler/divergentAccessorsVisibility1.ts(11,19): error TS2808: A get accessor must be at least as accessible as the setter +tests/cases/compiler/divergentAccessorsVisibility1.ts(12,9): error TS2808: A get accessor must be at least as accessible as the setter +tests/cases/compiler/divergentAccessorsVisibility1.ts(20,17): error TS2808: A get accessor must be at least as accessible as the setter +tests/cases/compiler/divergentAccessorsVisibility1.ts(21,9): error TS2808: A get accessor must be at least as accessible as the setter +tests/cases/compiler/divergentAccessorsVisibility1.ts(23,17): error TS2808: A get accessor must be at least as accessible as the setter +tests/cases/compiler/divergentAccessorsVisibility1.ts(24,19): error TS2808: A get accessor must be at least as accessible as the setter +tests/cases/compiler/divergentAccessorsVisibility1.ts(66,14): error TS2341: Property 'PublicPrivate' is private and only accessible within class 'Base'. +tests/cases/compiler/divergentAccessorsVisibility1.ts(69,14): error TS2341: Property 'ProtectedPrivate' is private and only accessible within class 'Base'. +tests/cases/compiler/divergentAccessorsVisibility1.ts(72,14): error TS2341: Property 'PrivatePrivate' is private and only accessible within class 'Base'. +tests/cases/compiler/divergentAccessorsVisibility1.ts(80,19): error TS2341: Property 'PrivatePublic' is private and only accessible within class 'Base'. +tests/cases/compiler/divergentAccessorsVisibility1.ts(81,19): error TS2341: Property 'PrivateProtected' is private and only accessible within class 'Base'. +tests/cases/compiler/divergentAccessorsVisibility1.ts(82,19): error TS2341: Property 'PrivatePrivate' is private and only accessible within class 'Base'. +tests/cases/compiler/divergentAccessorsVisibility1.ts(86,14): error TS2341: Property 'PublicPrivate' is private and only accessible within class 'Base'. +tests/cases/compiler/divergentAccessorsVisibility1.ts(89,14): error TS2341: Property 'ProtectedPrivate' is private and only accessible within class 'Base'. +tests/cases/compiler/divergentAccessorsVisibility1.ts(92,14): error TS2341: Property 'PrivatePrivate' is private and only accessible within class 'Base'. +tests/cases/compiler/divergentAccessorsVisibility1.ts(99,10): error TS2445: Property 'PublicProtected' is protected and only accessible within class 'Base' and its subclasses. +tests/cases/compiler/divergentAccessorsVisibility1.ts(100,10): error TS2341: Property 'PublicPrivate' is private and only accessible within class 'Base'. +tests/cases/compiler/divergentAccessorsVisibility1.ts(102,10): error TS2445: Property 'ProtectedProtected' is protected and only accessible within class 'Base' and its subclasses. +tests/cases/compiler/divergentAccessorsVisibility1.ts(103,10): error TS2341: Property 'ProtectedPrivate' is private and only accessible within class 'Base'. +tests/cases/compiler/divergentAccessorsVisibility1.ts(105,10): error TS2445: Property 'PrivateProtected' is protected and only accessible within class 'Base' and its subclasses. +tests/cases/compiler/divergentAccessorsVisibility1.ts(106,10): error TS2341: Property 'PrivatePrivate' is private and only accessible within class 'Base'. +tests/cases/compiler/divergentAccessorsVisibility1.ts(111,15): error TS2445: Property 'ProtectedPublic' is protected and only accessible within class 'Base' and its subclasses. +tests/cases/compiler/divergentAccessorsVisibility1.ts(112,15): error TS2445: Property 'ProtectedProtected' is protected and only accessible within class 'Base' and its subclasses. +tests/cases/compiler/divergentAccessorsVisibility1.ts(113,15): error TS2445: Property 'ProtectedPrivate' is protected and only accessible within class 'Base' and its subclasses. +tests/cases/compiler/divergentAccessorsVisibility1.ts(114,15): error TS2341: Property 'PrivatePublic' is private and only accessible within class 'Base'. +tests/cases/compiler/divergentAccessorsVisibility1.ts(115,15): error TS2341: Property 'PrivateProtected' is private and only accessible within class 'Base'. +tests/cases/compiler/divergentAccessorsVisibility1.ts(116,15): error TS2341: Property 'PrivatePrivate' is private and only accessible within class 'Base'. +tests/cases/compiler/divergentAccessorsVisibility1.ts(119,10): error TS2445: Property 'PublicProtected' is protected and only accessible within class 'Base' and its subclasses. +tests/cases/compiler/divergentAccessorsVisibility1.ts(120,10): error TS2341: Property 'PublicPrivate' is private and only accessible within class 'Base'. +tests/cases/compiler/divergentAccessorsVisibility1.ts(122,10): error TS2445: Property 'ProtectedProtected' is protected and only accessible within class 'Base' and its subclasses. +tests/cases/compiler/divergentAccessorsVisibility1.ts(123,10): error TS2341: Property 'ProtectedPrivate' is private and only accessible within class 'Base'. +tests/cases/compiler/divergentAccessorsVisibility1.ts(125,10): error TS2445: Property 'PrivateProtected' is protected and only accessible within class 'Base' and its subclasses. +tests/cases/compiler/divergentAccessorsVisibility1.ts(126,10): error TS2341: Property 'PrivatePrivate' is private and only accessible within class 'Base'. +tests/cases/compiler/divergentAccessorsVisibility1.ts(129,11): error TS2445: Property 'PublicProtected' is protected and only accessible within class 'Base' and its subclasses. +tests/cases/compiler/divergentAccessorsVisibility1.ts(130,11): error TS2341: Property 'PublicPrivate' is private and only accessible within class 'Base'. +tests/cases/compiler/divergentAccessorsVisibility1.ts(132,11): error TS2445: Property 'ProtectedProtected' is protected and only accessible within class 'Base' and its subclasses. +tests/cases/compiler/divergentAccessorsVisibility1.ts(133,11): error TS2341: Property 'ProtectedPrivate' is private and only accessible within class 'Base'. +tests/cases/compiler/divergentAccessorsVisibility1.ts(135,11): error TS2445: Property 'PrivateProtected' is protected and only accessible within class 'Base' and its subclasses. +tests/cases/compiler/divergentAccessorsVisibility1.ts(136,11): error TS2341: Property 'PrivatePrivate' is private and only accessible within class 'Base'. +tests/cases/compiler/divergentAccessorsVisibility1.ts(141,16): error TS2445: Property 'ProtectedPublic' is protected and only accessible within class 'Base' and its subclasses. +tests/cases/compiler/divergentAccessorsVisibility1.ts(142,16): error TS2445: Property 'ProtectedProtected' is protected and only accessible within class 'Base' and its subclasses. +tests/cases/compiler/divergentAccessorsVisibility1.ts(143,16): error TS2445: Property 'ProtectedPrivate' is protected and only accessible within class 'Base' and its subclasses. +tests/cases/compiler/divergentAccessorsVisibility1.ts(144,16): error TS2341: Property 'PrivatePublic' is private and only accessible within class 'Base'. +tests/cases/compiler/divergentAccessorsVisibility1.ts(145,16): error TS2341: Property 'PrivateProtected' is private and only accessible within class 'Base'. +tests/cases/compiler/divergentAccessorsVisibility1.ts(146,16): error TS2341: Property 'PrivatePrivate' is private and only accessible within class 'Base'. +tests/cases/compiler/divergentAccessorsVisibility1.ts(149,11): error TS2445: Property 'PublicProtected' is protected and only accessible within class 'Base' and its subclasses. +tests/cases/compiler/divergentAccessorsVisibility1.ts(150,11): error TS2341: Property 'PublicPrivate' is private and only accessible within class 'Base'. +tests/cases/compiler/divergentAccessorsVisibility1.ts(152,11): error TS2445: Property 'ProtectedProtected' is protected and only accessible within class 'Base' and its subclasses. +tests/cases/compiler/divergentAccessorsVisibility1.ts(153,11): error TS2341: Property 'ProtectedPrivate' is private and only accessible within class 'Base'. +tests/cases/compiler/divergentAccessorsVisibility1.ts(155,11): error TS2445: Property 'PrivateProtected' is protected and only accessible within class 'Base' and its subclasses. +tests/cases/compiler/divergentAccessorsVisibility1.ts(156,11): error TS2341: Property 'PrivatePrivate' is private and only accessible within class 'Base'. + + +==== tests/cases/compiler/divergentAccessorsVisibility1.ts (51 errors) ==== + class Base { + get PublicPublic() { return 0; } + set PublicPublic(v) { return; } + + get PublicProtected() { return 0; } + protected set PublicProtected(v) { return; } + + get PublicPrivate() { return 0; } + private set PublicPrivate(v) { return; } + + protected get ProtectedPublic() { return 0; } + ~~~~~~~~~~~~~~~ +!!! error TS2808: A get accessor must be at least as accessible as the setter + set ProtectedPublic(v) { return; } + ~~~~~~~~~~~~~~~ +!!! error TS2808: A get accessor must be at least as accessible as the setter + + protected get ProtectedProtected() { return 0; } + protected set ProtectedProtected(v) { return; } + + protected get ProtectedPrivate() { return 0; } + private set ProtectedPrivate(v) { return; } + + private get PrivatePublic() { return 0; } + ~~~~~~~~~~~~~ +!!! error TS2808: A get accessor must be at least as accessible as the setter + set PrivatePublic(v) { return; } + ~~~~~~~~~~~~~ +!!! error TS2808: A get accessor must be at least as accessible as the setter + + private get PrivateProtected() { return 0; } + ~~~~~~~~~~~~~~~~ +!!! error TS2808: A get accessor must be at least as accessible as the setter + protected set PrivateProtected(v) { return; } + ~~~~~~~~~~~~~~~~ +!!! error TS2808: A get accessor must be at least as accessible as the setter + + private get PrivatePrivate() { return 0; } + private set PrivatePrivate(v) { return; } + + test() { + this.PublicPublic = 0; + this.PublicProtected = 0; + this.PublicPrivate = 0; + this.ProtectedPublic = 0; + this.ProtectedProtected = 0; + this.ProtectedPrivate = 0; + this.PrivatePublic = 0; + this.PrivateProtected = 0; + this.PrivatePrivate = 0; + + void this.PublicPublic; + void this.PublicProtected; + void this.PublicPrivate; + void this.ProtectedPublic; + void this.ProtectedProtected; + void this.ProtectedPrivate; + void this.PrivatePublic; + void this.PrivateProtected; + void this.PrivatePrivate; + + this.PublicPublic += 0; + this.PublicProtected += 0; + this.PublicPrivate += 0; + this.ProtectedPublic += 0; + this.ProtectedProtected += 0; + this.ProtectedPrivate += 0; + this.PrivatePublic += 0; + this.PrivateProtected += 0; + this.PrivatePrivate += 0; + } + } + + class Derived extends Base { + test2() { + this.PublicPublic = 0; + this.PublicProtected = 0; + this.PublicPrivate = 0; + ~~~~~~~~~~~~~ +!!! error TS2341: Property 'PublicPrivate' is private and only accessible within class 'Base'. + this.ProtectedPublic = 0; + this.ProtectedProtected = 0; + this.ProtectedPrivate = 0; + ~~~~~~~~~~~~~~~~ +!!! error TS2341: Property 'ProtectedPrivate' is private and only accessible within class 'Base'. + this.PrivatePublic = 0; + this.PrivateProtected = 0; + this.PrivatePrivate = 0; + ~~~~~~~~~~~~~~ +!!! error TS2341: Property 'PrivatePrivate' is private and only accessible within class 'Base'. + + void this.PublicPublic; + void this.PublicProtected; + void this.PublicPrivate; + void this.ProtectedPublic; + void this.ProtectedProtected; + void this.ProtectedPrivate; + void this.PrivatePublic; + ~~~~~~~~~~~~~ +!!! error TS2341: Property 'PrivatePublic' is private and only accessible within class 'Base'. + void this.PrivateProtected; + ~~~~~~~~~~~~~~~~ +!!! error TS2341: Property 'PrivateProtected' is private and only accessible within class 'Base'. + void this.PrivatePrivate; + ~~~~~~~~~~~~~~ +!!! error TS2341: Property 'PrivatePrivate' is private and only accessible within class 'Base'. + + this.PublicPublic += 0; + this.PublicProtected += 0; + this.PublicPrivate += 0; + ~~~~~~~~~~~~~ +!!! error TS2341: Property 'PublicPrivate' is private and only accessible within class 'Base'. + this.ProtectedPublic += 0; + this.ProtectedProtected += 0; + this.ProtectedPrivate += 0; + ~~~~~~~~~~~~~~~~ +!!! error TS2341: Property 'ProtectedPrivate' is private and only accessible within class 'Base'. + this.PrivatePublic += 0; + this.PrivateProtected += 0; + this.PrivatePrivate += 0; + ~~~~~~~~~~~~~~ +!!! error TS2341: Property 'PrivatePrivate' is private and only accessible within class 'Base'. + } + } + + declare const base: Base, deriv: Derived; + function fn() { + base.PublicPublic = 0; + base.PublicProtected = 0; + ~~~~~~~~~~~~~~~ +!!! error TS2445: Property 'PublicProtected' is protected and only accessible within class 'Base' and its subclasses. + base.PublicPrivate = 0; + ~~~~~~~~~~~~~ +!!! error TS2341: Property 'PublicPrivate' is private and only accessible within class 'Base'. + base.ProtectedPublic = 0; + base.ProtectedProtected = 0; + ~~~~~~~~~~~~~~~~~~ +!!! error TS2445: Property 'ProtectedProtected' is protected and only accessible within class 'Base' and its subclasses. + base.ProtectedPrivate = 0; + ~~~~~~~~~~~~~~~~ +!!! error TS2341: Property 'ProtectedPrivate' is private and only accessible within class 'Base'. + base.PrivatePublic = 0; + base.PrivateProtected = 0; + ~~~~~~~~~~~~~~~~ +!!! error TS2445: Property 'PrivateProtected' is protected and only accessible within class 'Base' and its subclasses. + base.PrivatePrivate = 0; + ~~~~~~~~~~~~~~ +!!! error TS2341: Property 'PrivatePrivate' is private and only accessible within class 'Base'. + + void base.PublicPublic; + void base.PublicProtected; + void base.PublicPrivate; + void base.ProtectedPublic; + ~~~~~~~~~~~~~~~ +!!! error TS2445: Property 'ProtectedPublic' is protected and only accessible within class 'Base' and its subclasses. + void base.ProtectedProtected; + ~~~~~~~~~~~~~~~~~~ +!!! error TS2445: Property 'ProtectedProtected' is protected and only accessible within class 'Base' and its subclasses. + void base.ProtectedPrivate; + ~~~~~~~~~~~~~~~~ +!!! error TS2445: Property 'ProtectedPrivate' is protected and only accessible within class 'Base' and its subclasses. + void base.PrivatePublic; + ~~~~~~~~~~~~~ +!!! error TS2341: Property 'PrivatePublic' is private and only accessible within class 'Base'. + void base.PrivateProtected; + ~~~~~~~~~~~~~~~~ +!!! error TS2341: Property 'PrivateProtected' is private and only accessible within class 'Base'. + void base.PrivatePrivate; + ~~~~~~~~~~~~~~ +!!! error TS2341: Property 'PrivatePrivate' is private and only accessible within class 'Base'. + + base.PublicPublic += 0; + base.PublicProtected += 0; + ~~~~~~~~~~~~~~~ +!!! error TS2445: Property 'PublicProtected' is protected and only accessible within class 'Base' and its subclasses. + base.PublicPrivate += 0; + ~~~~~~~~~~~~~ +!!! error TS2341: Property 'PublicPrivate' is private and only accessible within class 'Base'. + base.ProtectedPublic += 0; + base.ProtectedProtected += 0; + ~~~~~~~~~~~~~~~~~~ +!!! error TS2445: Property 'ProtectedProtected' is protected and only accessible within class 'Base' and its subclasses. + base.ProtectedPrivate += 0; + ~~~~~~~~~~~~~~~~ +!!! error TS2341: Property 'ProtectedPrivate' is private and only accessible within class 'Base'. + base.PrivatePublic += 0; + base.PrivateProtected += 0; + ~~~~~~~~~~~~~~~~ +!!! error TS2445: Property 'PrivateProtected' is protected and only accessible within class 'Base' and its subclasses. + base.PrivatePrivate += 0; + ~~~~~~~~~~~~~~ +!!! error TS2341: Property 'PrivatePrivate' is private and only accessible within class 'Base'. + + deriv.PublicPublic = 0; + deriv.PublicProtected = 0; + ~~~~~~~~~~~~~~~ +!!! error TS2445: Property 'PublicProtected' is protected and only accessible within class 'Base' and its subclasses. + deriv.PublicPrivate = 0; + ~~~~~~~~~~~~~ +!!! error TS2341: Property 'PublicPrivate' is private and only accessible within class 'Base'. + deriv.ProtectedPublic = 0; + deriv.ProtectedProtected = 0; + ~~~~~~~~~~~~~~~~~~ +!!! error TS2445: Property 'ProtectedProtected' is protected and only accessible within class 'Base' and its subclasses. + deriv.ProtectedPrivate = 0; + ~~~~~~~~~~~~~~~~ +!!! error TS2341: Property 'ProtectedPrivate' is private and only accessible within class 'Base'. + deriv.PrivatePublic = 0; + deriv.PrivateProtected = 0; + ~~~~~~~~~~~~~~~~ +!!! error TS2445: Property 'PrivateProtected' is protected and only accessible within class 'Base' and its subclasses. + deriv.PrivatePrivate = 0; + ~~~~~~~~~~~~~~ +!!! error TS2341: Property 'PrivatePrivate' is private and only accessible within class 'Base'. + + void deriv.PublicPublic; + void deriv.PublicProtected; + void deriv.PublicPrivate; + void deriv.ProtectedPublic; + ~~~~~~~~~~~~~~~ +!!! error TS2445: Property 'ProtectedPublic' is protected and only accessible within class 'Base' and its subclasses. + void deriv.ProtectedProtected; + ~~~~~~~~~~~~~~~~~~ +!!! error TS2445: Property 'ProtectedProtected' is protected and only accessible within class 'Base' and its subclasses. + void deriv.ProtectedPrivate; + ~~~~~~~~~~~~~~~~ +!!! error TS2445: Property 'ProtectedPrivate' is protected and only accessible within class 'Base' and its subclasses. + void deriv.PrivatePublic; + ~~~~~~~~~~~~~ +!!! error TS2341: Property 'PrivatePublic' is private and only accessible within class 'Base'. + void deriv.PrivateProtected; + ~~~~~~~~~~~~~~~~ +!!! error TS2341: Property 'PrivateProtected' is private and only accessible within class 'Base'. + void deriv.PrivatePrivate; + ~~~~~~~~~~~~~~ +!!! error TS2341: Property 'PrivatePrivate' is private and only accessible within class 'Base'. + + deriv.PublicPublic += 0; + deriv.PublicProtected += 0; + ~~~~~~~~~~~~~~~ +!!! error TS2445: Property 'PublicProtected' is protected and only accessible within class 'Base' and its subclasses. + deriv.PublicPrivate += 0; + ~~~~~~~~~~~~~ +!!! error TS2341: Property 'PublicPrivate' is private and only accessible within class 'Base'. + deriv.ProtectedPublic += 0; + deriv.ProtectedProtected += 0; + ~~~~~~~~~~~~~~~~~~ +!!! error TS2445: Property 'ProtectedProtected' is protected and only accessible within class 'Base' and its subclasses. + deriv.ProtectedPrivate += 0; + ~~~~~~~~~~~~~~~~ +!!! error TS2341: Property 'ProtectedPrivate' is private and only accessible within class 'Base'. + deriv.PrivatePublic += 0; + deriv.PrivateProtected += 0; + ~~~~~~~~~~~~~~~~ +!!! error TS2445: Property 'PrivateProtected' is protected and only accessible within class 'Base' and its subclasses. + deriv.PrivatePrivate += 0; + ~~~~~~~~~~~~~~ +!!! error TS2341: Property 'PrivatePrivate' is private and only accessible within class 'Base'. + } + \ No newline at end of file diff --git a/tests/baselines/reference/divergentAccessorsVisibility1.js b/tests/baselines/reference/divergentAccessorsVisibility1.js new file mode 100644 index 0000000000000..4fab6316e7644 --- /dev/null +++ b/tests/baselines/reference/divergentAccessorsVisibility1.js @@ -0,0 +1,298 @@ +//// [divergentAccessorsVisibility1.ts] +class Base { + get PublicPublic() { return 0; } + set PublicPublic(v) { return; } + + get PublicProtected() { return 0; } + protected set PublicProtected(v) { return; } + + get PublicPrivate() { return 0; } + private set PublicPrivate(v) { return; } + + protected get ProtectedPublic() { return 0; } + set ProtectedPublic(v) { return; } + + protected get ProtectedProtected() { return 0; } + protected set ProtectedProtected(v) { return; } + + protected get ProtectedPrivate() { return 0; } + private set ProtectedPrivate(v) { return; } + + private get PrivatePublic() { return 0; } + set PrivatePublic(v) { return; } + + private get PrivateProtected() { return 0; } + protected set PrivateProtected(v) { return; } + + private get PrivatePrivate() { return 0; } + private set PrivatePrivate(v) { return; } + + test() { + this.PublicPublic = 0; + this.PublicProtected = 0; + this.PublicPrivate = 0; + this.ProtectedPublic = 0; + this.ProtectedProtected = 0; + this.ProtectedPrivate = 0; + this.PrivatePublic = 0; + this.PrivateProtected = 0; + this.PrivatePrivate = 0; + + void this.PublicPublic; + void this.PublicProtected; + void this.PublicPrivate; + void this.ProtectedPublic; + void this.ProtectedProtected; + void this.ProtectedPrivate; + void this.PrivatePublic; + void this.PrivateProtected; + void this.PrivatePrivate; + + this.PublicPublic += 0; + this.PublicProtected += 0; + this.PublicPrivate += 0; + this.ProtectedPublic += 0; + this.ProtectedProtected += 0; + this.ProtectedPrivate += 0; + this.PrivatePublic += 0; + this.PrivateProtected += 0; + this.PrivatePrivate += 0; + } +} + +class Derived extends Base { + test2() { + this.PublicPublic = 0; + this.PublicProtected = 0; + this.PublicPrivate = 0; + this.ProtectedPublic = 0; + this.ProtectedProtected = 0; + this.ProtectedPrivate = 0; + this.PrivatePublic = 0; + this.PrivateProtected = 0; + this.PrivatePrivate = 0; + + void this.PublicPublic; + void this.PublicProtected; + void this.PublicPrivate; + void this.ProtectedPublic; + void this.ProtectedProtected; + void this.ProtectedPrivate; + void this.PrivatePublic; + void this.PrivateProtected; + void this.PrivatePrivate; + + this.PublicPublic += 0; + this.PublicProtected += 0; + this.PublicPrivate += 0; + this.ProtectedPublic += 0; + this.ProtectedProtected += 0; + this.ProtectedPrivate += 0; + this.PrivatePublic += 0; + this.PrivateProtected += 0; + this.PrivatePrivate += 0; + } +} + +declare const base: Base, deriv: Derived; +function fn() { + base.PublicPublic = 0; + base.PublicProtected = 0; + base.PublicPrivate = 0; + base.ProtectedPublic = 0; + base.ProtectedProtected = 0; + base.ProtectedPrivate = 0; + base.PrivatePublic = 0; + base.PrivateProtected = 0; + base.PrivatePrivate = 0; + + void base.PublicPublic; + void base.PublicProtected; + void base.PublicPrivate; + void base.ProtectedPublic; + void base.ProtectedProtected; + void base.ProtectedPrivate; + void base.PrivatePublic; + void base.PrivateProtected; + void base.PrivatePrivate; + + base.PublicPublic += 0; + base.PublicProtected += 0; + base.PublicPrivate += 0; + base.ProtectedPublic += 0; + base.ProtectedProtected += 0; + base.ProtectedPrivate += 0; + base.PrivatePublic += 0; + base.PrivateProtected += 0; + base.PrivatePrivate += 0; + + deriv.PublicPublic = 0; + deriv.PublicProtected = 0; + deriv.PublicPrivate = 0; + deriv.ProtectedPublic = 0; + deriv.ProtectedProtected = 0; + deriv.ProtectedPrivate = 0; + deriv.PrivatePublic = 0; + deriv.PrivateProtected = 0; + deriv.PrivatePrivate = 0; + + void deriv.PublicPublic; + void deriv.PublicProtected; + void deriv.PublicPrivate; + void deriv.ProtectedPublic; + void deriv.ProtectedProtected; + void deriv.ProtectedPrivate; + void deriv.PrivatePublic; + void deriv.PrivateProtected; + void deriv.PrivatePrivate; + + deriv.PublicPublic += 0; + deriv.PublicProtected += 0; + deriv.PublicPrivate += 0; + deriv.ProtectedPublic += 0; + deriv.ProtectedProtected += 0; + deriv.ProtectedPrivate += 0; + deriv.PrivatePublic += 0; + deriv.PrivateProtected += 0; + deriv.PrivatePrivate += 0; +} + + +//// [divergentAccessorsVisibility1.js] +"use strict"; +class Base { + get PublicPublic() { return 0; } + set PublicPublic(v) { return; } + get PublicProtected() { return 0; } + set PublicProtected(v) { return; } + get PublicPrivate() { return 0; } + set PublicPrivate(v) { return; } + get ProtectedPublic() { return 0; } + set ProtectedPublic(v) { return; } + get ProtectedProtected() { return 0; } + set ProtectedProtected(v) { return; } + get ProtectedPrivate() { return 0; } + set ProtectedPrivate(v) { return; } + get PrivatePublic() { return 0; } + set PrivatePublic(v) { return; } + get PrivateProtected() { return 0; } + set PrivateProtected(v) { return; } + get PrivatePrivate() { return 0; } + set PrivatePrivate(v) { return; } + test() { + this.PublicPublic = 0; + this.PublicProtected = 0; + this.PublicPrivate = 0; + this.ProtectedPublic = 0; + this.ProtectedProtected = 0; + this.ProtectedPrivate = 0; + this.PrivatePublic = 0; + this.PrivateProtected = 0; + this.PrivatePrivate = 0; + void this.PublicPublic; + void this.PublicProtected; + void this.PublicPrivate; + void this.ProtectedPublic; + void this.ProtectedProtected; + void this.ProtectedPrivate; + void this.PrivatePublic; + void this.PrivateProtected; + void this.PrivatePrivate; + this.PublicPublic += 0; + this.PublicProtected += 0; + this.PublicPrivate += 0; + this.ProtectedPublic += 0; + this.ProtectedProtected += 0; + this.ProtectedPrivate += 0; + this.PrivatePublic += 0; + this.PrivateProtected += 0; + this.PrivatePrivate += 0; + } +} +class Derived extends Base { + test2() { + this.PublicPublic = 0; + this.PublicProtected = 0; + this.PublicPrivate = 0; + this.ProtectedPublic = 0; + this.ProtectedProtected = 0; + this.ProtectedPrivate = 0; + this.PrivatePublic = 0; + this.PrivateProtected = 0; + this.PrivatePrivate = 0; + void this.PublicPublic; + void this.PublicProtected; + void this.PublicPrivate; + void this.ProtectedPublic; + void this.ProtectedProtected; + void this.ProtectedPrivate; + void this.PrivatePublic; + void this.PrivateProtected; + void this.PrivatePrivate; + this.PublicPublic += 0; + this.PublicProtected += 0; + this.PublicPrivate += 0; + this.ProtectedPublic += 0; + this.ProtectedProtected += 0; + this.ProtectedPrivate += 0; + this.PrivatePublic += 0; + this.PrivateProtected += 0; + this.PrivatePrivate += 0; + } +} +function fn() { + base.PublicPublic = 0; + base.PublicProtected = 0; + base.PublicPrivate = 0; + base.ProtectedPublic = 0; + base.ProtectedProtected = 0; + base.ProtectedPrivate = 0; + base.PrivatePublic = 0; + base.PrivateProtected = 0; + base.PrivatePrivate = 0; + void base.PublicPublic; + void base.PublicProtected; + void base.PublicPrivate; + void base.ProtectedPublic; + void base.ProtectedProtected; + void base.ProtectedPrivate; + void base.PrivatePublic; + void base.PrivateProtected; + void base.PrivatePrivate; + base.PublicPublic += 0; + base.PublicProtected += 0; + base.PublicPrivate += 0; + base.ProtectedPublic += 0; + base.ProtectedProtected += 0; + base.ProtectedPrivate += 0; + base.PrivatePublic += 0; + base.PrivateProtected += 0; + base.PrivatePrivate += 0; + deriv.PublicPublic = 0; + deriv.PublicProtected = 0; + deriv.PublicPrivate = 0; + deriv.ProtectedPublic = 0; + deriv.ProtectedProtected = 0; + deriv.ProtectedPrivate = 0; + deriv.PrivatePublic = 0; + deriv.PrivateProtected = 0; + deriv.PrivatePrivate = 0; + void deriv.PublicPublic; + void deriv.PublicProtected; + void deriv.PublicPrivate; + void deriv.ProtectedPublic; + void deriv.ProtectedProtected; + void deriv.ProtectedPrivate; + void deriv.PrivatePublic; + void deriv.PrivateProtected; + void deriv.PrivatePrivate; + deriv.PublicPublic += 0; + deriv.PublicProtected += 0; + deriv.PublicPrivate += 0; + deriv.ProtectedPublic += 0; + deriv.ProtectedProtected += 0; + deriv.ProtectedPrivate += 0; + deriv.PrivatePublic += 0; + deriv.PrivateProtected += 0; + deriv.PrivatePrivate += 0; +} diff --git a/tests/baselines/reference/divergentAccessorsVisibility1.symbols b/tests/baselines/reference/divergentAccessorsVisibility1.symbols new file mode 100644 index 0000000000000..84dd4b1596d68 --- /dev/null +++ b/tests/baselines/reference/divergentAccessorsVisibility1.symbols @@ -0,0 +1,631 @@ +=== tests/cases/compiler/divergentAccessorsVisibility1.ts === +class Base { +>Base : Symbol(Base, Decl(divergentAccessorsVisibility1.ts, 0, 0)) + + get PublicPublic() { return 0; } +>PublicPublic : Symbol(Base.PublicPublic, Decl(divergentAccessorsVisibility1.ts, 0, 12), Decl(divergentAccessorsVisibility1.ts, 1, 36)) + + set PublicPublic(v) { return; } +>PublicPublic : Symbol(Base.PublicPublic, Decl(divergentAccessorsVisibility1.ts, 0, 12), Decl(divergentAccessorsVisibility1.ts, 1, 36)) +>v : Symbol(v, Decl(divergentAccessorsVisibility1.ts, 2, 21)) + + get PublicProtected() { return 0; } +>PublicProtected : Symbol(Base.PublicProtected, Decl(divergentAccessorsVisibility1.ts, 2, 35), Decl(divergentAccessorsVisibility1.ts, 4, 39)) + + protected set PublicProtected(v) { return; } +>PublicProtected : Symbol(Base.PublicProtected, Decl(divergentAccessorsVisibility1.ts, 2, 35), Decl(divergentAccessorsVisibility1.ts, 4, 39)) +>v : Symbol(v, Decl(divergentAccessorsVisibility1.ts, 5, 34)) + + get PublicPrivate() { return 0; } +>PublicPrivate : Symbol(Base.PublicPrivate, Decl(divergentAccessorsVisibility1.ts, 5, 48), Decl(divergentAccessorsVisibility1.ts, 7, 37)) + + private set PublicPrivate(v) { return; } +>PublicPrivate : Symbol(Base.PublicPrivate, Decl(divergentAccessorsVisibility1.ts, 5, 48), Decl(divergentAccessorsVisibility1.ts, 7, 37)) +>v : Symbol(v, Decl(divergentAccessorsVisibility1.ts, 8, 30)) + + protected get ProtectedPublic() { return 0; } +>ProtectedPublic : Symbol(Base.ProtectedPublic, Decl(divergentAccessorsVisibility1.ts, 8, 44), Decl(divergentAccessorsVisibility1.ts, 10, 49)) + + set ProtectedPublic(v) { return; } +>ProtectedPublic : Symbol(Base.ProtectedPublic, Decl(divergentAccessorsVisibility1.ts, 8, 44), Decl(divergentAccessorsVisibility1.ts, 10, 49)) +>v : Symbol(v, Decl(divergentAccessorsVisibility1.ts, 11, 24)) + + protected get ProtectedProtected() { return 0; } +>ProtectedProtected : Symbol(Base.ProtectedProtected, Decl(divergentAccessorsVisibility1.ts, 11, 38), Decl(divergentAccessorsVisibility1.ts, 13, 52)) + + protected set ProtectedProtected(v) { return; } +>ProtectedProtected : Symbol(Base.ProtectedProtected, Decl(divergentAccessorsVisibility1.ts, 11, 38), Decl(divergentAccessorsVisibility1.ts, 13, 52)) +>v : Symbol(v, Decl(divergentAccessorsVisibility1.ts, 14, 37)) + + protected get ProtectedPrivate() { return 0; } +>ProtectedPrivate : Symbol(Base.ProtectedPrivate, Decl(divergentAccessorsVisibility1.ts, 14, 51), Decl(divergentAccessorsVisibility1.ts, 16, 50)) + + private set ProtectedPrivate(v) { return; } +>ProtectedPrivate : Symbol(Base.ProtectedPrivate, Decl(divergentAccessorsVisibility1.ts, 14, 51), Decl(divergentAccessorsVisibility1.ts, 16, 50)) +>v : Symbol(v, Decl(divergentAccessorsVisibility1.ts, 17, 33)) + + private get PrivatePublic() { return 0; } +>PrivatePublic : Symbol(Base.PrivatePublic, Decl(divergentAccessorsVisibility1.ts, 17, 47), Decl(divergentAccessorsVisibility1.ts, 19, 45)) + + set PrivatePublic(v) { return; } +>PrivatePublic : Symbol(Base.PrivatePublic, Decl(divergentAccessorsVisibility1.ts, 17, 47), Decl(divergentAccessorsVisibility1.ts, 19, 45)) +>v : Symbol(v, Decl(divergentAccessorsVisibility1.ts, 20, 22)) + + private get PrivateProtected() { return 0; } +>PrivateProtected : Symbol(Base.PrivateProtected, Decl(divergentAccessorsVisibility1.ts, 20, 36), Decl(divergentAccessorsVisibility1.ts, 22, 48)) + + protected set PrivateProtected(v) { return; } +>PrivateProtected : Symbol(Base.PrivateProtected, Decl(divergentAccessorsVisibility1.ts, 20, 36), Decl(divergentAccessorsVisibility1.ts, 22, 48)) +>v : Symbol(v, Decl(divergentAccessorsVisibility1.ts, 23, 35)) + + private get PrivatePrivate() { return 0; } +>PrivatePrivate : Symbol(Base.PrivatePrivate, Decl(divergentAccessorsVisibility1.ts, 23, 49), Decl(divergentAccessorsVisibility1.ts, 25, 46)) + + private set PrivatePrivate(v) { return; } +>PrivatePrivate : Symbol(Base.PrivatePrivate, Decl(divergentAccessorsVisibility1.ts, 23, 49), Decl(divergentAccessorsVisibility1.ts, 25, 46)) +>v : Symbol(v, Decl(divergentAccessorsVisibility1.ts, 26, 31)) + + test() { +>test : Symbol(Base.test, Decl(divergentAccessorsVisibility1.ts, 26, 45)) + + this.PublicPublic = 0; +>this.PublicPublic : Symbol(Base.PublicPublic, Decl(divergentAccessorsVisibility1.ts, 0, 12), Decl(divergentAccessorsVisibility1.ts, 1, 36)) +>this : Symbol(Base, Decl(divergentAccessorsVisibility1.ts, 0, 0)) +>PublicPublic : Symbol(Base.PublicPublic, Decl(divergentAccessorsVisibility1.ts, 0, 12), Decl(divergentAccessorsVisibility1.ts, 1, 36)) + + this.PublicProtected = 0; +>this.PublicProtected : Symbol(Base.PublicProtected, Decl(divergentAccessorsVisibility1.ts, 2, 35), Decl(divergentAccessorsVisibility1.ts, 4, 39)) +>this : Symbol(Base, Decl(divergentAccessorsVisibility1.ts, 0, 0)) +>PublicProtected : Symbol(Base.PublicProtected, Decl(divergentAccessorsVisibility1.ts, 2, 35), Decl(divergentAccessorsVisibility1.ts, 4, 39)) + + this.PublicPrivate = 0; +>this.PublicPrivate : Symbol(Base.PublicPrivate, Decl(divergentAccessorsVisibility1.ts, 5, 48), Decl(divergentAccessorsVisibility1.ts, 7, 37)) +>this : Symbol(Base, Decl(divergentAccessorsVisibility1.ts, 0, 0)) +>PublicPrivate : Symbol(Base.PublicPrivate, Decl(divergentAccessorsVisibility1.ts, 5, 48), Decl(divergentAccessorsVisibility1.ts, 7, 37)) + + this.ProtectedPublic = 0; +>this.ProtectedPublic : Symbol(Base.ProtectedPublic, Decl(divergentAccessorsVisibility1.ts, 8, 44), Decl(divergentAccessorsVisibility1.ts, 10, 49)) +>this : Symbol(Base, Decl(divergentAccessorsVisibility1.ts, 0, 0)) +>ProtectedPublic : Symbol(Base.ProtectedPublic, Decl(divergentAccessorsVisibility1.ts, 8, 44), Decl(divergentAccessorsVisibility1.ts, 10, 49)) + + this.ProtectedProtected = 0; +>this.ProtectedProtected : Symbol(Base.ProtectedProtected, Decl(divergentAccessorsVisibility1.ts, 11, 38), Decl(divergentAccessorsVisibility1.ts, 13, 52)) +>this : Symbol(Base, Decl(divergentAccessorsVisibility1.ts, 0, 0)) +>ProtectedProtected : Symbol(Base.ProtectedProtected, Decl(divergentAccessorsVisibility1.ts, 11, 38), Decl(divergentAccessorsVisibility1.ts, 13, 52)) + + this.ProtectedPrivate = 0; +>this.ProtectedPrivate : Symbol(Base.ProtectedPrivate, Decl(divergentAccessorsVisibility1.ts, 14, 51), Decl(divergentAccessorsVisibility1.ts, 16, 50)) +>this : Symbol(Base, Decl(divergentAccessorsVisibility1.ts, 0, 0)) +>ProtectedPrivate : Symbol(Base.ProtectedPrivate, Decl(divergentAccessorsVisibility1.ts, 14, 51), Decl(divergentAccessorsVisibility1.ts, 16, 50)) + + this.PrivatePublic = 0; +>this.PrivatePublic : Symbol(Base.PrivatePublic, Decl(divergentAccessorsVisibility1.ts, 17, 47), Decl(divergentAccessorsVisibility1.ts, 19, 45)) +>this : Symbol(Base, Decl(divergentAccessorsVisibility1.ts, 0, 0)) +>PrivatePublic : Symbol(Base.PrivatePublic, Decl(divergentAccessorsVisibility1.ts, 17, 47), Decl(divergentAccessorsVisibility1.ts, 19, 45)) + + this.PrivateProtected = 0; +>this.PrivateProtected : Symbol(Base.PrivateProtected, Decl(divergentAccessorsVisibility1.ts, 20, 36), Decl(divergentAccessorsVisibility1.ts, 22, 48)) +>this : Symbol(Base, Decl(divergentAccessorsVisibility1.ts, 0, 0)) +>PrivateProtected : Symbol(Base.PrivateProtected, Decl(divergentAccessorsVisibility1.ts, 20, 36), Decl(divergentAccessorsVisibility1.ts, 22, 48)) + + this.PrivatePrivate = 0; +>this.PrivatePrivate : Symbol(Base.PrivatePrivate, Decl(divergentAccessorsVisibility1.ts, 23, 49), Decl(divergentAccessorsVisibility1.ts, 25, 46)) +>this : Symbol(Base, Decl(divergentAccessorsVisibility1.ts, 0, 0)) +>PrivatePrivate : Symbol(Base.PrivatePrivate, Decl(divergentAccessorsVisibility1.ts, 23, 49), Decl(divergentAccessorsVisibility1.ts, 25, 46)) + + void this.PublicPublic; +>this.PublicPublic : Symbol(Base.PublicPublic, Decl(divergentAccessorsVisibility1.ts, 0, 12), Decl(divergentAccessorsVisibility1.ts, 1, 36)) +>this : Symbol(Base, Decl(divergentAccessorsVisibility1.ts, 0, 0)) +>PublicPublic : Symbol(Base.PublicPublic, Decl(divergentAccessorsVisibility1.ts, 0, 12), Decl(divergentAccessorsVisibility1.ts, 1, 36)) + + void this.PublicProtected; +>this.PublicProtected : Symbol(Base.PublicProtected, Decl(divergentAccessorsVisibility1.ts, 2, 35), Decl(divergentAccessorsVisibility1.ts, 4, 39)) +>this : Symbol(Base, Decl(divergentAccessorsVisibility1.ts, 0, 0)) +>PublicProtected : Symbol(Base.PublicProtected, Decl(divergentAccessorsVisibility1.ts, 2, 35), Decl(divergentAccessorsVisibility1.ts, 4, 39)) + + void this.PublicPrivate; +>this.PublicPrivate : Symbol(Base.PublicPrivate, Decl(divergentAccessorsVisibility1.ts, 5, 48), Decl(divergentAccessorsVisibility1.ts, 7, 37)) +>this : Symbol(Base, Decl(divergentAccessorsVisibility1.ts, 0, 0)) +>PublicPrivate : Symbol(Base.PublicPrivate, Decl(divergentAccessorsVisibility1.ts, 5, 48), Decl(divergentAccessorsVisibility1.ts, 7, 37)) + + void this.ProtectedPublic; +>this.ProtectedPublic : Symbol(Base.ProtectedPublic, Decl(divergentAccessorsVisibility1.ts, 8, 44), Decl(divergentAccessorsVisibility1.ts, 10, 49)) +>this : Symbol(Base, Decl(divergentAccessorsVisibility1.ts, 0, 0)) +>ProtectedPublic : Symbol(Base.ProtectedPublic, Decl(divergentAccessorsVisibility1.ts, 8, 44), Decl(divergentAccessorsVisibility1.ts, 10, 49)) + + void this.ProtectedProtected; +>this.ProtectedProtected : Symbol(Base.ProtectedProtected, Decl(divergentAccessorsVisibility1.ts, 11, 38), Decl(divergentAccessorsVisibility1.ts, 13, 52)) +>this : Symbol(Base, Decl(divergentAccessorsVisibility1.ts, 0, 0)) +>ProtectedProtected : Symbol(Base.ProtectedProtected, Decl(divergentAccessorsVisibility1.ts, 11, 38), Decl(divergentAccessorsVisibility1.ts, 13, 52)) + + void this.ProtectedPrivate; +>this.ProtectedPrivate : Symbol(Base.ProtectedPrivate, Decl(divergentAccessorsVisibility1.ts, 14, 51), Decl(divergentAccessorsVisibility1.ts, 16, 50)) +>this : Symbol(Base, Decl(divergentAccessorsVisibility1.ts, 0, 0)) +>ProtectedPrivate : Symbol(Base.ProtectedPrivate, Decl(divergentAccessorsVisibility1.ts, 14, 51), Decl(divergentAccessorsVisibility1.ts, 16, 50)) + + void this.PrivatePublic; +>this.PrivatePublic : Symbol(Base.PrivatePublic, Decl(divergentAccessorsVisibility1.ts, 17, 47), Decl(divergentAccessorsVisibility1.ts, 19, 45)) +>this : Symbol(Base, Decl(divergentAccessorsVisibility1.ts, 0, 0)) +>PrivatePublic : Symbol(Base.PrivatePublic, Decl(divergentAccessorsVisibility1.ts, 17, 47), Decl(divergentAccessorsVisibility1.ts, 19, 45)) + + void this.PrivateProtected; +>this.PrivateProtected : Symbol(Base.PrivateProtected, Decl(divergentAccessorsVisibility1.ts, 20, 36), Decl(divergentAccessorsVisibility1.ts, 22, 48)) +>this : Symbol(Base, Decl(divergentAccessorsVisibility1.ts, 0, 0)) +>PrivateProtected : Symbol(Base.PrivateProtected, Decl(divergentAccessorsVisibility1.ts, 20, 36), Decl(divergentAccessorsVisibility1.ts, 22, 48)) + + void this.PrivatePrivate; +>this.PrivatePrivate : Symbol(Base.PrivatePrivate, Decl(divergentAccessorsVisibility1.ts, 23, 49), Decl(divergentAccessorsVisibility1.ts, 25, 46)) +>this : Symbol(Base, Decl(divergentAccessorsVisibility1.ts, 0, 0)) +>PrivatePrivate : Symbol(Base.PrivatePrivate, Decl(divergentAccessorsVisibility1.ts, 23, 49), Decl(divergentAccessorsVisibility1.ts, 25, 46)) + + this.PublicPublic += 0; +>this.PublicPublic : Symbol(Base.PublicPublic, Decl(divergentAccessorsVisibility1.ts, 0, 12), Decl(divergentAccessorsVisibility1.ts, 1, 36)) +>this : Symbol(Base, Decl(divergentAccessorsVisibility1.ts, 0, 0)) +>PublicPublic : Symbol(Base.PublicPublic, Decl(divergentAccessorsVisibility1.ts, 0, 12), Decl(divergentAccessorsVisibility1.ts, 1, 36)) + + this.PublicProtected += 0; +>this.PublicProtected : Symbol(Base.PublicProtected, Decl(divergentAccessorsVisibility1.ts, 2, 35), Decl(divergentAccessorsVisibility1.ts, 4, 39)) +>this : Symbol(Base, Decl(divergentAccessorsVisibility1.ts, 0, 0)) +>PublicProtected : Symbol(Base.PublicProtected, Decl(divergentAccessorsVisibility1.ts, 2, 35), Decl(divergentAccessorsVisibility1.ts, 4, 39)) + + this.PublicPrivate += 0; +>this.PublicPrivate : Symbol(Base.PublicPrivate, Decl(divergentAccessorsVisibility1.ts, 5, 48), Decl(divergentAccessorsVisibility1.ts, 7, 37)) +>this : Symbol(Base, Decl(divergentAccessorsVisibility1.ts, 0, 0)) +>PublicPrivate : Symbol(Base.PublicPrivate, Decl(divergentAccessorsVisibility1.ts, 5, 48), Decl(divergentAccessorsVisibility1.ts, 7, 37)) + + this.ProtectedPublic += 0; +>this.ProtectedPublic : Symbol(Base.ProtectedPublic, Decl(divergentAccessorsVisibility1.ts, 8, 44), Decl(divergentAccessorsVisibility1.ts, 10, 49)) +>this : Symbol(Base, Decl(divergentAccessorsVisibility1.ts, 0, 0)) +>ProtectedPublic : Symbol(Base.ProtectedPublic, Decl(divergentAccessorsVisibility1.ts, 8, 44), Decl(divergentAccessorsVisibility1.ts, 10, 49)) + + this.ProtectedProtected += 0; +>this.ProtectedProtected : Symbol(Base.ProtectedProtected, Decl(divergentAccessorsVisibility1.ts, 11, 38), Decl(divergentAccessorsVisibility1.ts, 13, 52)) +>this : Symbol(Base, Decl(divergentAccessorsVisibility1.ts, 0, 0)) +>ProtectedProtected : Symbol(Base.ProtectedProtected, Decl(divergentAccessorsVisibility1.ts, 11, 38), Decl(divergentAccessorsVisibility1.ts, 13, 52)) + + this.ProtectedPrivate += 0; +>this.ProtectedPrivate : Symbol(Base.ProtectedPrivate, Decl(divergentAccessorsVisibility1.ts, 14, 51), Decl(divergentAccessorsVisibility1.ts, 16, 50)) +>this : Symbol(Base, Decl(divergentAccessorsVisibility1.ts, 0, 0)) +>ProtectedPrivate : Symbol(Base.ProtectedPrivate, Decl(divergentAccessorsVisibility1.ts, 14, 51), Decl(divergentAccessorsVisibility1.ts, 16, 50)) + + this.PrivatePublic += 0; +>this.PrivatePublic : Symbol(Base.PrivatePublic, Decl(divergentAccessorsVisibility1.ts, 17, 47), Decl(divergentAccessorsVisibility1.ts, 19, 45)) +>this : Symbol(Base, Decl(divergentAccessorsVisibility1.ts, 0, 0)) +>PrivatePublic : Symbol(Base.PrivatePublic, Decl(divergentAccessorsVisibility1.ts, 17, 47), Decl(divergentAccessorsVisibility1.ts, 19, 45)) + + this.PrivateProtected += 0; +>this.PrivateProtected : Symbol(Base.PrivateProtected, Decl(divergentAccessorsVisibility1.ts, 20, 36), Decl(divergentAccessorsVisibility1.ts, 22, 48)) +>this : Symbol(Base, Decl(divergentAccessorsVisibility1.ts, 0, 0)) +>PrivateProtected : Symbol(Base.PrivateProtected, Decl(divergentAccessorsVisibility1.ts, 20, 36), Decl(divergentAccessorsVisibility1.ts, 22, 48)) + + this.PrivatePrivate += 0; +>this.PrivatePrivate : Symbol(Base.PrivatePrivate, Decl(divergentAccessorsVisibility1.ts, 23, 49), Decl(divergentAccessorsVisibility1.ts, 25, 46)) +>this : Symbol(Base, Decl(divergentAccessorsVisibility1.ts, 0, 0)) +>PrivatePrivate : Symbol(Base.PrivatePrivate, Decl(divergentAccessorsVisibility1.ts, 23, 49), Decl(divergentAccessorsVisibility1.ts, 25, 46)) + } +} + +class Derived extends Base { +>Derived : Symbol(Derived, Decl(divergentAccessorsVisibility1.ts, 59, 1)) +>Base : Symbol(Base, Decl(divergentAccessorsVisibility1.ts, 0, 0)) + + test2() { +>test2 : Symbol(Derived.test2, Decl(divergentAccessorsVisibility1.ts, 61, 28)) + + this.PublicPublic = 0; +>this.PublicPublic : Symbol(Base.PublicPublic, Decl(divergentAccessorsVisibility1.ts, 0, 12), Decl(divergentAccessorsVisibility1.ts, 1, 36)) +>this : Symbol(Derived, Decl(divergentAccessorsVisibility1.ts, 59, 1)) +>PublicPublic : Symbol(Base.PublicPublic, Decl(divergentAccessorsVisibility1.ts, 0, 12), Decl(divergentAccessorsVisibility1.ts, 1, 36)) + + this.PublicProtected = 0; +>this.PublicProtected : Symbol(Base.PublicProtected, Decl(divergentAccessorsVisibility1.ts, 2, 35), Decl(divergentAccessorsVisibility1.ts, 4, 39)) +>this : Symbol(Derived, Decl(divergentAccessorsVisibility1.ts, 59, 1)) +>PublicProtected : Symbol(Base.PublicProtected, Decl(divergentAccessorsVisibility1.ts, 2, 35), Decl(divergentAccessorsVisibility1.ts, 4, 39)) + + this.PublicPrivate = 0; +>this.PublicPrivate : Symbol(Base.PublicPrivate, Decl(divergentAccessorsVisibility1.ts, 5, 48), Decl(divergentAccessorsVisibility1.ts, 7, 37)) +>this : Symbol(Derived, Decl(divergentAccessorsVisibility1.ts, 59, 1)) +>PublicPrivate : Symbol(Base.PublicPrivate, Decl(divergentAccessorsVisibility1.ts, 5, 48), Decl(divergentAccessorsVisibility1.ts, 7, 37)) + + this.ProtectedPublic = 0; +>this.ProtectedPublic : Symbol(Base.ProtectedPublic, Decl(divergentAccessorsVisibility1.ts, 8, 44), Decl(divergentAccessorsVisibility1.ts, 10, 49)) +>this : Symbol(Derived, Decl(divergentAccessorsVisibility1.ts, 59, 1)) +>ProtectedPublic : Symbol(Base.ProtectedPublic, Decl(divergentAccessorsVisibility1.ts, 8, 44), Decl(divergentAccessorsVisibility1.ts, 10, 49)) + + this.ProtectedProtected = 0; +>this.ProtectedProtected : Symbol(Base.ProtectedProtected, Decl(divergentAccessorsVisibility1.ts, 11, 38), Decl(divergentAccessorsVisibility1.ts, 13, 52)) +>this : Symbol(Derived, Decl(divergentAccessorsVisibility1.ts, 59, 1)) +>ProtectedProtected : Symbol(Base.ProtectedProtected, Decl(divergentAccessorsVisibility1.ts, 11, 38), Decl(divergentAccessorsVisibility1.ts, 13, 52)) + + this.ProtectedPrivate = 0; +>this.ProtectedPrivate : Symbol(Base.ProtectedPrivate, Decl(divergentAccessorsVisibility1.ts, 14, 51), Decl(divergentAccessorsVisibility1.ts, 16, 50)) +>this : Symbol(Derived, Decl(divergentAccessorsVisibility1.ts, 59, 1)) +>ProtectedPrivate : Symbol(Base.ProtectedPrivate, Decl(divergentAccessorsVisibility1.ts, 14, 51), Decl(divergentAccessorsVisibility1.ts, 16, 50)) + + this.PrivatePublic = 0; +>this.PrivatePublic : Symbol(Base.PrivatePublic, Decl(divergentAccessorsVisibility1.ts, 17, 47), Decl(divergentAccessorsVisibility1.ts, 19, 45)) +>this : Symbol(Derived, Decl(divergentAccessorsVisibility1.ts, 59, 1)) +>PrivatePublic : Symbol(Base.PrivatePublic, Decl(divergentAccessorsVisibility1.ts, 17, 47), Decl(divergentAccessorsVisibility1.ts, 19, 45)) + + this.PrivateProtected = 0; +>this.PrivateProtected : Symbol(Base.PrivateProtected, Decl(divergentAccessorsVisibility1.ts, 20, 36), Decl(divergentAccessorsVisibility1.ts, 22, 48)) +>this : Symbol(Derived, Decl(divergentAccessorsVisibility1.ts, 59, 1)) +>PrivateProtected : Symbol(Base.PrivateProtected, Decl(divergentAccessorsVisibility1.ts, 20, 36), Decl(divergentAccessorsVisibility1.ts, 22, 48)) + + this.PrivatePrivate = 0; +>this.PrivatePrivate : Symbol(Base.PrivatePrivate, Decl(divergentAccessorsVisibility1.ts, 23, 49), Decl(divergentAccessorsVisibility1.ts, 25, 46)) +>this : Symbol(Derived, Decl(divergentAccessorsVisibility1.ts, 59, 1)) +>PrivatePrivate : Symbol(Base.PrivatePrivate, Decl(divergentAccessorsVisibility1.ts, 23, 49), Decl(divergentAccessorsVisibility1.ts, 25, 46)) + + void this.PublicPublic; +>this.PublicPublic : Symbol(Base.PublicPublic, Decl(divergentAccessorsVisibility1.ts, 0, 12), Decl(divergentAccessorsVisibility1.ts, 1, 36)) +>this : Symbol(Derived, Decl(divergentAccessorsVisibility1.ts, 59, 1)) +>PublicPublic : Symbol(Base.PublicPublic, Decl(divergentAccessorsVisibility1.ts, 0, 12), Decl(divergentAccessorsVisibility1.ts, 1, 36)) + + void this.PublicProtected; +>this.PublicProtected : Symbol(Base.PublicProtected, Decl(divergentAccessorsVisibility1.ts, 2, 35), Decl(divergentAccessorsVisibility1.ts, 4, 39)) +>this : Symbol(Derived, Decl(divergentAccessorsVisibility1.ts, 59, 1)) +>PublicProtected : Symbol(Base.PublicProtected, Decl(divergentAccessorsVisibility1.ts, 2, 35), Decl(divergentAccessorsVisibility1.ts, 4, 39)) + + void this.PublicPrivate; +>this.PublicPrivate : Symbol(Base.PublicPrivate, Decl(divergentAccessorsVisibility1.ts, 5, 48), Decl(divergentAccessorsVisibility1.ts, 7, 37)) +>this : Symbol(Derived, Decl(divergentAccessorsVisibility1.ts, 59, 1)) +>PublicPrivate : Symbol(Base.PublicPrivate, Decl(divergentAccessorsVisibility1.ts, 5, 48), Decl(divergentAccessorsVisibility1.ts, 7, 37)) + + void this.ProtectedPublic; +>this.ProtectedPublic : Symbol(Base.ProtectedPublic, Decl(divergentAccessorsVisibility1.ts, 8, 44), Decl(divergentAccessorsVisibility1.ts, 10, 49)) +>this : Symbol(Derived, Decl(divergentAccessorsVisibility1.ts, 59, 1)) +>ProtectedPublic : Symbol(Base.ProtectedPublic, Decl(divergentAccessorsVisibility1.ts, 8, 44), Decl(divergentAccessorsVisibility1.ts, 10, 49)) + + void this.ProtectedProtected; +>this.ProtectedProtected : Symbol(Base.ProtectedProtected, Decl(divergentAccessorsVisibility1.ts, 11, 38), Decl(divergentAccessorsVisibility1.ts, 13, 52)) +>this : Symbol(Derived, Decl(divergentAccessorsVisibility1.ts, 59, 1)) +>ProtectedProtected : Symbol(Base.ProtectedProtected, Decl(divergentAccessorsVisibility1.ts, 11, 38), Decl(divergentAccessorsVisibility1.ts, 13, 52)) + + void this.ProtectedPrivate; +>this.ProtectedPrivate : Symbol(Base.ProtectedPrivate, Decl(divergentAccessorsVisibility1.ts, 14, 51), Decl(divergentAccessorsVisibility1.ts, 16, 50)) +>this : Symbol(Derived, Decl(divergentAccessorsVisibility1.ts, 59, 1)) +>ProtectedPrivate : Symbol(Base.ProtectedPrivate, Decl(divergentAccessorsVisibility1.ts, 14, 51), Decl(divergentAccessorsVisibility1.ts, 16, 50)) + + void this.PrivatePublic; +>this.PrivatePublic : Symbol(Base.PrivatePublic, Decl(divergentAccessorsVisibility1.ts, 17, 47), Decl(divergentAccessorsVisibility1.ts, 19, 45)) +>this : Symbol(Derived, Decl(divergentAccessorsVisibility1.ts, 59, 1)) +>PrivatePublic : Symbol(Base.PrivatePublic, Decl(divergentAccessorsVisibility1.ts, 17, 47), Decl(divergentAccessorsVisibility1.ts, 19, 45)) + + void this.PrivateProtected; +>this.PrivateProtected : Symbol(Base.PrivateProtected, Decl(divergentAccessorsVisibility1.ts, 20, 36), Decl(divergentAccessorsVisibility1.ts, 22, 48)) +>this : Symbol(Derived, Decl(divergentAccessorsVisibility1.ts, 59, 1)) +>PrivateProtected : Symbol(Base.PrivateProtected, Decl(divergentAccessorsVisibility1.ts, 20, 36), Decl(divergentAccessorsVisibility1.ts, 22, 48)) + + void this.PrivatePrivate; +>this.PrivatePrivate : Symbol(Base.PrivatePrivate, Decl(divergentAccessorsVisibility1.ts, 23, 49), Decl(divergentAccessorsVisibility1.ts, 25, 46)) +>this : Symbol(Derived, Decl(divergentAccessorsVisibility1.ts, 59, 1)) +>PrivatePrivate : Symbol(Base.PrivatePrivate, Decl(divergentAccessorsVisibility1.ts, 23, 49), Decl(divergentAccessorsVisibility1.ts, 25, 46)) + + this.PublicPublic += 0; +>this.PublicPublic : Symbol(Base.PublicPublic, Decl(divergentAccessorsVisibility1.ts, 0, 12), Decl(divergentAccessorsVisibility1.ts, 1, 36)) +>this : Symbol(Derived, Decl(divergentAccessorsVisibility1.ts, 59, 1)) +>PublicPublic : Symbol(Base.PublicPublic, Decl(divergentAccessorsVisibility1.ts, 0, 12), Decl(divergentAccessorsVisibility1.ts, 1, 36)) + + this.PublicProtected += 0; +>this.PublicProtected : Symbol(Base.PublicProtected, Decl(divergentAccessorsVisibility1.ts, 2, 35), Decl(divergentAccessorsVisibility1.ts, 4, 39)) +>this : Symbol(Derived, Decl(divergentAccessorsVisibility1.ts, 59, 1)) +>PublicProtected : Symbol(Base.PublicProtected, Decl(divergentAccessorsVisibility1.ts, 2, 35), Decl(divergentAccessorsVisibility1.ts, 4, 39)) + + this.PublicPrivate += 0; +>this.PublicPrivate : Symbol(Base.PublicPrivate, Decl(divergentAccessorsVisibility1.ts, 5, 48), Decl(divergentAccessorsVisibility1.ts, 7, 37)) +>this : Symbol(Derived, Decl(divergentAccessorsVisibility1.ts, 59, 1)) +>PublicPrivate : Symbol(Base.PublicPrivate, Decl(divergentAccessorsVisibility1.ts, 5, 48), Decl(divergentAccessorsVisibility1.ts, 7, 37)) + + this.ProtectedPublic += 0; +>this.ProtectedPublic : Symbol(Base.ProtectedPublic, Decl(divergentAccessorsVisibility1.ts, 8, 44), Decl(divergentAccessorsVisibility1.ts, 10, 49)) +>this : Symbol(Derived, Decl(divergentAccessorsVisibility1.ts, 59, 1)) +>ProtectedPublic : Symbol(Base.ProtectedPublic, Decl(divergentAccessorsVisibility1.ts, 8, 44), Decl(divergentAccessorsVisibility1.ts, 10, 49)) + + this.ProtectedProtected += 0; +>this.ProtectedProtected : Symbol(Base.ProtectedProtected, Decl(divergentAccessorsVisibility1.ts, 11, 38), Decl(divergentAccessorsVisibility1.ts, 13, 52)) +>this : Symbol(Derived, Decl(divergentAccessorsVisibility1.ts, 59, 1)) +>ProtectedProtected : Symbol(Base.ProtectedProtected, Decl(divergentAccessorsVisibility1.ts, 11, 38), Decl(divergentAccessorsVisibility1.ts, 13, 52)) + + this.ProtectedPrivate += 0; +>this.ProtectedPrivate : Symbol(Base.ProtectedPrivate, Decl(divergentAccessorsVisibility1.ts, 14, 51), Decl(divergentAccessorsVisibility1.ts, 16, 50)) +>this : Symbol(Derived, Decl(divergentAccessorsVisibility1.ts, 59, 1)) +>ProtectedPrivate : Symbol(Base.ProtectedPrivate, Decl(divergentAccessorsVisibility1.ts, 14, 51), Decl(divergentAccessorsVisibility1.ts, 16, 50)) + + this.PrivatePublic += 0; +>this.PrivatePublic : Symbol(Base.PrivatePublic, Decl(divergentAccessorsVisibility1.ts, 17, 47), Decl(divergentAccessorsVisibility1.ts, 19, 45)) +>this : Symbol(Derived, Decl(divergentAccessorsVisibility1.ts, 59, 1)) +>PrivatePublic : Symbol(Base.PrivatePublic, Decl(divergentAccessorsVisibility1.ts, 17, 47), Decl(divergentAccessorsVisibility1.ts, 19, 45)) + + this.PrivateProtected += 0; +>this.PrivateProtected : Symbol(Base.PrivateProtected, Decl(divergentAccessorsVisibility1.ts, 20, 36), Decl(divergentAccessorsVisibility1.ts, 22, 48)) +>this : Symbol(Derived, Decl(divergentAccessorsVisibility1.ts, 59, 1)) +>PrivateProtected : Symbol(Base.PrivateProtected, Decl(divergentAccessorsVisibility1.ts, 20, 36), Decl(divergentAccessorsVisibility1.ts, 22, 48)) + + this.PrivatePrivate += 0; +>this.PrivatePrivate : Symbol(Base.PrivatePrivate, Decl(divergentAccessorsVisibility1.ts, 23, 49), Decl(divergentAccessorsVisibility1.ts, 25, 46)) +>this : Symbol(Derived, Decl(divergentAccessorsVisibility1.ts, 59, 1)) +>PrivatePrivate : Symbol(Base.PrivatePrivate, Decl(divergentAccessorsVisibility1.ts, 23, 49), Decl(divergentAccessorsVisibility1.ts, 25, 46)) + } +} + +declare const base: Base, deriv: Derived; +>base : Symbol(base, Decl(divergentAccessorsVisibility1.ts, 95, 13)) +>Base : Symbol(Base, Decl(divergentAccessorsVisibility1.ts, 0, 0)) +>deriv : Symbol(deriv, Decl(divergentAccessorsVisibility1.ts, 95, 25)) +>Derived : Symbol(Derived, Decl(divergentAccessorsVisibility1.ts, 59, 1)) + +function fn() { +>fn : Symbol(fn, Decl(divergentAccessorsVisibility1.ts, 95, 41)) + + base.PublicPublic = 0; +>base.PublicPublic : Symbol(Base.PublicPublic, Decl(divergentAccessorsVisibility1.ts, 0, 12), Decl(divergentAccessorsVisibility1.ts, 1, 36)) +>base : Symbol(base, Decl(divergentAccessorsVisibility1.ts, 95, 13)) +>PublicPublic : Symbol(Base.PublicPublic, Decl(divergentAccessorsVisibility1.ts, 0, 12), Decl(divergentAccessorsVisibility1.ts, 1, 36)) + + base.PublicProtected = 0; +>base.PublicProtected : Symbol(Base.PublicProtected, Decl(divergentAccessorsVisibility1.ts, 2, 35), Decl(divergentAccessorsVisibility1.ts, 4, 39)) +>base : Symbol(base, Decl(divergentAccessorsVisibility1.ts, 95, 13)) +>PublicProtected : Symbol(Base.PublicProtected, Decl(divergentAccessorsVisibility1.ts, 2, 35), Decl(divergentAccessorsVisibility1.ts, 4, 39)) + + base.PublicPrivate = 0; +>base.PublicPrivate : Symbol(Base.PublicPrivate, Decl(divergentAccessorsVisibility1.ts, 5, 48), Decl(divergentAccessorsVisibility1.ts, 7, 37)) +>base : Symbol(base, Decl(divergentAccessorsVisibility1.ts, 95, 13)) +>PublicPrivate : Symbol(Base.PublicPrivate, Decl(divergentAccessorsVisibility1.ts, 5, 48), Decl(divergentAccessorsVisibility1.ts, 7, 37)) + + base.ProtectedPublic = 0; +>base.ProtectedPublic : Symbol(Base.ProtectedPublic, Decl(divergentAccessorsVisibility1.ts, 8, 44), Decl(divergentAccessorsVisibility1.ts, 10, 49)) +>base : Symbol(base, Decl(divergentAccessorsVisibility1.ts, 95, 13)) +>ProtectedPublic : Symbol(Base.ProtectedPublic, Decl(divergentAccessorsVisibility1.ts, 8, 44), Decl(divergentAccessorsVisibility1.ts, 10, 49)) + + base.ProtectedProtected = 0; +>base.ProtectedProtected : Symbol(Base.ProtectedProtected, Decl(divergentAccessorsVisibility1.ts, 11, 38), Decl(divergentAccessorsVisibility1.ts, 13, 52)) +>base : Symbol(base, Decl(divergentAccessorsVisibility1.ts, 95, 13)) +>ProtectedProtected : Symbol(Base.ProtectedProtected, Decl(divergentAccessorsVisibility1.ts, 11, 38), Decl(divergentAccessorsVisibility1.ts, 13, 52)) + + base.ProtectedPrivate = 0; +>base.ProtectedPrivate : Symbol(Base.ProtectedPrivate, Decl(divergentAccessorsVisibility1.ts, 14, 51), Decl(divergentAccessorsVisibility1.ts, 16, 50)) +>base : Symbol(base, Decl(divergentAccessorsVisibility1.ts, 95, 13)) +>ProtectedPrivate : Symbol(Base.ProtectedPrivate, Decl(divergentAccessorsVisibility1.ts, 14, 51), Decl(divergentAccessorsVisibility1.ts, 16, 50)) + + base.PrivatePublic = 0; +>base.PrivatePublic : Symbol(Base.PrivatePublic, Decl(divergentAccessorsVisibility1.ts, 17, 47), Decl(divergentAccessorsVisibility1.ts, 19, 45)) +>base : Symbol(base, Decl(divergentAccessorsVisibility1.ts, 95, 13)) +>PrivatePublic : Symbol(Base.PrivatePublic, Decl(divergentAccessorsVisibility1.ts, 17, 47), Decl(divergentAccessorsVisibility1.ts, 19, 45)) + + base.PrivateProtected = 0; +>base.PrivateProtected : Symbol(Base.PrivateProtected, Decl(divergentAccessorsVisibility1.ts, 20, 36), Decl(divergentAccessorsVisibility1.ts, 22, 48)) +>base : Symbol(base, Decl(divergentAccessorsVisibility1.ts, 95, 13)) +>PrivateProtected : Symbol(Base.PrivateProtected, Decl(divergentAccessorsVisibility1.ts, 20, 36), Decl(divergentAccessorsVisibility1.ts, 22, 48)) + + base.PrivatePrivate = 0; +>base.PrivatePrivate : Symbol(Base.PrivatePrivate, Decl(divergentAccessorsVisibility1.ts, 23, 49), Decl(divergentAccessorsVisibility1.ts, 25, 46)) +>base : Symbol(base, Decl(divergentAccessorsVisibility1.ts, 95, 13)) +>PrivatePrivate : Symbol(Base.PrivatePrivate, Decl(divergentAccessorsVisibility1.ts, 23, 49), Decl(divergentAccessorsVisibility1.ts, 25, 46)) + + void base.PublicPublic; +>base.PublicPublic : Symbol(Base.PublicPublic, Decl(divergentAccessorsVisibility1.ts, 0, 12), Decl(divergentAccessorsVisibility1.ts, 1, 36)) +>base : Symbol(base, Decl(divergentAccessorsVisibility1.ts, 95, 13)) +>PublicPublic : Symbol(Base.PublicPublic, Decl(divergentAccessorsVisibility1.ts, 0, 12), Decl(divergentAccessorsVisibility1.ts, 1, 36)) + + void base.PublicProtected; +>base.PublicProtected : Symbol(Base.PublicProtected, Decl(divergentAccessorsVisibility1.ts, 2, 35), Decl(divergentAccessorsVisibility1.ts, 4, 39)) +>base : Symbol(base, Decl(divergentAccessorsVisibility1.ts, 95, 13)) +>PublicProtected : Symbol(Base.PublicProtected, Decl(divergentAccessorsVisibility1.ts, 2, 35), Decl(divergentAccessorsVisibility1.ts, 4, 39)) + + void base.PublicPrivate; +>base.PublicPrivate : Symbol(Base.PublicPrivate, Decl(divergentAccessorsVisibility1.ts, 5, 48), Decl(divergentAccessorsVisibility1.ts, 7, 37)) +>base : Symbol(base, Decl(divergentAccessorsVisibility1.ts, 95, 13)) +>PublicPrivate : Symbol(Base.PublicPrivate, Decl(divergentAccessorsVisibility1.ts, 5, 48), Decl(divergentAccessorsVisibility1.ts, 7, 37)) + + void base.ProtectedPublic; +>base.ProtectedPublic : Symbol(Base.ProtectedPublic, Decl(divergentAccessorsVisibility1.ts, 8, 44), Decl(divergentAccessorsVisibility1.ts, 10, 49)) +>base : Symbol(base, Decl(divergentAccessorsVisibility1.ts, 95, 13)) +>ProtectedPublic : Symbol(Base.ProtectedPublic, Decl(divergentAccessorsVisibility1.ts, 8, 44), Decl(divergentAccessorsVisibility1.ts, 10, 49)) + + void base.ProtectedProtected; +>base.ProtectedProtected : Symbol(Base.ProtectedProtected, Decl(divergentAccessorsVisibility1.ts, 11, 38), Decl(divergentAccessorsVisibility1.ts, 13, 52)) +>base : Symbol(base, Decl(divergentAccessorsVisibility1.ts, 95, 13)) +>ProtectedProtected : Symbol(Base.ProtectedProtected, Decl(divergentAccessorsVisibility1.ts, 11, 38), Decl(divergentAccessorsVisibility1.ts, 13, 52)) + + void base.ProtectedPrivate; +>base.ProtectedPrivate : Symbol(Base.ProtectedPrivate, Decl(divergentAccessorsVisibility1.ts, 14, 51), Decl(divergentAccessorsVisibility1.ts, 16, 50)) +>base : Symbol(base, Decl(divergentAccessorsVisibility1.ts, 95, 13)) +>ProtectedPrivate : Symbol(Base.ProtectedPrivate, Decl(divergentAccessorsVisibility1.ts, 14, 51), Decl(divergentAccessorsVisibility1.ts, 16, 50)) + + void base.PrivatePublic; +>base.PrivatePublic : Symbol(Base.PrivatePublic, Decl(divergentAccessorsVisibility1.ts, 17, 47), Decl(divergentAccessorsVisibility1.ts, 19, 45)) +>base : Symbol(base, Decl(divergentAccessorsVisibility1.ts, 95, 13)) +>PrivatePublic : Symbol(Base.PrivatePublic, Decl(divergentAccessorsVisibility1.ts, 17, 47), Decl(divergentAccessorsVisibility1.ts, 19, 45)) + + void base.PrivateProtected; +>base.PrivateProtected : Symbol(Base.PrivateProtected, Decl(divergentAccessorsVisibility1.ts, 20, 36), Decl(divergentAccessorsVisibility1.ts, 22, 48)) +>base : Symbol(base, Decl(divergentAccessorsVisibility1.ts, 95, 13)) +>PrivateProtected : Symbol(Base.PrivateProtected, Decl(divergentAccessorsVisibility1.ts, 20, 36), Decl(divergentAccessorsVisibility1.ts, 22, 48)) + + void base.PrivatePrivate; +>base.PrivatePrivate : Symbol(Base.PrivatePrivate, Decl(divergentAccessorsVisibility1.ts, 23, 49), Decl(divergentAccessorsVisibility1.ts, 25, 46)) +>base : Symbol(base, Decl(divergentAccessorsVisibility1.ts, 95, 13)) +>PrivatePrivate : Symbol(Base.PrivatePrivate, Decl(divergentAccessorsVisibility1.ts, 23, 49), Decl(divergentAccessorsVisibility1.ts, 25, 46)) + + base.PublicPublic += 0; +>base.PublicPublic : Symbol(Base.PublicPublic, Decl(divergentAccessorsVisibility1.ts, 0, 12), Decl(divergentAccessorsVisibility1.ts, 1, 36)) +>base : Symbol(base, Decl(divergentAccessorsVisibility1.ts, 95, 13)) +>PublicPublic : Symbol(Base.PublicPublic, Decl(divergentAccessorsVisibility1.ts, 0, 12), Decl(divergentAccessorsVisibility1.ts, 1, 36)) + + base.PublicProtected += 0; +>base.PublicProtected : Symbol(Base.PublicProtected, Decl(divergentAccessorsVisibility1.ts, 2, 35), Decl(divergentAccessorsVisibility1.ts, 4, 39)) +>base : Symbol(base, Decl(divergentAccessorsVisibility1.ts, 95, 13)) +>PublicProtected : Symbol(Base.PublicProtected, Decl(divergentAccessorsVisibility1.ts, 2, 35), Decl(divergentAccessorsVisibility1.ts, 4, 39)) + + base.PublicPrivate += 0; +>base.PublicPrivate : Symbol(Base.PublicPrivate, Decl(divergentAccessorsVisibility1.ts, 5, 48), Decl(divergentAccessorsVisibility1.ts, 7, 37)) +>base : Symbol(base, Decl(divergentAccessorsVisibility1.ts, 95, 13)) +>PublicPrivate : Symbol(Base.PublicPrivate, Decl(divergentAccessorsVisibility1.ts, 5, 48), Decl(divergentAccessorsVisibility1.ts, 7, 37)) + + base.ProtectedPublic += 0; +>base.ProtectedPublic : Symbol(Base.ProtectedPublic, Decl(divergentAccessorsVisibility1.ts, 8, 44), Decl(divergentAccessorsVisibility1.ts, 10, 49)) +>base : Symbol(base, Decl(divergentAccessorsVisibility1.ts, 95, 13)) +>ProtectedPublic : Symbol(Base.ProtectedPublic, Decl(divergentAccessorsVisibility1.ts, 8, 44), Decl(divergentAccessorsVisibility1.ts, 10, 49)) + + base.ProtectedProtected += 0; +>base.ProtectedProtected : Symbol(Base.ProtectedProtected, Decl(divergentAccessorsVisibility1.ts, 11, 38), Decl(divergentAccessorsVisibility1.ts, 13, 52)) +>base : Symbol(base, Decl(divergentAccessorsVisibility1.ts, 95, 13)) +>ProtectedProtected : Symbol(Base.ProtectedProtected, Decl(divergentAccessorsVisibility1.ts, 11, 38), Decl(divergentAccessorsVisibility1.ts, 13, 52)) + + base.ProtectedPrivate += 0; +>base.ProtectedPrivate : Symbol(Base.ProtectedPrivate, Decl(divergentAccessorsVisibility1.ts, 14, 51), Decl(divergentAccessorsVisibility1.ts, 16, 50)) +>base : Symbol(base, Decl(divergentAccessorsVisibility1.ts, 95, 13)) +>ProtectedPrivate : Symbol(Base.ProtectedPrivate, Decl(divergentAccessorsVisibility1.ts, 14, 51), Decl(divergentAccessorsVisibility1.ts, 16, 50)) + + base.PrivatePublic += 0; +>base.PrivatePublic : Symbol(Base.PrivatePublic, Decl(divergentAccessorsVisibility1.ts, 17, 47), Decl(divergentAccessorsVisibility1.ts, 19, 45)) +>base : Symbol(base, Decl(divergentAccessorsVisibility1.ts, 95, 13)) +>PrivatePublic : Symbol(Base.PrivatePublic, Decl(divergentAccessorsVisibility1.ts, 17, 47), Decl(divergentAccessorsVisibility1.ts, 19, 45)) + + base.PrivateProtected += 0; +>base.PrivateProtected : Symbol(Base.PrivateProtected, Decl(divergentAccessorsVisibility1.ts, 20, 36), Decl(divergentAccessorsVisibility1.ts, 22, 48)) +>base : Symbol(base, Decl(divergentAccessorsVisibility1.ts, 95, 13)) +>PrivateProtected : Symbol(Base.PrivateProtected, Decl(divergentAccessorsVisibility1.ts, 20, 36), Decl(divergentAccessorsVisibility1.ts, 22, 48)) + + base.PrivatePrivate += 0; +>base.PrivatePrivate : Symbol(Base.PrivatePrivate, Decl(divergentAccessorsVisibility1.ts, 23, 49), Decl(divergentAccessorsVisibility1.ts, 25, 46)) +>base : Symbol(base, Decl(divergentAccessorsVisibility1.ts, 95, 13)) +>PrivatePrivate : Symbol(Base.PrivatePrivate, Decl(divergentAccessorsVisibility1.ts, 23, 49), Decl(divergentAccessorsVisibility1.ts, 25, 46)) + + deriv.PublicPublic = 0; +>deriv.PublicPublic : Symbol(Base.PublicPublic, Decl(divergentAccessorsVisibility1.ts, 0, 12), Decl(divergentAccessorsVisibility1.ts, 1, 36)) +>deriv : Symbol(deriv, Decl(divergentAccessorsVisibility1.ts, 95, 25)) +>PublicPublic : Symbol(Base.PublicPublic, Decl(divergentAccessorsVisibility1.ts, 0, 12), Decl(divergentAccessorsVisibility1.ts, 1, 36)) + + deriv.PublicProtected = 0; +>deriv.PublicProtected : Symbol(Base.PublicProtected, Decl(divergentAccessorsVisibility1.ts, 2, 35), Decl(divergentAccessorsVisibility1.ts, 4, 39)) +>deriv : Symbol(deriv, Decl(divergentAccessorsVisibility1.ts, 95, 25)) +>PublicProtected : Symbol(Base.PublicProtected, Decl(divergentAccessorsVisibility1.ts, 2, 35), Decl(divergentAccessorsVisibility1.ts, 4, 39)) + + deriv.PublicPrivate = 0; +>deriv.PublicPrivate : Symbol(Base.PublicPrivate, Decl(divergentAccessorsVisibility1.ts, 5, 48), Decl(divergentAccessorsVisibility1.ts, 7, 37)) +>deriv : Symbol(deriv, Decl(divergentAccessorsVisibility1.ts, 95, 25)) +>PublicPrivate : Symbol(Base.PublicPrivate, Decl(divergentAccessorsVisibility1.ts, 5, 48), Decl(divergentAccessorsVisibility1.ts, 7, 37)) + + deriv.ProtectedPublic = 0; +>deriv.ProtectedPublic : Symbol(Base.ProtectedPublic, Decl(divergentAccessorsVisibility1.ts, 8, 44), Decl(divergentAccessorsVisibility1.ts, 10, 49)) +>deriv : Symbol(deriv, Decl(divergentAccessorsVisibility1.ts, 95, 25)) +>ProtectedPublic : Symbol(Base.ProtectedPublic, Decl(divergentAccessorsVisibility1.ts, 8, 44), Decl(divergentAccessorsVisibility1.ts, 10, 49)) + + deriv.ProtectedProtected = 0; +>deriv.ProtectedProtected : Symbol(Base.ProtectedProtected, Decl(divergentAccessorsVisibility1.ts, 11, 38), Decl(divergentAccessorsVisibility1.ts, 13, 52)) +>deriv : Symbol(deriv, Decl(divergentAccessorsVisibility1.ts, 95, 25)) +>ProtectedProtected : Symbol(Base.ProtectedProtected, Decl(divergentAccessorsVisibility1.ts, 11, 38), Decl(divergentAccessorsVisibility1.ts, 13, 52)) + + deriv.ProtectedPrivate = 0; +>deriv.ProtectedPrivate : Symbol(Base.ProtectedPrivate, Decl(divergentAccessorsVisibility1.ts, 14, 51), Decl(divergentAccessorsVisibility1.ts, 16, 50)) +>deriv : Symbol(deriv, Decl(divergentAccessorsVisibility1.ts, 95, 25)) +>ProtectedPrivate : Symbol(Base.ProtectedPrivate, Decl(divergentAccessorsVisibility1.ts, 14, 51), Decl(divergentAccessorsVisibility1.ts, 16, 50)) + + deriv.PrivatePublic = 0; +>deriv.PrivatePublic : Symbol(Base.PrivatePublic, Decl(divergentAccessorsVisibility1.ts, 17, 47), Decl(divergentAccessorsVisibility1.ts, 19, 45)) +>deriv : Symbol(deriv, Decl(divergentAccessorsVisibility1.ts, 95, 25)) +>PrivatePublic : Symbol(Base.PrivatePublic, Decl(divergentAccessorsVisibility1.ts, 17, 47), Decl(divergentAccessorsVisibility1.ts, 19, 45)) + + deriv.PrivateProtected = 0; +>deriv.PrivateProtected : Symbol(Base.PrivateProtected, Decl(divergentAccessorsVisibility1.ts, 20, 36), Decl(divergentAccessorsVisibility1.ts, 22, 48)) +>deriv : Symbol(deriv, Decl(divergentAccessorsVisibility1.ts, 95, 25)) +>PrivateProtected : Symbol(Base.PrivateProtected, Decl(divergentAccessorsVisibility1.ts, 20, 36), Decl(divergentAccessorsVisibility1.ts, 22, 48)) + + deriv.PrivatePrivate = 0; +>deriv.PrivatePrivate : Symbol(Base.PrivatePrivate, Decl(divergentAccessorsVisibility1.ts, 23, 49), Decl(divergentAccessorsVisibility1.ts, 25, 46)) +>deriv : Symbol(deriv, Decl(divergentAccessorsVisibility1.ts, 95, 25)) +>PrivatePrivate : Symbol(Base.PrivatePrivate, Decl(divergentAccessorsVisibility1.ts, 23, 49), Decl(divergentAccessorsVisibility1.ts, 25, 46)) + + void deriv.PublicPublic; +>deriv.PublicPublic : Symbol(Base.PublicPublic, Decl(divergentAccessorsVisibility1.ts, 0, 12), Decl(divergentAccessorsVisibility1.ts, 1, 36)) +>deriv : Symbol(deriv, Decl(divergentAccessorsVisibility1.ts, 95, 25)) +>PublicPublic : Symbol(Base.PublicPublic, Decl(divergentAccessorsVisibility1.ts, 0, 12), Decl(divergentAccessorsVisibility1.ts, 1, 36)) + + void deriv.PublicProtected; +>deriv.PublicProtected : Symbol(Base.PublicProtected, Decl(divergentAccessorsVisibility1.ts, 2, 35), Decl(divergentAccessorsVisibility1.ts, 4, 39)) +>deriv : Symbol(deriv, Decl(divergentAccessorsVisibility1.ts, 95, 25)) +>PublicProtected : Symbol(Base.PublicProtected, Decl(divergentAccessorsVisibility1.ts, 2, 35), Decl(divergentAccessorsVisibility1.ts, 4, 39)) + + void deriv.PublicPrivate; +>deriv.PublicPrivate : Symbol(Base.PublicPrivate, Decl(divergentAccessorsVisibility1.ts, 5, 48), Decl(divergentAccessorsVisibility1.ts, 7, 37)) +>deriv : Symbol(deriv, Decl(divergentAccessorsVisibility1.ts, 95, 25)) +>PublicPrivate : Symbol(Base.PublicPrivate, Decl(divergentAccessorsVisibility1.ts, 5, 48), Decl(divergentAccessorsVisibility1.ts, 7, 37)) + + void deriv.ProtectedPublic; +>deriv.ProtectedPublic : Symbol(Base.ProtectedPublic, Decl(divergentAccessorsVisibility1.ts, 8, 44), Decl(divergentAccessorsVisibility1.ts, 10, 49)) +>deriv : Symbol(deriv, Decl(divergentAccessorsVisibility1.ts, 95, 25)) +>ProtectedPublic : Symbol(Base.ProtectedPublic, Decl(divergentAccessorsVisibility1.ts, 8, 44), Decl(divergentAccessorsVisibility1.ts, 10, 49)) + + void deriv.ProtectedProtected; +>deriv.ProtectedProtected : Symbol(Base.ProtectedProtected, Decl(divergentAccessorsVisibility1.ts, 11, 38), Decl(divergentAccessorsVisibility1.ts, 13, 52)) +>deriv : Symbol(deriv, Decl(divergentAccessorsVisibility1.ts, 95, 25)) +>ProtectedProtected : Symbol(Base.ProtectedProtected, Decl(divergentAccessorsVisibility1.ts, 11, 38), Decl(divergentAccessorsVisibility1.ts, 13, 52)) + + void deriv.ProtectedPrivate; +>deriv.ProtectedPrivate : Symbol(Base.ProtectedPrivate, Decl(divergentAccessorsVisibility1.ts, 14, 51), Decl(divergentAccessorsVisibility1.ts, 16, 50)) +>deriv : Symbol(deriv, Decl(divergentAccessorsVisibility1.ts, 95, 25)) +>ProtectedPrivate : Symbol(Base.ProtectedPrivate, Decl(divergentAccessorsVisibility1.ts, 14, 51), Decl(divergentAccessorsVisibility1.ts, 16, 50)) + + void deriv.PrivatePublic; +>deriv.PrivatePublic : Symbol(Base.PrivatePublic, Decl(divergentAccessorsVisibility1.ts, 17, 47), Decl(divergentAccessorsVisibility1.ts, 19, 45)) +>deriv : Symbol(deriv, Decl(divergentAccessorsVisibility1.ts, 95, 25)) +>PrivatePublic : Symbol(Base.PrivatePublic, Decl(divergentAccessorsVisibility1.ts, 17, 47), Decl(divergentAccessorsVisibility1.ts, 19, 45)) + + void deriv.PrivateProtected; +>deriv.PrivateProtected : Symbol(Base.PrivateProtected, Decl(divergentAccessorsVisibility1.ts, 20, 36), Decl(divergentAccessorsVisibility1.ts, 22, 48)) +>deriv : Symbol(deriv, Decl(divergentAccessorsVisibility1.ts, 95, 25)) +>PrivateProtected : Symbol(Base.PrivateProtected, Decl(divergentAccessorsVisibility1.ts, 20, 36), Decl(divergentAccessorsVisibility1.ts, 22, 48)) + + void deriv.PrivatePrivate; +>deriv.PrivatePrivate : Symbol(Base.PrivatePrivate, Decl(divergentAccessorsVisibility1.ts, 23, 49), Decl(divergentAccessorsVisibility1.ts, 25, 46)) +>deriv : Symbol(deriv, Decl(divergentAccessorsVisibility1.ts, 95, 25)) +>PrivatePrivate : Symbol(Base.PrivatePrivate, Decl(divergentAccessorsVisibility1.ts, 23, 49), Decl(divergentAccessorsVisibility1.ts, 25, 46)) + + deriv.PublicPublic += 0; +>deriv.PublicPublic : Symbol(Base.PublicPublic, Decl(divergentAccessorsVisibility1.ts, 0, 12), Decl(divergentAccessorsVisibility1.ts, 1, 36)) +>deriv : Symbol(deriv, Decl(divergentAccessorsVisibility1.ts, 95, 25)) +>PublicPublic : Symbol(Base.PublicPublic, Decl(divergentAccessorsVisibility1.ts, 0, 12), Decl(divergentAccessorsVisibility1.ts, 1, 36)) + + deriv.PublicProtected += 0; +>deriv.PublicProtected : Symbol(Base.PublicProtected, Decl(divergentAccessorsVisibility1.ts, 2, 35), Decl(divergentAccessorsVisibility1.ts, 4, 39)) +>deriv : Symbol(deriv, Decl(divergentAccessorsVisibility1.ts, 95, 25)) +>PublicProtected : Symbol(Base.PublicProtected, Decl(divergentAccessorsVisibility1.ts, 2, 35), Decl(divergentAccessorsVisibility1.ts, 4, 39)) + + deriv.PublicPrivate += 0; +>deriv.PublicPrivate : Symbol(Base.PublicPrivate, Decl(divergentAccessorsVisibility1.ts, 5, 48), Decl(divergentAccessorsVisibility1.ts, 7, 37)) +>deriv : Symbol(deriv, Decl(divergentAccessorsVisibility1.ts, 95, 25)) +>PublicPrivate : Symbol(Base.PublicPrivate, Decl(divergentAccessorsVisibility1.ts, 5, 48), Decl(divergentAccessorsVisibility1.ts, 7, 37)) + + deriv.ProtectedPublic += 0; +>deriv.ProtectedPublic : Symbol(Base.ProtectedPublic, Decl(divergentAccessorsVisibility1.ts, 8, 44), Decl(divergentAccessorsVisibility1.ts, 10, 49)) +>deriv : Symbol(deriv, Decl(divergentAccessorsVisibility1.ts, 95, 25)) +>ProtectedPublic : Symbol(Base.ProtectedPublic, Decl(divergentAccessorsVisibility1.ts, 8, 44), Decl(divergentAccessorsVisibility1.ts, 10, 49)) + + deriv.ProtectedProtected += 0; +>deriv.ProtectedProtected : Symbol(Base.ProtectedProtected, Decl(divergentAccessorsVisibility1.ts, 11, 38), Decl(divergentAccessorsVisibility1.ts, 13, 52)) +>deriv : Symbol(deriv, Decl(divergentAccessorsVisibility1.ts, 95, 25)) +>ProtectedProtected : Symbol(Base.ProtectedProtected, Decl(divergentAccessorsVisibility1.ts, 11, 38), Decl(divergentAccessorsVisibility1.ts, 13, 52)) + + deriv.ProtectedPrivate += 0; +>deriv.ProtectedPrivate : Symbol(Base.ProtectedPrivate, Decl(divergentAccessorsVisibility1.ts, 14, 51), Decl(divergentAccessorsVisibility1.ts, 16, 50)) +>deriv : Symbol(deriv, Decl(divergentAccessorsVisibility1.ts, 95, 25)) +>ProtectedPrivate : Symbol(Base.ProtectedPrivate, Decl(divergentAccessorsVisibility1.ts, 14, 51), Decl(divergentAccessorsVisibility1.ts, 16, 50)) + + deriv.PrivatePublic += 0; +>deriv.PrivatePublic : Symbol(Base.PrivatePublic, Decl(divergentAccessorsVisibility1.ts, 17, 47), Decl(divergentAccessorsVisibility1.ts, 19, 45)) +>deriv : Symbol(deriv, Decl(divergentAccessorsVisibility1.ts, 95, 25)) +>PrivatePublic : Symbol(Base.PrivatePublic, Decl(divergentAccessorsVisibility1.ts, 17, 47), Decl(divergentAccessorsVisibility1.ts, 19, 45)) + + deriv.PrivateProtected += 0; +>deriv.PrivateProtected : Symbol(Base.PrivateProtected, Decl(divergentAccessorsVisibility1.ts, 20, 36), Decl(divergentAccessorsVisibility1.ts, 22, 48)) +>deriv : Symbol(deriv, Decl(divergentAccessorsVisibility1.ts, 95, 25)) +>PrivateProtected : Symbol(Base.PrivateProtected, Decl(divergentAccessorsVisibility1.ts, 20, 36), Decl(divergentAccessorsVisibility1.ts, 22, 48)) + + deriv.PrivatePrivate += 0; +>deriv.PrivatePrivate : Symbol(Base.PrivatePrivate, Decl(divergentAccessorsVisibility1.ts, 23, 49), Decl(divergentAccessorsVisibility1.ts, 25, 46)) +>deriv : Symbol(deriv, Decl(divergentAccessorsVisibility1.ts, 95, 25)) +>PrivatePrivate : Symbol(Base.PrivatePrivate, Decl(divergentAccessorsVisibility1.ts, 23, 49), Decl(divergentAccessorsVisibility1.ts, 25, 46)) +} + diff --git a/tests/baselines/reference/divergentAccessorsVisibility1.types b/tests/baselines/reference/divergentAccessorsVisibility1.types new file mode 100644 index 0000000000000..3f3ad6c5bd959 --- /dev/null +++ b/tests/baselines/reference/divergentAccessorsVisibility1.types @@ -0,0 +1,818 @@ +=== tests/cases/compiler/divergentAccessorsVisibility1.ts === +class Base { +>Base : Base + + get PublicPublic() { return 0; } +>PublicPublic : number +>0 : 0 + + set PublicPublic(v) { return; } +>PublicPublic : number +>v : number + + get PublicProtected() { return 0; } +>PublicProtected : number +>0 : 0 + + protected set PublicProtected(v) { return; } +>PublicProtected : number +>v : number + + get PublicPrivate() { return 0; } +>PublicPrivate : number +>0 : 0 + + private set PublicPrivate(v) { return; } +>PublicPrivate : number +>v : number + + protected get ProtectedPublic() { return 0; } +>ProtectedPublic : number +>0 : 0 + + set ProtectedPublic(v) { return; } +>ProtectedPublic : number +>v : number + + protected get ProtectedProtected() { return 0; } +>ProtectedProtected : number +>0 : 0 + + protected set ProtectedProtected(v) { return; } +>ProtectedProtected : number +>v : number + + protected get ProtectedPrivate() { return 0; } +>ProtectedPrivate : number +>0 : 0 + + private set ProtectedPrivate(v) { return; } +>ProtectedPrivate : number +>v : number + + private get PrivatePublic() { return 0; } +>PrivatePublic : number +>0 : 0 + + set PrivatePublic(v) { return; } +>PrivatePublic : number +>v : number + + private get PrivateProtected() { return 0; } +>PrivateProtected : number +>0 : 0 + + protected set PrivateProtected(v) { return; } +>PrivateProtected : number +>v : number + + private get PrivatePrivate() { return 0; } +>PrivatePrivate : number +>0 : 0 + + private set PrivatePrivate(v) { return; } +>PrivatePrivate : number +>v : number + + test() { +>test : () => void + + this.PublicPublic = 0; +>this.PublicPublic = 0 : 0 +>this.PublicPublic : number +>this : this +>PublicPublic : number +>0 : 0 + + this.PublicProtected = 0; +>this.PublicProtected = 0 : 0 +>this.PublicProtected : number +>this : this +>PublicProtected : number +>0 : 0 + + this.PublicPrivate = 0; +>this.PublicPrivate = 0 : 0 +>this.PublicPrivate : number +>this : this +>PublicPrivate : number +>0 : 0 + + this.ProtectedPublic = 0; +>this.ProtectedPublic = 0 : 0 +>this.ProtectedPublic : number +>this : this +>ProtectedPublic : number +>0 : 0 + + this.ProtectedProtected = 0; +>this.ProtectedProtected = 0 : 0 +>this.ProtectedProtected : number +>this : this +>ProtectedProtected : number +>0 : 0 + + this.ProtectedPrivate = 0; +>this.ProtectedPrivate = 0 : 0 +>this.ProtectedPrivate : number +>this : this +>ProtectedPrivate : number +>0 : 0 + + this.PrivatePublic = 0; +>this.PrivatePublic = 0 : 0 +>this.PrivatePublic : number +>this : this +>PrivatePublic : number +>0 : 0 + + this.PrivateProtected = 0; +>this.PrivateProtected = 0 : 0 +>this.PrivateProtected : number +>this : this +>PrivateProtected : number +>0 : 0 + + this.PrivatePrivate = 0; +>this.PrivatePrivate = 0 : 0 +>this.PrivatePrivate : number +>this : this +>PrivatePrivate : number +>0 : 0 + + void this.PublicPublic; +>void this.PublicPublic : undefined +>this.PublicPublic : number +>this : this +>PublicPublic : number + + void this.PublicProtected; +>void this.PublicProtected : undefined +>this.PublicProtected : number +>this : this +>PublicProtected : number + + void this.PublicPrivate; +>void this.PublicPrivate : undefined +>this.PublicPrivate : number +>this : this +>PublicPrivate : number + + void this.ProtectedPublic; +>void this.ProtectedPublic : undefined +>this.ProtectedPublic : number +>this : this +>ProtectedPublic : number + + void this.ProtectedProtected; +>void this.ProtectedProtected : undefined +>this.ProtectedProtected : number +>this : this +>ProtectedProtected : number + + void this.ProtectedPrivate; +>void this.ProtectedPrivate : undefined +>this.ProtectedPrivate : number +>this : this +>ProtectedPrivate : number + + void this.PrivatePublic; +>void this.PrivatePublic : undefined +>this.PrivatePublic : number +>this : this +>PrivatePublic : number + + void this.PrivateProtected; +>void this.PrivateProtected : undefined +>this.PrivateProtected : number +>this : this +>PrivateProtected : number + + void this.PrivatePrivate; +>void this.PrivatePrivate : undefined +>this.PrivatePrivate : number +>this : this +>PrivatePrivate : number + + this.PublicPublic += 0; +>this.PublicPublic += 0 : number +>this.PublicPublic : number +>this : this +>PublicPublic : number +>0 : 0 + + this.PublicProtected += 0; +>this.PublicProtected += 0 : number +>this.PublicProtected : number +>this : this +>PublicProtected : number +>0 : 0 + + this.PublicPrivate += 0; +>this.PublicPrivate += 0 : number +>this.PublicPrivate : number +>this : this +>PublicPrivate : number +>0 : 0 + + this.ProtectedPublic += 0; +>this.ProtectedPublic += 0 : number +>this.ProtectedPublic : number +>this : this +>ProtectedPublic : number +>0 : 0 + + this.ProtectedProtected += 0; +>this.ProtectedProtected += 0 : number +>this.ProtectedProtected : number +>this : this +>ProtectedProtected : number +>0 : 0 + + this.ProtectedPrivate += 0; +>this.ProtectedPrivate += 0 : number +>this.ProtectedPrivate : number +>this : this +>ProtectedPrivate : number +>0 : 0 + + this.PrivatePublic += 0; +>this.PrivatePublic += 0 : number +>this.PrivatePublic : number +>this : this +>PrivatePublic : number +>0 : 0 + + this.PrivateProtected += 0; +>this.PrivateProtected += 0 : number +>this.PrivateProtected : number +>this : this +>PrivateProtected : number +>0 : 0 + + this.PrivatePrivate += 0; +>this.PrivatePrivate += 0 : number +>this.PrivatePrivate : number +>this : this +>PrivatePrivate : number +>0 : 0 + } +} + +class Derived extends Base { +>Derived : Derived +>Base : Base + + test2() { +>test2 : () => void + + this.PublicPublic = 0; +>this.PublicPublic = 0 : 0 +>this.PublicPublic : number +>this : this +>PublicPublic : number +>0 : 0 + + this.PublicProtected = 0; +>this.PublicProtected = 0 : 0 +>this.PublicProtected : number +>this : this +>PublicProtected : number +>0 : 0 + + this.PublicPrivate = 0; +>this.PublicPrivate = 0 : 0 +>this.PublicPrivate : number +>this : this +>PublicPrivate : number +>0 : 0 + + this.ProtectedPublic = 0; +>this.ProtectedPublic = 0 : 0 +>this.ProtectedPublic : number +>this : this +>ProtectedPublic : number +>0 : 0 + + this.ProtectedProtected = 0; +>this.ProtectedProtected = 0 : 0 +>this.ProtectedProtected : number +>this : this +>ProtectedProtected : number +>0 : 0 + + this.ProtectedPrivate = 0; +>this.ProtectedPrivate = 0 : 0 +>this.ProtectedPrivate : number +>this : this +>ProtectedPrivate : number +>0 : 0 + + this.PrivatePublic = 0; +>this.PrivatePublic = 0 : 0 +>this.PrivatePublic : number +>this : this +>PrivatePublic : number +>0 : 0 + + this.PrivateProtected = 0; +>this.PrivateProtected = 0 : 0 +>this.PrivateProtected : number +>this : this +>PrivateProtected : number +>0 : 0 + + this.PrivatePrivate = 0; +>this.PrivatePrivate = 0 : 0 +>this.PrivatePrivate : number +>this : this +>PrivatePrivate : number +>0 : 0 + + void this.PublicPublic; +>void this.PublicPublic : undefined +>this.PublicPublic : number +>this : this +>PublicPublic : number + + void this.PublicProtected; +>void this.PublicProtected : undefined +>this.PublicProtected : number +>this : this +>PublicProtected : number + + void this.PublicPrivate; +>void this.PublicPrivate : undefined +>this.PublicPrivate : number +>this : this +>PublicPrivate : number + + void this.ProtectedPublic; +>void this.ProtectedPublic : undefined +>this.ProtectedPublic : number +>this : this +>ProtectedPublic : number + + void this.ProtectedProtected; +>void this.ProtectedProtected : undefined +>this.ProtectedProtected : number +>this : this +>ProtectedProtected : number + + void this.ProtectedPrivate; +>void this.ProtectedPrivate : undefined +>this.ProtectedPrivate : number +>this : this +>ProtectedPrivate : number + + void this.PrivatePublic; +>void this.PrivatePublic : undefined +>this.PrivatePublic : number +>this : this +>PrivatePublic : number + + void this.PrivateProtected; +>void this.PrivateProtected : undefined +>this.PrivateProtected : number +>this : this +>PrivateProtected : number + + void this.PrivatePrivate; +>void this.PrivatePrivate : undefined +>this.PrivatePrivate : number +>this : this +>PrivatePrivate : number + + this.PublicPublic += 0; +>this.PublicPublic += 0 : number +>this.PublicPublic : number +>this : this +>PublicPublic : number +>0 : 0 + + this.PublicProtected += 0; +>this.PublicProtected += 0 : number +>this.PublicProtected : number +>this : this +>PublicProtected : number +>0 : 0 + + this.PublicPrivate += 0; +>this.PublicPrivate += 0 : number +>this.PublicPrivate : number +>this : this +>PublicPrivate : number +>0 : 0 + + this.ProtectedPublic += 0; +>this.ProtectedPublic += 0 : number +>this.ProtectedPublic : number +>this : this +>ProtectedPublic : number +>0 : 0 + + this.ProtectedProtected += 0; +>this.ProtectedProtected += 0 : number +>this.ProtectedProtected : number +>this : this +>ProtectedProtected : number +>0 : 0 + + this.ProtectedPrivate += 0; +>this.ProtectedPrivate += 0 : number +>this.ProtectedPrivate : number +>this : this +>ProtectedPrivate : number +>0 : 0 + + this.PrivatePublic += 0; +>this.PrivatePublic += 0 : number +>this.PrivatePublic : number +>this : this +>PrivatePublic : number +>0 : 0 + + this.PrivateProtected += 0; +>this.PrivateProtected += 0 : number +>this.PrivateProtected : number +>this : this +>PrivateProtected : number +>0 : 0 + + this.PrivatePrivate += 0; +>this.PrivatePrivate += 0 : number +>this.PrivatePrivate : number +>this : this +>PrivatePrivate : number +>0 : 0 + } +} + +declare const base: Base, deriv: Derived; +>base : Base +>deriv : Derived + +function fn() { +>fn : () => void + + base.PublicPublic = 0; +>base.PublicPublic = 0 : 0 +>base.PublicPublic : number +>base : Base +>PublicPublic : number +>0 : 0 + + base.PublicProtected = 0; +>base.PublicProtected = 0 : 0 +>base.PublicProtected : number +>base : Base +>PublicProtected : number +>0 : 0 + + base.PublicPrivate = 0; +>base.PublicPrivate = 0 : 0 +>base.PublicPrivate : number +>base : Base +>PublicPrivate : number +>0 : 0 + + base.ProtectedPublic = 0; +>base.ProtectedPublic = 0 : 0 +>base.ProtectedPublic : number +>base : Base +>ProtectedPublic : number +>0 : 0 + + base.ProtectedProtected = 0; +>base.ProtectedProtected = 0 : 0 +>base.ProtectedProtected : number +>base : Base +>ProtectedProtected : number +>0 : 0 + + base.ProtectedPrivate = 0; +>base.ProtectedPrivate = 0 : 0 +>base.ProtectedPrivate : number +>base : Base +>ProtectedPrivate : number +>0 : 0 + + base.PrivatePublic = 0; +>base.PrivatePublic = 0 : 0 +>base.PrivatePublic : number +>base : Base +>PrivatePublic : number +>0 : 0 + + base.PrivateProtected = 0; +>base.PrivateProtected = 0 : 0 +>base.PrivateProtected : number +>base : Base +>PrivateProtected : number +>0 : 0 + + base.PrivatePrivate = 0; +>base.PrivatePrivate = 0 : 0 +>base.PrivatePrivate : number +>base : Base +>PrivatePrivate : number +>0 : 0 + + void base.PublicPublic; +>void base.PublicPublic : undefined +>base.PublicPublic : number +>base : Base +>PublicPublic : number + + void base.PublicProtected; +>void base.PublicProtected : undefined +>base.PublicProtected : number +>base : Base +>PublicProtected : number + + void base.PublicPrivate; +>void base.PublicPrivate : undefined +>base.PublicPrivate : number +>base : Base +>PublicPrivate : number + + void base.ProtectedPublic; +>void base.ProtectedPublic : undefined +>base.ProtectedPublic : number +>base : Base +>ProtectedPublic : number + + void base.ProtectedProtected; +>void base.ProtectedProtected : undefined +>base.ProtectedProtected : number +>base : Base +>ProtectedProtected : number + + void base.ProtectedPrivate; +>void base.ProtectedPrivate : undefined +>base.ProtectedPrivate : number +>base : Base +>ProtectedPrivate : number + + void base.PrivatePublic; +>void base.PrivatePublic : undefined +>base.PrivatePublic : number +>base : Base +>PrivatePublic : number + + void base.PrivateProtected; +>void base.PrivateProtected : undefined +>base.PrivateProtected : number +>base : Base +>PrivateProtected : number + + void base.PrivatePrivate; +>void base.PrivatePrivate : undefined +>base.PrivatePrivate : number +>base : Base +>PrivatePrivate : number + + base.PublicPublic += 0; +>base.PublicPublic += 0 : number +>base.PublicPublic : number +>base : Base +>PublicPublic : number +>0 : 0 + + base.PublicProtected += 0; +>base.PublicProtected += 0 : number +>base.PublicProtected : number +>base : Base +>PublicProtected : number +>0 : 0 + + base.PublicPrivate += 0; +>base.PublicPrivate += 0 : number +>base.PublicPrivate : number +>base : Base +>PublicPrivate : number +>0 : 0 + + base.ProtectedPublic += 0; +>base.ProtectedPublic += 0 : number +>base.ProtectedPublic : number +>base : Base +>ProtectedPublic : number +>0 : 0 + + base.ProtectedProtected += 0; +>base.ProtectedProtected += 0 : number +>base.ProtectedProtected : number +>base : Base +>ProtectedProtected : number +>0 : 0 + + base.ProtectedPrivate += 0; +>base.ProtectedPrivate += 0 : number +>base.ProtectedPrivate : number +>base : Base +>ProtectedPrivate : number +>0 : 0 + + base.PrivatePublic += 0; +>base.PrivatePublic += 0 : number +>base.PrivatePublic : number +>base : Base +>PrivatePublic : number +>0 : 0 + + base.PrivateProtected += 0; +>base.PrivateProtected += 0 : number +>base.PrivateProtected : number +>base : Base +>PrivateProtected : number +>0 : 0 + + base.PrivatePrivate += 0; +>base.PrivatePrivate += 0 : number +>base.PrivatePrivate : number +>base : Base +>PrivatePrivate : number +>0 : 0 + + deriv.PublicPublic = 0; +>deriv.PublicPublic = 0 : 0 +>deriv.PublicPublic : number +>deriv : Derived +>PublicPublic : number +>0 : 0 + + deriv.PublicProtected = 0; +>deriv.PublicProtected = 0 : 0 +>deriv.PublicProtected : number +>deriv : Derived +>PublicProtected : number +>0 : 0 + + deriv.PublicPrivate = 0; +>deriv.PublicPrivate = 0 : 0 +>deriv.PublicPrivate : number +>deriv : Derived +>PublicPrivate : number +>0 : 0 + + deriv.ProtectedPublic = 0; +>deriv.ProtectedPublic = 0 : 0 +>deriv.ProtectedPublic : number +>deriv : Derived +>ProtectedPublic : number +>0 : 0 + + deriv.ProtectedProtected = 0; +>deriv.ProtectedProtected = 0 : 0 +>deriv.ProtectedProtected : number +>deriv : Derived +>ProtectedProtected : number +>0 : 0 + + deriv.ProtectedPrivate = 0; +>deriv.ProtectedPrivate = 0 : 0 +>deriv.ProtectedPrivate : number +>deriv : Derived +>ProtectedPrivate : number +>0 : 0 + + deriv.PrivatePublic = 0; +>deriv.PrivatePublic = 0 : 0 +>deriv.PrivatePublic : number +>deriv : Derived +>PrivatePublic : number +>0 : 0 + + deriv.PrivateProtected = 0; +>deriv.PrivateProtected = 0 : 0 +>deriv.PrivateProtected : number +>deriv : Derived +>PrivateProtected : number +>0 : 0 + + deriv.PrivatePrivate = 0; +>deriv.PrivatePrivate = 0 : 0 +>deriv.PrivatePrivate : number +>deriv : Derived +>PrivatePrivate : number +>0 : 0 + + void deriv.PublicPublic; +>void deriv.PublicPublic : undefined +>deriv.PublicPublic : number +>deriv : Derived +>PublicPublic : number + + void deriv.PublicProtected; +>void deriv.PublicProtected : undefined +>deriv.PublicProtected : number +>deriv : Derived +>PublicProtected : number + + void deriv.PublicPrivate; +>void deriv.PublicPrivate : undefined +>deriv.PublicPrivate : number +>deriv : Derived +>PublicPrivate : number + + void deriv.ProtectedPublic; +>void deriv.ProtectedPublic : undefined +>deriv.ProtectedPublic : number +>deriv : Derived +>ProtectedPublic : number + + void deriv.ProtectedProtected; +>void deriv.ProtectedProtected : undefined +>deriv.ProtectedProtected : number +>deriv : Derived +>ProtectedProtected : number + + void deriv.ProtectedPrivate; +>void deriv.ProtectedPrivate : undefined +>deriv.ProtectedPrivate : number +>deriv : Derived +>ProtectedPrivate : number + + void deriv.PrivatePublic; +>void deriv.PrivatePublic : undefined +>deriv.PrivatePublic : number +>deriv : Derived +>PrivatePublic : number + + void deriv.PrivateProtected; +>void deriv.PrivateProtected : undefined +>deriv.PrivateProtected : number +>deriv : Derived +>PrivateProtected : number + + void deriv.PrivatePrivate; +>void deriv.PrivatePrivate : undefined +>deriv.PrivatePrivate : number +>deriv : Derived +>PrivatePrivate : number + + deriv.PublicPublic += 0; +>deriv.PublicPublic += 0 : number +>deriv.PublicPublic : number +>deriv : Derived +>PublicPublic : number +>0 : 0 + + deriv.PublicProtected += 0; +>deriv.PublicProtected += 0 : number +>deriv.PublicProtected : number +>deriv : Derived +>PublicProtected : number +>0 : 0 + + deriv.PublicPrivate += 0; +>deriv.PublicPrivate += 0 : number +>deriv.PublicPrivate : number +>deriv : Derived +>PublicPrivate : number +>0 : 0 + + deriv.ProtectedPublic += 0; +>deriv.ProtectedPublic += 0 : number +>deriv.ProtectedPublic : number +>deriv : Derived +>ProtectedPublic : number +>0 : 0 + + deriv.ProtectedProtected += 0; +>deriv.ProtectedProtected += 0 : number +>deriv.ProtectedProtected : number +>deriv : Derived +>ProtectedProtected : number +>0 : 0 + + deriv.ProtectedPrivate += 0; +>deriv.ProtectedPrivate += 0 : number +>deriv.ProtectedPrivate : number +>deriv : Derived +>ProtectedPrivate : number +>0 : 0 + + deriv.PrivatePublic += 0; +>deriv.PrivatePublic += 0 : number +>deriv.PrivatePublic : number +>deriv : Derived +>PrivatePublic : number +>0 : 0 + + deriv.PrivateProtected += 0; +>deriv.PrivateProtected += 0 : number +>deriv.PrivateProtected : number +>deriv : Derived +>PrivateProtected : number +>0 : 0 + + deriv.PrivatePrivate += 0; +>deriv.PrivatePrivate += 0 : number +>deriv.PrivatePrivate : number +>deriv : Derived +>PrivatePrivate : number +>0 : 0 +} + diff --git a/tests/baselines/reference/getAndSetNotIdenticalType.errors.txt b/tests/baselines/reference/getAndSetNotIdenticalType.errors.txt index a16cbfe7b37a5..9d9b6421af36a 100644 --- a/tests/baselines/reference/getAndSetNotIdenticalType.errors.txt +++ b/tests/baselines/reference/getAndSetNotIdenticalType.errors.txt @@ -1,21 +1,18 @@ tests/cases/compiler/getAndSetNotIdenticalType.ts(2,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/getAndSetNotIdenticalType.ts(2,9): error TS2380: 'get' and 'set' accessor must have the same type. +tests/cases/compiler/getAndSetNotIdenticalType.ts(2,9): error TS2380: The return type of a 'get' accessor must be assignable to its 'set' accessor type tests/cases/compiler/getAndSetNotIdenticalType.ts(5,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/getAndSetNotIdenticalType.ts(5,9): error TS2380: 'get' and 'set' accessor must have the same type. -==== tests/cases/compiler/getAndSetNotIdenticalType.ts (4 errors) ==== +==== tests/cases/compiler/getAndSetNotIdenticalType.ts (3 errors) ==== class C { get x(): number { ~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~ -!!! error TS2380: 'get' and 'set' accessor must have the same type. +!!! error TS2380: The return type of a 'get' accessor must be assignable to its 'set' accessor type return 1; } set x(v: string) { } ~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. - ~ -!!! error TS2380: 'get' and 'set' accessor must have the same type. } \ No newline at end of file diff --git a/tests/baselines/reference/getAndSetNotIdenticalType2.errors.txt b/tests/baselines/reference/getAndSetNotIdenticalType2.errors.txt index 2f9c494b9a943..6c866b21c15d5 100644 --- a/tests/baselines/reference/getAndSetNotIdenticalType2.errors.txt +++ b/tests/baselines/reference/getAndSetNotIdenticalType2.errors.txt @@ -1,13 +1,16 @@ tests/cases/compiler/getAndSetNotIdenticalType2.ts(5,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/getAndSetNotIdenticalType2.ts(5,9): error TS2380: 'get' and 'set' accessor must have the same type. +tests/cases/compiler/getAndSetNotIdenticalType2.ts(5,9): error TS2380: The return type of a 'get' accessor must be assignable to its 'set' accessor type +tests/cases/compiler/getAndSetNotIdenticalType2.ts(5,9): error TS2380: The return type of a 'get' accessor must be assignable to its 'set' accessor type + Type 'T' is not assignable to type 'string'. tests/cases/compiler/getAndSetNotIdenticalType2.ts(8,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/getAndSetNotIdenticalType2.ts(8,9): error TS2380: 'get' and 'set' accessor must have the same type. tests/cases/compiler/getAndSetNotIdenticalType2.ts(9,9): error TS2322: Type 'A' is not assignable to type 'A'. Type 'string' is not assignable to type 'T'. 'T' could be instantiated with an arbitrary type which could be unrelated to 'string'. +tests/cases/compiler/getAndSetNotIdenticalType2.ts(15,1): error TS2322: Type 'A' is not assignable to type 'A'. + Type 'unknown' is not assignable to type 'string'. -==== tests/cases/compiler/getAndSetNotIdenticalType2.ts (5 errors) ==== +==== tests/cases/compiler/getAndSetNotIdenticalType2.ts (6 errors) ==== class A { foo: T; } class C { @@ -16,14 +19,15 @@ tests/cases/compiler/getAndSetNotIdenticalType2.ts(9,9): error TS2322: Type 'A) { ~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. - ~ -!!! error TS2380: 'get' and 'set' accessor must have the same type. this.data = v; ~~~~~~~~~ !!! error TS2322: Type 'A' is not assignable to type 'A'. @@ -34,4 +38,7 @@ tests/cases/compiler/getAndSetNotIdenticalType2.ts(9,9): error TS2322: Type 'A' is not assignable to type 'A'. +!!! error TS2322: Type 'unknown' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/getAndSetNotIdenticalType2.types b/tests/baselines/reference/getAndSetNotIdenticalType2.types index b5d4705fd6bc4..d7d903cfe5f8d 100644 --- a/tests/baselines/reference/getAndSetNotIdenticalType2.types +++ b/tests/baselines/reference/getAndSetNotIdenticalType2.types @@ -43,8 +43,8 @@ var r = x.x; x.x = r; >x.x = r : A ->x.x : A +>x.x : A >x : C ->x : A +>x : A >r : A diff --git a/tests/baselines/reference/getAndSetNotIdenticalType3.errors.txt b/tests/baselines/reference/getAndSetNotIdenticalType3.errors.txt index 3fb17d65a400b..8b4e6a0e04b1a 100644 --- a/tests/baselines/reference/getAndSetNotIdenticalType3.errors.txt +++ b/tests/baselines/reference/getAndSetNotIdenticalType3.errors.txt @@ -1,12 +1,14 @@ tests/cases/compiler/getAndSetNotIdenticalType3.ts(5,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/getAndSetNotIdenticalType3.ts(5,9): error TS2380: 'get' and 'set' accessor must have the same type. +tests/cases/compiler/getAndSetNotIdenticalType3.ts(5,9): error TS2380: The return type of a 'get' accessor must be assignable to its 'set' accessor type +tests/cases/compiler/getAndSetNotIdenticalType3.ts(5,9): error TS2380: The return type of a 'get' accessor must be assignable to its 'set' accessor type + Type 'number' is not assignable to type 'string'. tests/cases/compiler/getAndSetNotIdenticalType3.ts(8,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/getAndSetNotIdenticalType3.ts(8,9): error TS2380: 'get' and 'set' accessor must have the same type. tests/cases/compiler/getAndSetNotIdenticalType3.ts(9,9): error TS2322: Type 'A' is not assignable to type 'A'. Type 'string' is not assignable to type 'number'. +tests/cases/compiler/getAndSetNotIdenticalType3.ts(15,1): error TS2322: Type 'A' is not assignable to type 'A'. -==== tests/cases/compiler/getAndSetNotIdenticalType3.ts (5 errors) ==== +==== tests/cases/compiler/getAndSetNotIdenticalType3.ts (6 errors) ==== class A { foo: T; } class C { @@ -15,14 +17,15 @@ tests/cases/compiler/getAndSetNotIdenticalType3.ts(9,9): error TS2322: Type 'A) { ~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. - ~ -!!! error TS2380: 'get' and 'set' accessor must have the same type. this.data = v; ~~~~~~~~~ !!! error TS2322: Type 'A' is not assignable to type 'A'. @@ -32,4 +35,6 @@ tests/cases/compiler/getAndSetNotIdenticalType3.ts(9,9): error TS2322: Type 'A' is not assignable to type 'A'. \ No newline at end of file diff --git a/tests/baselines/reference/getAndSetNotIdenticalType3.types b/tests/baselines/reference/getAndSetNotIdenticalType3.types index e5722f57393fb..45ecfa6a485d5 100644 --- a/tests/baselines/reference/getAndSetNotIdenticalType3.types +++ b/tests/baselines/reference/getAndSetNotIdenticalType3.types @@ -43,8 +43,8 @@ var r = x.x; x.x = r; >x.x = r : A ->x.x : A +>x.x : A >x : C ->x : A +>x : A >r : A diff --git a/tests/baselines/reference/gettersAndSettersAccessibility.errors.txt b/tests/baselines/reference/gettersAndSettersAccessibility.errors.txt index faccaab8fdfc2..2cd7edfd140b9 100644 --- a/tests/baselines/reference/gettersAndSettersAccessibility.errors.txt +++ b/tests/baselines/reference/gettersAndSettersAccessibility.errors.txt @@ -1,7 +1,7 @@ tests/cases/compiler/gettersAndSettersAccessibility.ts(2,14): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/gettersAndSettersAccessibility.ts(2,14): error TS2379: Getter and setter accessors do not agree in visibility. +tests/cases/compiler/gettersAndSettersAccessibility.ts(2,14): error TS2808: A get accessor must be at least as accessible as the setter tests/cases/compiler/gettersAndSettersAccessibility.ts(3,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/gettersAndSettersAccessibility.ts(3,13): error TS2379: Getter and setter accessors do not agree in visibility. +tests/cases/compiler/gettersAndSettersAccessibility.ts(3,13): error TS2808: A get accessor must be at least as accessible as the setter ==== tests/cases/compiler/gettersAndSettersAccessibility.ts (4 errors) ==== @@ -10,11 +10,11 @@ tests/cases/compiler/gettersAndSettersAccessibility.ts(3,13): error TS2379: Gett ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~ -!!! error TS2379: Getter and setter accessors do not agree in visibility. +!!! error TS2808: A get accessor must be at least as accessible as the setter public set Baz(n:number) {} // error - accessors do not agree in visibility ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~ -!!! error TS2379: Getter and setter accessors do not agree in visibility. +!!! error TS2808: A get accessor must be at least as accessible as the setter } \ No newline at end of file diff --git a/tests/baselines/reference/gettersAndSettersErrors.errors.txt b/tests/baselines/reference/gettersAndSettersErrors.errors.txt index 013e195876e86..ef39e558a839e 100644 --- a/tests/baselines/reference/gettersAndSettersErrors.errors.txt +++ b/tests/baselines/reference/gettersAndSettersErrors.errors.txt @@ -5,9 +5,9 @@ tests/cases/compiler/gettersAndSettersErrors.ts(5,12): error TS2717: Subsequent tests/cases/compiler/gettersAndSettersErrors.ts(6,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/gettersAndSettersErrors.ts(7,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/gettersAndSettersErrors.ts(11,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/gettersAndSettersErrors.ts(11,17): error TS2379: Getter and setter accessors do not agree in visibility. +tests/cases/compiler/gettersAndSettersErrors.ts(11,17): error TS2808: A get accessor must be at least as accessible as the setter tests/cases/compiler/gettersAndSettersErrors.ts(12,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/gettersAndSettersErrors.ts(12,16): error TS2379: Getter and setter accessors do not agree in visibility. +tests/cases/compiler/gettersAndSettersErrors.ts(12,16): error TS2808: A get accessor must be at least as accessible as the setter ==== tests/cases/compiler/gettersAndSettersErrors.ts (10 errors) ==== @@ -38,12 +38,12 @@ tests/cases/compiler/gettersAndSettersErrors.ts(12,16): error TS2379: Getter and ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~ -!!! error TS2379: Getter and setter accessors do not agree in visibility. +!!! error TS2808: A get accessor must be at least as accessible as the setter public set Baz(n:number) {} // error - accessors do not agree in visibility ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~ -!!! error TS2379: Getter and setter accessors do not agree in visibility. +!!! error TS2808: A get accessor must be at least as accessible as the setter } diff --git a/tests/baselines/reference/jsdocAccessibilityTags.errors.txt b/tests/baselines/reference/jsdocAccessibilityTags.errors.txt index bcbad8b95eaf2..2edc3816d24b2 100644 --- a/tests/baselines/reference/jsdocAccessibilityTags.errors.txt +++ b/tests/baselines/reference/jsdocAccessibilityTags.errors.txt @@ -1,5 +1,3 @@ -tests/cases/conformance/jsdoc/jsdocAccessibilityTag.js(21,9): error TS2379: Getter and setter accessors do not agree in visibility. -tests/cases/conformance/jsdoc/jsdocAccessibilityTag.js(23,9): error TS2379: Getter and setter accessors do not agree in visibility. tests/cases/conformance/jsdoc/jsdocAccessibilityTag.js(50,14): error TS2341: Property 'priv' is private and only accessible within class 'A'. tests/cases/conformance/jsdoc/jsdocAccessibilityTag.js(55,14): error TS2341: Property 'priv2' is private and only accessible within class 'C'. tests/cases/conformance/jsdoc/jsdocAccessibilityTag.js(58,9): error TS2341: Property 'priv' is private and only accessible within class 'A'. @@ -12,7 +10,7 @@ tests/cases/conformance/jsdoc/jsdocAccessibilityTag.js(61,9): error TS2341: Prop tests/cases/conformance/jsdoc/jsdocAccessibilityTag.js(61,25): error TS2445: Property 'prot2' is protected and only accessible within class 'C' and its subclasses. -==== tests/cases/conformance/jsdoc/jsdocAccessibilityTag.js (12 errors) ==== +==== tests/cases/conformance/jsdoc/jsdocAccessibilityTag.js (10 errors) ==== class A { /** * Ap docs @@ -34,12 +32,8 @@ tests/cases/conformance/jsdoc/jsdocAccessibilityTag.js(61,25): error TS2445: Pro pub = 6; /** @public */ get ack() { return this.priv } - ~~~ -!!! error TS2379: Getter and setter accessors do not agree in visibility. /** @private */ set ack(value) { } - ~~~ -!!! error TS2379: Getter and setter accessors do not agree in visibility. } class C { constructor() { diff --git a/tests/baselines/reference/objectLiteralErrors.errors.txt b/tests/baselines/reference/objectLiteralErrors.errors.txt index fa97ae0ddf406..2a6114ed0957e 100644 --- a/tests/baselines/reference/objectLiteralErrors.errors.txt +++ b/tests/baselines/reference/objectLiteralErrors.errors.txt @@ -71,14 +71,12 @@ tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(38,26) tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(39,13): error TS2300: Duplicate identifier 'a'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(39,46): error TS1119: An object literal cannot have property and accessor with the same name. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(39,46): error TS2300: Duplicate identifier 'a'. -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(42,16): error TS2380: 'get' and 'set' accessor must have the same type. -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(42,47): error TS2380: 'get' and 'set' accessor must have the same type. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(42,16): error TS2380: The return type of a 'get' accessor must be assignable to its 'set' accessor type tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(43,22): error TS2322: Type 'number' is not assignable to type 'string'. -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(44,16): error TS2380: 'get' and 'set' accessor must have the same type. -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(44,55): error TS2380: 'get' and 'set' accessor must have the same type. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(44,16): error TS2380: The return type of a 'get' accessor must be assignable to its 'set' accessor type -==== tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts (78 errors) ==== +==== tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts (76 errors) ==== // Multiple properties with the same name var e1 = { a: 0, a: 0 }; ~ @@ -268,15 +266,11 @@ tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(44,55) // Get and set accessor with mismatched type annotations var g1 = { get a(): number { return 4; }, set a(n: string) { } }; ~ -!!! error TS2380: 'get' and 'set' accessor must have the same type. - ~ -!!! error TS2380: 'get' and 'set' accessor must have the same type. +!!! error TS2380: The return type of a 'get' accessor must be assignable to its 'set' accessor type var g2 = { get a() { return 4; }, set a(n: string) { } }; ~~~~~~~~~ !!! error TS2322: Type 'number' is not assignable to type 'string'. var g3 = { get a(): number { return undefined; }, set a(n: string) { } }; ~ -!!! error TS2380: 'get' and 'set' accessor must have the same type. - ~ -!!! error TS2380: 'get' and 'set' accessor must have the same type. +!!! error TS2380: The return type of a 'get' accessor must be assignable to its 'set' accessor type \ No newline at end of file diff --git a/tests/baselines/reference/thisTypeInAccessorsNegative.errors.txt b/tests/baselines/reference/thisTypeInAccessorsNegative.errors.txt index d7e4ae0628c80..c01bd4c2725bd 100644 --- a/tests/baselines/reference/thisTypeInAccessorsNegative.errors.txt +++ b/tests/baselines/reference/thisTypeInAccessorsNegative.errors.txt @@ -1,10 +1,8 @@ -tests/cases/conformance/types/thisType/thisTypeInAccessorsNegative.ts(10,9): error TS2682: 'get' and 'set' accessor must have the same 'this' type. tests/cases/conformance/types/thisType/thisTypeInAccessorsNegative.ts(10,11): error TS2784: 'get' and 'set' accessors cannot declare 'this' parameters. -tests/cases/conformance/types/thisType/thisTypeInAccessorsNegative.ts(11,9): error TS2682: 'get' and 'set' accessor must have the same 'this' type. tests/cases/conformance/types/thisType/thisTypeInAccessorsNegative.ts(11,11): error TS2784: 'get' and 'set' accessors cannot declare 'this' parameters. -==== tests/cases/conformance/types/thisType/thisTypeInAccessorsNegative.ts (4 errors) ==== +==== tests/cases/conformance/types/thisType/thisTypeInAccessorsNegative.ts (2 errors) ==== interface Foo { n: number; x: number; @@ -15,13 +13,9 @@ tests/cases/conformance/types/thisType/thisTypeInAccessorsNegative.ts(11,11): er const mismatch = { n: 13, get x(this: Foo) { return this.n; }, - ~ -!!! error TS2682: 'get' and 'set' accessor must have the same 'this' type. ~~~~~~~~~ !!! error TS2784: 'get' and 'set' accessors cannot declare 'this' parameters. set x(this: Bar, n) { this.wrong = "method"; } - ~ -!!! error TS2682: 'get' and 'set' accessor must have the same 'this' type. ~~~~~~~~~ !!! error TS2784: 'get' and 'set' accessors cannot declare 'this' parameters. } diff --git a/tests/cases/compiler/accessorBodyInTypeContext.ts b/tests/cases/compiler/accessorBodyInTypeContext.ts new file mode 100644 index 0000000000000..bfbc183077af4 --- /dev/null +++ b/tests/cases/compiler/accessorBodyInTypeContext.ts @@ -0,0 +1,16 @@ +type A = { + get foo() { return 0 } +}; + +type B = { + set foo(v: any) { } +}; + +interface X { + get foo() { return 0 } +} + +interface Y { + set foo(v: any) { } +} + diff --git a/tests/cases/compiler/divergentAccessors1.ts b/tests/cases/compiler/divergentAccessors1.ts new file mode 100644 index 0000000000000..e8d8106500902 --- /dev/null +++ b/tests/cases/compiler/divergentAccessors1.ts @@ -0,0 +1,25 @@ +// @strict: true + +// Accessors in interfaces/types + +{ + interface IHasGetSet { + get foo(): number; + set foo(v: number | string); + } + + const ihgs: IHasGetSet = null as any; + ihgs.foo = "32"; + let r_ihgs_foo: number = ihgs.foo; +} + +{ + type T_HasGetSet = { + get foo(): number; + set foo(v: number | string); + } + + const t_hgs: T_HasGetSet = null as any; + t_hgs.foo = "32"; + let r_t_hgs_foo: number = t_hgs.foo; +} diff --git a/tests/cases/compiler/divergentAccessorsTypes1.ts b/tests/cases/compiler/divergentAccessorsTypes1.ts new file mode 100644 index 0000000000000..fb3e5c63dd78c --- /dev/null +++ b/tests/cases/compiler/divergentAccessorsTypes1.ts @@ -0,0 +1,66 @@ +// @strict: true +// @target: esnext + +class Test1 { + get foo(): string { return "" } + set foo(s: string | number) { + let a = s as string; + let b = s as number; + } + + get bar(): string | number { return "" } + set bar(s: string | number | boolean) { + } +} + +interface Test2 { + get foo(): string; + set foo(s: string | number); + + get bar(): string | number; + set bar(s: string | number | boolean); +} + +type Test3 = { + get foo(): string; + set foo(s: string | number); + + get bar(): string | number; + set bar(s: string | number | boolean); +}; + +{ + const t = new Test1(); + t.foo = 32; + let m: string = t.foo; + + // See how CFA interacts with out-of-type writes + t.bar = 42; + let n: number = t.bar; + t.bar = false; + let o = t.bar; +} + +{ + const t = {} as Test2; + t.foo = 32; + let m: string = t.foo; + + // See how CFA interacts with out-of-type writes + t.bar = 42; + let n: number = t.bar; + t.bar = false; + let o = t.bar; +} + +{ + const t = {} as Test3; + t.foo = 32; + let m: string = t.foo; + + // See how CFA interacts with out-of-type writes + t.bar = 42; + let n: number = t.bar; + t.bar = false; + let o = t.bar; +} \ No newline at end of file diff --git a/tests/cases/compiler/divergentAccessorsTypes2.ts b/tests/cases/compiler/divergentAccessorsTypes2.ts new file mode 100644 index 0000000000000..9e1b42739fe19 --- /dev/null +++ b/tests/cases/compiler/divergentAccessorsTypes2.ts @@ -0,0 +1,13 @@ +// @strict: true +// @target: esnext + +class Test1 { + get foo(): T { return null as any } + set foo(s: T | undefined ) { + } +} + +const s = new Test1(); +s.foo = undefined; +s.foo = "hello"; +s.foo = 42; diff --git a/tests/cases/compiler/divergentAccessorsVisibility1.ts b/tests/cases/compiler/divergentAccessorsVisibility1.ts new file mode 100644 index 0000000000000..2ab11a295d984 --- /dev/null +++ b/tests/cases/compiler/divergentAccessorsVisibility1.ts @@ -0,0 +1,160 @@ +// @strict: true +// @target: esnext + +class Base { + get PublicPublic() { return 0; } + set PublicPublic(v) { return; } + + get PublicProtected() { return 0; } + protected set PublicProtected(v) { return; } + + get PublicPrivate() { return 0; } + private set PublicPrivate(v) { return; } + + protected get ProtectedPublic() { return 0; } + set ProtectedPublic(v) { return; } + + protected get ProtectedProtected() { return 0; } + protected set ProtectedProtected(v) { return; } + + protected get ProtectedPrivate() { return 0; } + private set ProtectedPrivate(v) { return; } + + private get PrivatePublic() { return 0; } + set PrivatePublic(v) { return; } + + private get PrivateProtected() { return 0; } + protected set PrivateProtected(v) { return; } + + private get PrivatePrivate() { return 0; } + private set PrivatePrivate(v) { return; } + + test() { + this.PublicPublic = 0; + this.PublicProtected = 0; + this.PublicPrivate = 0; + this.ProtectedPublic = 0; + this.ProtectedProtected = 0; + this.ProtectedPrivate = 0; + this.PrivatePublic = 0; + this.PrivateProtected = 0; + this.PrivatePrivate = 0; + + void this.PublicPublic; + void this.PublicProtected; + void this.PublicPrivate; + void this.ProtectedPublic; + void this.ProtectedProtected; + void this.ProtectedPrivate; + void this.PrivatePublic; + void this.PrivateProtected; + void this.PrivatePrivate; + + this.PublicPublic += 0; + this.PublicProtected += 0; + this.PublicPrivate += 0; + this.ProtectedPublic += 0; + this.ProtectedProtected += 0; + this.ProtectedPrivate += 0; + this.PrivatePublic += 0; + this.PrivateProtected += 0; + this.PrivatePrivate += 0; + } +} + +class Derived extends Base { + test2() { + this.PublicPublic = 0; + this.PublicProtected = 0; + this.PublicPrivate = 0; + this.ProtectedPublic = 0; + this.ProtectedProtected = 0; + this.ProtectedPrivate = 0; + this.PrivatePublic = 0; + this.PrivateProtected = 0; + this.PrivatePrivate = 0; + + void this.PublicPublic; + void this.PublicProtected; + void this.PublicPrivate; + void this.ProtectedPublic; + void this.ProtectedProtected; + void this.ProtectedPrivate; + void this.PrivatePublic; + void this.PrivateProtected; + void this.PrivatePrivate; + + this.PublicPublic += 0; + this.PublicProtected += 0; + this.PublicPrivate += 0; + this.ProtectedPublic += 0; + this.ProtectedProtected += 0; + this.ProtectedPrivate += 0; + this.PrivatePublic += 0; + this.PrivateProtected += 0; + this.PrivatePrivate += 0; + } +} + +declare const base: Base, deriv: Derived; +function fn() { + base.PublicPublic = 0; + base.PublicProtected = 0; + base.PublicPrivate = 0; + base.ProtectedPublic = 0; + base.ProtectedProtected = 0; + base.ProtectedPrivate = 0; + base.PrivatePublic = 0; + base.PrivateProtected = 0; + base.PrivatePrivate = 0; + + void base.PublicPublic; + void base.PublicProtected; + void base.PublicPrivate; + void base.ProtectedPublic; + void base.ProtectedProtected; + void base.ProtectedPrivate; + void base.PrivatePublic; + void base.PrivateProtected; + void base.PrivatePrivate; + + base.PublicPublic += 0; + base.PublicProtected += 0; + base.PublicPrivate += 0; + base.ProtectedPublic += 0; + base.ProtectedProtected += 0; + base.ProtectedPrivate += 0; + base.PrivatePublic += 0; + base.PrivateProtected += 0; + base.PrivatePrivate += 0; + + deriv.PublicPublic = 0; + deriv.PublicProtected = 0; + deriv.PublicPrivate = 0; + deriv.ProtectedPublic = 0; + deriv.ProtectedProtected = 0; + deriv.ProtectedPrivate = 0; + deriv.PrivatePublic = 0; + deriv.PrivateProtected = 0; + deriv.PrivatePrivate = 0; + + void deriv.PublicPublic; + void deriv.PublicProtected; + void deriv.PublicPrivate; + void deriv.ProtectedPublic; + void deriv.ProtectedProtected; + void deriv.ProtectedPrivate; + void deriv.PrivatePublic; + void deriv.PrivateProtected; + void deriv.PrivatePrivate; + + deriv.PublicPublic += 0; + deriv.PublicProtected += 0; + deriv.PublicPrivate += 0; + deriv.ProtectedPublic += 0; + deriv.ProtectedProtected += 0; + deriv.ProtectedPrivate += 0; + deriv.PrivatePublic += 0; + deriv.PrivateProtected += 0; + deriv.PrivatePrivate += 0; +} diff --git a/tests/cases/fourslash/incrementalResolveAccessor.ts b/tests/cases/fourslash/incrementalResolveAccessor.ts index 810c0db143803..456b7e3a69278 100644 --- a/tests/cases/fourslash/incrementalResolveAccessor.ts +++ b/tests/cases/fourslash/incrementalResolveAccessor.ts @@ -16,4 +16,4 @@ verify.quickInfoAt("1", "var b: string"); // TypeCheck -verify.numberOfErrorsInCurrentFile(3); \ No newline at end of file +verify.numberOfErrorsInCurrentFile(2); \ No newline at end of file