Accept new baselines

This commit is contained in:
Anders Hejlsberg
2016-07-16 14:46:10 -07:00
parent 614d171a21
commit a96d38ef96
8 changed files with 73 additions and 30 deletions

View File

@@ -19,14 +19,14 @@ function foo<T extends number>(x: T) {
foo(5);
>foo(5) : void
>foo : <T extends number>(x: T) => void
>5 : number
>5 : 5
foo(E.A);
>foo(E.A) : void
>foo : <T extends number>(x: T) => void
>E.A : E
>E.A : E.A
>E : typeof E
>A : E
>A : E.A
class A { a }
>A : A

View File

@@ -15,8 +15,8 @@ var i: I<string>;
>I : I<T>
var y = i(""); // y should be string
>y : string
>i("") : string
>y : ""
>i("") : ""
>i : I<string>
>"" : string
>"" : ""

View File

@@ -2,8 +2,8 @@ tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericC
tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(11,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(19,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(30,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(30,25): error TS2322: Type 'string' is not assignable to type 'T'.
tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(32,16): error TS2322: Type 'string' is not assignable to type 'T'.
tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(30,25): error TS2322: Type '""' is not assignable to type 'T'.
tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(32,16): error TS2322: Type '""' is not assignable to type 'T'.
tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(41,1): error TS2322: Type 'E<string>' is not assignable to type 'C<number>'.
Types of property 'x' are incompatible.
Type 'string' is not assignable to type 'number'.
@@ -49,11 +49,11 @@ tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericC
~
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
~~
!!! error TS2322: Type 'string' is not assignable to type 'T'.
!!! error TS2322: Type '""' is not assignable to type 'T'.
foo(): T {
return ''; // error
~~
!!! error TS2322: Type 'string' is not assignable to type 'T'.
!!! error TS2322: Type '""' is not assignable to type 'T'.
}
}

View File

@@ -15,8 +15,8 @@ var i: I<string>;
>I : I<T>
var y = new i(""); // y should be string
>y : string
>new i("") : string
>y : ""
>new i("") : ""
>i : I<string>
>"" : string
>"" : ""

View File

@@ -1,15 +0,0 @@
tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTypeParameterConstraint02.ts(6,13): error TS2345: Argument of type '(y: "foo" | "bar") => string' is not assignable to parameter of type '(x: "foo") => "foo"'.
Type 'string' is not assignable to type '"foo"'.
==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTypeParameterConstraint02.ts (1 errors) ====
function foo<T extends "foo">(f: (x: T) => T) {
return f;
}
let f = foo((y: "foo" | "bar") => y === "foo" ? y : "foo");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '(y: "foo" | "bar") => string' is not assignable to parameter of type '(x: "foo") => "foo"'.
!!! error TS2345: Type 'string' is not assignable to type '"foo"'.
let fResult = f("foo");

View File

@@ -17,5 +17,5 @@ var fResult = f("foo");
//// [stringLiteralTypesAsTypeParameterConstraint02.d.ts]
declare function foo<T extends "foo">(f: (x: T) => T): (x: T) => T;
declare let f: any;
declare let fResult: any;
declare let f: (x: "foo") => "foo";
declare let fResult: "foo";

View File

@@ -0,0 +1,25 @@
=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTypeParameterConstraint02.ts ===
function foo<T extends "foo">(f: (x: T) => T) {
>foo : Symbol(foo, Decl(stringLiteralTypesAsTypeParameterConstraint02.ts, 0, 0))
>T : Symbol(T, Decl(stringLiteralTypesAsTypeParameterConstraint02.ts, 1, 13))
>f : Symbol(f, Decl(stringLiteralTypesAsTypeParameterConstraint02.ts, 1, 30))
>x : Symbol(x, Decl(stringLiteralTypesAsTypeParameterConstraint02.ts, 1, 34))
>T : Symbol(T, Decl(stringLiteralTypesAsTypeParameterConstraint02.ts, 1, 13))
>T : Symbol(T, Decl(stringLiteralTypesAsTypeParameterConstraint02.ts, 1, 13))
return f;
>f : Symbol(f, Decl(stringLiteralTypesAsTypeParameterConstraint02.ts, 1, 30))
}
let f = foo((y: "foo" | "bar") => y === "foo" ? y : "foo");
>f : Symbol(f, Decl(stringLiteralTypesAsTypeParameterConstraint02.ts, 5, 3))
>foo : Symbol(foo, Decl(stringLiteralTypesAsTypeParameterConstraint02.ts, 0, 0))
>y : Symbol(y, Decl(stringLiteralTypesAsTypeParameterConstraint02.ts, 5, 13))
>y : Symbol(y, Decl(stringLiteralTypesAsTypeParameterConstraint02.ts, 5, 13))
>y : Symbol(y, Decl(stringLiteralTypesAsTypeParameterConstraint02.ts, 5, 13))
let fResult = f("foo");
>fResult : Symbol(fResult, Decl(stringLiteralTypesAsTypeParameterConstraint02.ts, 6, 3))
>f : Symbol(f, Decl(stringLiteralTypesAsTypeParameterConstraint02.ts, 5, 3))

View File

@@ -0,0 +1,33 @@
=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTypeParameterConstraint02.ts ===
function foo<T extends "foo">(f: (x: T) => T) {
>foo : <T extends "foo">(f: (x: T) => T) => (x: T) => T
>T : T
>f : (x: T) => T
>x : T
>T : T
>T : T
return f;
>f : (x: T) => T
}
let f = foo((y: "foo" | "bar") => y === "foo" ? y : "foo");
>f : (x: "foo") => "foo"
>foo((y: "foo" | "bar") => y === "foo" ? y : "foo") : (x: "foo") => "foo"
>foo : <T extends "foo">(f: (x: T) => T) => (x: T) => T
>(y: "foo" | "bar") => y === "foo" ? y : "foo" : (y: "foo" | "bar") => "foo"
>y : "foo" | "bar"
>y === "foo" ? y : "foo" : "foo"
>y === "foo" : boolean
>y : "foo" | "bar"
>"foo" : "foo"
>y : "foo"
>"foo" : "foo"
let fResult = f("foo");
>fResult : "foo"
>f("foo") : "foo"
>f : (x: "foo") => "foo"
>"foo" : "foo"