Updated Baselines

This commit is contained in:
Arthur Ozga 2015-07-10 13:51:16 -07:00
parent e6cf920664
commit 35d2592a51
12 changed files with 389 additions and 3 deletions

View File

@ -0,0 +1,30 @@
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractConstructorAssignability.ts(8,5): error TS2322: Type 'typeof B' is not assignable to type 'typeof A'.
Cannot assign an abstract constructor type to a non-abstract constructor type.
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractConstructorAssignability.ts(10,5): error TS2322: Type 'typeof B' is not assignable to type 'typeof C'.
Cannot assign an abstract constructor type to a non-abstract constructor type.
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractConstructorAssignability.ts(13,1): error TS2511: Cannot create an instance of the abstract class 'B'.
==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractConstructorAssignability.ts (3 errors) ====
class A {}
abstract class B extends A {}
class C extends B {}
var AA : typeof A = B;
~~
!!! error TS2322: Type 'typeof B' is not assignable to type 'typeof A'.
!!! error TS2322: Cannot assign an abstract constructor type to a non-abstract constructor type.
var BB : typeof B = A;
var CC : typeof C = B;
~~
!!! error TS2322: Type 'typeof B' is not assignable to type 'typeof C'.
!!! error TS2322: Cannot assign an abstract constructor type to a non-abstract constructor type.
new AA;
new BB;
~~~~~~
!!! error TS2511: Cannot create an instance of the abstract class 'B'.
new CC;

View File

@ -0,0 +1,47 @@
//// [classAbstractConstructorAssignability.ts]
class A {}
abstract class B extends A {}
class C extends B {}
var AA : typeof A = B;
var BB : typeof B = A;
var CC : typeof C = B;
new AA;
new BB;
new CC;
//// [classAbstractConstructorAssignability.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 A = (function () {
function A() {
}
return A;
})();
var B = (function (_super) {
__extends(B, _super);
function B() {
_super.apply(this, arguments);
}
return B;
})(A);
var C = (function (_super) {
__extends(C, _super);
function C() {
_super.apply(this, arguments);
}
return C;
})(B);
var AA = B;
var BB = A;
var CC = B;
new AA;
new BB;
new CC;

View File

@ -0,0 +1,22 @@
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractExtends.ts(10,7): error TS2515: Non-abstract class 'C' does not implement inherited abstract member 'bar' from class 'B'.
==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractExtends.ts (1 errors) ====
class A {
foo() {}
}
abstract class B extends A {
abstract bar();
}
class C extends B { }
~
!!! error TS2515: Non-abstract class 'C' does not implement inherited abstract member 'bar' from class 'B'.
abstract class D extends B {}
class E extends B {
bar() {}
}

View File

@ -0,0 +1,59 @@
//// [classAbstractExtends.ts]
class A {
foo() {}
}
abstract class B extends A {
abstract bar();
}
class C extends B { }
abstract class D extends B {}
class E extends B {
bar() {}
}
//// [classAbstractExtends.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 A = (function () {
function A() {
}
A.prototype.foo = function () { };
return A;
})();
var B = (function (_super) {
__extends(B, _super);
function B() {
_super.apply(this, arguments);
}
return B;
})(A);
var C = (function (_super) {
__extends(C, _super);
function C() {
_super.apply(this, arguments);
}
return C;
})(B);
var D = (function (_super) {
__extends(D, _super);
function D() {
_super.apply(this, arguments);
}
return D;
})(B);
var E = (function (_super) {
__extends(E, _super);
function E() {
_super.apply(this, arguments);
}
E.prototype.bar = function () { };
return E;
})(B);

View File

@ -0,0 +1,28 @@
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractFactoryFunction.ts(10,12): error TS2511: Cannot create an instance of the abstract class 'B'.
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractFactoryFunction.ts(14,6): error TS2345: Argument of type 'typeof B' is not assignable to parameter of type 'typeof A'.
Cannot assign an abstract constructor type to a non-abstract constructor type.
==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractFactoryFunction.ts (2 errors) ====
class A {}
abstract class B extends A {}
function NewA(Factory: typeof A) {
return new A;
}
function NewB(Factory: typeof B) {
return new B;
~~~~~
!!! error TS2511: Cannot create an instance of the abstract class 'B'.
}
NewA(A);
NewA(B);
~
!!! error TS2345: Argument of type 'typeof B' is not assignable to parameter of type 'typeof A'.
!!! error TS2345: Cannot assign an abstract constructor type to a non-abstract constructor type.
NewB(A);
NewB(B);

View File

