Accept new baselines

This commit is contained in:
Anders Hejlsberg
2019-01-18 09:34:47 -08:00
parent 2200d35385
commit ef89d26dc8
4 changed files with 310 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
tests/cases/conformance/es6/restParameters/readonlyRestParameters.ts(8,5): error TS2556: Expected 2 arguments, but got 0 or more.
tests/cases/conformance/es6/restParameters/readonlyRestParameters.ts(20,5): error TS2554: Expected 2 arguments, but got 3.
tests/cases/conformance/es6/restParameters/readonlyRestParameters.ts(25,5): error TS2542: Index signature in type 'readonly string[]' only permits reading.
==== tests/cases/conformance/es6/restParameters/readonlyRestParameters.ts (3 errors) ====
function f0(a: string, b: string) {
f0(a, b);
f1(a, b);
f2(a, b);
}
function f1(...args: readonly string[]) {
f0(...args); // Error
~~~~~~~~~~~
!!! error TS2556: Expected 2 arguments, but got 0 or more.
!!! related TS6210 tests/cases/conformance/es6/restParameters/readonlyRestParameters.ts:1:13: An argument for 'a' was not provided.
f1('abc', 'def');
f1('abc', ...args);
f1(...args);
}
function f2(...args: readonly [string, string]) {
f0(...args);
f1('abc', 'def');
f1('abc', ...args);
f1(...args);
f2('abc', 'def');
f2('abc', ...args); // Error
~~~~~~~~~~~~~~~~~~
!!! error TS2554: Expected 2 arguments, but got 3.
f2(...args);
}
function f4(...args: readonly string[]) {
args[0] = 'abc'; // Error
~~~~~~~
!!! error TS2542: Index signature in type 'readonly string[]' only permits reading.
}

View File

@@ -0,0 +1,73 @@
//// [readonlyRestParameters.ts]
function f0(a: string, b: string) {
f0(a, b);
f1(a, b);
f2(a, b);
}
function f1(...args: readonly string[]) {
f0(...args); // Error
f1('abc', 'def');
f1('abc', ...args);
f1(...args);
}
function f2(...args: readonly [string, string]) {
f0(...args);
f1('abc', 'def');
f1('abc', ...args);
f1(...args);
f2('abc', 'def');
f2('abc', ...args); // Error
f2(...args);
}
function f4(...args: readonly string[]) {
args[0] = 'abc'; // Error
}
//// [readonlyRestParameters.js]
"use strict";
function f0(a, b) {
f0(a, b);
f1(a, b);
f2(a, b);
}
function f1() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
f0.apply(void 0, args); // Error
f1('abc', 'def');
f1.apply(void 0, ['abc'].concat(args));
f1.apply(void 0, args);
}
function f2() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
f0.apply(void 0, args);
f1('abc', 'def');
f1.apply(void 0, ['abc'].concat(args));
f1.apply(void 0, args);
f2('abc', 'def');
f2.apply(void 0, ['abc'].concat(args)); // Error
f2.apply(void 0, args);
}
function f4() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
args[0] = 'abc'; // Error
}
//// [readonlyRestParameters.d.ts]
declare function f0(a: string, b: string): void;
declare function f1(...args: readonly string[]): void;
declare function f2(...args: readonly [string, string]): void;
declare function f4(...args: readonly string[]): void;

View File

