Accept new baselines

This commit is contained in:
Anders Hejlsberg
2017-06-06 13:26:39 -07:00
parent 634c75c426
commit 8a7693908d
6 changed files with 85 additions and 31 deletions

View File

@@ -16,10 +16,10 @@ var f2: {
};
f2 = (x, y) => { return x }
>f2 = (x, y) => { return x } : (x: any, y: any) => any
>f2 = (x, y) => { return x } : (x: T, y: U) => T
>f2 : <T, U>(x: T, y: U) => T
>(x, y) => { return x } : (x: any, y: any) => any
>x : any
>y : any
>x : any
>(x, y) => { return x } : (x: T, y: U) => T
>x : T
>y : U
>x : T

View File

@@ -9,13 +9,13 @@ function f(p: <T>(x: T) => void) { };
f(x => f(y => x = y));
>f(x => f(y => x = y)) : void
>f : (p: <T>(x: T) => void) => void
>x => f(y => x = y) : (x: any) => void
>x : any
>x => f(y => x = y) : (x: T) => void
>x : T
>f(y => x = y) : void
>f : (p: <T>(x: T) => void) => void
>y => x = y : (y: any) => any
>y : any
>x = y : any
>x : any
>y : any
>y => x = y : (y: T) => T
>y : T
>x = y : T
>x : T
>y : T

View File

@@ -6,9 +6,9 @@ var r = < <T>(x: T) => T > ((x) => { return null; }); // bug was 'could not find
>x : T
>T : T
>T : T
>((x) => { return null; }) : (x: any) => any
>(x) => { return null; } : (x: any) => any
>x : any
>((x) => { return null; }) : (x: T) => any
>(x) => { return null; } : (x: T) => any
>x : T
>null : null
var s = < <T>(x: T) => T > ((x: any) => { return null; }); // no error

View File

@@ -1,16 +0,0 @@
tests/cases/compiler/implicitAnyGenericTypeInference.ts(6,19): error TS7006: Parameter 'x' implicitly has an 'any' type.
tests/cases/compiler/implicitAnyGenericTypeInference.ts(6,22): error TS7006: Parameter 'y' implicitly has an 'any' type.
==== tests/cases/compiler/implicitAnyGenericTypeInference.ts (2 errors) ====
interface Comparer<T> {
compareTo<U>(x: T, y: U): U;
}
var c: Comparer<any>;
c = { compareTo: (x, y) => { return y; } };
~
!!! error TS7006: Parameter 'x' implicitly has an 'any' type.
~
!!! error TS7006: Parameter 'y' implicitly has an 'any' type.
var r = c.compareTo(1, '');

View File

@@ -0,0 +1,32 @@
=== tests/cases/compiler/implicitAnyGenericTypeInference.ts ===
interface Comparer<T> {
>Comparer : Symbol(Comparer, Decl(implicitAnyGenericTypeInference.ts, 0, 0))
>T : Symbol(T, Decl(implicitAnyGenericTypeInference.ts, 0, 19))
compareTo<U>(x: T, y: U): U;
>compareTo : Symbol(Comparer.compareTo, Decl(implicitAnyGenericTypeInference.ts, 0, 23))
>U : Symbol(U, Decl(implicitAnyGenericTypeInference.ts, 1, 14))
>x : Symbol(x, Decl(implicitAnyGenericTypeInference.ts, 1, 17))
>T : Symbol(T, Decl(implicitAnyGenericTypeInference.ts, 0, 19))
>y : Symbol(y, Decl(implicitAnyGenericTypeInference.ts, 1, 22))
>U : Symbol(U, Decl(implicitAnyGenericTypeInference.ts, 1, 14))
>U : Symbol(U, Decl(implicitAnyGenericTypeInference.ts, 1, 14))
}
var c: Comparer<any>;
>c : Symbol(c, Decl(implicitAnyGenericTypeInference.ts, 4, 3))
>Comparer : Symbol(Comparer, Decl(implicitAnyGenericTypeInference.ts, 0, 0))
c = { compareTo: (x, y) => { return y; } };
>c : Symbol(c, Decl(implicitAnyGenericTypeInference.ts, 4, 3))
>compareTo : Symbol(compareTo, Decl(implicitAnyGenericTypeInference.ts, 5, 5))
>x : Symbol(x, Decl(implicitAnyGenericTypeInference.ts, 5, 18))
>y : Symbol(y, Decl(implicitAnyGenericTypeInference.ts, 5, 20))
>y : Symbol(y, Decl(implicitAnyGenericTypeInference.ts, 5, 20))
var r = c.compareTo(1, '');
>r : Symbol(r, Decl(implicitAnyGenericTypeInference.ts, 6, 3))
>c.compareTo : Symbol(Comparer.compareTo, Decl(implicitAnyGenericTypeInference.ts, 0, 23))
>c : Symbol(c, Decl(implicitAnyGenericTypeInference.ts, 4, 3))
>compareTo : Symbol(Comparer.compareTo, Decl(implicitAnyGenericTypeInference.ts, 0, 23))

View File

@@ -0,0 +1,38 @@
=== tests/cases/compiler/implicitAnyGenericTypeInference.ts ===
interface Comparer<T> {
>Comparer : Comparer<T>
>T : T
compareTo<U>(x: T, y: U): U;
>compareTo : <U>(x: T, y: U) => U
>U : U
>x : T
>T : T
>y : U
>U : U
>U : U
}
var c: Comparer<any>;
>c : Comparer<any>
>Comparer : Comparer<T>
c = { compareTo: (x, y) => { return y; } };
>c = { compareTo: (x, y) => { return y; } } : { compareTo: (x: any, y: U) => U; }
>c : Comparer<any>
>{ compareTo: (x, y) => { return y; } } : { compareTo: (x: any, y: U) => U; }
>compareTo : (x: any, y: U) => U
>(x, y) => { return y; } : (x: any, y: U) => U
>x : any
>y : U
>y : U
var r = c.compareTo(1, '');
>r : string
>c.compareTo(1, '') : ""
>c.compareTo : <U>(x: any, y: U) => U
>c : Comparer<any>
>compareTo : <U>(x: any, y: U) => U
>1 : 1
>'' : ""