@ -0,0 +1,47 @@
//// [classAbstractFactoryFunction.ts]
class A {}
abstract class B extends A {}
function NewA(Factory: typeof A) {
return new A;
}
function NewB(Factory: typeof B) {
return new B;
}
NewA(A);
NewA(B);
NewB(A);
NewB(B);
//// [classAbstractFactoryFunction.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 A = (function () {
function A() {
}
return A;
})();
var B = (function (_super) {
__extends(B, _super);
function B() {
_super.apply(this, arguments);
}
return B;
})(A);
function NewA(Factory) {
return new A;
}
function NewB(Factory) {
return new B;
}
NewA(A);
NewA(B);
NewB(A);
NewB(B);

View File

@ -1,10 +1,14 @@
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations1.ts(8,1): error TS2511: Cannot create an instance of the abstract class 'A'.
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations1.ts(9,1): error TS2511: Cannot create an instance of the abstract class 'A'.
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations1.ts(11,1): error TS2511: Cannot create an instance of the abstract class 'C'.
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations1.ts(12,1): error TS2511: Cannot create an instance of the abstract class 'A'.
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations1.ts(13,1): error TS2511: Cannot create an instance of the abstract class 'A'.
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations1.ts(15,1): error TS2511: Cannot create an instance of the abstract class 'C'.
==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations1.ts (3 errors) ====
//
// Calling new with (non)abstract classes.
//
abstract class A {}
class B extends A {}

View File

@ -1,5 +1,9 @@
//// [classAbstractInstantiations1.ts]
//
// Calling new with (non)abstract classes.
//
abstract class A {}
class B extends A {}
@ -21,6 +25,9 @@ c = new B;
//// [classAbstractInstantiations1.js]
//
// Calling new with (non)abstract classes.
//
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; }

View File

@ -0,0 +1,19 @@
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractMethodInNonAbstractClass.ts(2,5): error TS1244: Abstract methods can only appear within an abstract class.
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractMethodInNonAbstractClass.ts(6,5): error TS1244: Abstract methods can only appear within an abstract class.
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractMethodInNonAbstractClass.ts(6,5): error TS1245: Method 'foo' cannot have an implementation because it is marked abstract.
==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractMethodInNonAbstractClass.ts (3 errors) ====
class A {
abstract foo();
~~~~~~~~
!!! error TS1244: Abstract methods can only appear within an abstract class.
}
class B {
abstract foo() {}
~~~~~~~~
!!! error TS1244: Abstract methods can only appear within an abstract class.
~~~~~~~~~~~~~~~~~
!!! error TS1245: Method 'foo' cannot have an implementation because it is marked abstract.
}

View File

@ -0,0 +1,21 @@
//// [classAbstractMethodInNonAbstractClass.ts]
class A {
abstract foo();
}
class B {
abstract foo() {}
}
//// [classAbstractMethodInNonAbstractClass.js]
var A = (function () {
function A() {
}
return A;
})();
var B = (function () {
function B() {
}
B.prototype.foo = function () { };
return B;
})();

View File

@ -0,0 +1,29 @@
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractOverrideWithAbstract.ts(19,7): error TS2515: Non-abstract class 'CC' does not implement inherited abstract member 'foo' from class 'BB'.
==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractOverrideWithAbstract.ts (1 errors) ====
class A {
foo() {}
}
abstract class B extends A {
abstract foo();
}
abstract class AA {
foo() {}
abstract bar();
}
abstract class BB extends AA {
abstract foo();
bar () {}
}
class CC extends BB {} // error
~~
!!! error TS2515: Non-abstract class 'CC' does not implement inherited abstract member 'foo' from class 'BB'.
class DD extends BB {
foo() {}
}

View File

@ -0,0 +1,73 @@
//// [classAbstractOverrideWithAbstract.ts]
class A {
foo() {}
}
abstract class B extends A {
abstract foo();
}
abstract class AA {
foo() {}
abstract bar();
}
abstract class BB extends AA {
abstract foo();
bar () {}
}
class CC extends BB {} // error
class DD extends BB {
foo() {}
}
//// [classAbstractOverrideWithAbstract.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 A = (function () {
function A() {
}
A.prototype.foo = function () { };
return A;
})();
var B = (function (_super) {
__extends(B, _super);
function B() {
_super.apply(this, arguments);
}
return B;
})(A);
var AA = (function () {
function AA() {
}
AA.prototype.foo = function () { };
return AA;
})();
var BB = (function (_super) {
__extends(BB, _super);
function BB() {
_super.apply(this, arguments);
}
BB.prototype.bar = function () { };
return BB;
})(AA);
var CC = (function (_super) {
__extends(CC, _super);
function CC() {
_super.apply(this, arguments);
}
return CC;
})(BB); // error
var DD = (function (_super) {
__extends(DD, _super);
function DD() {
_super.apply(this, arguments);
}
DD.prototype.foo = function () { };
return DD;
})(BB);