Skip to content

Commit 7e3c033

Browse files
committed
Unknown bases return baseConstructorType, not anyType
Returns several baselines to their original states.
1 parent 75f1774 commit 7e3c033

6 files changed

+18
-18
lines changed

src/compiler/checker.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4664,7 +4664,7 @@ namespace ts {
46644664
baseType = getTypeFromClassOrInterfaceReference(baseTypeNode, baseConstructorType.symbol);
46654665
}
46664666
else if (baseConstructorType.flags & TypeFlags.Any) {
4667-
baseType = anyType;
4667+
baseType = baseConstructorType;
46684668
}
46694669
else {
46704670
// The class derives from a "class-like" constructor function, check that we have at least one construct signature

tests/baselines/reference/parserGenericsInTypeContexts1.errors.txt

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts1.ts(1,17): error TS2304: Cannot find name 'A'.
2-
tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts1.ts(1,19): error TS2304: Cannot find name 'T'.
32
tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts1.ts(1,33): error TS2304: Cannot find name 'B'.
43
tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts1.ts(4,9): error TS2315: Type 'C' is not generic.
54
tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts1.ts(5,9): error TS2304: Cannot find name 'D'.
@@ -10,12 +9,10 @@ tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts
109
tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts1.ts(14,16): error TS2304: Cannot find name 'F'.
1110

1211

13-
==== tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts1.ts (10 errors) ====
12+
==== tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts1.ts (9 errors) ====
1413
class C extends A<T> implements B<T> {
1514
~
1615
!!! error TS2304: Cannot find name 'A'.
17-
~
18-
!!! error TS2304: Cannot find name 'T'.
1916
~
2017
!!! error TS2304: Cannot find name 'B'.
2118
}

tests/baselines/reference/parserGenericsInTypeContexts2.errors.txt

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts2.ts(1,17): error TS2304: Cannot find name 'A'.
2-
tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts2.ts(1,19): error TS2304: Cannot find name 'X'.
3-
tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts2.ts(1,25): error TS2304: Cannot find name 'Y'.
42
tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts2.ts(1,45): error TS2304: Cannot find name 'B'.
53
tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts2.ts(4,9): error TS2315: Type 'C' is not generic.
64
tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts2.ts(5,9): error TS2304: Cannot find name 'D'.
@@ -11,14 +9,10 @@ tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts
119
tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts2.ts(14,16): error TS2304: Cannot find name 'F'.
1210

1311

14-
==== tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts2.ts (11 errors) ====
12+
==== tests/cases/conformance/parser/ecmascript5/Generics/parserGenericsInTypeContexts2.ts (9 errors) ====
1513
class C extends A<X<T>, Y<Z<T>>> implements B<X<T>, Y<Z<T>>> {
1614
~
1715
!!! error TS2304: Cannot find name 'A'.
18-
~
19-
!!! error TS2304: Cannot find name 'X'.
20-
~
21-
!!! error TS2304: Cannot find name 'Y'.
2216
~
2317
!!! error TS2304: Cannot find name 'B'.
2418
}
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
tests/cases/compiler/recursiveBaseCheck3.ts(1,7): error TS2506: 'A' is referenced directly or indirectly in its own base expression.
22
tests/cases/compiler/recursiveBaseCheck3.ts(1,20): error TS2449: Class 'C' used before its declaration.
33
tests/cases/compiler/recursiveBaseCheck3.ts(2,7): error TS2506: 'C' is referenced directly or indirectly in its own base expression.
4+
tests/cases/compiler/recursiveBaseCheck3.ts(4,9): error TS2339: Property 'blah' does not exist on type 'C<{}>'.
45

56

6-
==== tests/cases/compiler/recursiveBaseCheck3.ts (3 errors) ====
7+
==== tests/cases/compiler/recursiveBaseCheck3.ts (4 errors) ====
78
class A<T> extends C<T> { }
89
~
910
!!! error TS2506: 'A' is referenced directly or indirectly in its own base expression.
@@ -13,4 +14,6 @@ tests/cases/compiler/recursiveBaseCheck3.ts(2,7): error TS2506: 'C' is reference
1314
~
1415
!!! error TS2506: 'C' is referenced directly or indirectly in its own base expression.
1516

16-
(new C).blah;
17+
(new C).blah;
18+
~~~~
19+
!!! error TS2339: Property 'blah' does not exist on type 'C<{}>'.
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
tests/cases/compiler/recursiveBaseCheck4.ts(1,7): error TS2506: 'M' is referenced directly or indirectly in its own base expression.
2+
tests/cases/compiler/recursiveBaseCheck4.ts(2,9): error TS2339: Property 'blah' does not exist on type 'M<{}>'.
23

34

4-
==== tests/cases/compiler/recursiveBaseCheck4.ts (1 errors) ====
5+
==== tests/cases/compiler/recursiveBaseCheck4.ts (2 errors) ====
56
class M<T> extends M<string> { }
67
~
78
!!! error TS2506: 'M' is referenced directly or indirectly in its own base expression.
8-
(new M).blah;
9+
(new M).blah;
10+
~~~~
11+
!!! error TS2339: Property 'blah' does not exist on type 'M<{}>'.
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
tests/cases/compiler/recursiveBaseCheck6.ts(1,7): error TS2506: 'S18' is referenced directly or indirectly in its own base expression.
2+
tests/cases/compiler/recursiveBaseCheck6.ts(2,13): error TS2339: Property 'blah' does not exist on type 'S18<{}>'.
23

34

4-
==== tests/cases/compiler/recursiveBaseCheck6.ts (1 errors) ====
5+
==== tests/cases/compiler/recursiveBaseCheck6.ts (2 errors) ====
56
class S18<A> extends S18<{ S19: A; }>{ }
67
~~~
78
!!! error TS2506: 'S18' is referenced directly or indirectly in its own base expression.
8-
(new S18()).blah;
9+
(new S18()).blah;
10+
~~~~
11+
!!! error TS2339: Property 'blah' does not exist on type 'S18<{}>'.

0 commit comments

Comments
 (0)