Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Accepting new baselines
  • Loading branch information
ahejlsberg committed Feb 9, 2016
commit 837e6dbda36cdf34befbf0536592f4913c59d645
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
tests/cases/conformance/types/members/augmentedTypeAssignmentCompatIndexSignature.ts(15,5): error TS2322: Type '{}' is not assignable to type '{ [n: number]: Foo; }'.
Index signature is missing in type '{}'.
tests/cases/conformance/types/members/augmentedTypeAssignmentCompatIndexSignature.ts(19,5): error TS2322: Type '() => void' is not assignable to type '{ [n: number]: Bar; }'.
Index signature is missing in type '() => void'.


==== tests/cases/conformance/types/members/augmentedTypeAssignmentCompatIndexSignature.ts (2 errors) ====
==== tests/cases/conformance/types/members/augmentedTypeAssignmentCompatIndexSignature.ts (1 errors) ====
interface Foo { a }
interface Bar { b }

Expand All @@ -20,9 +18,6 @@ tests/cases/conformance/types/members/augmentedTypeAssignmentCompatIndexSignatur
var f = () => { };

var v1: {
~~
!!! error TS2322: Type '{}' is not assignable to type '{ [n: number]: Foo; }'.
!!! error TS2322: Index signature is missing in type '{}'.
[n: number]: Foo
} = o; // Should be allowed

Expand Down

Large diffs are not rendered by default.

This file was deleted.

32 changes: 32 additions & 0 deletions tests/baselines/reference/contextualTypingOfObjectLiterals.symbols
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
=== tests/cases/compiler/contextualTypingOfObjectLiterals.ts ===
var obj1: { [x: string]: string; };
>obj1 : Symbol(obj1, Decl(contextualTypingOfObjectLiterals.ts, 0, 3))
>x : Symbol(x, Decl(contextualTypingOfObjectLiterals.ts, 0, 13))

var obj2 = {x: ""};
>obj2 : Symbol(obj2, Decl(contextualTypingOfObjectLiterals.ts, 1, 3))
>x : Symbol(x, Decl(contextualTypingOfObjectLiterals.ts, 1, 12))

obj1 = {}; // Ok
>obj1 : Symbol(obj1, Decl(contextualTypingOfObjectLiterals.ts, 0, 3))

obj1 = obj2; // Error - indexer doesn't match
>obj1 : Symbol(obj1, Decl(contextualTypingOfObjectLiterals.ts, 0, 3))
>obj2 : Symbol(obj2, Decl(contextualTypingOfObjectLiterals.ts, 1, 3))

function f(x: { [s: string]: string }) { }
>f : Symbol(f, Decl(contextualTypingOfObjectLiterals.ts, 3, 12))
>x : Symbol(x, Decl(contextualTypingOfObjectLiterals.ts, 5, 11))
>s : Symbol(s, Decl(contextualTypingOfObjectLiterals.ts, 5, 17))

f({}); // Ok
>f : Symbol(f, Decl(contextualTypingOfObjectLiterals.ts, 3, 12))

f(obj1); // Ok
>f : Symbol(f, Decl(contextualTypingOfObjectLiterals.ts, 3, 12))
>obj1 : Symbol(obj1, Decl(contextualTypingOfObjectLiterals.ts, 0, 3))

f(obj2); // Error - indexer doesn't match
>f : Symbol(f, Decl(contextualTypingOfObjectLiterals.ts, 3, 12))
>obj2 : Symbol(obj2, Decl(contextualTypingOfObjectLiterals.ts, 1, 3))

41 changes: 41 additions & 0 deletions tests/baselines/reference/contextualTypingOfObjectLiterals.types
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
=== tests/cases/compiler/contextualTypingOfObjectLiterals.ts ===
var obj1: { [x: string]: string; };
>obj1 : { [x: string]: string; }
>x : string

var obj2 = {x: ""};
>obj2 : { x: string; }
>{x: ""} : { x: string; }
>x : string
>"" : string

obj1 = {}; // Ok
>obj1 = {} : { [x: string]: undefined; }
>obj1 : { [x: string]: string; }
>{} : { [x: string]: undefined; }

obj1 = obj2; // Error - indexer doesn't match
>obj1 = obj2 : { x: string; }
>obj1 : { [x: string]: string; }
>obj2 : { x: string; }

function f(x: { [s: string]: string }) { }
>f : (x: { [s: string]: string; }) => void
>x : { [s: string]: string; }
>s : string

f({}); // Ok
>f({}) : void
>f : (x: { [s: string]: string; }) => void
>{} : { [x: string]: undefined; }

f(obj1); // Ok
>f(obj1) : void
>f : (x: { [s: string]: string; }) => void
>obj1 : { [x: string]: string; }

f(obj2); // Error - indexer doesn't match
>f(obj2) : void
>f : (x: { [s: string]: string; }) => void
>obj2 : { x: string; }

28 changes: 0 additions & 28 deletions tests/baselines/reference/indexerAssignability.errors.txt

This file was deleted.

36 changes: 36 additions & 0 deletions tests/baselines/reference/indexerAssignability.symbols
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
=== tests/cases/compiler/indexerAssignability.ts ===
var a: { [s: string]: string; };
>a : Symbol(a, Decl(indexerAssignability.ts, 0, 3))
>s : Symbol(s, Decl(indexerAssignability.ts, 0, 10))

