diff --git a/tests/baselines/reference/abstractClass1.errors.txt b/tests/baselines/reference/abstractClass1.errors.txt deleted file mode 100644 index 5e658fec641..00000000000 --- a/tests/baselines/reference/abstractClass1.errors.txt +++ /dev/null @@ -1,57 +0,0 @@ -tests/cases/compiler/abstractClass1.ts(15,9): error TS2511: Cannot create an instance of the abstract class 'Foo'. -tests/cases/compiler/abstractClass1.ts(16,9): error TS2346: Supplied parameters do not match any signature of call target. -tests/cases/compiler/abstractClass1.ts(16,9): error TS2511: Cannot create an instance of the abstract class 'Foo'. -tests/cases/compiler/abstractClass1.ts(25,1): error TS2511: Cannot create an instance of the abstract class 'Qux'. -tests/cases/compiler/abstractClass1.ts(35,1): error TS2346: Supplied parameters do not match any signature of call target. -tests/cases/compiler/abstractClass1.ts(35,1): error TS2511: Cannot create an instance of the abstract class 'Foo'. - - -==== tests/cases/compiler/abstractClass1.ts (6 errors) ==== - - abstract class Foo { - constructor(f: any) { } - public static bar(): void { } - - public empty() { } - } - - class Bar extends Foo { - constructor(f: any) { - super(f); - } - } - - var a = new Foo(1); // Error - ~~~~~~~~~~ -!!! error TS2511: Cannot create an instance of the abstract class 'Foo'. - var b = new Foo(); // Error because of invalid constructor arguments - ~~~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. - ~~~~~~~~~ -!!! error TS2511: Cannot create an instance of the abstract class 'Foo'. - - module baz { - export abstract class Qux { - } - export class Quz extends Qux { - } - } - - new baz.Qux(); - ~~~~~~~~~~~~~ -!!! error TS2511: Cannot create an instance of the abstract class 'Qux'. - - // Valid - var c = new Bar(1); - c.empty(); - - // Calling a static method on a abstract class is valid - Foo.bar(); - - var Copy = Foo; - new Copy(); - ~~~~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. - ~~~~~~~~~~ -!!! error TS2511: Cannot create an instance of the abstract class 'Foo'. - \ No newline at end of file diff --git a/tests/baselines/reference/abstractClass1.js b/tests/baselines/reference/abstractClass1.js deleted file mode 100644 index 06868a485f5..00000000000 --- a/tests/baselines/reference/abstractClass1.js +++ /dev/null @@ -1,106 +0,0 @@ -//// [abstractClass1.ts] - -abstract class Foo { - constructor(f: any) { } - public static bar(): void { } - - public empty() { } -} - -class Bar extends Foo { - constructor(f: any) { - super(f); - } -} - -var a = new Foo(1); // Error -var b = new Foo(); // Error because of invalid constructor arguments - -module baz { - export abstract class Qux { - } - export class Quz extends Qux { - } -} - -new baz.Qux(); - -// Valid -var c = new Bar(1); -c.empty(); - -// Calling a static method on a abstract class is valid -Foo.bar(); - -var Copy = Foo; -new Copy(); - - -//// [abstractClass1.js] -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Foo = (function () { - function Foo(f) { - } - Foo.bar = function () { }; - Foo.prototype.empty = function () { }; - return Foo; -})(); -var Bar = (function (_super) { - __extends(Bar, _super); - function Bar(f) { - _super.call(this, f); - } - return Bar; -})(Foo); -var a = new Foo(1); // Error -var b = new Foo(); // Error because of invalid constructor arguments -var baz; -(function (baz) { - var Qux = (function () { - function Qux() { - } - return Qux; - })(); - baz.Qux = Qux; - var Quz = (function (_super) { - __extends(Quz, _super); - function Quz() { - _super.apply(this, arguments); - } - return Quz; - })(Qux); - baz.Quz = Quz; -})(baz || (baz = {})); -new baz.Qux(); -// Valid -var c = new Bar(1); -c.empty(); -// Calling a static method on a abstract class is valid -Foo.bar(); -var Copy = Foo; -new Copy(); - - -//// [abstractClass1.d.ts] -declare abstract class Foo { - constructor(f: any); - static bar(): void; - empty(): void; -} -declare class Bar extends Foo { - constructor(f: any); -} -declare var a: Foo; -declare var b: any; -declare module baz { - abstract class Qux { - } - class Quz extends Qux { - } -} -declare var c: Bar; -declare var Copy: typeof Foo; diff --git a/tests/baselines/reference/abstractClassIdentifierName.js b/tests/baselines/reference/abstractClassIdentifierName.js deleted file mode 100644 index 0e53e44671a..00000000000 --- a/tests/baselines/reference/abstractClassIdentifierName.js +++ /dev/null @@ -1,14 +0,0 @@ -//// [abstractClassIdentifierName.ts] -class abstract { - - abstract(): void { } -} - - -//// [abstractClassIdentifierName.js] -var abstract = (function () { - function abstract() { - } - abstract.prototype.abstract = function () { }; - return abstract; -})(); diff --git a/tests/baselines/reference/abstractClassIdentifierName.symbols b/tests/baselines/reference/abstractClassIdentifierName.symbols deleted file mode 100644 index 12d878620d8..00000000000 --- a/tests/baselines/reference/abstractClassIdentifierName.symbols +++ /dev/null @@ -1,8 +0,0 @@ -=== tests/cases/compiler/abstractClassIdentifierName.ts === -class abstract { ->abstract : Symbol(abstract, Decl(abstractClassIdentifierName.ts, 0, 0)) - - abstract(): void { } ->abstract : Symbol(abstract, Decl(abstractClassIdentifierName.ts, 0, 16)) -} - diff --git a/tests/baselines/reference/abstractClassIdentifierName.types b/tests/baselines/reference/abstractClassIdentifierName.types deleted file mode 100644 index e31abf49a6f..00000000000 --- a/tests/baselines/reference/abstractClassIdentifierName.types +++ /dev/null @@ -1,8 +0,0 @@ -=== tests/cases/compiler/abstractClassIdentifierName.ts === -class abstract { ->abstract : abstract - - abstract(): void { } ->abstract : () => void -} - diff --git a/tests/baselines/reference/classAbstractAsIdentifier.js b/tests/baselines/reference/classAbstractAsIdentifier.js new file mode 100644 index 00000000000..6adadd346b5 --- /dev/null +++ b/tests/baselines/reference/classAbstractAsIdentifier.js @@ -0,0 +1,15 @@ +//// [classAbstractAsIdentifier.ts] +class abstract { + foo() { return 1; } +} + +new abstract; + +//// [classAbstractAsIdentifier.js] +var abstract = (function () { + function abstract() { + } + abstract.prototype.foo = function () { return 1; }; + return abstract; +})(); +new abstract; diff --git a/tests/baselines/reference/classAbstractAsIdentifier.symbols b/tests/baselines/reference/classAbstractAsIdentifier.symbols new file mode 100644 index 00000000000..f2ce2ebcab5 --- /dev/null +++ b/tests/baselines/reference/classAbstractAsIdentifier.symbols @@ -0,0 +1,11 @@ +=== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractAsIdentifier.ts === +class abstract { +>abstract : Symbol(abstract, Decl(classAbstractAsIdentifier.ts, 0, 0)) + + foo() { return 1; } +>foo : Symbol(foo, Decl(classAbstractAsIdentifier.ts, 0, 16)) +} + +new abstract; +>abstract : Symbol(abstract, Decl(classAbstractAsIdentifier.ts, 0, 0)) + diff --git a/tests/baselines/reference/classAbstractAsIdentifier.types b/tests/baselines/reference/classAbstractAsIdentifier.types new file mode 100644 index 00000000000..e2894af804d --- /dev/null +++ b/tests/baselines/reference/classAbstractAsIdentifier.types @@ -0,0 +1,13 @@ +=== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractAsIdentifier.ts === +class abstract { +>abstract : abstract + + foo() { return 1; } +>foo : () => number +>1 : number +} + +new abstract; +>new abstract : abstract +>abstract : typeof abstract + diff --git a/tests/baselines/reference/classAbstractDeclarations.d.errors.txt b/tests/baselines/reference/classAbstractDeclarations.d.errors.txt index 501a54e5539..33beb6d296b 100644 --- a/tests/baselines/reference/classAbstractDeclarations.d.errors.txt +++ b/tests/baselines/reference/classAbstractDeclarations.d.errors.txt @@ -1,8 +1,8 @@ tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractDeclarations.d.ts(2,5): error TS1236: 'abstract' modifier can only appear on a class or method declaration. tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractDeclarations.d.ts(2,28): error TS1184: An implementation cannot be declared in ambient contexts. -tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractDeclarations.d.ts(11,15): error TS2515: Non-abstract class 'CC' does not implement inherited abstract member 'AA.foo'. -tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractDeclarations.d.ts(13,15): error TS2515: Non-abstract class 'DD' does not implement inherited abstract member 'BB.foo'. -tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractDeclarations.d.ts(17,15): error TS2515: Non-abstract class 'FF' does not implement inherited abstract member 'CC.foo'. +tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractDeclarations.d.ts(11,15): error TS2515: Non-abstract class 'CC' does not implement inherited abstract member 'foo' from class 'AA'. +tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractDeclarations.d.ts(13,15): error TS2515: Non-abstract class 'DD' does not implement inherited abstract member 'foo' from class 'BB'. +tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractDeclarations.d.ts(17,15): error TS2515: Non-abstract class 'FF' does not implement inherited abstract member 'foo' from class 'CC'. ==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractDeclarations.d.ts (5 errors) ==== @@ -22,17 +22,17 @@ tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbst declare class CC extends AA {} ~~ -!!! error TS2515: Non-abstract class 'CC' does not implement inherited abstract member 'AA.foo'. +!!! error TS2515: Non-abstract class 'CC' does not implement inherited abstract member 'foo' from class 'AA'. declare class DD extends BB {} ~~ -!!! error TS2515: Non-abstract class 'DD' does not implement inherited abstract member 'BB.foo'. +!!! error TS2515: Non-abstract class 'DD' does not implement inherited abstract member 'foo' from class 'BB'. declare abstract class EE extends BB {} declare class FF extends CC {} ~~ -!!! error TS2515: Non-abstract class 'FF' does not implement inherited abstract member 'CC.foo'. +!!! error TS2515: Non-abstract class 'FF' does not implement inherited abstract member 'foo' from class 'CC'. declare abstract class GG extends CC {} diff --git a/tests/baselines/reference/classAbstractInAModule.errors.txt b/tests/baselines/reference/classAbstractInAModule.errors.txt new file mode 100644 index 00000000000..426da866087 --- /dev/null +++ b/tests/baselines/reference/classAbstractInAModule.errors.txt @@ -0,0 +1,13 @@ +tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInAModule.ts(6,1): error TS2511: Cannot create an instance of the abstract class 'A'. + + +==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInAModule.ts (1 errors) ==== + module M { + export abstract class A {} + export class B extends A {} + } + + new M.A; + ~~~~~~~ +!!! error TS2511: Cannot create an instance of the abstract class 'A'. + new M.B; \ No newline at end of file diff --git a/tests/baselines/reference/classAbstractInAModule.js b/tests/baselines/reference/classAbstractInAModule.js new file mode 100644 index 00000000000..e7ecd66b5bd --- /dev/null +++ b/tests/baselines/reference/classAbstractInAModule.js @@ -0,0 +1,34 @@ +//// [classAbstractInAModule.ts] +module M { + export abstract class A {} + export class B extends A {} +} + +new M.A; +new M.B; + +//// [classAbstractInAModule.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var M; +(function (M) { + var A = (function () { + function A() { + } + return A; + })(); + M.A = A; + var B = (function (_super) { + __extends(B, _super); + function B() { + _super.apply(this, arguments); + } + return B; + })(A); + M.B = B; +})(M || (M = {})); +new M.A; +new M.B; diff --git a/tests/baselines/reference/classAbstractInheritance.errors.txt b/tests/baselines/reference/classAbstractInheritance.errors.txt index a663a466757..3e106204415 100644 --- a/tests/baselines/reference/classAbstractInheritance.errors.txt +++ b/tests/baselines/reference/classAbstractInheritance.errors.txt @@ -1,6 +1,6 @@ -tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInheritance.ts(13,7): error TS2515: Non-abstract class 'CC' does not implement inherited abstract member 'AA.foo'. -tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInheritance.ts(15,7): error TS2515: Non-abstract class 'DD' does not implement inherited abstract member 'BB.foo'. -tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInheritance.ts(19,7): error TS2515: Non-abstract class 'FF' does not implement inherited abstract member 'CC.foo'. +tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInheritance.ts(13,7): error TS2515: Non-abstract class 'CC' does not implement inherited abstract member 'foo' from class 'AA'. +tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInheritance.ts(15,7): error TS2515: Non-abstract class 'DD' does not implement inherited abstract member 'foo' from class 'BB'. +tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInheritance.ts(19,7): error TS2515: Non-abstract class 'FF' does not implement inherited abstract member 'foo' from class 'CC'. ==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInheritance.ts (3 errors) ==== @@ -18,16 +18,16 @@ tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbst class CC extends AA {} ~~ -!!! error TS2515: Non-abstract class 'CC' does not implement inherited abstract member 'AA.foo'. +!!! error TS2515: Non-abstract class 'CC' does not implement inherited abstract member 'foo' from class 'AA'. class DD extends BB {} ~~ -!!! error TS2515: Non-abstract class 'DD' does not implement inherited abstract member 'BB.foo'. +!!! error TS2515: Non-abstract class 'DD' does not implement inherited abstract member 'foo' from class 'BB'. abstract class EE extends BB {} class FF extends CC {} ~~ -!!! error TS2515: Non-abstract class 'FF' does not implement inherited abstract member 'CC.foo'. +!!! error TS2515: Non-abstract class 'FF' does not implement inherited abstract member 'foo' from class 'CC'. abstract class GG extends CC {} \ No newline at end of file diff --git a/tests/baselines/reference/classAbstractInstantiations2.errors.txt b/tests/baselines/reference/classAbstractInstantiations2.errors.txt index c3cb4a4cae4..8252887e98d 100644 --- a/tests/baselines/reference/classAbstractInstantiations2.errors.txt +++ b/tests/baselines/reference/classAbstractInstantiations2.errors.txt @@ -1,26 +1,20 @@ -tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(6,28): error TS2304: Cannot find name 'bar'. tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(10,1): error TS2511: Cannot create an instance of the abstract class 'B'. tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(17,5): error TS2511: Cannot create an instance of the abstract class 'B'. tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(21,1): error TS2511: Cannot create an instance of the abstract class 'B'. -tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(26,7): error TS2515: Non-abstract class 'C' does not implement inherited abstract member 'B.bar'. -tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(45,14): error TS2516: All declarations of an abstract method must be consecutive. -tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(45,20): error TS1144: '{' or ';' expected. -tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(45,20): error TS2300: Duplicate identifier 'boolean'. +tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(26,7): error TS2515: Non-abstract class 'C' does not implement inherited abstract member 'bar' from class 'B'. +tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(46,5): error TS2391: Function implementation is missing or not immediately following the declaration. tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(46,5): error TS2512: Overload signatures must all be `abstract` or not `abstract. -tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(46,21): error TS1144: '{' or ';' expected. -tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(46,21): error TS2300: Duplicate identifier 'boolean'. -tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(49,7): error TS2514: Classes containing abstract functions must be marked abstract. +tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(49,7): error TS2514: Classes containing abstract methods must be marked abstract. +tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(50,5): error TS1238: Abstract methods can only appear within an abstract class. -==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts (12 errors) ==== +==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts (8 errors) ==== class A { // ... } abstract class B { - foo(): number { return bar(); } - ~~~ -!!! error TS2304: Cannot find name 'bar'. + foo(): number { return this.bar(); } abstract bar() : number; } @@ -48,7 +42,7 @@ tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbst class C extends B { } // error -- not declared abstract ~ -!!! error TS2515: Non-abstract class 'C' does not implement inherited abstract member 'B.bar'. +!!! error TS2515: Non-abstract class 'C' does not implement inherited abstract member 'bar' from class 'B'. abstract class D extends B { } // okay @@ -67,24 +61,18 @@ tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbst y : number; abstract quz(x : number, y : string) : boolean; // error -- declarations must be adjacent - abstract nom() boolean; - ~~~ -!!! error TS2516: All declarations of an abstract method must be consecutive. - ~~~~~~~ -!!! error TS1144: '{' or ';' expected. - ~~~~~~~ -!!! error TS2300: Duplicate identifier 'boolean'. - nom(x : number) boolean; // error -- use of modifier abstract must match on all overloads. + abstract nom(): boolean; + nom(x : number): boolean; // error -- use of modifier abstract must match on all overloads. + ~~~ +!!! error TS2391: Function implementation is missing or not immediately following the declaration. ~~~ !!! error TS2512: Overload signatures must all be `abstract` or not `abstract. - ~~~~~~~ -!!! error TS1144: '{' or ';' expected. - ~~~~~~~ -!!! error TS2300: Duplicate identifier 'boolean'. } class H { // error -- not declared abstract ~ -!!! error TS2514: Classes containing abstract functions must be marked abstract. +!!! error TS2514: Classes containing abstract methods must be marked abstract. abstract baz() : number; + ~~~~~~~~ +!!! error TS1238: Abstract methods can only appear within an abstract class. } \ No newline at end of file diff --git a/tests/baselines/reference/classAbstractInstantiations2.js b/tests/baselines/reference/classAbstractInstantiations2.js index 055bdfedbc3..5b868b3f795 100644 --- a/tests/baselines/reference/classAbstractInstantiations2.js +++ b/tests/baselines/reference/classAbstractInstantiations2.js @@ -4,7 +4,7 @@ class A { } abstract class B { - foo(): number { return bar(); } + foo(): number { return this.bar(); } abstract bar() : number; } @@ -43,8 +43,8 @@ abstract class G { y : number; abstract quz(x : number, y : string) : boolean; // error -- declarations must be adjacent - abstract nom() boolean; - nom(x : number) boolean; // error -- use of modifier abstract must match on all overloads. + abstract nom(): boolean; + nom(x : number): boolean; // error -- use of modifier abstract must match on all overloads. } class H { // error -- not declared abstract @@ -65,7 +65,7 @@ var A = (function () { var B = (function () { function B() { } - B.prototype.foo = function () { return bar(); }; + B.prototype.foo = function () { return this.bar(); }; return B; })(); new B; // error @@ -112,8 +112,6 @@ var F = (function (_super) { var G = (function () { function G() { } - G.prototype.nom = ; - G.prototype.nom = ; return G; })(); var H = (function () { diff --git a/tests/baselines/reference/classAbstractMixedWithModifiers.errors.txt b/tests/baselines/reference/classAbstractMixedWithModifiers.errors.txt index 488fbdeb36e..4b0870e6bc5 100644 --- a/tests/baselines/reference/classAbstractMixedWithModifiers.errors.txt +++ b/tests/baselines/reference/classAbstractMixedWithModifiers.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractMixedWithModifiers.ts(6,13): error TS1237: 'private' modifier cannot be used with 'abstract' modifier. tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractMixedWithModifiers.ts(8,14): error TS1029: 'public' modifier must precede 'abstract' modifier. tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractMixedWithModifiers.ts(9,14): error TS1029: 'protected' modifier must precede 'abstract' modifier. -tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractMixedWithModifiers.ts(10,14): error TS1029: 'private' modifier must precede 'abstract' modifier. +tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractMixedWithModifiers.ts(10,14): error TS1237: 'private' modifier cannot be used with 'abstract' modifier. tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractMixedWithModifiers.ts(12,14): error TS1237: 'static' modifier cannot be used with 'abstract' modifier. tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractMixedWithModifiers.ts(14,12): error TS1237: 'static' modifier cannot be used with 'abstract' modifier. @@ -24,7 +24,7 @@ tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbst !!! error TS1029: 'protected' modifier must precede 'abstract' modifier. abstract private foo_dd(); ~~~~~~~ -!!! error TS1029: 'private' modifier must precede 'abstract' modifier. +!!! error TS1237: 'private' modifier cannot be used with 'abstract' modifier. abstract static foo_d(); ~~~~~~ diff --git a/tests/baselines/reference/classAbstractProperties.errors.txt b/tests/baselines/reference/classAbstractProperties.errors.txt index 30e7ca1153d..d3ee6308bc5 100644 --- a/tests/baselines/reference/classAbstractProperties.errors.txt +++ b/tests/baselines/reference/classAbstractProperties.errors.txt @@ -2,10 +2,11 @@ tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbst tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractProperties.ts(3,12): error TS1236: 'abstract' modifier can only appear on a class or method declaration. tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractProperties.ts(4,15): error TS1236: 'abstract' modifier can only appear on a class or method declaration. tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractProperties.ts(5,13): error TS1236: 'abstract' modifier can only appear on a class or method declaration. -tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractProperties.ts(10,13): error TS1237: 'private' modifier cannot be used with 'abstract' modifier. +tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractProperties.ts(7,5): error TS1236: 'abstract' modifier can only appear on a class or method declaration. +tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractProperties.ts(12,13): error TS1237: 'private' modifier cannot be used with 'abstract' modifier. -==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractProperties.ts (5 errors) ==== +==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractProperties.ts (6 errors) ==== abstract class A { abstract x : number; ~~~~~~~~ @@ -20,6 +21,10 @@ tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbst ~~~~~~~~ !!! error TS1236: 'abstract' modifier can only appear on a class or method declaration. + abstract m: () => void; + ~~~~~~~~ +!!! error TS1236: 'abstract' modifier can only appear on a class or method declaration. + abstract foo_x() : number; public abstract foo_y() : number; protected abstract foo_z() : number; diff --git a/tests/baselines/reference/classAbstractProperties.js b/tests/baselines/reference/classAbstractProperties.js index a410715e4f7..0cbebcf0de0 100644 --- a/tests/baselines/reference/classAbstractProperties.js +++ b/tests/baselines/reference/classAbstractProperties.js @@ -5,6 +5,8 @@ abstract class A { protected abstract z : number; private abstract w : number; + abstract m: () => void; + abstract foo_x() : number; public abstract foo_y() : number; protected abstract foo_z() : number; diff --git a/tests/baselines/reference/classAbstractSuperCalls.errors.txt b/tests/baselines/reference/classAbstractSuperCalls.errors.txt index ea81b2b60af..a9dbf0f7ba8 100644 --- a/tests/baselines/reference/classAbstractSuperCalls.errors.txt +++ b/tests/baselines/reference/classAbstractSuperCalls.errors.txt @@ -1,7 +1,8 @@ -tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractSuperCalls.ts(14,26): error TS2513: Abstract method 'foo.B' cannot be called via super expression. +tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractSuperCalls.ts(14,26): error TS2513: Abstract method 'foo' in class 'B' cannot be accessed via super expression. +tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractSuperCalls.ts(14,41): error TS2513: Abstract method 'foo' in class 'B' cannot be accessed via super expression. -==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractSuperCalls.ts (1 errors) ==== +==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractSuperCalls.ts (2 errors) ==== class A { foo() { return 1; } @@ -15,9 +16,11 @@ tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbst class C extends B { foo() { return 2; } - qux() { return super.foo(); } // error, super is abstract + qux() { return super.foo() || super.foo; } // 2 errors, foo is abstract ~~~ -!!! error TS2513: Abstract method 'foo.B' cannot be called via super expression. +!!! error TS2513: Abstract method 'foo' in class 'B' cannot be accessed via super expression. + ~~~ +!!! error TS2513: Abstract method 'foo' in class 'B' cannot be accessed via super expression. norf() { return super.bar(); } } diff --git a/tests/baselines/reference/classAbstractSuperCalls.js b/tests/baselines/reference/classAbstractSuperCalls.js index 152fd03f463..deccaa50ccf 100644 --- a/tests/baselines/reference/classAbstractSuperCalls.js +++ b/tests/baselines/reference/classAbstractSuperCalls.js @@ -12,7 +12,7 @@ abstract class B extends A { class C extends B { foo() { return 2; } - qux() { return super.foo(); } // error, super is abstract + qux() { return super.foo() || super.foo; } // 2 errors, foo is abstract norf() { return super.bar(); } } @@ -54,7 +54,7 @@ var C = (function (_super) { _super.apply(this, arguments); } C.prototype.foo = function () { return 2; }; - C.prototype.qux = function () { return _super.prototype.foo.call(this); }; // error, super is abstract + C.prototype.qux = function () { return _super.prototype.foo.call(this) || _super.prototype.foo; }; // 2 errors, foo is abstract C.prototype.norf = function () { return _super.prototype.bar.call(this); }; return C; })(B); diff --git a/tests/baselines/reference/classAbstractUsingAbstractMethod.errors.txt b/tests/baselines/reference/classAbstractUsingAbstractMethod1.errors.txt similarity index 70% rename from tests/baselines/reference/classAbstractUsingAbstractMethod.errors.txt rename to tests/baselines/reference/classAbstractUsingAbstractMethod1.errors.txt index 3ae5084e2db..df3682a36af 100644 --- a/tests/baselines/reference/classAbstractUsingAbstractMethod.errors.txt +++ b/tests/baselines/reference/classAbstractUsingAbstractMethod1.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractUsingAbstractMethod.ts(16,5): error TS2511: Cannot create an instance of the abstract class 'C'. +tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractUsingAbstractMethod1.ts(16,5): error TS2511: Cannot create an instance of the abstract class 'C'. -==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractUsingAbstractMethod.ts (1 errors) ==== +==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractUsingAbstractMethod1.ts (1 errors) ==== abstract class A { abstract foo() : number; } diff --git a/tests/baselines/reference/classAbstractUsingAbstractMethod.js b/tests/baselines/reference/classAbstractUsingAbstractMethod1.js similarity index 89% rename from tests/baselines/reference/classAbstractUsingAbstractMethod.js rename to tests/baselines/reference/classAbstractUsingAbstractMethod1.js index 74bc80b2630..18d22803a7d 100644 --- a/tests/baselines/reference/classAbstractUsingAbstractMethod.js +++ b/tests/baselines/reference/classAbstractUsingAbstractMethod1.js @@ -1,4 +1,4 @@ -//// [classAbstractUsingAbstractMethod.ts] +//// [classAbstractUsingAbstractMethod1.ts] abstract class A { abstract foo() : number; } @@ -17,7 +17,7 @@ a.foo(); a = new C; // error, cannot instantiate abstract class. a.foo(); -//// [classAbstractUsingAbstractMethod.js] +//// [classAbstractUsingAbstractMethod1.js] var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } diff --git a/tests/baselines/reference/classAbstractUsingAbstractMethods2.errors.txt b/tests/baselines/reference/classAbstractUsingAbstractMethods2.errors.txt new file mode 100644 index 00000000000..8a0e5735a25 --- /dev/null +++ b/tests/baselines/reference/classAbstractUsingAbstractMethods2.errors.txt @@ -0,0 +1,42 @@ +tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractUsingAbstractMethods2.ts(1,7): error TS2514: Classes containing abstract methods must be marked abstract. +tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractUsingAbstractMethods2.ts(2,5): error TS1238: Abstract methods can only appear within an abstract class. +tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractUsingAbstractMethods2.ts(5,7): error TS2515: Non-abstract class 'B' does not implement inherited abstract member 'foo' from class 'A'. +tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractUsingAbstractMethods2.ts(21,7): error TS2515: Non-abstract class 'BB' does not implement inherited abstract member 'foo' from class 'AA'. + + +==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractUsingAbstractMethods2.ts (4 errors) ==== + class A { + ~ +!!! error TS2514: Classes containing abstract methods must be marked abstract. + abstract foo(); + ~~~~~~~~ +!!! error TS1238: Abstract methods can only appear within an abstract class. + } + + class B extends A {} + ~ +!!! error TS2515: Non-abstract class 'B' does not implement inherited abstract member 'foo' from class 'A'. + + abstract class C extends A {} + + class D extends A { + foo() {} + } + + abstract class E extends A { + foo() {} + } + + abstract class AA { + abstract foo(); + } + + class BB extends AA {} + ~~ +!!! error TS2515: Non-abstract class 'BB' does not implement inherited abstract member 'foo' from class 'AA'. + + abstract class CC extends AA {} + + class DD extends AA { + foo() {} + } \ No newline at end of file diff --git a/tests/baselines/reference/classWithAbstractMethods.js b/tests/baselines/reference/classAbstractUsingAbstractMethods2.js similarity index 91% rename from tests/baselines/reference/classWithAbstractMethods.js rename to tests/baselines/reference/classAbstractUsingAbstractMethods2.js index 91ccc5f9306..d5797232929 100644 --- a/tests/baselines/reference/classWithAbstractMethods.js +++ b/tests/baselines/reference/classAbstractUsingAbstractMethods2.js @@ -1,4 +1,4 @@ -//// [classWithAbstractMethods.ts] +//// [classAbstractUsingAbstractMethods2.ts] class A { abstract foo(); } @@ -27,7 +27,7 @@ class DD extends AA { foo() {} } -//// [classWithAbstractMethods.js] +//// [classAbstractUsingAbstractMethods2.js] var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } diff --git a/tests/baselines/reference/classAbstractWithInterface.errors.txt b/tests/baselines/reference/classAbstractWithInterface.errors.txt new file mode 100644 index 00000000000..7dc4dcd87c4 --- /dev/null +++ b/tests/baselines/reference/classAbstractWithInterface.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractWithInterface.ts(1,1): error TS1236: 'abstract' modifier can only appear on a class or method declaration. + + +==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractWithInterface.ts (1 errors) ==== + abstract interface I {} + ~~~~~~~~ +!!! error TS1236: 'abstract' modifier can only appear on a class or method declaration. \ No newline at end of file diff --git a/tests/baselines/reference/classAbstractWithInterface.js b/tests/baselines/reference/classAbstractWithInterface.js new file mode 100644 index 00000000000..317e393a2f5 --- /dev/null +++ b/tests/baselines/reference/classAbstractWithInterface.js @@ -0,0 +1,4 @@ +//// [classAbstractWithInterface.ts] +abstract interface I {} + +//// [classAbstractWithInterface.js] diff --git a/tests/baselines/reference/classWithAbstractMethods.errors.txt b/tests/baselines/reference/classWithAbstractMethods.errors.txt deleted file mode 100644 index d66303289ab..00000000000 --- a/tests/baselines/reference/classWithAbstractMethods.errors.txt +++ /dev/null @@ -1,42 +0,0 @@ -tests/cases/conformance/classes/classDeclarations/classWithAbstractMethods.ts(1,7): error TS2514: Classes containing abstract functions must be marked abstract. -tests/cases/conformance/classes/classDeclarations/classWithAbstractMethods.ts(2,5): error TS1238: Abstract methods can only appear within an abstract class. -tests/cases/conformance/classes/classDeclarations/classWithAbstractMethods.ts(5,7): error TS2515: Non-abstract class 'B' does not implement inherited abstract member 'A.foo'. -tests/cases/conformance/classes/classDeclarations/classWithAbstractMethods.ts(21,7): error TS2515: Non-abstract class 'BB' does not implement inherited abstract member 'AA.foo'. - - -==== tests/cases/conformance/classes/classDeclarations/classWithAbstractMethods.ts (4 errors) ==== - class A { - ~ -!!! error TS2514: Classes containing abstract functions must be marked abstract. - abstract foo(); - ~~~~~~~~ -!!! error TS1238: Abstract methods can only appear within an abstract class. - } - - class B extends A {} - ~ -!!! error TS2515: Non-abstract class 'B' does not implement inherited abstract member 'A.foo'. - - abstract class C extends A {} - - class D extends A { - foo() {} - } - - abstract class E extends A { - foo() {} - } - - abstract class AA { - abstract foo(); - } - - class BB extends AA {} - ~~ -!!! error TS2515: Non-abstract class 'BB' does not implement inherited abstract member 'AA.foo'. - - abstract class CC extends AA {} - - class DD extends AA { - foo() {} - } \ No newline at end of file