From cd272e824496bbf33fcbc0778b09a8eb88785063 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Tue, 14 Feb 2017 12:42:32 -0800 Subject: [PATCH 1/4] Error on emit declaration of extends class w/o symbol Error when emitting an extends clause for a type that has no symbol. This error only occurs on exported classes. This prevents the emitter from producing types that extend from intersections, which are not parseable right now. --- src/compiler/checker.ts | 3 +++ src/compiler/declarationEmitter.ts | 20 ++++++++++++++++---- src/compiler/diagnosticMessages.json | 4 ++++ src/compiler/types.ts | 1 + src/compiler/utilities.ts | 3 ++- src/services/utilities.ts | 5 +++-- 6 files changed, 29 insertions(+), 7 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 9d84273b00..c9c42a6a72 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -20844,6 +20844,9 @@ namespace ts { const classType = getDeclaredTypeOfSymbol(getSymbolOfNode(node)); resolveBaseTypesOfClass(classType); const baseType = classType.resolvedBaseTypes.length ? classType.resolvedBaseTypes[0] : unknownType; + if (!baseType.symbol) { + writer.reportIllegalExtends(); + } getSymbolDisplayBuilder().buildTypeDisplay(baseType, writer, enclosingDeclaration, flags); } diff --git a/src/compiler/declarationEmitter.ts b/src/compiler/declarationEmitter.ts index f737c5e086..d5ea403e11 100644 --- a/src/compiler/declarationEmitter.ts +++ b/src/compiler/declarationEmitter.ts @@ -190,6 +190,7 @@ namespace ts { const writer = createTextWriter(newLine); writer.trackSymbol = trackSymbol; writer.reportInaccessibleThisError = reportInaccessibleThisError; + writer.reportIllegalExtends = reportIllegalExtends; writer.writeKeyword = writer.write; writer.writeOperator = writer.write; writer.writePunctuation = writer.write; @@ -313,6 +314,14 @@ namespace ts { recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForSymbol(symbol, meaning)); } + function reportIllegalExtends() { + if (errorNameNode) { + reportedDeclarationError = true; + emitterDiagnostics.add(createDiagnosticForNode(errorNameNode, Diagnostics.Extends_clause_of_exported_class_0_refers_to_a_type_with_no_declaration, + declarationNameToString(errorNameNode))); + } + } + function reportInaccessibleThisError() { if (errorNameNode) { reportedDeclarationError = true; @@ -1071,7 +1080,7 @@ namespace ts { } } - function emitHeritageClause(typeReferences: ExpressionWithTypeArguments[], isImplementsList: boolean) { + function emitHeritageClause(className: Identifier, typeReferences: ExpressionWithTypeArguments[], isImplementsList: boolean) { if (typeReferences) { write(isImplementsList ? " implements " : " extends "); emitCommaList(typeReferences, emitTypeOfTypeReference); @@ -1086,7 +1095,9 @@ namespace ts { } else { writer.getSymbolAccessibilityDiagnostic = getHeritageClauseVisibilityError; + errorNameNode = className; resolver.writeBaseConstructorTypeOfClass(enclosingDeclaration, enclosingDeclaration, TypeFormatFlags.UseTypeOfFunction | TypeFormatFlags.UseTypeAliasValue, writer); + errorNameNode = undefined; } function getHeritageClauseVisibilityError(): SymbolAccessibilityDiagnostic { @@ -1136,9 +1147,10 @@ namespace ts { emitTypeParameters(node.typeParameters); const baseTypeNode = getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { - emitHeritageClause([baseTypeNode], /*isImplementsList*/ false); + node.name + emitHeritageClause(node.name, [baseTypeNode], /*isImplementsList*/ false); } - emitHeritageClause(getClassImplementsHeritageClauseElements(node), /*isImplementsList*/ true); + emitHeritageClause(node.name, getClassImplementsHeritageClauseElements(node), /*isImplementsList*/ true); write(" {"); writeLine(); increaseIndent(); @@ -1160,7 +1172,7 @@ namespace ts { emitTypeParameters(node.typeParameters); const interfaceExtendsTypes = filter(getInterfaceBaseTypeNodes(node), base => isEntityNameExpression(base.expression)); if (interfaceExtendsTypes && interfaceExtendsTypes.length) { - emitHeritageClause(interfaceExtendsTypes, /*isImplementsList*/ false); + emitHeritageClause(node.name, interfaceExtendsTypes, /*isImplementsList*/ false); } write(" {"); writeLine(); diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 9f67b95c4d..befdd5cfe4 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -2352,6 +2352,10 @@ "category": "Error", "code": 4092 }, + "Extends clause of exported class '{0}' refers to a type with no declaration.": { + "category": "Error", + "code": 4093 + }, "The current host does not support the '{0}' option.": { "category": "Error", diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 7fb71d12b9..b216d84386 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -2459,6 +2459,7 @@ // with import statements it previously saw (but chose not to emit). trackSymbol(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): void; reportInaccessibleThisError(): void; + reportIllegalExtends(): void; } export const enum TypeFormatFlags { diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 39d53a9a9c..0a88058b9c 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -53,7 +53,8 @@ namespace ts { decreaseIndent: noop, clear: () => str = "", trackSymbol: noop, - reportInaccessibleThisError: noop + reportInaccessibleThisError: noop, + reportIllegalExtends: noop }; } diff --git a/src/services/utilities.ts b/src/services/utilities.ts index f83f9ef823..0d2245abba 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -1166,7 +1166,8 @@ namespace ts { decreaseIndent: () => { indent--; }, clear: resetWriter, trackSymbol: noop, - reportInaccessibleThisError: noop + reportInaccessibleThisError: noop, + reportIllegalExtends: noop }; function writeIndent() { @@ -1386,4 +1387,4 @@ namespace ts { // First token is the open curly, this is where we want to put the 'super' call. return constructor.body.getFirstToken(sourceFile).getEnd(); } -} \ No newline at end of file +} From 2f27e85a18aded71e6d27fcfc9e995f53107ad8f Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Tue, 14 Feb 2017 13:31:22 -0800 Subject: [PATCH 2/4] Test error w/exported class extending intersection --- ...arationEmitExpressionInExtends4.errors.txt | 8 +- ...xportClassExtendingIntersection.errors.txt | 39 ++++++ .../exportClassExtendingIntersection.js | 114 ++++++++++++++++++ .../reference/mixinAccessModifiers.errors.txt | 20 ++- .../reference/mixinAccessModifiers.js | 57 --------- .../exportClassExtendingIntersection.ts | 34 ++++++ 6 files changed, 213 insertions(+), 59 deletions(-) create mode 100644 tests/baselines/reference/exportClassExtendingIntersection.errors.txt create mode 100644 tests/baselines/reference/exportClassExtendingIntersection.js create mode 100644 tests/cases/compiler/exportClassExtendingIntersection.ts diff --git a/tests/baselines/reference/declarationEmitExpressionInExtends4.errors.txt b/tests/baselines/reference/declarationEmitExpressionInExtends4.errors.txt index ad022a0d4d..3d2c6689b7 100644 --- a/tests/baselines/reference/declarationEmitExpressionInExtends4.errors.txt +++ b/tests/baselines/reference/declarationEmitExpressionInExtends4.errors.txt @@ -1,11 +1,13 @@ tests/cases/compiler/declarationEmitExpressionInExtends4.ts(2,10): error TS4060: Return type of exported function has or is using private name 'D'. +tests/cases/compiler/declarationEmitExpressionInExtends4.ts(6,7): error TS4093: Extends clause of exported class 'C' refers to a type with no declaration. tests/cases/compiler/declarationEmitExpressionInExtends4.ts(6,17): error TS2315: Type 'D' is not generic. +tests/cases/compiler/declarationEmitExpressionInExtends4.ts(10,7): error TS4093: Extends clause of exported class 'C2' refers to a type with no declaration. tests/cases/compiler/declarationEmitExpressionInExtends4.ts(10,18): error TS2304: Cannot find name 'SomeUndefinedFunction'. tests/cases/compiler/declarationEmitExpressionInExtends4.ts(15,18): error TS2304: Cannot find name 'SomeUndefinedFunction'. tests/cases/compiler/declarationEmitExpressionInExtends4.ts(15,18): error TS4020: Extends clause of exported class 'C3' has or is using private name 'SomeUndefinedFunction'. -==== tests/cases/compiler/declarationEmitExpressionInExtends4.ts (5 errors) ==== +==== tests/cases/compiler/declarationEmitExpressionInExtends4.ts (7 errors) ==== function getSomething() { ~~~~~~~~~~~~ @@ -14,12 +16,16 @@ tests/cases/compiler/declarationEmitExpressionInExtends4.ts(15,18): error TS4020 } class C extends getSomething() { + ~ +!!! error TS4093: Extends clause of exported class 'C' refers to a type with no declaration. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2315: Type 'D' is not generic. } class C2 extends SomeUndefinedFunction() { + ~~ +!!! error TS4093: Extends clause of exported class 'C2' refers to a type with no declaration. ~~~~~~~~~~~~~~~~~~~~~ !!! error TS2304: Cannot find name 'SomeUndefinedFunction'. diff --git a/tests/baselines/reference/exportClassExtendingIntersection.errors.txt b/tests/baselines/reference/exportClassExtendingIntersection.errors.txt new file mode 100644 index 0000000000..774376a026 --- /dev/null +++ b/tests/baselines/reference/exportClassExtendingIntersection.errors.txt @@ -0,0 +1,39 @@ +tests/cases/compiler/FinalClass.ts(4,14): error TS4093: Extends clause of exported class 'MyExtendedClass' refers to a type with no declaration. + + +==== tests/cases/compiler/BaseClass.ts (0 errors) ==== + export type Constructor = new (...args: any[]) => T; + + export class MyBaseClass { + baseProperty: string; + constructor(value: T) {} + } +==== tests/cases/compiler/MixinClass.ts (0 errors) ==== + import { Constructor, MyBaseClass } from './BaseClass'; + + export interface MyMixin { + mixinProperty: string; + } + + export function MyMixin>>(base: T): T & Constructor { + return class extends base { + mixinProperty: string; + } + } +==== tests/cases/compiler/FinalClass.ts (1 errors) ==== + import { MyBaseClass } from './BaseClass'; + import { MyMixin } from './MixinClass'; + + export class MyExtendedClass extends MyMixin(MyBaseClass) { + ~~~~~~~~~~~~~~~ +!!! error TS4093: Extends clause of exported class 'MyExtendedClass' refers to a type with no declaration. + extendedClassProperty: number; + } +==== tests/cases/compiler/Main.ts (0 errors) ==== + import { MyExtendedClass } from './FinalClass'; + import { MyMixin } from './MixinClass'; + + const myExtendedClass = new MyExtendedClass('string'); + + const AnotherMixedClass = MyMixin(MyExtendedClass); + \ No newline at end of file diff --git a/tests/baselines/reference/exportClassExtendingIntersection.js b/tests/baselines/reference/exportClassExtendingIntersection.js new file mode 100644 index 0000000000..2309a9af9b --- /dev/null +++ b/tests/baselines/reference/exportClassExtendingIntersection.js @@ -0,0 +1,114 @@ +//// [tests/cases/compiler/exportClassExtendingIntersection.ts] //// + +//// [BaseClass.ts] +export type Constructor = new (...args: any[]) => T; + +export class MyBaseClass { + baseProperty: string; + constructor(value: T) {} +} +//// [MixinClass.ts] +import { Constructor, MyBaseClass } from './BaseClass'; + +export interface MyMixin { + mixinProperty: string; +} + +export function MyMixin>>(base: T): T & Constructor { + return class extends base { + mixinProperty: string; + } +} +//// [FinalClass.ts] +import { MyBaseClass } from './BaseClass'; +import { MyMixin } from './MixinClass'; + +export class MyExtendedClass extends MyMixin(MyBaseClass) { + extendedClassProperty: number; +} +//// [Main.ts] +import { MyExtendedClass } from './FinalClass'; +import { MyMixin } from './MixinClass'; + +const myExtendedClass = new MyExtendedClass('string'); + +const AnotherMixedClass = MyMixin(MyExtendedClass); + + +//// [BaseClass.js] +"use strict"; +exports.__esModule = true; +var MyBaseClass = (function () { + function MyBaseClass(value) { + } + return MyBaseClass; +}()); +exports.MyBaseClass = MyBaseClass; +//// [MixinClass.js] +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +exports.__esModule = true; +function MyMixin(base) { + return (function (_super) { + __extends(class_1, _super); + function class_1() { + return _super !== null && _super.apply(this, arguments) || this; + } + return class_1; + }(base)); +} +exports.MyMixin = MyMixin; +//// [FinalClass.js] +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +exports.__esModule = true; +var BaseClass_1 = require("./BaseClass"); +var MixinClass_1 = require("./MixinClass"); +var MyExtendedClass = (function (_super) { + __extends(MyExtendedClass, _super); + function MyExtendedClass() { + return _super !== null && _super.apply(this, arguments) || this; + } + return MyExtendedClass; +}(MixinClass_1.MyMixin(BaseClass_1.MyBaseClass))); +exports.MyExtendedClass = MyExtendedClass; +//// [Main.js] +"use strict"; +exports.__esModule = true; +var FinalClass_1 = require("./FinalClass"); +var MixinClass_1 = require("./MixinClass"); +var myExtendedClass = new FinalClass_1.MyExtendedClass('string'); +var AnotherMixedClass = MixinClass_1.MyMixin(FinalClass_1.MyExtendedClass); + + +//// [BaseClass.d.ts] +export declare type Constructor = new (...args: any[]) => T; +export declare class MyBaseClass { + baseProperty: string; + constructor(value: T); +} +//// [MixinClass.d.ts] +import { Constructor, MyBaseClass } from './BaseClass'; +export interface MyMixin { + mixinProperty: string; +} +export declare function MyMixin>>(base: T): T & Constructor; +//// [Main.d.ts] diff --git a/tests/baselines/reference/mixinAccessModifiers.errors.txt b/tests/baselines/reference/mixinAccessModifiers.errors.txt index a161a85588..22cfab4e0e 100644 --- a/tests/baselines/reference/mixinAccessModifiers.errors.txt +++ b/tests/baselines/reference/mixinAccessModifiers.errors.txt @@ -5,19 +5,25 @@ tests/cases/conformance/classes/mixinAccessModifiers.ts(51,4): error TS2445: Pro tests/cases/conformance/classes/mixinAccessModifiers.ts(66,7): error TS2415: Class 'C1' incorrectly extends base class 'Private & Private2'. Type 'C1' is not assignable to type 'Private'. Property 'p' has conflicting declarations and is inaccessible in type 'C1'. +tests/cases/conformance/classes/mixinAccessModifiers.ts(66,7): error TS4093: Extends clause of exported class 'C1' refers to a type with no declaration. tests/cases/conformance/classes/mixinAccessModifiers.ts(67,7): error TS2415: Class 'C2' incorrectly extends base class 'Private & Protected'. Type 'C2' is not assignable to type 'Private'. Property 'p' has conflicting declarations and is inaccessible in type 'C2'. +tests/cases/conformance/classes/mixinAccessModifiers.ts(67,7): error TS4093: Extends clause of exported class 'C2' refers to a type with no declaration. tests/cases/conformance/classes/mixinAccessModifiers.ts(68,7): error TS2415: Class 'C3' incorrectly extends base class 'Private & Public'. Type 'C3' is not assignable to type 'Private'. Property 'p' has conflicting declarations and is inaccessible in type 'C3'. +tests/cases/conformance/classes/mixinAccessModifiers.ts(68,7): error TS4093: Extends clause of exported class 'C3' refers to a type with no declaration. +tests/cases/conformance/classes/mixinAccessModifiers.ts(70,7): error TS4093: Extends clause of exported class 'C4' refers to a type with no declaration. +tests/cases/conformance/classes/mixinAccessModifiers.ts(83,7): error TS4093: Extends clause of exported class 'C5' refers to a type with no declaration. tests/cases/conformance/classes/mixinAccessModifiers.ts(85,6): error TS2445: Property 'p' is protected and only accessible within class 'C4' and its subclasses. tests/cases/conformance/classes/mixinAccessModifiers.ts(90,6): error TS2445: Property 's' is protected and only accessible within class 'typeof C4' and its subclasses. +tests/cases/conformance/classes/mixinAccessModifiers.ts(96,7): error TS4093: Extends clause of exported class 'C6' refers to a type with no declaration. tests/cases/conformance/classes/mixinAccessModifiers.ts(98,6): error TS2445: Property 'p' is protected and only accessible within class 'C4' and its subclasses. tests/cases/conformance/classes/mixinAccessModifiers.ts(103,6): error TS2445: Property 's' is protected and only accessible within class 'typeof C4' and its subclasses. -==== tests/cases/conformance/classes/mixinAccessModifiers.ts (11 errors) ==== +==== tests/cases/conformance/classes/mixinAccessModifiers.ts (17 errors) ==== type Constructable = new (...args: any[]) => object; @@ -96,18 +102,26 @@ tests/cases/conformance/classes/mixinAccessModifiers.ts(103,6): error TS2445: Pr !!! error TS2415: Class 'C1' incorrectly extends base class 'Private & Private2'. !!! error TS2415: Type 'C1' is not assignable to type 'Private'. !!! error TS2415: Property 'p' has conflicting declarations and is inaccessible in type 'C1'. + ~~ +!!! error TS4093: Extends clause of exported class 'C1' refers to a type with no declaration. class C2 extends Mix(Private, Protected) {} ~~ !!! error TS2415: Class 'C2' incorrectly extends base class 'Private & Protected'. !!! error TS2415: Type 'C2' is not assignable to type 'Private'. !!! error TS2415: Property 'p' has conflicting declarations and is inaccessible in type 'C2'. + ~~ +!!! error TS4093: Extends clause of exported class 'C2' refers to a type with no declaration. class C3 extends Mix(Private, Public) {} ~~ !!! error TS2415: Class 'C3' incorrectly extends base class 'Private & Public'. !!! error TS2415: Type 'C3' is not assignable to type 'Private'. !!! error TS2415: Property 'p' has conflicting declarations and is inaccessible in type 'C3'. + ~~ +!!! error TS4093: Extends clause of exported class 'C3' refers to a type with no declaration. class C4 extends Mix(Protected, Protected2) { + ~~ +!!! error TS4093: Extends clause of exported class 'C4' refers to a type with no declaration. f(c4: C4, c5: C5, c6: C6) { c4.p; c5.p; @@ -121,6 +135,8 @@ tests/cases/conformance/classes/mixinAccessModifiers.ts(103,6): error TS2445: Pr } class C5 extends Mix(Protected, Public) { + ~~ +!!! error TS4093: Extends clause of exported class 'C5' refers to a type with no declaration. f(c4: C4, c5: C5, c6: C6) { c4.p; // Error, not in class deriving from Protected2 ~ @@ -138,6 +154,8 @@ tests/cases/conformance/classes/mixinAccessModifiers.ts(103,6): error TS2445: Pr } class C6 extends Mix(Public, Public2) { + ~~ +!!! error TS4093: Extends clause of exported class 'C6' refers to a type with no declaration. f(c4: C4, c5: C5, c6: C6) { c4.p; // Error, not in class deriving from Protected2 ~ diff --git a/tests/baselines/reference/mixinAccessModifiers.js b/tests/baselines/reference/mixinAccessModifiers.js index 5bf42f480f..1db30e37a6 100644 --- a/tests/baselines/reference/mixinAccessModifiers.js +++ b/tests/baselines/reference/mixinAccessModifiers.js @@ -264,60 +264,3 @@ var C6 = (function (_super) { }; return C6; }(Mix(Public, Public2))); - - -//// [mixinAccessModifiers.d.ts] -declare type Constructable = new (...args: any[]) => object; -declare class Private { - constructor(...args: any[]); - private p; -} -declare class Private2 { - constructor(...args: any[]); - private p; -} -declare class Protected { - constructor(...args: any[]); - protected p: string; - protected static s: string; -} -declare class Protected2 { - constructor(...args: any[]); - protected p: string; - protected static s: string; -} -declare class Public { - constructor(...args: any[]); - p: string; - static s: string; -} -declare class Public2 { - constructor(...args: any[]); - p: string; - static s: string; -} -declare function f1(x: Private & Private2): void; -declare function f2(x: Private & Protected): void; -declare function f3(x: Private & Public): void; -declare function f4(x: Protected & Protected2): void; -declare function f5(x: Protected & Public): void; -declare function f6(x: Public & Public2): void; -declare function Mix(c1: T, c2: U): T & U; -declare class C1 extends Private & Private2 { -} -declare class C2 extends Private & Protected { -} -declare class C3 extends Private & Public { -} -declare class C4 extends Protected & Protected2 { - f(c4: C4, c5: C5, c6: C6): void; - static g(): void; -} -declare class C5 extends Protected & Public { - f(c4: C4, c5: C5, c6: C6): void; - static g(): void; -} -declare class C6 extends Public & Public2 { - f(c4: C4, c5: C5, c6: C6): void; - static g(): void; -} diff --git a/tests/cases/compiler/exportClassExtendingIntersection.ts b/tests/cases/compiler/exportClassExtendingIntersection.ts new file mode 100644 index 0000000000..2252be3bad --- /dev/null +++ b/tests/cases/compiler/exportClassExtendingIntersection.ts @@ -0,0 +1,34 @@ +// @declaration: true +// @Filename:BaseClass.ts +export type Constructor = new (...args: any[]) => T; + +export class MyBaseClass { + baseProperty: string; + constructor(value: T) {} +} +// @Filename:MixinClass.ts +import { Constructor, MyBaseClass } from './BaseClass'; + +export interface MyMixin { + mixinProperty: string; +} + +export function MyMixin>>(base: T): T & Constructor { + return class extends base { + mixinProperty: string; + } +} +// @Filename:FinalClass.ts +import { MyBaseClass } from './BaseClass'; +import { MyMixin } from './MixinClass'; + +export class MyExtendedClass extends MyMixin(MyBaseClass) { + extendedClassProperty: number; +} +// @Filename:Main.ts +import { MyExtendedClass } from './FinalClass'; +import { MyMixin } from './MixinClass'; + +const myExtendedClass = new MyExtendedClass('string'); + +const AnotherMixedClass = MyMixin(MyExtendedClass); From d1a972fcdd19eda667f7947e6fdcf2b474b80675 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Tue, 14 Feb 2017 14:13:12 -0800 Subject: [PATCH 3/4] Address PR comment --- src/compiler/declarationEmitter.ts | 2 +- src/compiler/diagnosticMessages.json | 2 +- ...arationEmitExpressionInExtends4.errors.txt | 8 +++---- ...xportClassExtendingIntersection.errors.txt | 4 ++-- .../reference/mixinAccessModifiers.errors.txt | 24 +++++++++---------- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/compiler/declarationEmitter.ts b/src/compiler/declarationEmitter.ts index d5ea403e11..f05a914380 100644 --- a/src/compiler/declarationEmitter.ts +++ b/src/compiler/declarationEmitter.ts @@ -317,7 +317,7 @@ namespace ts { function reportIllegalExtends() { if (errorNameNode) { reportedDeclarationError = true; - emitterDiagnostics.add(createDiagnosticForNode(errorNameNode, Diagnostics.Extends_clause_of_exported_class_0_refers_to_a_type_with_no_declaration, + emitterDiagnostics.add(createDiagnosticForNode(errorNameNode, Diagnostics.Extends_clause_of_exported_class_0_refers_to_a_type_whose_name_cannot_be_referenced, declarationNameToString(errorNameNode))); } } diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index befdd5cfe4..e477f1528e 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -2352,7 +2352,7 @@ "category": "Error", "code": 4092 }, - "Extends clause of exported class '{0}' refers to a type with no declaration.": { + "Extends clause of exported class '{0}' refers to a type whose name cannot be referenced.": { "category": "Error", "code": 4093 }, diff --git a/tests/baselines/reference/declarationEmitExpressionInExtends4.errors.txt b/tests/baselines/reference/declarationEmitExpressionInExtends4.errors.txt index 3d2c6689b7..80e815c561 100644 --- a/tests/baselines/reference/declarationEmitExpressionInExtends4.errors.txt +++ b/tests/baselines/reference/declarationEmitExpressionInExtends4.errors.txt @@ -1,7 +1,7 @@ tests/cases/compiler/declarationEmitExpressionInExtends4.ts(2,10): error TS4060: Return type of exported function has or is using private name 'D'. -tests/cases/compiler/declarationEmitExpressionInExtends4.ts(6,7): error TS4093: Extends clause of exported class 'C' refers to a type with no declaration. +tests/cases/compiler/declarationEmitExpressionInExtends4.ts(6,7): error TS4093: Extends clause of exported class 'C' refers to a type whose name cannot be referenced. tests/cases/compiler/declarationEmitExpressionInExtends4.ts(6,17): error TS2315: Type 'D' is not generic. -tests/cases/compiler/declarationEmitExpressionInExtends4.ts(10,7): error TS4093: Extends clause of exported class 'C2' refers to a type with no declaration. +tests/cases/compiler/declarationEmitExpressionInExtends4.ts(10,7): error TS4093: Extends clause of exported class 'C2' refers to a type whose name cannot be referenced. tests/cases/compiler/declarationEmitExpressionInExtends4.ts(10,18): error TS2304: Cannot find name 'SomeUndefinedFunction'. tests/cases/compiler/declarationEmitExpressionInExtends4.ts(15,18): error TS2304: Cannot find name 'SomeUndefinedFunction'. tests/cases/compiler/declarationEmitExpressionInExtends4.ts(15,18): error TS4020: Extends clause of exported class 'C3' has or is using private name 'SomeUndefinedFunction'. @@ -17,7 +17,7 @@ tests/cases/compiler/declarationEmitExpressionInExtends4.ts(15,18): error TS4020 class C extends getSomething() { ~ -!!! error TS4093: Extends clause of exported class 'C' refers to a type with no declaration. +!!! error TS4093: Extends clause of exported class 'C' refers to a type whose name cannot be referenced. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2315: Type 'D' is not generic. @@ -25,7 +25,7 @@ tests/cases/compiler/declarationEmitExpressionInExtends4.ts(15,18): error TS4020 class C2 extends SomeUndefinedFunction() { ~~ -!!! error TS4093: Extends clause of exported class 'C2' refers to a type with no declaration. +!!! error TS4093: Extends clause of exported class 'C2' refers to a type whose name cannot be referenced. ~~~~~~~~~~~~~~~~~~~~~ !!! error TS2304: Cannot find name 'SomeUndefinedFunction'. diff --git a/tests/baselines/reference/exportClassExtendingIntersection.errors.txt b/tests/baselines/reference/exportClassExtendingIntersection.errors.txt index 774376a026..8464d0691c 100644 --- a/tests/baselines/reference/exportClassExtendingIntersection.errors.txt +++ b/tests/baselines/reference/exportClassExtendingIntersection.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/FinalClass.ts(4,14): error TS4093: Extends clause of exported class 'MyExtendedClass' refers to a type with no declaration. +tests/cases/compiler/FinalClass.ts(4,14): error TS4093: Extends clause of exported class 'MyExtendedClass' refers to a type whose name cannot be referenced. ==== tests/cases/compiler/BaseClass.ts (0 errors) ==== @@ -26,7 +26,7 @@ tests/cases/compiler/FinalClass.ts(4,14): error TS4093: Extends clause of export export class MyExtendedClass extends MyMixin(MyBaseClass) { ~~~~~~~~~~~~~~~ -!!! error TS4093: Extends clause of exported class 'MyExtendedClass' refers to a type with no declaration. +!!! error TS4093: Extends clause of exported class 'MyExtendedClass' refers to a type whose name cannot be referenced. extendedClassProperty: number; } ==== tests/cases/compiler/Main.ts (0 errors) ==== diff --git a/tests/baselines/reference/mixinAccessModifiers.errors.txt b/tests/baselines/reference/mixinAccessModifiers.errors.txt index 22cfab4e0e..cacdeef6d5 100644 --- a/tests/baselines/reference/mixinAccessModifiers.errors.txt +++ b/tests/baselines/reference/mixinAccessModifiers.errors.txt @@ -5,20 +5,20 @@ tests/cases/conformance/classes/mixinAccessModifiers.ts(51,4): error TS2445: Pro tests/cases/conformance/classes/mixinAccessModifiers.ts(66,7): error TS2415: Class 'C1' incorrectly extends base class 'Private & Private2'. Type 'C1' is not assignable to type 'Private'. Property 'p' has conflicting declarations and is inaccessible in type 'C1'. -tests/cases/conformance/classes/mixinAccessModifiers.ts(66,7): error TS4093: Extends clause of exported class 'C1' refers to a type with no declaration. +tests/cases/conformance/classes/mixinAccessModifiers.ts(66,7): error TS4093: Extends clause of exported class 'C1' refers to a type whose name cannot be referenced. tests/cases/conformance/classes/mixinAccessModifiers.ts(67,7): error TS2415: Class 'C2' incorrectly extends base class 'Private & Protected'. Type 'C2' is not assignable to type 'Private'. Property 'p' has conflicting declarations and is inaccessible in type 'C2'. -tests/cases/conformance/classes/mixinAccessModifiers.ts(67,7): error TS4093: Extends clause of exported class 'C2' refers to a type with no declaration. +tests/cases/conformance/classes/mixinAccessModifiers.ts(67,7): error TS4093: Extends clause of exported class 'C2' refers to a type whose name cannot be referenced. tests/cases/conformance/classes/mixinAccessModifiers.ts(68,7): error TS2415: Class 'C3' incorrectly extends base class 'Private & Public'. Type 'C3' is not assignable to type 'Private'. Property 'p' has conflicting declarations and is inaccessible in type 'C3'. -tests/cases/conformance/classes/mixinAccessModifiers.ts(68,7): error TS4093: Extends clause of exported class 'C3' refers to a type with no declaration. -tests/cases/conformance/classes/mixinAccessModifiers.ts(70,7): error TS4093: Extends clause of exported class 'C4' refers to a type with no declaration. -tests/cases/conformance/classes/mixinAccessModifiers.ts(83,7): error TS4093: Extends clause of exported class 'C5' refers to a type with no declaration. +tests/cases/conformance/classes/mixinAccessModifiers.ts(68,7): error TS4093: Extends clause of exported class 'C3' refers to a type whose name cannot be referenced. +tests/cases/conformance/classes/mixinAccessModifiers.ts(70,7): error TS4093: Extends clause of exported class 'C4' refers to a type whose name cannot be referenced. +tests/cases/conformance/classes/mixinAccessModifiers.ts(83,7): error TS4093: Extends clause of exported class 'C5' refers to a type whose name cannot be referenced. tests/cases/conformance/classes/mixinAccessModifiers.ts(85,6): error TS2445: Property 'p' is protected and only accessible within class 'C4' and its subclasses. tests/cases/conformance/classes/mixinAccessModifiers.ts(90,6): error TS2445: Property 's' is protected and only accessible within class 'typeof C4' and its subclasses. -tests/cases/conformance/classes/mixinAccessModifiers.ts(96,7): error TS4093: Extends clause of exported class 'C6' refers to a type with no declaration. +tests/cases/conformance/classes/mixinAccessModifiers.ts(96,7): error TS4093: Extends clause of exported class 'C6' refers to a type whose name cannot be referenced. tests/cases/conformance/classes/mixinAccessModifiers.ts(98,6): error TS2445: Property 'p' is protected and only accessible within class 'C4' and its subclasses. tests/cases/conformance/classes/mixinAccessModifiers.ts(103,6): error TS2445: Property 's' is protected and only accessible within class 'typeof C4' and its subclasses. @@ -103,25 +103,25 @@ tests/cases/conformance/classes/mixinAccessModifiers.ts(103,6): error TS2445: Pr !!! error TS2415: Type 'C1' is not assignable to type 'Private'. !!! error TS2415: Property 'p' has conflicting declarations and is inaccessible in type 'C1'. ~~ -!!! error TS4093: Extends clause of exported class 'C1' refers to a type with no declaration. +!!! error TS4093: Extends clause of exported class 'C1' refers to a type whose name cannot be referenced. class C2 extends Mix(Private, Protected) {} ~~ !!! error TS2415: Class 'C2' incorrectly extends base class 'Private & Protected'. !!! error TS2415: Type 'C2' is not assignable to type 'Private'. !!! error TS2415: Property 'p' has conflicting declarations and is inaccessible in type 'C2'. ~~ -!!! error TS4093: Extends clause of exported class 'C2' refers to a type with no declaration. +!!! error TS4093: Extends clause of exported class 'C2' refers to a type whose name cannot be referenced. class C3 extends Mix(Private, Public) {} ~~ !!! error TS2415: Class 'C3' incorrectly extends base class 'Private & Public'. !!! error TS2415: Type 'C3' is not assignable to type 'Private'. !!! error TS2415: Property 'p' has conflicting declarations and is inaccessible in type 'C3'. ~~ -!!! error TS4093: Extends clause of exported class 'C3' refers to a type with no declaration. +!!! error TS4093: Extends clause of exported class 'C3' refers to a type whose name cannot be referenced. class C4 extends Mix(Protected, Protected2) { ~~ -!!! error TS4093: Extends clause of exported class 'C4' refers to a type with no declaration. +!!! error TS4093: Extends clause of exported class 'C4' refers to a type whose name cannot be referenced. f(c4: C4, c5: C5, c6: C6) { c4.p; c5.p; @@ -136,7 +136,7 @@ tests/cases/conformance/classes/mixinAccessModifiers.ts(103,6): error TS2445: Pr class C5 extends Mix(Protected, Public) { ~~ -!!! error TS4093: Extends clause of exported class 'C5' refers to a type with no declaration. +!!! error TS4093: Extends clause of exported class 'C5' refers to a type whose name cannot be referenced. f(c4: C4, c5: C5, c6: C6) { c4.p; // Error, not in class deriving from Protected2 ~ @@ -155,7 +155,7 @@ tests/cases/conformance/classes/mixinAccessModifiers.ts(103,6): error TS2445: Pr class C6 extends Mix(Public, Public2) { ~~ -!!! error TS4093: Extends clause of exported class 'C6' refers to a type with no declaration. +!!! error TS4093: Extends clause of exported class 'C6' refers to a type whose name cannot be referenced. f(c4: C4, c5: C5, c6: C6) { c4.p; // Error, not in class deriving from Protected2 ~ From c2b2c78c4a4e20b1a72fc3d58e173636eea7ca70 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Tue, 14 Feb 2017 15:04:31 -0800 Subject: [PATCH 4/4] Make 'extends' error message uniform. Refer to "'extends' clause" instead of "Extends clause". --- src/compiler/declarationEmitter.ts | 6 ++--- src/compiler/diagnosticMessages.json | 8 +++---- ...arationEmitExpressionInExtends3.errors.txt | 8 +++---- ...arationEmitExpressionInExtends4.errors.txt | 12 +++++----- ...xportClassExtendingIntersection.errors.txt | 4 ++-- .../reference/mixinAccessModifiers.errors.txt | 24 +++++++++---------- ...ivacyClassExtendsClauseDeclFile.errors.txt | 20 ++++++++-------- ...yInterfaceExtendsClauseDeclFile.errors.txt | 24 +++++++++---------- 8 files changed, 53 insertions(+), 53 deletions(-) diff --git a/src/compiler/declarationEmitter.ts b/src/compiler/declarationEmitter.ts index f05a914380..f64a9fdafb 100644 --- a/src/compiler/declarationEmitter.ts +++ b/src/compiler/declarationEmitter.ts @@ -317,7 +317,7 @@ namespace ts { function reportIllegalExtends() { if (errorNameNode) { reportedDeclarationError = true; - emitterDiagnostics.add(createDiagnosticForNode(errorNameNode, Diagnostics.Extends_clause_of_exported_class_0_refers_to_a_type_whose_name_cannot_be_referenced, + emitterDiagnostics.add(createDiagnosticForNode(errorNameNode, Diagnostics.extends_clause_of_exported_class_0_refers_to_a_type_whose_name_cannot_be_referenced, declarationNameToString(errorNameNode))); } } @@ -1107,11 +1107,11 @@ namespace ts { // Class or Interface implemented/extended is inaccessible diagnosticMessage = isImplementsList ? Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : - Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_private_name_1; + Diagnostics.extends_clause_of_exported_class_0_has_or_is_using_private_name_1; } else { // interface is inaccessible - diagnosticMessage = Diagnostics.Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1; + diagnosticMessage = Diagnostics.extends_clause_of_exported_interface_0_has_or_is_using_private_name_1; } return { diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index e477f1528e..141ca8c784 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -2096,11 +2096,11 @@ "category": "Error", "code": 4019 }, - "Extends clause of exported class '{0}' has or is using private name '{1}'.": { + "'extends' clause of exported class '{0}' has or is using private name '{1}'.": { "category": "Error", "code": 4020 }, - "Extends clause of exported interface '{0}' has or is using private name '{1}'.": { + "'extends' clause of exported interface '{0}' has or is using private name '{1}'.": { "category": "Error", "code": 4022 }, @@ -2352,7 +2352,7 @@ "category": "Error", "code": 4092 }, - "Extends clause of exported class '{0}' refers to a type whose name cannot be referenced.": { + "'extends' clause of exported class '{0}' refers to a type whose name cannot be referenced.": { "category": "Error", "code": 4093 }, @@ -3169,7 +3169,7 @@ "category": "Error", "code": 8016 }, - "Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses.": { + "Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clause.": { "category": "Error", "code": 9002 }, diff --git a/tests/baselines/reference/declarationEmitExpressionInExtends3.errors.txt b/tests/baselines/reference/declarationEmitExpressionInExtends3.errors.txt index 5ed622caaf..8bc4d9ac8d 100644 --- a/tests/baselines/reference/declarationEmitExpressionInExtends3.errors.txt +++ b/tests/baselines/reference/declarationEmitExpressionInExtends3.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/declarationEmitExpressionInExtends3.ts(29,30): error TS4020: Extends clause of exported class 'MyClass' has or is using private name 'LocalClass'. -tests/cases/compiler/declarationEmitExpressionInExtends3.ts(37,31): error TS4020: Extends clause of exported class 'MyClass3' has or is using private name 'LocalInterface'. +tests/cases/compiler/declarationEmitExpressionInExtends3.ts(29,30): error TS4020: 'extends' clause of exported class 'MyClass' has or is using private name 'LocalClass'. +tests/cases/compiler/declarationEmitExpressionInExtends3.ts(37,31): error TS4020: 'extends' clause of exported class 'MyClass3' has or is using private name 'LocalInterface'. ==== tests/cases/compiler/declarationEmitExpressionInExtends3.ts (2 errors) ==== @@ -33,7 +33,7 @@ tests/cases/compiler/declarationEmitExpressionInExtends3.ts(37,31): error TS4020 export class MyClass extends getLocalClass(undefined) { // error LocalClass is inaccisible ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4020: Extends clause of exported class 'MyClass' has or is using private name 'LocalClass'. +!!! error TS4020: 'extends' clause of exported class 'MyClass' has or is using private name 'LocalClass'. } @@ -43,7 +43,7 @@ tests/cases/compiler/declarationEmitExpressionInExtends3.ts(37,31): error TS4020 export class MyClass3 extends getExportedClass(undefined) { // Error LocalInterface is inaccisble ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4020: Extends clause of exported class 'MyClass3' has or is using private name 'LocalInterface'. +!!! error TS4020: 'extends' clause of exported class 'MyClass3' has or is using private name 'LocalInterface'. } diff --git a/tests/baselines/reference/declarationEmitExpressionInExtends4.errors.txt b/tests/baselines/reference/declarationEmitExpressionInExtends4.errors.txt index 80e815c561..127f71ff35 100644 --- a/tests/baselines/reference/declarationEmitExpressionInExtends4.errors.txt +++ b/tests/baselines/reference/declarationEmitExpressionInExtends4.errors.txt @@ -1,10 +1,10 @@ tests/cases/compiler/declarationEmitExpressionInExtends4.ts(2,10): error TS4060: Return type of exported function has or is using private name 'D'. -tests/cases/compiler/declarationEmitExpressionInExtends4.ts(6,7): error TS4093: Extends clause of exported class 'C' refers to a type whose name cannot be referenced. +tests/cases/compiler/declarationEmitExpressionInExtends4.ts(6,7): error TS4093: 'extends' clause of exported class 'C' refers to a type whose name cannot be referenced. tests/cases/compiler/declarationEmitExpressionInExtends4.ts(6,17): error TS2315: Type 'D' is not generic. -tests/cases/compiler/declarationEmitExpressionInExtends4.ts(10,7): error TS4093: Extends clause of exported class 'C2' refers to a type whose name cannot be referenced. +tests/cases/compiler/declarationEmitExpressionInExtends4.ts(10,7): error TS4093: 'extends' clause of exported class 'C2' refers to a type whose name cannot be referenced. tests/cases/compiler/declarationEmitExpressionInExtends4.ts(10,18): error TS2304: Cannot find name 'SomeUndefinedFunction'. tests/cases/compiler/declarationEmitExpressionInExtends4.ts(15,18): error TS2304: Cannot find name 'SomeUndefinedFunction'. -tests/cases/compiler/declarationEmitExpressionInExtends4.ts(15,18): error TS4020: Extends clause of exported class 'C3' has or is using private name 'SomeUndefinedFunction'. +tests/cases/compiler/declarationEmitExpressionInExtends4.ts(15,18): error TS4020: 'extends' clause of exported class 'C3' has or is using private name 'SomeUndefinedFunction'. ==== tests/cases/compiler/declarationEmitExpressionInExtends4.ts (7 errors) ==== @@ -17,7 +17,7 @@ tests/cases/compiler/declarationEmitExpressionInExtends4.ts(15,18): error TS4020 class C extends getSomething() { ~ -!!! error TS4093: Extends clause of exported class 'C' refers to a type whose name cannot be referenced. +!!! error TS4093: 'extends' clause of exported class 'C' refers to a type whose name cannot be referenced. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2315: Type 'D' is not generic. @@ -25,7 +25,7 @@ tests/cases/compiler/declarationEmitExpressionInExtends4.ts(15,18): error TS4020 class C2 extends SomeUndefinedFunction() { ~~ -!!! error TS4093: Extends clause of exported class 'C2' refers to a type whose name cannot be referenced. +!!! error TS4093: 'extends' clause of exported class 'C2' refers to a type whose name cannot be referenced. ~~~~~~~~~~~~~~~~~~~~~ !!! error TS2304: Cannot find name 'SomeUndefinedFunction'. @@ -36,6 +36,6 @@ tests/cases/compiler/declarationEmitExpressionInExtends4.ts(15,18): error TS4020 ~~~~~~~~~~~~~~~~~~~~~ !!! error TS2304: Cannot find name 'SomeUndefinedFunction'. ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4020: Extends clause of exported class 'C3' has or is using private name 'SomeUndefinedFunction'. +!!! error TS4020: 'extends' clause of exported class 'C3' has or is using private name 'SomeUndefinedFunction'. } \ No newline at end of file diff --git a/tests/baselines/reference/exportClassExtendingIntersection.errors.txt b/tests/baselines/reference/exportClassExtendingIntersection.errors.txt index 8464d0691c..eb94869fdc 100644 --- a/tests/baselines/reference/exportClassExtendingIntersection.errors.txt +++ b/tests/baselines/reference/exportClassExtendingIntersection.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/FinalClass.ts(4,14): error TS4093: Extends clause of exported class 'MyExtendedClass' refers to a type whose name cannot be referenced. +tests/cases/compiler/FinalClass.ts(4,14): error TS4093: 'extends' clause of exported class 'MyExtendedClass' refers to a type whose name cannot be referenced. ==== tests/cases/compiler/BaseClass.ts (0 errors) ==== @@ -26,7 +26,7 @@ tests/cases/compiler/FinalClass.ts(4,14): error TS4093: Extends clause of export export class MyExtendedClass extends MyMixin(MyBaseClass) { ~~~~~~~~~~~~~~~ -!!! error TS4093: Extends clause of exported class 'MyExtendedClass' refers to a type whose name cannot be referenced. +!!! error TS4093: 'extends' clause of exported class 'MyExtendedClass' refers to a type whose name cannot be referenced. extendedClassProperty: number; } ==== tests/cases/compiler/Main.ts (0 errors) ==== diff --git a/tests/baselines/reference/mixinAccessModifiers.errors.txt b/tests/baselines/reference/mixinAccessModifiers.errors.txt index cacdeef6d5..be82571e02 100644 --- a/tests/baselines/reference/mixinAccessModifiers.errors.txt +++ b/tests/baselines/reference/mixinAccessModifiers.errors.txt @@ -5,20 +5,20 @@ tests/cases/conformance/classes/mixinAccessModifiers.ts(51,4): error TS2445: Pro tests/cases/conformance/classes/mixinAccessModifiers.ts(66,7): error TS2415: Class 'C1' incorrectly extends base class 'Private & Private2'. Type 'C1' is not assignable to type 'Private'. Property 'p' has conflicting declarations and is inaccessible in type 'C1'. -tests/cases/conformance/classes/mixinAccessModifiers.ts(66,7): error TS4093: Extends clause of exported class 'C1' refers to a type whose name cannot be referenced. +tests/cases/conformance/classes/mixinAccessModifiers.ts(66,7): error TS4093: 'extends' clause of exported class 'C1' refers to a type whose name cannot be referenced. tests/cases/conformance/classes/mixinAccessModifiers.ts(67,7): error TS2415: Class 'C2' incorrectly extends base class 'Private & Protected'. Type 'C2' is not assignable to type 'Private'. Property 'p' has conflicting declarations and is inaccessible in type 'C2'. -tests/cases/conformance/classes/mixinAccessModifiers.ts(67,7): error TS4093: Extends clause of exported class 'C2' refers to a type whose name cannot be referenced. +tests/cases/conformance/classes/mixinAccessModifiers.ts(67,7): error TS4093: 'extends' clause of exported class 'C2' refers to a type whose name cannot be referenced. tests/cases/conformance/classes/mixinAccessModifiers.ts(68,7): error TS2415: Class 'C3' incorrectly extends base class 'Private & Public'. Type 'C3' is not assignable to type 'Private'. Property 'p' has conflicting declarations and is inaccessible in type 'C3'. -tests/cases/conformance/classes/mixinAccessModifiers.ts(68,7): error TS4093: Extends clause of exported class 'C3' refers to a type whose name cannot be referenced. -tests/cases/conformance/classes/mixinAccessModifiers.ts(70,7): error TS4093: Extends clause of exported class 'C4' refers to a type whose name cannot be referenced. -tests/cases/conformance/classes/mixinAccessModifiers.ts(83,7): error TS4093: Extends clause of exported class 'C5' refers to a type whose name cannot be referenced. +tests/cases/conformance/classes/mixinAccessModifiers.ts(68,7): error TS4093: 'extends' clause of exported class 'C3' refers to a type whose name cannot be referenced. +tests/cases/conformance/classes/mixinAccessModifiers.ts(70,7): error TS4093: 'extends' clause of exported class 'C4' refers to a type whose name cannot be referenced. +tests/cases/conformance/classes/mixinAccessModifiers.ts(83,7): error TS4093: 'extends' clause of exported class 'C5' refers to a type whose name cannot be referenced. tests/cases/conformance/classes/mixinAccessModifiers.ts(85,6): error TS2445: Property 'p' is protected and only accessible within class 'C4' and its subclasses. tests/cases/conformance/classes/mixinAccessModifiers.ts(90,6): error TS2445: Property 's' is protected and only accessible within class 'typeof C4' and its subclasses. -tests/cases/conformance/classes/mixinAccessModifiers.ts(96,7): error TS4093: Extends clause of exported class 'C6' refers to a type whose name cannot be referenced. +tests/cases/conformance/classes/mixinAccessModifiers.ts(96,7): error TS4093: 'extends' clause of exported class 'C6' refers to a type whose name cannot be referenced. tests/cases/conformance/classes/mixinAccessModifiers.ts(98,6): error TS2445: Property 'p' is protected and only accessible within class 'C4' and its subclasses. tests/cases/conformance/classes/mixinAccessModifiers.ts(103,6): error TS2445: Property 's' is protected and only accessible within class 'typeof C4' and its subclasses. @@ -103,25 +103,25 @@ tests/cases/conformance/classes/mixinAccessModifiers.ts(103,6): error TS2445: Pr !!! error TS2415: Type 'C1' is not assignable to type 'Private'. !!! error TS2415: Property 'p' has conflicting declarations and is inaccessible in type 'C1'. ~~ -!!! error TS4093: Extends clause of exported class 'C1' refers to a type whose name cannot be referenced. +!!! error TS4093: 'extends' clause of exported class 'C1' refers to a type whose name cannot be referenced. class C2 extends Mix(Private, Protected) {} ~~ !!! error TS2415: Class 'C2' incorrectly extends base class 'Private & Protected'. !!! error TS2415: Type 'C2' is not assignable to type 'Private'. !!! error TS2415: Property 'p' has conflicting declarations and is inaccessible in type 'C2'. ~~ -!!! error TS4093: Extends clause of exported class 'C2' refers to a type whose name cannot be referenced. +!!! error TS4093: 'extends' clause of exported class 'C2' refers to a type whose name cannot be referenced. class C3 extends Mix(Private, Public) {} ~~ !!! error TS2415: Class 'C3' incorrectly extends base class 'Private & Public'. !!! error TS2415: Type 'C3' is not assignable to type 'Private'. !!! error TS2415: Property 'p' has conflicting declarations and is inaccessible in type 'C3'. ~~ -!!! error TS4093: Extends clause of exported class 'C3' refers to a type whose name cannot be referenced. +!!! error TS4093: 'extends' clause of exported class 'C3' refers to a type whose name cannot be referenced. class C4 extends Mix(Protected, Protected2) { ~~ -!!! error TS4093: Extends clause of exported class 'C4' refers to a type whose name cannot be referenced. +!!! error TS4093: 'extends' clause of exported class 'C4' refers to a type whose name cannot be referenced. f(c4: C4, c5: C5, c6: C6) { c4.p; c5.p; @@ -136,7 +136,7 @@ tests/cases/conformance/classes/mixinAccessModifiers.ts(103,6): error TS2445: Pr class C5 extends Mix(Protected, Public) { ~~ -!!! error TS4093: Extends clause of exported class 'C5' refers to a type whose name cannot be referenced. +!!! error TS4093: 'extends' clause of exported class 'C5' refers to a type whose name cannot be referenced. f(c4: C4, c5: C5, c6: C6) { c4.p; // Error, not in class deriving from Protected2 ~ @@ -155,7 +155,7 @@ tests/cases/conformance/classes/mixinAccessModifiers.ts(103,6): error TS2445: Pr class C6 extends Mix(Public, Public2) { ~~ -!!! error TS4093: Extends clause of exported class 'C6' refers to a type whose name cannot be referenced. +!!! error TS4093: 'extends' clause of exported class 'C6' refers to a type whose name cannot be referenced. f(c4: C4, c5: C5, c6: C6) { c4.p; // Error, not in class deriving from Protected2 ~ diff --git a/tests/baselines/reference/privacyClassExtendsClauseDeclFile.errors.txt b/tests/baselines/reference/privacyClassExtendsClauseDeclFile.errors.txt index 8b66d02b23..dd44005047 100644 --- a/tests/baselines/reference/privacyClassExtendsClauseDeclFile.errors.txt +++ b/tests/baselines/reference/privacyClassExtendsClauseDeclFile.errors.txt @@ -1,10 +1,10 @@ -tests/cases/compiler/privacyClassExtendsClauseDeclFile_GlobalFile.ts(16,67): error TS4020: Extends clause of exported class 'publicClassExtendingPrivateClassInModule' has or is using private name 'privateClassInPublicModule'. -tests/cases/compiler/privacyClassExtendsClauseDeclFile_externalModule.ts(17,67): error TS4020: Extends clause of exported class 'publicClassExtendingPrivateClassInModule' has or is using private name 'privateClassInPublicModule'. +tests/cases/compiler/privacyClassExtendsClauseDeclFile_GlobalFile.ts(16,67): error TS4020: 'extends' clause of exported class 'publicClassExtendingPrivateClassInModule' has or is using private name 'privateClassInPublicModule'. +tests/cases/compiler/privacyClassExtendsClauseDeclFile_externalModule.ts(17,67): error TS4020: 'extends' clause of exported class 'publicClassExtendingPrivateClassInModule' has or is using private name 'privateClassInPublicModule'. tests/cases/compiler/privacyClassExtendsClauseDeclFile_externalModule.ts(20,63): error TS2690: A class must be declared after its base class. -tests/cases/compiler/privacyClassExtendsClauseDeclFile_externalModule.ts(22,69): error TS4020: Extends clause of exported class 'publicClassExtendingFromPrivateModuleClass' has or is using private name 'privateModule'. +tests/cases/compiler/privacyClassExtendsClauseDeclFile_externalModule.ts(22,69): error TS4020: 'extends' clause of exported class 'publicClassExtendingFromPrivateModuleClass' has or is using private name 'privateModule'. tests/cases/compiler/privacyClassExtendsClauseDeclFile_externalModule.ts(22,69): error TS2690: A class must be declared after its base class. -tests/cases/compiler/privacyClassExtendsClauseDeclFile_externalModule.ts(64,55): error TS4020: Extends clause of exported class 'publicClassExtendingPrivateClass' has or is using private name 'privateClass'. -tests/cases/compiler/privacyClassExtendsClauseDeclFile_externalModule.ts(69,65): error TS4020: Extends clause of exported class 'publicClassExtendingFromPrivateModuleClass' has or is using private name 'privateModule'. +tests/cases/compiler/privacyClassExtendsClauseDeclFile_externalModule.ts(64,55): error TS4020: 'extends' clause of exported class 'publicClassExtendingPrivateClass' has or is using private name 'privateClass'. +tests/cases/compiler/privacyClassExtendsClauseDeclFile_externalModule.ts(69,65): error TS4020: 'extends' clause of exported class 'publicClassExtendingFromPrivateModuleClass' has or is using private name 'privateModule'. ==== tests/cases/compiler/privacyClassExtendsClauseDeclFile_externalModule.ts (6 errors) ==== @@ -26,7 +26,7 @@ tests/cases/compiler/privacyClassExtendsClauseDeclFile_externalModule.ts(69,65): } export class publicClassExtendingPrivateClassInModule extends privateClassInPublicModule { // Should error ~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4020: Extends clause of exported class 'publicClassExtendingPrivateClassInModule' has or is using private name 'privateClassInPublicModule'. +!!! error TS4020: 'extends' clause of exported class 'publicClassExtendingPrivateClassInModule' has or is using private name 'privateClassInPublicModule'. } class privateClassExtendingFromPrivateModuleClass extends privateModule.publicClassInPrivateModule { @@ -35,7 +35,7 @@ tests/cases/compiler/privacyClassExtendsClauseDeclFile_externalModule.ts(69,65): } export class publicClassExtendingFromPrivateModuleClass extends privateModule.publicClassInPrivateModule { // Should error ~~~~~~~~~~~~~ -!!! error TS4020: Extends clause of exported class 'publicClassExtendingFromPrivateModuleClass' has or is using private name 'privateModule'. +!!! error TS4020: 'extends' clause of exported class 'publicClassExtendingFromPrivateModuleClass' has or is using private name 'privateModule'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2690: A class must be declared after its base class. } @@ -81,14 +81,14 @@ tests/cases/compiler/privacyClassExtendsClauseDeclFile_externalModule.ts(69,65): } export class publicClassExtendingPrivateClass extends privateClass { // Should error ~~~~~~~~~~~~ -!!! error TS4020: Extends clause of exported class 'publicClassExtendingPrivateClass' has or is using private name 'privateClass'. +!!! error TS4020: 'extends' clause of exported class 'publicClassExtendingPrivateClass' has or is using private name 'privateClass'. } class privateClassExtendingFromPrivateModuleClass extends privateModule.publicClassInPrivateModule { } export class publicClassExtendingFromPrivateModuleClass extends privateModule.publicClassInPrivateModule { // Should error ~~~~~~~~~~~~~ -!!! error TS4020: Extends clause of exported class 'publicClassExtendingFromPrivateModuleClass' has or is using private name 'privateModule'. +!!! error TS4020: 'extends' clause of exported class 'publicClassExtendingFromPrivateModuleClass' has or is using private name 'privateModule'. } ==== tests/cases/compiler/privacyClassExtendsClauseDeclFile_GlobalFile.ts (1 errors) ==== @@ -109,7 +109,7 @@ tests/cases/compiler/privacyClassExtendsClauseDeclFile_externalModule.ts(69,65): } export class publicClassExtendingPrivateClassInModule extends privateClassInPublicModule { // Should error ~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4020: Extends clause of exported class 'publicClassExtendingPrivateClassInModule' has or is using private name 'privateClassInPublicModule'. +!!! error TS4020: 'extends' clause of exported class 'publicClassExtendingPrivateClassInModule' has or is using private name 'privateClassInPublicModule'. } } class publicClassInGlobal { diff --git a/tests/baselines/reference/privacyInterfaceExtendsClauseDeclFile.errors.txt b/tests/baselines/reference/privacyInterfaceExtendsClauseDeclFile.errors.txt index 41c53ffd19..2107e77317 100644 --- a/tests/baselines/reference/privacyInterfaceExtendsClauseDeclFile.errors.txt +++ b/tests/baselines/reference/privacyInterfaceExtendsClauseDeclFile.errors.txt @@ -1,9 +1,9 @@ -tests/cases/compiler/privacyInterfaceExtendsClauseDeclFile_GlobalFile.ts(14,82): error TS4022: Extends clause of exported interface 'publicInterfaceImplementingPrivateInterfaceInModule' has or is using private name 'privateInterfaceInPublicModule'. -tests/cases/compiler/privacyInterfaceExtendsClauseDeclFile_externalModule.ts(15,82): error TS4022: Extends clause of exported interface 'publicInterfaceImplementingPrivateInterfaceInModule' has or is using private name 'privateInterfaceInPublicModule'. -tests/cases/compiler/privacyInterfaceExtendsClauseDeclFile_externalModule.ts(20,84): error TS4022: Extends clause of exported interface 'publicInterfaceImplementingFromPrivateModuleInterface' has or is using private name 'privateModule'. -tests/cases/compiler/privacyInterfaceExtendsClauseDeclFile_externalModule.ts(23,83): error TS4022: Extends clause of exported interface 'publicInterfaceImplementingPrivateAndPublicInterface' has or is using private name 'privateInterfaceInPublicModule'. -tests/cases/compiler/privacyInterfaceExtendsClauseDeclFile_externalModule.ts(63,70): error TS4022: Extends clause of exported interface 'publicInterfaceImplementingPrivateInterface' has or is using private name 'privateInterface'. -tests/cases/compiler/privacyInterfaceExtendsClauseDeclFile_externalModule.ts(68,80): error TS4022: Extends clause of exported interface 'publicInterfaceImplementingFromPrivateModuleInterface' has or is using private name 'privateModule'. +tests/cases/compiler/privacyInterfaceExtendsClauseDeclFile_GlobalFile.ts(14,82): error TS4022: 'extends' clause of exported interface 'publicInterfaceImplementingPrivateInterfaceInModule' has or is using private name 'privateInterfaceInPublicModule'. +tests/cases/compiler/privacyInterfaceExtendsClauseDeclFile_externalModule.ts(15,82): error TS4022: 'extends' clause of exported interface 'publicInterfaceImplementingPrivateInterfaceInModule' has or is using private name 'privateInterfaceInPublicModule'. +tests/cases/compiler/privacyInterfaceExtendsClauseDeclFile_externalModule.ts(20,84): error TS4022: 'extends' clause of exported interface 'publicInterfaceImplementingFromPrivateModuleInterface' has or is using private name 'privateModule'. +tests/cases/compiler/privacyInterfaceExtendsClauseDeclFile_externalModule.ts(23,83): error TS4022: 'extends' clause of exported interface 'publicInterfaceImplementingPrivateAndPublicInterface' has or is using private name 'privateInterfaceInPublicModule'. +tests/cases/compiler/privacyInterfaceExtendsClauseDeclFile_externalModule.ts(63,70): error TS4022: 'extends' clause of exported interface 'publicInterfaceImplementingPrivateInterface' has or is using private name 'privateInterface'. +tests/cases/compiler/privacyInterfaceExtendsClauseDeclFile_externalModule.ts(68,80): error TS4022: 'extends' clause of exported interface 'publicInterfaceImplementingFromPrivateModuleInterface' has or is using private name 'privateModule'. ==== tests/cases/compiler/privacyInterfaceExtendsClauseDeclFile_externalModule.ts (5 errors) ==== @@ -23,19 +23,19 @@ tests/cases/compiler/privacyInterfaceExtendsClauseDeclFile_externalModule.ts(68, } export interface publicInterfaceImplementingPrivateInterfaceInModule extends privateInterfaceInPublicModule { // Should error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4022: Extends clause of exported interface 'publicInterfaceImplementingPrivateInterfaceInModule' has or is using private name 'privateInterfaceInPublicModule'. +!!! error TS4022: 'extends' clause of exported interface 'publicInterfaceImplementingPrivateInterfaceInModule' has or is using private name 'privateInterfaceInPublicModule'. } interface privateInterfaceImplementingFromPrivateModuleInterface extends privateModule.publicInterfaceInPrivateModule { } export interface publicInterfaceImplementingFromPrivateModuleInterface extends privateModule.publicInterfaceInPrivateModule { // Should error ~~~~~~~~~~~~~ -!!! error TS4022: Extends clause of exported interface 'publicInterfaceImplementingFromPrivateModuleInterface' has or is using private name 'privateModule'. +!!! error TS4022: 'extends' clause of exported interface 'publicInterfaceImplementingFromPrivateModuleInterface' has or is using private name 'privateModule'. } export interface publicInterfaceImplementingPrivateAndPublicInterface extends privateInterfaceInPublicModule, publicInterfaceInPublicModule { // Should error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4022: Extends clause of exported interface 'publicInterfaceImplementingPrivateAndPublicInterface' has or is using private name 'privateInterfaceInPublicModule'. +!!! error TS4022: 'extends' clause of exported interface 'publicInterfaceImplementingPrivateAndPublicInterface' has or is using private name 'privateInterfaceInPublicModule'. } } @@ -77,14 +77,14 @@ tests/cases/compiler/privacyInterfaceExtendsClauseDeclFile_externalModule.ts(68, } export interface publicInterfaceImplementingPrivateInterface extends privateInterface { // Should error ~~~~~~~~~~~~~~~~ -!!! error TS4022: Extends clause of exported interface 'publicInterfaceImplementingPrivateInterface' has or is using private name 'privateInterface'. +!!! error TS4022: 'extends' clause of exported interface 'publicInterfaceImplementingPrivateInterface' has or is using private name 'privateInterface'. } interface privateInterfaceImplementingFromPrivateModuleInterface extends privateModule.publicInterfaceInPrivateModule { } export interface publicInterfaceImplementingFromPrivateModuleInterface extends privateModule.publicInterfaceInPrivateModule { // Should error ~~~~~~~~~~~~~ -!!! error TS4022: Extends clause of exported interface 'publicInterfaceImplementingFromPrivateModuleInterface' has or is using private name 'privateModule'. +!!! error TS4022: 'extends' clause of exported interface 'publicInterfaceImplementingFromPrivateModuleInterface' has or is using private name 'privateModule'. } ==== tests/cases/compiler/privacyInterfaceExtendsClauseDeclFile_GlobalFile.ts (1 errors) ==== @@ -103,7 +103,7 @@ tests/cases/compiler/privacyInterfaceExtendsClauseDeclFile_externalModule.ts(68, } export interface publicInterfaceImplementingPrivateInterfaceInModule extends privateInterfaceInPublicModule { // Should error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4022: Extends clause of exported interface 'publicInterfaceImplementingPrivateInterfaceInModule' has or is using private name 'privateInterfaceInPublicModule'. +!!! error TS4022: 'extends' clause of exported interface 'publicInterfaceImplementingPrivateInterfaceInModule' has or is using private name 'privateInterfaceInPublicModule'. } } interface publicInterfaceInGlobal {