8000 Updated Baselines · jango2015/TypeScript@35d2592 · GitHub
[go: up one dir, main page]

Skip to content

Commit 35d2592

Browse files
author
Arthur Ozga
committed
Updated Baselines
1 parent e6cf920 commit 35d2592

12 files changed

+389
-3
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractConstructorAssignability.ts(8,5): error TS2322: Type 'typeof B' is not assignable to type 'typeof A'.
2+
Cannot assign an abstract constructor type to a non-abstract constructor type.
3+
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractConstructorAssignability.ts(10,5): error TS2322: Type 'typeof B' is not assignable to type 'typeof C'.
4+
Cannot assign an abstract constructor type to a non-abstract constructor type.
5+
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractConstructorAssignability.ts(13,1): error TS2511: Cannot create an instance of the abstract class 'B'.
6+
7+
8+
==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractConstructorAssignability.ts (3 errors) ====
9+
10+
class A {}
11+
12+
abstract class B extends A {}
13+
14+
class C extends B {}
15+
16+
var AA : typeof A = B;
17+
~~
18+
!!! error TS2322: Type 'typeof B' is not assignable to type 'typeof A'.
19+
!!! error TS2322: Cannot assign an abstract constructor type to a non-abstract constructor type.
20+
var BB : typeof B = A;
21+
var CC : typeof C = B;
22+
~~
23+
!!! error TS2322: Type 'typeof B' is not assignable to type 'typeof C'.
24+
!!! error TS2322: Cannot assign an abstract constructor type to a non-abstract constructor type.
25+
26+
new AA;
27+
new BB;
28+
~~~~~~
29+
!!! error TS2511: Cannot create an instance of the abstract class 'B'.
30+
new CC;
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
//// [classAbstractConstructorAssignability.ts]
2+
3+
class A {}
4+
5+
abstract class B extends A {}
6+
7+
class C extends B {}
8+
9+
var AA : typeof A = B;
10+
var BB : typeof B = A;
11+
var CC : typeof C = B;
12+
13+
new AA;
14+
new BB;
15+
new CC;
16+
17+
//// [classAbstractConstructorAssignability.js]
18+
var __extends = (this && this.__extends) || function (d, b) {
19+
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
20+
function __() { this.constructor = d; }
21+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
22+
};
23+
var A = (function () {
24+
function A() {
25+
}
26+
return A;
27+
})();
28+
var B = (function (_super) {
29+
__extends(B, _super);
30+
function B() {
31+
_super.apply(this, arguments);
32+
}
33+
return B;
34+
})(A);
35+
var C = (function (_super) {
36+
__extends(C, _super);
37+
function C() {
38+
_super.apply(this, arguments);
39+
}
40+
return C;
41+
})(B);
42+
var AA = B;
43+
var BB = A;
44+
var CC = B;
45+
new AA;
46+
new BB;
47+
new CC;
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
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'.
2+
3+
4+
==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractExtends.ts (1 errors) ====
5+
6+
class A {
7+
foo() {}
8+
}
9+
10+
abstract class B extends A {
11+
abstract bar();
12+
}
13+
14+
class C extends B { }
15+
~
16+
!!! error TS2515: Non-abstract class 'C' does not implement inherited abstract member 'bar' from class 'B'.
17+
18+
abstract class D extends B {}
19+
20+
class E extends B {
21+
bar() {}
22+
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
//// [classAbstractExtends.ts]
2+
3+
class A {
4+
foo() {}
5+
}
6+
7+
abstract class B extends A {
8+
abstract bar();
9+
}
10+
11+
class C extends B { }
12+
13+
abstract class D extends B {}
14+
15+
class E extends B {
16+
bar() {}
17+
}
18+
19+
//// [classAbstractExtends.js]
20+
var __extends = (this && this.__extends) || function (d, b) {
21+
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
22+
function __() { this.constructor = d; }
23+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
24+
};
25+
var A = (function () {
26+
function A() {
27+
}
28+
A.prototype.foo = function () { };
29+
return A;
30+
})();
31+
var B = (function (_super) {
32+
__extends(B, _super);
33+
function B() {
34+
_super.apply(this, arguments);
35+
}
36+
return B;
37+
})(A);
38+
var C = (function (_super) {
39+
__extends(C, _super);
40+
function C() {
41+
_super.apply(this, arguments);
42+
}
43+
return C;
44+
})(B);
45+
var D = (function (_super) {
46+
__extends(D, _super);
47+
function D() {
48+
_super.apply(this, arguments);
49+
}
50+
return D;
51+
})(B);
52+
var E = (function (_super) {
53+
__extends(E, _super);
54+
function E() {
55+
_super.apply(this, arguments);
56+
}
57+
E.prototype.bar = function () { };
58+
return E;
59+
})(B);
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractFactoryFunction.ts(10,12): error TS2511: Cannot create an instance of the abstract class 'B'.
2+
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'.
3+
Cannot assign an abstract constructor type to a non-abstract constructor type.
4+
5+
6+
==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractFactoryFunction.ts (2 errors) ====
7+
8+
class A {}
9+
abstract class B extends A {}
10+
11+
function NewA(Factory: typeof A) {
12+
return new A;
13+
}
14+
15+
function NewB(Factory: typeof B) {
16+
return new B;
17+
~~~~~
18+
!!! error TS2511: Cannot create an instance of the abstract class 'B'.
19+
}
20+
21+
NewA(A);
22+
NewA(B);
23+
~
24+
!!! error TS2345: Argument of type 'typeof B' is not assignable to parameter of type 'typeof A'.
25+
!!! error TS2345: Cannot assign an abstract constructor type to a non-abstract constructor type.
26+
27+
NewB(A);
28+
NewB(B);
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
//// [classAbstractFactoryFunction.ts]
2+
3+
class A {}
4+
abstract class B extends A {}
5+
6+
function NewA(Factory: typeof A) {
7+
return new A;
8+
}
9+
10+
function NewB(Factory: typeof B) {
11+
return new B;
12+
}
13+
14+
NewA(A);
15+
NewA(B);
16+
17+
NewB(A);
18+
NewB(B);
19+
20+
//// [classAbstractFactoryFunction.js]
21+
var __extends = (this && this.__extends) || function (d, b) {
22+
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
23+
function __() { this.constructor = d; }
24+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
25+
};
26+
var A = (function () {
27+
function A() {
28+
}
29+
return A;
30+
})();
31+
var B = (function (_super) {
32+
__extends(B, _super);
33+
function B() {
34+
_super.apply(this, arguments);
35+
}
36+
return B;
37+
})(A);
38+
function NewA(Factory) {
39+
return new A;
40+
}
41+
function NewB(Factory) {
42+
return new B;
43+
}
44+
NewA(A);
45+
NewA(B);
46+
NewB(A);
47+
NewB(B);

tests/baselines/reference/classAbstractInstantiations1.errors.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations1.ts(8,1): error TS2511: Cannot create an instance of the abstract class 'A'.
2-
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations1.ts(9,1): error TS2511: Cannot create an instance of the abstract class 'A'.
3-
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations1.ts(11,1): error TS2511: Cannot create an instance of the abstract class 'C'.
1+
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations1.ts(12,1): error TS2511: Cannot create an instance of the abstract class 'A'.
2+
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations1.ts(13,1): error TS2511: Cannot create an instance of the abstract class 'A'.
3+
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations1.ts(15,1): error TS2511: Cannot create an instance of the abstract class 'C'.
44

55

66
==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations1.ts (3 errors) ====
77

8+
//
9+
// Calling new with (non)abstract classes.
10+
//
11+
812
abstract class A {}
913

1014
class B extends A {}

tests/baselines/reference/classAbstractInstantiations1.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
//// [classAbstractInstantiations1.ts]
22

3+
//
4+
// Calling new with (non)abstract classes.
5+
//
6+
37
abstract class A {}
48

59
class B extends A {}
@@ -21,6 +25,9 @@ c = new B;
2125

2226

2327
//// [classAbstractInstantiations1.js]
28+
//
29+
// Calling new with (non)abstract classes.
30+
//
2431
var __extends = (this && this.__extends) || function (d, b) {
2532
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
2633
function __() { this.constructor = d; }
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractMethodInNonAbstractClass.ts(2,5): error TS1244: Abstract methods can only appear within an abstract class.
2+
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractMethodInNonAbstractClass.ts(6,5): error TS1244: Abstract methods can only appear within an abstract class.
3+
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractMethodInNonAbstractClass.ts(6,5): error TS1245: Method 'foo' cannot have an implementation because it is marked abstract.
4+
5+
6+
==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractMethodInNonAbstractClass.ts (3 errors) ====
7+
class A {
8+
abstract foo();
9+
~~~~~~~~
10+
!!! error TS1244: Abstract methods can only appear within an abstract class.
11+
}
12+
13+
class B {
14+
abstract foo() {}
15+
~~~~~~~~
16+
!!! error TS1244: Abstract methods can only appear within an abstract class.
17+
~~~~~~~~~~~~~~~~~
18+
!!! error TS1245: Method 'foo' cannot have an implementation because it is marked abstract.
19+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//// [classAbstractMethodInNonAbstractClass.ts]
2+
class A {
3+
abstract foo();
4+
}
5+
6+
class B {
7+
abstract foo() {}
8+
}
9+
10+
//// [classAbstractMethodInNonAbstractClass.js]
11+
var A = (function () {
12+
function A() {
13+
}
14+
return A;
15+
})();
16+
var B = (function () {
17+
function B() {
18+
}
19+
B.prototype.foo = function () { };
20+
return B;
21+
})();

0 commit comments

Comments
 (0)
0