TypeScript/tests/baselines/reference/assignmentCompatWithObjectMembers3.types

160 lines
6.7 KiB
Plaintext
Raw Normal View History

2014-08-15 23:33:16 +02:00
=== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembers3.ts ===
// members N and M of types S and T have the same name, same accessibility, same optionality, and N is assignable M
// additional optional properties do not cause errors
class S implements S2 { foo: string; }
2015-04-13 23:01:57 +02:00
>S : S, Symbol(S, Decl(assignmentCompatWithObjectMembers3.ts, 0, 0))
>S2 : S2, Symbol(S2, Decl(assignmentCompatWithObjectMembers3.ts, 6, 9))
>foo : string, Symbol(foo, Decl(assignmentCompatWithObjectMembers3.ts, 3, 23))
2014-08-15 23:33:16 +02:00
class T implements T2 { foo: string; }
2015-04-13 23:01:57 +02:00
>T : T, Symbol(T, Decl(assignmentCompatWithObjectMembers3.ts, 3, 38))
>T2 : T2, Symbol(T2, Decl(assignmentCompatWithObjectMembers3.ts, 8, 42))
>foo : string, Symbol(foo, Decl(assignmentCompatWithObjectMembers3.ts, 4, 23))
2014-08-15 23:33:16 +02:00
var s: S;
2015-04-13 23:01:57 +02:00
>s : S, Symbol(s, Decl(assignmentCompatWithObjectMembers3.ts, 5, 3))
>S : S, Symbol(S, Decl(assignmentCompatWithObjectMembers3.ts, 0, 0))
2014-08-15 23:33:16 +02:00
var t: T;
2015-04-13 23:01:57 +02:00
>t : T, Symbol(t, Decl(assignmentCompatWithObjectMembers3.ts, 6, 3))
>T : T, Symbol(T, Decl(assignmentCompatWithObjectMembers3.ts, 3, 38))
2014-08-15 23:33:16 +02:00
interface S2 { foo: string; bar?: string }
2015-04-13 23:01:57 +02:00
>S2 : S2, Symbol(S2, Decl(assignmentCompatWithObjectMembers3.ts, 6, 9))
>foo : string, Symbol(foo, Decl(assignmentCompatWithObjectMembers3.ts, 8, 14))
>bar : string, Symbol(bar, Decl(assignmentCompatWithObjectMembers3.ts, 8, 27))
2014-08-15 23:33:16 +02:00
interface T2 { foo: string; baz?: string }
2015-04-13 23:01:57 +02:00
>T2 : T2, Symbol(T2, Decl(assignmentCompatWithObjectMembers3.ts, 8, 42))
>foo : string, Symbol(foo, Decl(assignmentCompatWithObjectMembers3.ts, 9, 14))
>baz : string, Symbol(baz, Decl(assignmentCompatWithObjectMembers3.ts, 9, 27))
2014-08-15 23:33:16 +02:00
var s2: S2;
2015-04-13 23:01:57 +02:00
>s2 : S2, Symbol(s2, Decl(assignmentCompatWithObjectMembers3.ts, 10, 3))
>S2 : S2, Symbol(S2, Decl(assignmentCompatWithObjectMembers3.ts, 6, 9))
2014-08-15 23:33:16 +02:00
var t2: T2;
2015-04-13 23:01:57 +02:00
>t2 : T2, Symbol(t2, Decl(assignmentCompatWithObjectMembers3.ts, 11, 3))
>T2 : T2, Symbol(T2, Decl(assignmentCompatWithObjectMembers3.ts, 8, 42))
2014-08-15 23:33:16 +02:00
var a: { foo: string; bar?: string }
2015-04-13 23:01:57 +02:00
>a : { foo: string; bar?: string; }, Symbol(a, Decl(assignmentCompatWithObjectMembers3.ts, 13, 3))
>foo : string, Symbol(foo, Decl(assignmentCompatWithObjectMembers3.ts, 13, 8))
>bar : string, Symbol(bar, Decl(assignmentCompatWithObjectMembers3.ts, 13, 21))
2014-08-15 23:33:16 +02:00
var b: { foo: string; baz?: string }
2015-04-13 23:01:57 +02:00
>b : { foo: string; baz?: string; }, Symbol(b, Decl(assignmentCompatWithObjectMembers3.ts, 14, 3))
>foo : string, Symbol(foo, Decl(assignmentCompatWithObjectMembers3.ts, 14, 8))
>baz : string, Symbol(baz, Decl(assignmentCompatWithObjectMembers3.ts, 14, 21))
2014-08-15 23:33:16 +02:00
var a2: S2 = { foo: '' };
2015-04-13 23:01:57 +02:00
>a2 : S2, Symbol(a2, Decl(assignmentCompatWithObjectMembers3.ts, 16, 3))
>S2 : S2, Symbol(S2, Decl(assignmentCompatWithObjectMembers3.ts, 6, 9))
2015-01-24 17:04:23 +01:00
>{ foo: '' } : { foo: string; }
2015-04-13 23:01:57 +02:00
>foo : string, Symbol(foo, Decl(assignmentCompatWithObjectMembers3.ts, 16, 14))
2015-04-13 21:36:11 +02:00
>'' : string
2014-08-15 23:33:16 +02:00
var b2: T2 = { foo: '' };
2015-04-13 23:01:57 +02:00
>b2 : T2, Symbol(b2, Decl(assignmentCompatWithObjectMembers3.ts, 17, 3))
>T2 : T2, Symbol(T2, Decl(assignmentCompatWithObjectMembers3.ts, 8, 42))
2015-01-24 17:04:23 +01:00
>{ foo: '' } : { foo: string; }
2015-04-13 23:01:57 +02:00
>foo : string, Symbol(foo, Decl(assignmentCompatWithObjectMembers3.ts, 17, 14))
2015-04-13 21:36:11 +02:00
>'' : string
2014-08-15 23:33:16 +02:00
s = t;
>s = t : T
2015-04-13 23:01:57 +02:00
>s : S, Symbol(s, Decl(assignmentCompatWithObjectMembers3.ts, 5, 3))
>t : T, Symbol(t, Decl(assignmentCompatWithObjectMembers3.ts, 6, 3))
2014-08-15 23:33:16 +02:00
t = s;
>t = s : S
2015-04-13 23:01:57 +02:00
>t : T, Symbol(t, Decl(assignmentCompatWithObjectMembers3.ts, 6, 3))
>s : S, Symbol(s, Decl(assignmentCompatWithObjectMembers3.ts, 5, 3))
2014-08-15 23:33:16 +02:00
s = s2;
>s = s2 : S2
2015-04-13 23:01:57 +02:00
>s : S, Symbol(s, Decl(assignmentCompatWithObjectMembers3.ts, 5, 3))
>s2 : S2, Symbol(s2, Decl(assignmentCompatWithObjectMembers3.ts, 10, 3))
2014-08-15 23:33:16 +02:00
s = a2;
>s = a2 : S2
2015-04-13 23:01:57 +02:00
>s : S, Symbol(s, Decl(assignmentCompatWithObjectMembers3.ts, 5, 3))
>a2 : S2, Symbol(a2, Decl(assignmentCompatWithObjectMembers3.ts, 16, 3))
2014-08-15 23:33:16 +02:00
s2 = t2;
>s2 = t2 : T2
2015-04-13 23:01:57 +02:00
>s2 : S2, Symbol(s2, Decl(assignmentCompatWithObjectMembers3.ts, 10, 3))
>t2 : T2, Symbol(t2, Decl(assignmentCompatWithObjectMembers3.ts, 11, 3))
2014-08-15 23:33:16 +02:00
t2 = s2;
>t2 = s2 : S2
2015-04-13 23:01:57 +02:00
>t2 : T2, Symbol(t2, Decl(assignmentCompatWithObjectMembers3.ts, 11, 3))
>s2 : S2, Symbol(s2, Decl(assignmentCompatWithObjectMembers3.ts, 10, 3))
2014-08-15 23:33:16 +02:00
s2 = t;
>s2 = t : T
2015-04-13 23:01:57 +02:00
>s2 : S2, Symbol(s2, Decl(assignmentCompatWithObjectMembers3.ts, 10, 3))
>t : T, Symbol(t, Decl(assignmentCompatWithObjectMembers3.ts, 6, 3))
2014-08-15 23:33:16 +02:00
s2 = b;
>s2 = b : { foo: string; baz?: string; }
2015-04-13 23:01:57 +02:00
>s2 : S2, Symbol(s2, Decl(assignmentCompatWithObjectMembers3.ts, 10, 3))
>b : { foo: string; baz?: string; }, Symbol(b, Decl(assignmentCompatWithObjectMembers3.ts, 14, 3))
2014-08-15 23:33:16 +02:00
s2 = a2;
>s2 = a2 : S2
2015-04-13 23:01:57 +02:00
>s2 : S2, Symbol(s2, Decl(assignmentCompatWithObjectMembers3.ts, 10, 3))
>a2 : S2, Symbol(a2, Decl(assignmentCompatWithObjectMembers3.ts, 16, 3))
2014-08-15 23:33:16 +02:00
a = b;
>a = b : { foo: string; baz?: string; }
2015-04-13 23:01:57 +02:00
>a : { foo: string; bar?: string; }, Symbol(a, Decl(assignmentCompatWithObjectMembers3.ts, 13, 3))
>b : { foo: string; baz?: string; }, Symbol(b, Decl(assignmentCompatWithObjectMembers3.ts, 14, 3))
2014-08-15 23:33:16 +02:00
b = a;
>b = a : { foo: string; bar?: string; }
2015-04-13 23:01:57 +02:00
>b : { foo: string; baz?: string; }, Symbol(b, Decl(assignmentCompatWithObjectMembers3.ts, 14, 3))
>a : { foo: string; bar?: string; }, Symbol(a, Decl(assignmentCompatWithObjectMembers3.ts, 13, 3))
2014-08-15 23:33:16 +02:00
a = s;
>a = s : S
2015-04-13 23:01:57 +02:00
>a : { foo: string; bar?: string; }, Symbol(a, Decl(assignmentCompatWithObjectMembers3.ts, 13, 3))
>s : S, Symbol(s, Decl(assignmentCompatWithObjectMembers3.ts, 5, 3))
2014-08-15 23:33:16 +02:00
a = s2;
>a = s2 : S2
2015-04-13 23:01:57 +02:00
>a : { foo: string; bar?: string; }, Symbol(a, Decl(assignmentCompatWithObjectMembers3.ts, 13, 3))
>s2 : S2, Symbol(s2, Decl(assignmentCompatWithObjectMembers3.ts, 10, 3))
2014-08-15 23:33:16 +02:00
a = a2;
>a = a2 : S2
2015-04-13 23:01:57 +02:00
>a : { foo: string; bar?: string; }, Symbol(a, Decl(assignmentCompatWithObjectMembers3.ts, 13, 3))
>a2 : S2, Symbol(a2, Decl(assignmentCompatWithObjectMembers3.ts, 16, 3))
2014-08-15 23:33:16 +02:00
a2 = b2;
>a2 = b2 : T2
2015-04-13 23:01:57 +02:00
>a2 : S2, Symbol(a2, Decl(assignmentCompatWithObjectMembers3.ts, 16, 3))
>b2 : T2, Symbol(b2, Decl(assignmentCompatWithObjectMembers3.ts, 17, 3))
2014-08-15 23:33:16 +02:00
b2 = a2;
>b2 = a2 : S2
2015-04-13 23:01:57 +02:00
>b2 : T2, Symbol(b2, Decl(assignmentCompatWithObjectMembers3.ts, 17, 3))
>a2 : S2, Symbol(a2, Decl(assignmentCompatWithObjectMembers3.ts, 16, 3))
2014-08-15 23:33:16 +02:00
a2 = b;
>a2 = b : { foo: string; baz?: string; }
2015-04-13 23:01:57 +02:00
>a2 : S2, Symbol(a2, Decl(assignmentCompatWithObjectMembers3.ts, 16, 3))
>b : { foo: string; baz?: string; }, Symbol(b, Decl(assignmentCompatWithObjectMembers3.ts, 14, 3))
2014-08-15 23:33:16 +02:00
a2 = t2;
>a2 = t2 : T2
2015-04-13 23:01:57 +02:00
>a2 : S2, Symbol(a2, Decl(assignmentCompatWithObjectMembers3.ts, 16, 3))
>t2 : T2, Symbol(t2, Decl(assignmentCompatWithObjectMembers3.ts, 11, 3))
2014-08-15 23:33:16 +02:00
a2 = t;
>a2 = t : T
2015-04-13 23:01:57 +02:00
>a2 : S2, Symbol(a2, Decl(assignmentCompatWithObjectMembers3.ts, 16, 3))
>t : T, Symbol(t, Decl(assignmentCompatWithObjectMembers3.ts, 6, 3))
2014-08-15 23:33:16 +02:00