@@ -0,0 +1,81 @@
=== tests/cases/conformance/es6/restParameters/readonlyRestParameters.ts ===
function f0(a: string, b: string) {
>f0 : Symbol(f0, Decl(readonlyRestParameters.ts, 0, 0))
>a : Symbol(a, Decl(readonlyRestParameters.ts, 0, 12))
>b : Symbol(b, Decl(readonlyRestParameters.ts, 0, 22))
f0(a, b);
>f0 : Symbol(f0, Decl(readonlyRestParameters.ts, 0, 0))
>a : Symbol(a, Decl(readonlyRestParameters.ts, 0, 12))
>b : Symbol(b, Decl(readonlyRestParameters.ts, 0, 22))
f1(a, b);
>f1 : Symbol(f1, Decl(readonlyRestParameters.ts, 4, 1))
>a : Symbol(a, Decl(readonlyRestParameters.ts, 0, 12))
>b : Symbol(b, Decl(readonlyRestParameters.ts, 0, 22))
f2(a, b);
>f2 : Symbol(f2, Decl(readonlyRestParameters.ts, 11, 1))
>a : Symbol(a, Decl(readonlyRestParameters.ts, 0, 12))
>b : Symbol(b, Decl(readonlyRestParameters.ts, 0, 22))
}
function f1(...args: readonly string[]) {
>f1 : Symbol(f1, Decl(readonlyRestParameters.ts, 4, 1))
>args : Symbol(args, Decl(readonlyRestParameters.ts, 6, 12))
f0(...args); // Error
>f0 : Symbol(f0, Decl(readonlyRestParameters.ts, 0, 0))
>args : Symbol(args, Decl(readonlyRestParameters.ts, 6, 12))
f1('abc', 'def');
>f1 : Symbol(f1, Decl(readonlyRestParameters.ts, 4, 1))
f1('abc', ...args);
>f1 : Symbol(f1, Decl(readonlyRestParameters.ts, 4, 1))
>args : Symbol(args, Decl(readonlyRestParameters.ts, 6, 12))
f1(...args);
>f1 : Symbol(f1, Decl(readonlyRestParameters.ts, 4, 1))
>args : Symbol(args, Decl(readonlyRestParameters.ts, 6, 12))
}
function f2(...args: readonly [string, string]) {
>f2 : Symbol(f2, Decl(readonlyRestParameters.ts, 11, 1))
>args : Symbol(args, Decl(readonlyRestParameters.ts, 13, 12))
f0(...args);
>f0 : Symbol(f0, Decl(readonlyRestParameters.ts, 0, 0))
>args : Symbol(args, Decl(readonlyRestParameters.ts, 13, 12))
f1('abc', 'def');
>f1 : Symbol(f1, Decl(readonlyRestParameters.ts, 4, 1))
f1('abc', ...args);
>f1 : Symbol(f1, Decl(readonlyRestParameters.ts, 4, 1))
>args : Symbol(args, Decl(readonlyRestParameters.ts, 13, 12))
f1(...args);
>f1 : Symbol(f1, Decl(readonlyRestParameters.ts, 4, 1))
>args : Symbol(args, Decl(readonlyRestParameters.ts, 13, 12))
f2('abc', 'def');
>f2 : Symbol(f2, Decl(readonlyRestParameters.ts, 11, 1))
f2('abc', ...args); // Error
>f2 : Symbol(f2, Decl(readonlyRestParameters.ts, 11, 1))
>args : Symbol(args, Decl(readonlyRestParameters.ts, 13, 12))
f2(...args);
>f2 : Symbol(f2, Decl(readonlyRestParameters.ts, 11, 1))
>args : Symbol(args, Decl(readonlyRestParameters.ts, 13, 12))
}
function f4(...args: readonly string[]) {
>f4 : Symbol(f4, Decl(readonlyRestParameters.ts, 21, 1))
>args : Symbol(args, Decl(readonlyRestParameters.ts, 23, 12))
args[0] = 'abc'; // Error
>args : Symbol(args, Decl(readonlyRestParameters.ts, 23, 12))
}

View File

@@ -0,0 +1,116 @@
=== tests/cases/conformance/es6/restParameters/readonlyRestParameters.ts ===
function f0(a: string, b: string) {
>f0 : (a: string, b: string) => void
>a : string
>b : string
f0(a, b);
>f0(a, b) : void
>f0 : (a: string, b: string) => void
>a : string
>b : string
f1(a, b);
>f1(a, b) : void
>f1 : (...args: readonly string[]) => void
>a : string
>b : string
f2(a, b);
>f2(a, b) : void
>f2 : (args_0: string, args_1: string) => void
>a : string
>b : string
}
function f1(...args: readonly string[]) {
>f1 : (...args: readonly string[]) => void
>args : readonly string[]
f0(...args); // Error
>f0(...args) : void
>f0 : (a: string, b: string) => void
>...args : string
>args : readonly string[]
f1('abc', 'def');
>f1('abc', 'def') : void
>f1 : (...args: readonly string[]) => void
>'abc' : "abc"
>'def' : "def"
f1('abc', ...args);
>f1('abc', ...args) : void
>f1 : (...args: readonly string[]) => void
>'abc' : "abc"
>...args : string
>args : readonly string[]
f1(...args);
>f1(...args) : void
>f1 : (...args: readonly string[]) => void
>...args : string
>args : readonly string[]
}
function f2(...args: readonly [string, string]) {
>f2 : (args_0: string, args_1: string) => void
>args : readonly [string, string]
f0(...args);
>f0(...args) : void
>f0 : (a: string, b: string) => void
>...args : string
>args : readonly [string, string]
f1('abc', 'def');
>f1('abc', 'def') : void
>f1 : (...args: readonly string[]) => void
>'abc' : "abc"
>'def' : "def"
f1('abc', ...args);
>f1('abc', ...args) : void
>f1 : (...args: readonly string[]) => void
>'abc' : "abc"
>...args : string
>args : readonly [string, string]
f1(...args);
>f1(...args) : void
>f1 : (...args: readonly string[]) => void
>...args : string
>args : readonly [string, string]
f2('abc', 'def');
>f2('abc', 'def') : void
>f2 : (args_0: string, args_1: string) => void
>'abc' : "abc"
>'def' : "def"
f2('abc', ...args); // Error
>f2('abc', ...args) : void
>f2 : (args_0: string, args_1: string) => void
>'abc' : "abc"
>...args : string
>args : readonly [string, string]
f2(...args);
>f2(...args) : void
>f2 : (args_0: string, args_1: string) => void
>...args : string
>args : readonly [string, string]
}
function f4(...args: readonly string[]) {
>f4 : (...args: readonly string[]) => void
>args : readonly string[]
args[0] = 'abc'; // Error
>args[0] = 'abc' : "abc"
>args[0] : string
>args : readonly string[]
>0 : 0
>'abc' : "abc"
}