mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-19 20:37:00 -05:00
Accepting new baselines
This commit is contained in:
@@ -18,7 +18,6 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstrain
|
||||
Type 'new <T>(x: T) => T' provides no match for the signature '(x: string): string'
|
||||
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(34,16): error TS2345: Argument of type 'F2' is not assignable to parameter of type '(x: string) => string'.
|
||||
Type 'F2' provides no match for the signature '(x: string): string'
|
||||
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(36,38): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
||||
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(37,10): error TS2345: Argument of type 'T' is not assignable to parameter of type '(x: string) => string'.
|
||||
Type '() => void' is not assignable to type '(x: string) => string'.
|
||||
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(38,10): error TS2345: Argument of type 'U' is not assignable to parameter of type '(x: string) => string'.
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndConstraints4.ts(19,17): error TS2345: Argument of type 'C' is not assignable to parameter of type 'D'.
|
||||
Property 'y' is missing in type 'C'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndConstraints4.ts(30,24): error TS2345: Argument of type 'C' is not assignable to parameter of type 'T'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndConstraints4.ts (1 errors) ====
|
||||
==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndConstraints4.ts (2 errors) ====
|
||||
// Generic call with constraints infering type parameter from object member properties
|
||||
|
||||
class C {
|
||||
@@ -21,6 +23,9 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObj
|
||||
var d: D;
|
||||
var r = foo(c, d);
|
||||
var r2 = foo(d, c); // error because C does not extend D
|
||||
~
|
||||
!!! error TS2345: Argument of type 'C' is not assignable to parameter of type 'D'.
|
||||
!!! error TS2345: Property 'y' is missing in type 'C'.
|
||||
var r3 = foo(c, { x: '', foo: c });
|
||||
var r4 = foo(null, null);
|
||||
var r5 = foo({}, null);
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndConstraints5.ts(18,17): error TS2345: Argument of type 'C' is not assignable to parameter of type 'D'.
|
||||
Property 'y' is missing in type 'C'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndConstraints5.ts(19,23): error TS2345: Argument of type '() => void' is not assignable to parameter of type '() => number'.
|
||||
Type 'void' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndConstraints5.ts(22,24): error TS2345: Argument of type 'C' is not assignable to parameter of type 'T'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndConstraints5.ts (1 errors) ====
|
||||
==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndConstraints5.ts (3 errors) ====
|
||||
// Generic call with constraints infering type parameter from object member properties
|
||||
|
||||
class C {
|
||||
@@ -20,7 +24,13 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObj
|
||||
var c: C;
|
||||
var d: D;
|
||||
var r2 = foo(d, c); // the constraints are self-referencing, no downstream error
|
||||
~
|
||||
!!! error TS2345: Argument of type 'C' is not assignable to parameter of type 'D'.
|
||||
!!! error TS2345: Property 'y' is missing in type 'C'.
|
||||
var r9 = foo(() => 1, () => { }); // the constraints are self-referencing, no downstream error
|
||||
~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '() => void' is not assignable to parameter of type '() => number'.
|
||||
!!! error TS2345: Type 'void' is not assignable to type 'number'.
|
||||
|
||||
function other<T, U extends T>() {
|
||||
var r5 = foo<T, U>(c, d); // error
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/maxConstraints.ts(8,22): error TS2345: Argument of type 'number' is not assignable to parameter of type 'Comparable<any>'.
|
||||
tests/cases/compiler/maxConstraints.ts(8,22): error TS2345: Argument of type 'number' is not assignable to parameter of type 'Comparable<number>'.
|
||||
Property 'compareTo' is missing in type 'Number'.
|
||||
|
||||
|
||||
@@ -12,5 +12,5 @@ tests/cases/compiler/maxConstraints.ts(8,22): error TS2345: Argument of type 'nu
|
||||
var max2: Comparer = (x, y) => { return (x.compareTo(y) > 0) ? x : y };
|
||||
var maxResult = max2(1, 2);
|
||||
~
|
||||
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'Comparable<any>'.
|
||||
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'Comparable<number>'.
|
||||
!!! error TS2345: Property 'compareTo' is missing in type 'Number'.
|
||||
@@ -135,11 +135,14 @@ var a: {
|
||||
}
|
||||
var r3 = a().foo(); // error, no inferences for U so it doesn't satisfy constraint
|
||||
>r3 : Symbol(r3, Decl(propertyAccessOnTypeParameterWithConstraints3.ts, 41, 3))
|
||||
>a().foo : Symbol(A.foo, Decl(propertyAccessOnTypeParameterWithConstraints3.ts, 2, 9))
|
||||
>a : Symbol(a, Decl(propertyAccessOnTypeParameterWithConstraints3.ts, 37, 3))
|
||||
>foo : Symbol(A.foo, Decl(propertyAccessOnTypeParameterWithConstraints3.ts, 2, 9))
|
||||
|
||||
var r3b = a()['foo']();
|
||||
>r3b : Symbol(r3b, Decl(propertyAccessOnTypeParameterWithConstraints3.ts, 42, 3))
|
||||
>a : Symbol(a, Decl(propertyAccessOnTypeParameterWithConstraints3.ts, 37, 3))
|
||||
>'foo' : Symbol(A.foo, Decl(propertyAccessOnTypeParameterWithConstraints3.ts, 2, 9))
|
||||
|
||||
// parameter supplied for type argument inference for U
|
||||
var r3c = a(new B()).foo(); // valid call to an invalid function, U is inferred as B, which has a foo
|
||||
|
||||
@@ -154,18 +154,18 @@ var a: {
|
||||
>U : U
|
||||
}
|
||||
var r3 = a().foo(); // error, no inferences for U so it doesn't satisfy constraint
|
||||
>r3 : any
|
||||
>a().foo() : any
|
||||
>a().foo : any
|
||||
>a() : any
|
||||
>r3 : string
|
||||
>a().foo() : string
|
||||
>a().foo : () => string
|
||||
>a() : A
|
||||
>a : { <U extends A, T extends U>(): T; <U extends T, T extends A>(x: U): U; }
|
||||
>foo : any
|
||||
>foo : () => string
|
||||
|
||||
var r3b = a()['foo']();
|
||||
>r3b : any
|
||||
>a()['foo']() : any
|
||||
>a()['foo'] : any
|
||||
>a() : any
|
||||
>r3b : string
|
||||
>a()['foo']() : string
|
||||
>a()['foo'] : () => string
|
||||
>a() : A
|
||||
>a : { <U extends A, T extends U>(): T; <U extends T, T extends A>(x: U): U; }
|
||||
>'foo' : string
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
tests/cases/conformance/types/typeParameters/typeParameterLists/propertyAccessOnTypeParameterWithConstraints5.ts(15,32): error TS2339: Property 'notHere' does not exist on type 'U'.
|
||||
tests/cases/conformance/types/typeParameters/typeParameterLists/propertyAccessOnTypeParameterWithConstraints5.ts(25,16): error TS2339: Property 'notHere' does not exist on type 'B'.
|
||||
tests/cases/conformance/types/typeParameters/typeParameterLists/propertyAccessOnTypeParameterWithConstraints5.ts(32,22): error TS2339: Property 'notHere' does not exist on type 'A'.
|
||||
tests/cases/conformance/types/typeParameters/typeParameterLists/propertyAccessOnTypeParameterWithConstraints5.ts(38,16): error TS2322: Type 'string' is not assignable to type 'U'.
|
||||
tests/cases/conformance/types/typeParameters/typeParameterLists/propertyAccessOnTypeParameterWithConstraints5.ts(38,22): error TS2339: Property 'notHere' does not exist on type 'U'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/typeParameters/typeParameterLists/propertyAccessOnTypeParameterWithConstraints5.ts (4 errors) ====
|
||||
==== tests/cases/conformance/types/typeParameters/typeParameterLists/propertyAccessOnTypeParameterWithConstraints5.ts (5 errors) ====
|
||||
class A {
|
||||
foo(): string { return ''; }
|
||||
}
|
||||
@@ -41,6 +42,8 @@ tests/cases/conformance/types/typeParameters/typeParameterLists/propertyAccessOn
|
||||
}
|
||||
// BUG 794164
|
||||
var r3: string = a().notHere();
|
||||
~~~~~~~
|
||||
!!! error TS2339: Property 'notHere' does not exist on type 'A'.
|
||||
var r3b: string = a()['foo']();
|
||||
|
||||
var b = {
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
tests/cases/conformance/types/typeParameters/typeArgumentLists/typeParameterAsTypeParameterConstraint2.ts(6,8): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
tests/cases/conformance/types/typeParameters/typeArgumentLists/typeParameterAsTypeParameterConstraint2.ts(7,8): error TS2345: Argument of type '{}' is not assignable to parameter of type 'number'.
|
||||
tests/cases/conformance/types/typeParameters/typeArgumentLists/typeParameterAsTypeParameterConstraint2.ts(13,17): error TS2345: Argument of type 'NumberVariant' is not assignable to parameter of type 'number'.
|
||||
tests/cases/conformance/types/typeParameters/typeArgumentLists/typeParameterAsTypeParameterConstraint2.ts(16,9): error TS2345: Argument of type '{ length: string; }' is not assignable to parameter of type '{ length: number; }'.
|
||||
Types of property 'length' are incompatible.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/typeParameters/typeArgumentLists/typeParameterAsTypeParameterConstraint2.ts(17,9): error TS2345: Argument of type '{ length: {}; }' is not assignable to parameter of type '{ length: number; }'.
|
||||
Types of property 'length' are incompatible.
|
||||
Type '{}' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/typeParameters/typeArgumentLists/typeParameterAsTypeParameterConstraint2.ts(18,10): error TS2345: Argument of type 'string[]' is not assignable to parameter of type '{ length: any[]; }'.
|
||||
Types of property 'length' are incompatible.
|
||||
Type 'number' is not assignable to type 'any[]'.
|
||||
Property 'length' is missing in type 'Number'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/typeParameters/typeArgumentLists/typeParameterAsTypeParameterConstraint2.ts (6 errors) ====
|
||||
// using a type parameter as a constraint for a type parameter is invalid
|
||||
// these should be errors unless otherwise noted
|
||||
|
||||
function foo<T, U extends T>(x: T, y: U): U { return y; } // this is now an error
|
||||
|
||||
foo(1, '');
|
||||
~~
|
||||
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
foo(1, {});
|
||||
~~
|
||||
!!! error TS2345: Argument of type '{}' is not assignable to parameter of type 'number'.
|
||||
|
||||
interface NumberVariant extends Number {
|
||||
x: number;
|
||||
}
|
||||
var n: NumberVariant;
|
||||
var r3 = foo(1, n);
|
||||
~
|
||||
!!! error TS2345: Argument of type 'NumberVariant' is not assignable to parameter of type 'number'.
|
||||
|
||||
function foo2<T, U extends { length: T }>(x: T, y: U) { return y; } // this is now an error
|
||||
foo2(1, { length: '' });
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '{ length: string; }' is not assignable to parameter of type '{ length: number; }'.
|
||||
!!! error TS2345: Types of property 'length' are incompatible.
|
||||
!!! error TS2345: Type 'string' is not assignable to type 'number'.
|
||||
foo2(1, { length: {} });
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '{ length: {}; }' is not assignable to parameter of type '{ length: number; }'.
|
||||
!!! error TS2345: Types of property 'length' are incompatible.
|
||||
!!! error TS2345: Type '{}' is not assignable to type 'number'.
|
||||
foo2([], ['']);
|
||||
~~~~
|
||||
!!! error TS2345: Argument of type 'string[]' is not assignable to parameter of type '{ length: any[]; }'.
|
||||
!!! error TS2345: Types of property 'length' are incompatible.
|
||||
!!! error TS2345: Type 'number' is not assignable to type 'any[]'.
|
||||
!!! error TS2345: Property 'length' is missing in type 'Number'.
|
||||
@@ -1,61 +0,0 @@
|
||||
=== tests/cases/conformance/types/typeParameters/typeArgumentLists/typeParameterAsTypeParameterConstraint2.ts ===
|
||||
// using a type parameter as a constraint for a type parameter is invalid
|
||||
// these should be errors unless otherwise noted
|
||||
|
||||
function foo<T, U extends T>(x: T, y: U): U { return y; } // this is now an error
|
||||
>foo : Symbol(foo, Decl(typeParameterAsTypeParameterConstraint2.ts, 0, 0))
|
||||
>T : Symbol(T, Decl(typeParameterAsTypeParameterConstraint2.ts, 3, 13))
|
||||
>U : Symbol(U, Decl(typeParameterAsTypeParameterConstraint2.ts, 3, 15))
|
||||
>T : Symbol(T, Decl(typeParameterAsTypeParameterConstraint2.ts, 3, 13))
|
||||
>x : Symbol(x, Decl(typeParameterAsTypeParameterConstraint2.ts, 3, 29))
|
||||
>T : Symbol(T, Decl(typeParameterAsTypeParameterConstraint2.ts, 3, 13))
|
||||
>y : Symbol(y, Decl(typeParameterAsTypeParameterConstraint2.ts, 3, 34))
|
||||
>U : Symbol(U, Decl(typeParameterAsTypeParameterConstraint2.ts, 3, 15))
|
||||
>U : Symbol(U, Decl(typeParameterAsTypeParameterConstraint2.ts, 3, 15))
|
||||
>y : Symbol(y, Decl(typeParameterAsTypeParameterConstraint2.ts, 3, 34))
|
||||
|
||||
foo(1, '');
|
||||
>foo : Symbol(foo, Decl(typeParameterAsTypeParameterConstraint2.ts, 0, 0))
|
||||
|
||||
foo(1, {});
|
||||
>foo : Symbol(foo, Decl(typeParameterAsTypeParameterConstraint2.ts, 0, 0))
|
||||
|
||||
interface NumberVariant extends Number {
|
||||
>NumberVariant : Symbol(NumberVariant, Decl(typeParameterAsTypeParameterConstraint2.ts, 6, 11))
|
||||
>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
|
||||
x: number;
|
||||
>x : Symbol(x, Decl(typeParameterAsTypeParameterConstraint2.ts, 8, 40))
|
||||
}
|
||||
var n: NumberVariant;
|
||||
>n : Symbol(n, Decl(typeParameterAsTypeParameterConstraint2.ts, 11, 3))
|
||||
>NumberVariant : Symbol(NumberVariant, Decl(typeParameterAsTypeParameterConstraint2.ts, 6, 11))
|
||||
|
||||
var r3 = foo(1, n);
|
||||
>r3 : Symbol(r3, Decl(typeParameterAsTypeParameterConstraint2.ts, 12, 3))
|
||||
>foo : Symbol(foo, Decl(typeParameterAsTypeParameterConstraint2.ts, 0, 0))
|
||||
>n : Symbol(n, Decl(typeParameterAsTypeParameterConstraint2.ts, 11, 3))
|
||||
|
||||
function foo2<T, U extends { length: T }>(x: T, y: U) { return y; } // this is now an error
|
||||
>foo2 : Symbol(foo2, Decl(typeParameterAsTypeParameterConstraint2.ts, 12, 19))
|
||||
>T : Symbol(T, Decl(typeParameterAsTypeParameterConstraint2.ts, 14, 14))
|
||||
>U : Symbol(U, Decl(typeParameterAsTypeParameterConstraint2.ts, 14, 16))
|
||||
>length : Symbol(length, Decl(typeParameterAsTypeParameterConstraint2.ts, 14, 28))
|
||||
>T : Symbol(T, Decl(typeParameterAsTypeParameterConstraint2.ts, 14, 14))
|
||||
>x : Symbol(x, Decl(typeParameterAsTypeParameterConstraint2.ts, 14, 42))
|
||||
>T : Symbol(T, Decl(typeParameterAsTypeParameterConstraint2.ts, 14, 14))
|
||||
>y : Symbol(y, Decl(typeParameterAsTypeParameterConstraint2.ts, 14, 47))
|
||||
>U : Symbol(U, Decl(typeParameterAsTypeParameterConstraint2.ts, 14, 16))
|
||||
>y : Symbol(y, Decl(typeParameterAsTypeParameterConstraint2.ts, 14, 47))
|
||||
|
||||
foo2(1, { length: '' });
|
||||
>foo2 : Symbol(foo2, Decl(typeParameterAsTypeParameterConstraint2.ts, 12, 19))
|
||||
>length : Symbol(length, Decl(typeParameterAsTypeParameterConstraint2.ts, 15, 9))
|
||||
|
||||
foo2(1, { length: {} });
|
||||
>foo2 : Symbol(foo2, Decl(typeParameterAsTypeParameterConstraint2.ts, 12, 19))
|
||||
>length : Symbol(length, Decl(typeParameterAsTypeParameterConstraint2.ts, 16, 9))
|
||||
|
||||
foo2([], ['']);
|
||||
>foo2 : Symbol(foo2, Decl(typeParameterAsTypeParameterConstraint2.ts, 12, 19))
|
||||
|
||||
@@ -1,81 +0,0 @@
|
||||
=== tests/cases/conformance/types/typeParameters/typeArgumentLists/typeParameterAsTypeParameterConstraint2.ts ===
|
||||
// using a type parameter as a constraint for a type parameter is invalid
|
||||
// these should be errors unless otherwise noted
|
||||
|
||||
function foo<T, U extends T>(x: T, y: U): U { return y; } // this is now an error
|
||||
>foo : <T, U extends T>(x: T, y: U) => U
|
||||
>T : T
|
||||
>U : U
|
||||
>T : T
|
||||
>x : T
|
||||
>T : T
|
||||
>y : U
|
||||
>U : U
|
||||
>U : U
|
||||
>y : U
|
||||
|
||||
foo(1, '');
|
||||
>foo(1, '') : any
|
||||
>foo : <T, U extends T>(x: T, y: U) => U
|
||||
>1 : number
|
||||
>'' : string
|
||||
|
||||
foo(1, {});
|
||||
>foo(1, {}) : any
|
||||
>foo : <T, U extends T>(x: T, y: U) => U
|
||||
>1 : number
|
||||
>{} : {}
|
||||
|
||||
interface NumberVariant extends Number {
|
||||
>NumberVariant : NumberVariant
|
||||
>Number : Number
|
||||
|
||||
x: number;
|
||||
>x : number
|
||||
}
|
||||
var n: NumberVariant;
|
||||
>n : NumberVariant
|
||||
>NumberVariant : NumberVariant
|
||||
|
||||
var r3 = foo(1, n);
|
||||
>r3 : any
|
||||
>foo(1, n) : any
|
||||
>foo : <T, U extends T>(x: T, y: U) => U
|
||||
>1 : number
|
||||
>n : NumberVariant
|
||||
|
||||
function foo2<T, U extends { length: T }>(x: T, y: U) { return y; } // this is now an error
|
||||
>foo2 : <T, U extends { length: T; }>(x: T, y: U) => U
|
||||
>T : T
|
||||
>U : U
|
||||
>length : T
|
||||
>T : T
|
||||
>x : T
|
||||
>T : T
|
||||
>y : U
|
||||
>U : U
|
||||
>y : U
|
||||
|
||||
foo2(1, { length: '' });
|
||||
>foo2(1, { length: '' }) : { length: any; }
|
||||
>foo2 : <T, U extends { length: T; }>(x: T, y: U) => U
|
||||
>1 : number
|
||||
>{ length: '' } : { length: string; }
|
||||
>length : string
|
||||
>'' : string
|
||||
|
||||
foo2(1, { length: {} });
|
||||
>foo2(1, { length: {} }) : { length: any; }
|
||||
>foo2 : <T, U extends { length: T; }>(x: T, y: U) => U
|
||||
>1 : number
|
||||
>{ length: {} } : { length: {}; }
|
||||
>length : {}
|
||||
>{} : {}
|
||||
|
||||
foo2([], ['']);
|
||||
>foo2([], ['']) : { length: any; }
|
||||
>foo2 : <T, U extends { length: T; }>(x: T, y: U) => U
|
||||
>[] : undefined[]
|
||||
>[''] : string[]
|
||||
>'' : string
|
||||
|
||||
Reference in New Issue
Block a user