Skip to content

Commit 0923a7c

Browse files
committed
Accept good (!??!) baseline changes
1 parent 61f0736 commit 0923a7c

File tree

3 files changed

+84
-1
lines changed

3 files changed

+84
-1
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
tests/cases/conformance/expressions/newOperator/newOperatorConformance.ts(32,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'c1' must be of type 'T<unknown>', but here has type 'T<{}>'.
2+
3+
4+
==== tests/cases/conformance/expressions/newOperator/newOperatorConformance.ts (1 errors) ====
5+
class C0 {
6+
7+
}
8+
class C1 {
9+
constructor(n: number, s: string) { }
10+
}
11+
12+
class T<T> {
13+
constructor(n?: T) { }
14+
}
15+
16+
var anyCtor: {
17+
new (): any;
18+
};
19+
20+
var anyCtor1: {
21+
new (n): any;
22+
};
23+
24+
interface nestedCtor {
25+
new (): nestedCtor;
26+
}
27+
var nestedCtor: nestedCtor;
28+
29+
// Construct expression with no parentheses for construct signature with 0 parameters
30+
var a = new C0;
31+
var a: C0;
32+
33+
34+
// Generic construct expression with no parentheses
35+
var c1 = new T;
36+
var c1: T<{}>;
37+
~~
38+
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'c1' must be of type 'T<unknown>', but here has type 'T<{}>'.
39+
40+
// Construct expression where constructor is of type 'any' with no parentheses
41+
var d = new anyCtor;
42+
var d: any;
43+
44+
// Construct expression where constructor is of type 'any' with > 1 arg
45+
var d = new anyCtor1(undefined);
46+
47+
// Construct expression of type where apparent type has a construct signature with 0 arguments
48+
function newFn1<T extends { new (): number }>(s: T) {
49+
var p = new s;
50+
var p: number;
51+
}
52+
53+
// Construct expression of type where apparent type has a construct signature with 1 arguments
54+
function newFn2<T extends { new (s: number): string}>(s: T) {
55+
var p = new s(32);
56+
var p: string;
57+
}
58+
59+
// Construct expression of void returning function
60+
function fnVoid(): void { }
61+
var t = new fnVoid();
62+
var t: any;
63+
64+
// Chained new expressions
65+
var nested = new (new (new nestedCtor())())();
66+
var n = new nested();
67+
var n = new nested();
68+

tests/baselines/reference/newOperatorErrorCases.errors.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
tests/cases/conformance/expressions/newOperator/newOperatorErrorCases.ts(26,16): error TS1005: ',' expected.
22
tests/cases/conformance/expressions/newOperator/newOperatorErrorCases.ts(26,16): error TS2695: Left side of comma operator is unused and has no side effects.
3+
tests/cases/conformance/expressions/newOperator/newOperatorErrorCases.ts(30,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'c1' must be of type 'T<unknown>', but here has type 'T<{}>'.
34
tests/cases/conformance/expressions/newOperator/newOperatorErrorCases.ts(31,23): error TS1005: '(' expected.
45
tests/cases/conformance/expressions/newOperator/newOperatorErrorCases.ts(36,9): error TS2350: Only a void function can be called with the 'new' keyword.
56

67

7-
==== tests/cases/conformance/expressions/newOperator/newOperatorErrorCases.ts (4 errors) ====
8+
==== tests/cases/conformance/expressions/newOperator/newOperatorErrorCases.ts (5 errors) ====
89
class C0 {
910

1011
}
@@ -39,6 +40,8 @@ tests/cases/conformance/expressions/newOperator/newOperatorErrorCases.ts(36,9):
3940
// Generic construct expression with no parentheses
4041
var c1 = new T;
4142
var c1: T<{}>;
43+
~~
44+
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'c1' must be of type 'T<unknown>', but here has type 'T<{}>'.
4245
var c2 = new T<string>; // Parse error
4346
~
4447
!!! error TS1005: '(' expected.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
tests/cases/conformance/types/typeParameters/typeArgumentLists/wrappedAndRecursiveConstraints2.ts(6,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'c' must be of type 'C<number>', but here has type 'C<C<string>>'.
2+
3+
4+
==== tests/cases/conformance/types/typeParameters/typeArgumentLists/wrappedAndRecursiveConstraints2.ts (1 errors) ====
5+
class C<T extends C<T>> { // error
6+
constructor(x: T) { }
7+
}
8+
9+
var c = new C(1);
10+
var c = new C(new C('')); // error
11+
~
12+
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'c' must be of type 'C<number>', but here has type 'C<C<string>>'.

0 commit comments

Comments
 (0)