Skip to content

Commit ef89d26

Browse files
committed
Accept new baselines
1 parent 2200d35 commit ef89d26

File tree

4 files changed

+310
-0
lines changed

4 files changed

+310
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
tests/cases/conformance/es6/restParameters/readonlyRestParameters.ts(8,5): error TS2556: Expected 2 arguments, but got 0 or more.
2+
tests/cases/conformance/es6/restParameters/readonlyRestParameters.ts(20,5): error TS2554: Expected 2 arguments, but got 3.
3+
tests/cases/conformance/es6/restParameters/readonlyRestParameters.ts(25,5): error TS2542: Index signature in type 'readonly string[]' only permits reading.
4+
5+
6+
==== tests/cases/conformance/es6/restParameters/readonlyRestParameters.ts (3 errors) ====
7+
function f0(a: string, b: string) {
8+
f0(a, b);
9+
f1(a, b);
10+
f2(a, b);
11+
}
12+
13+
function f1(...args: readonly string[]) {
14+
f0(...args); // Error
15+
~~~~~~~~~~~
16+
!!! error TS2556: Expected 2 arguments, but got 0 or more.
17+
!!! related TS6210 tests/cases/conformance/es6/restParameters/readonlyRestParameters.ts:1:13: An argument for 'a' was not provided.
18+
f1('abc', 'def');
19+
f1('abc', ...args);
20+
f1(...args);
21+
}
22+
23+
function f2(...args: readonly [string, string]) {
24+
f0(...args);
25+
f1('abc', 'def');
26+
f1('abc', ...args);
27+
f1(...args);
28+
f2('abc', 'def');
29+
f2('abc', ...args); // Error
30+
~~~~~~~~~~~~~~~~~~
31+
!!! error TS2554: Expected 2 arguments, but got 3.
32+
f2(...args);
33+
}
34+
35+
function f4(...args: readonly string[]) {
36+
args[0] = 'abc'; // Error
37+
~~~~~~~
38+
!!! error TS2542: Index signature in type 'readonly string[]' only permits reading.
39+
}
40+
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
//// [readonlyRestParameters.ts]
2+
function f0(a: string, b: string) {
3+
f0(a, b);
4+
f1(a, b);
5+
f2(a, b);
6+
}
7+
8+
function f1(...args: readonly string[]) {
9+
f0(...args); // Error
10+
f1('abc', 'def');
11+
f1('abc', ...args);
12+
f1(...args);
13+
}
14+
15+
function f2(...args: readonly [string, string]) {
16+
f0(...args);
17+
f1('abc', 'def');
18+
f1('abc', ...args);
19+
f1(...args);
20+
f2('abc', 'def');
21+
f2('abc', ...args); // Error
22+
f2(...args);
23+
}
24+
25+
function f4(...args: readonly string[]) {
26+
args[0] = 'abc'; // Error
27+
}
28+
29+
30+
//// [readonlyRestParameters.js]
31+
"use strict";
32+
function f0(a, b) {
33+
f0(a, b);
34+
f1(a, b);
35+
f2(a, b);
36+
}
37+
function f1() {
38+
var args = [];
39+
for (var _i = 0; _i < arguments.length; _i++) {
40+
args[_i] = arguments[_i];
41+
}
42+
f0.apply(void 0, args); // Error
43+
f1('abc', 'def');
44+
f1.apply(void 0, ['abc'].concat(args));
45+
f1.apply(void 0, args);
46+
}
47+
function f2() {
48+
var args = [];
49+
for (var _i = 0; _i < arguments.length; _i++) {
50+
args[_i] = arguments[_i];
51+
}
52+
f0.apply(void 0, args);
53+
f1('abc', 'def');
54+
f1.apply(void 0, ['abc'].concat(args));
55+
f1.apply(void 0, args);
56+
f2('abc', 'def');
57+
f2.apply(void 0, ['abc'].concat(args)); // Error
58+
f2.apply(void 0, args);
59+
}
60+
function f4() {
61+
var args = [];
62+
for (var _i = 0; _i < arguments.length; _i++) {
63+
args[_i] = arguments[_i];
64+
}
65+
args[0] = 'abc'; // Error
66+
}
67+
68+
69+
//// [readonlyRestParameters.d.ts]
70+
declare function f0(a: string, b: string): void;
71+
declare function f1(...args: readonly string[]): void;
72+
declare function f2(...args: readonly [string, string]): void;
73+
declare function f4(...args: readonly string[]): void;
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
=== tests/cases/conformance/es6/restParameters/readonlyRestParameters.ts ===
2+
function f0(a: string, b: string) {
3+
>f0 : Symbol(f0, Decl(readonlyRestParameters.ts, 0, 0))
4+
>a : Symbol(a, Decl(readonlyRestParameters.ts, 0, 12))
5+
>b : Symbol(b, Decl(readonlyRestParameters.ts, 0, 22))
6+
7+
f0(a, b);
8+
>f0 : Symbol(f0, Decl(readonlyRestParameters.ts, 0, 0))
9+
>a : Symbol(a, Decl(readonlyRestParameters.ts, 0, 12))
10+
>b : Symbol(b, Decl(readonlyRestParameters.ts, 0, 22))
11+
12+
f1(a, b);
13+
>f1 : Symbol(f1, Decl(readonlyRestParameters.ts, 4, 1))
14+
>a : Symbol(a, Decl(readonlyRestParameters.ts, 0, 12))
15+
>b : Symbol(b, Decl(readonlyRestParameters.ts, 0, 22))
16+
17+
f2(a, b);
18+
>f2 : Symbol(f2, Decl(readonlyRestParameters.ts, 11, 1))
19+
>a : Symbol(a, Decl(readonlyRestParameters.ts, 0, 12))
20+
>b : Symbol(b, Decl(readonlyRestParameters.ts, 0, 22))
21+
}
22+
23+
function f1(...args: readonly string[]) {
24+
>f1 : Symbol(f1, Decl(readonlyRestParameters.ts, 4, 1))
25+
>args : Symbol(args, Decl(readonlyRestParameters.ts, 6, 12))
26+
27+
f0(...args); // Error
28+
>f0 : Symbol(f0, Decl(readonlyRestParameters.ts, 0, 0))
29+
>args : Symbol(args, Decl(readonlyRestParameters.ts, 6, 12))
30+
31+
f1('abc', 'def');
32+
>f1 : Symbol(f1, Decl(readonlyRestParameters.ts, 4, 1))
33+
34+
f1('abc', ...args);
35+
>f1 : Symbol(f1, Decl(readonlyRestParameters.ts, 4, 1))
36+
>args : Symbol(args, Decl(readonlyRestParameters.ts, 6, 12))
37+
38+
f1(...args);
39+
>f1 : Symbol(f1, Decl(readonlyRestParameters.ts, 4, 1))
40+
>args : Symbol(args, Decl(readonlyRestParameters.ts, 6, 12))
41+
}
42+
43+
function f2(...args: readonly [string, string]) {
44+
>f2 : Symbol(f2, Decl(readonlyRestParameters.ts, 11, 1))
45+
>args : Symbol(args, Decl(readonlyRestParameters.ts, 13, 12))
46+
47+
f0(...args);
48+
>f0 : Symbol(f0, Decl(readonlyRestParameters.ts, 0, 0))
49+
>args : Symbol(args, Decl(readonlyRestParameters.ts, 13, 12))
50+
51+
f1('abc', 'def');
52+
>f1 : Symbol(f1, Decl(readonlyRestParameters.ts, 4, 1))
53+
54+
f1('abc', ...args);
55+
>f1 : Symbol(f1, Decl(readonlyRestParameters.ts, 4, 1))
56+
>args : Symbol(args, Decl(readonlyRestParameters.ts, 13, 12))
57+
58+
f1(...args);
59+
>f1 : Symbol(f1, Decl(readonlyRestParameters.ts, 4, 1))
60+
>args : Symbol(args, Decl(readonlyRestParameters.ts, 13, 12))
61+
62+
f2('abc', 'def');
63+
>f2 : Symbol(f2, Decl(readonlyRestParameters.ts, 11, 1))
64+
65+
f2('abc', ...args); // Error
66+
>f2 : Symbol(f2, Decl(readonlyRestParameters.ts, 11, 1))
67+
>args : Symbol(args, Decl(readonlyRestParameters.ts, 13, 12))
68+
69+
f2(...args);
70+
>f2 : Symbol(f2, Decl(readonlyRestParameters.ts, 11, 1))
71+
>args : Symbol(args, Decl(readonlyRestParameters.ts, 13, 12))
72+
}
73+
74+
function f4(...args: readonly string[]) {
75+
>f4 : Symbol(f4, Decl(readonlyRestParameters.ts, 21, 1))
76+
>args : Symbol(args, Decl(readonlyRestParameters.ts, 23, 12))
77+
78+
args[0] = 'abc'; // Error
79+
>args : Symbol(args, Decl(readonlyRestParameters.ts, 23, 12))
80+
}
81+
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
=== tests/cases/conformance/es6/restParameters/readonlyRestParameters.ts ===
2+
function f0(a: string, b: string) {
3+
>f0 : (a: string, b: string) => void
4+
>a : string
5+
>b : string
6+
7+
f0(a, b);
8+
>f0(a, b) : void
9+
>f0 : (a: string, b: string) => void
10+
>a : string
11+
>b : string
12+
13+
f1(a, b);
14+
>f1(a, b) : void
15+
>f1 : (...args: readonly string[]) => void
16+
>a : string
17+
>b : string
18+
19+
f2(a, b);
20+
>f2(a, b) : void
21+
>f2 : (args_0: string, args_1: string) => void
22+
>a : string
23+
>b : string
24+
}
25+
26+
function f1(...args: readonly string[]) {
27+
>f1 : (...args: readonly string[]) => void
28+
>args : readonly string[]
29+
30+
f0(...args); // Error
31+
>f0(...args) : void
32+
>f0 : (a: string, b: string) => void
33+
>...args : string
34+
>args : readonly string[]
35+
36+
f1('abc', 'def');
37+
>f1('abc', 'def') : void
38+
>f1 : (...args: readonly string[]) => void
39+
>'abc' : "abc"
40+
>'def' : "def"
41+
42+
f1('abc', ...args);
43+
>f1('abc', ...args) : void
44+
>f1 : (...args: readonly string[]) => void
45+
>'abc' : "abc"
46+
>...args : string
47+
>args : readonly string[]
48+
49+
f1(...args);
50+
>f1(...args) : void
51+
>f1 : (...args: readonly string[]) => void
52+
>...args : string
53+
>args : readonly string[]
54+
}
55+
56+
function f2(...args: readonly [string, string]) {
57+
>f2 : (args_0: string, args_1: string) => void
58+
>args : readonly [string, string]
59+
60+
f0(...args);
61+
>f0(...args) : void
62+
>f0 : (a: string, b: string) => void
63+
>...args : string
64+
>args : readonly [string, string]
65+
66+
f1('abc', 'def');
67+
>f1('abc', 'def') : void
68+
>f1 : (...args: readonly string[]) => void
69+
>'abc' : "abc"
70+
>'def' : "def"
71+
72+
f1('abc', ...args);
73+
>f1('abc', ...args) : void
74+
>f1 : (...args: readonly string[]) => void
75+
>'abc' : "abc"
76+
>...args : string
77+
>args : readonly [string, string]
78+
79+
f1(...args);
80+
>f1(...args) : void
81+
>f1 : (...args: readonly string[]) => void
82+
>...args : string
83+
>args : readonly [string, string]
84+
85+
f2('abc', 'def');
86+
>f2('abc', 'def') : void
87+
>f2 : (args_0: string, args_1: string) => void
88+
>'abc' : "abc"
89+
>'def' : "def"
90+
91+
f2('abc', ...args); // Error
92+
>f2('abc', ...args) : void
93+
>f2 : (args_0: string, args_1: string) => void
94+
>'abc' : "abc"
95+
>...args : string
96+
>args : readonly [string, string]
97+
98+
f2(...args);
99+
>f2(...args) : void
100+
>f2 : (args_0: string, args_1: string) => void
101+
>...args : string
102+
>args : readonly [string, string]
103+
}
104+
105+
function f4(...args: readonly string[]) {
106+
>f4 : (...args: readonly string[]) => void
107+
>args : readonly string[]
108+
109+
args[0] = 'abc'; // Error
110+
>args[0] = 'abc' : "abc"
111+
>args[0] : string
112+
>args : readonly string[]
113+
>0 : 0
114+
>'abc' : "abc"
115+
}
116+

0 commit comments

Comments
 (0)