var b: { [n: number]: string; };
>b : Symbol(b, Decl(indexerAssignability.ts, 1, 3))
>n : Symbol(n, Decl(indexerAssignability.ts, 1, 10))

var c: {};
>c : Symbol(c, Decl(indexerAssignability.ts, 2, 3))

a = b;
>a : Symbol(a, Decl(indexerAssignability.ts, 0, 3))
>b : Symbol(b, Decl(indexerAssignability.ts, 1, 3))

a = c;
>a : Symbol(a, Decl(indexerAssignability.ts, 0, 3))
>c : Symbol(c, Decl(indexerAssignability.ts, 2, 3))

b = a;
>b : Symbol(b, Decl(indexerAssignability.ts, 1, 3))
>a : Symbol(a, Decl(indexerAssignability.ts, 0, 3))

b = c;
>b : Symbol(b, Decl(indexerAssignability.ts, 1, 3))
>c : Symbol(c, Decl(indexerAssignability.ts, 2, 3))

c = a;
>c : Symbol(c, Decl(indexerAssignability.ts, 2, 3))
>a : Symbol(a, Decl(indexerAssignability.ts, 0, 3))

c = b;
>c : Symbol(c, Decl(indexerAssignability.ts, 2, 3))
>b : Symbol(b, Decl(indexerAssignability.ts, 1, 3))

42 changes: 42 additions & 0 deletions tests/baselines/reference/indexerAssignability.types
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
=== tests/cases/compiler/indexerAssignability.ts ===
var a: { [s: string]: string; };
>a : { [s: string]: string; }
>s : string

var b: { [n: number]: string; };
>b : { [n: number]: string; }
>n : number

var c: {};
>c : {}

a = b;
>a = b : { [n: number]: string; }
>a : { [s: string]: string; }
>b : { [n: number]: string; }

a = c;
>a = c : {}
>a : { [s: string]: string; }
>c : {}

b = a;
>b = a : { [s: string]: string; }
>b : { [n: number]: string; }
>a : { [s: string]: string; }

b = c;
>b = c : {}
>b : { [n: number]: string; }
>c : {}

c = a;
>c = a : { [s: string]: string; }
>c : {}
>a : { [s: string]: string; }

c = b;
>c = b : { [n: number]: string; }
>c : {}
>b : { [n: number]: string; }

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
tests/cases/compiler/numericIndexerConstraint2.ts(4,1): error TS2322: Type '{ one: number; }' is not assignable to type '{ [index: string]: Foo; }'.
Index signature is missing in type '{ one: number; }'.
Property 'one' is incompatible with index signature.
Type 'number' is not assignable to type 'Foo'.


==== tests/cases/compiler/numericIndexerConstraint2.ts (1 errors) ====
Expand All @@ -9,4 +10,5 @@ tests/cases/compiler/numericIndexerConstraint2.ts(4,1): error TS2322: Type '{ on
x = a;
~
!!! error TS2322: Type '{ one: number; }' is not assignable to type '{ [index: string]: Foo; }'.
!!! error TS2322: Index signature is missing in type '{ one: number; }'.
!!! error TS2322: Property 'one' is incompatible with index signature.
!!! error TS2322: Type 'number' is not assignable to type 'Foo'.
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
tests/cases/compiler/numericIndexerConstraint5.ts(2,5): error TS2322: Type '{ 0: Date; name: string; }' is not assignable to type '{ [name: number]: string; }'.
Index signature is missing in type '{ 0: Date; name: string; }'.
Property '0' is incompatible with index signature.
Type 'Date' is not assignable to type 'string'.


==== tests/cases/compiler/numericIndexerConstraint5.ts (1 errors) ====
var x = { name: "x", 0: new Date() };
var z: { [name: number]: string } = x;
~
!!! error TS2322: Type '{ 0: Date; name: string; }' is not assignable to type '{ [name: number]: string; }'.
!!! error TS2322: Index signature is missing in type '{ 0: Date; name: string; }'.
!!! error TS2322: Property '0' is incompatible with index signature.
!!! error TS2322: Type 'Date' is not assignable to type 'string'.
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
tests/cases/compiler/stringIndexerAssignments1.ts(4,1): error TS2322: Type '{ one: string; }' is not assignable to type '{ [index: string]: string; one: string; }'.
Index signature is missing in type '{ one: string; }'.
tests/cases/compiler/stringIndexerAssignments1.ts(5,1): error TS2322: Type '{ one: number; two: string; }' is not assignable to type '{ [index: string]: string; one: string; }'.
Types of property 'one' are incompatible.
Type 'number' is not assignable to type 'string'.


==== tests/cases/compiler/stringIndexerAssignments1.ts (2 errors) ====
==== tests/cases/compiler/stringIndexerAssignments1.ts (1 errors) ====
var x: { [index: string]: string; one: string; };
var a: { one: string; };
var b: { one: number; two: string; };
x = a;
~
!!! error TS2322: Type '{ one: string; }' is not assignable to type '{ [index: string]: string; one: string; }'.
!!! error TS2322: Index signature is missing in type '{ one: string; }'.
x = b; // error
~
!!! error TS2322: Type '{ one: number; two: string; }' is not assignable to type '{ [index: string]: string; one: string; }'.
Expand Down