TypeScript/tests/baselines/reference/subtypesOfUnion.symbols
Wesley Wigham 5353475fce Always collect type and symbol baselines (#18621)
* Always generate type & symbol baselines

* Accept changed shadowed baselines

* Accept brand new type and symbol baselines

* Allow `getTypeAtLocation` to return undefined in the type writer

* Accept baselines which had missing type information

* Bind container for dynamically names enum members so they may be printed

* Accept type/symbol baselines for enums with computed members

* First pass at reducing typeWriter memory overhead

* Use generators to allow for type and symbol baselines with no cache

* Accept new baselines for tests whose output was fixed by better newline splitting

* Hard cap on number of declarations printed, cache declaration print text

* handle differing newlines better still to handle RWC newlines

* Lower abridging count, accept abridged baselines

* Limit max RWC error output size, limit RWC type and symbol baseline input size

* Move skip logic into type and symbol baseliner to streamline error handling

* Accept removal of empty baselines

* Canonicalize path earlier to handle odd paths in input files

* Do canonicalization earlier still, also ensure parallel perf profiles for different targets do not trample one another

* No need to pathify again
2017-09-22 15:52:04 -07:00

192 lines
6.9 KiB
Plaintext

=== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts ===
enum E { e1, e2 }
>E : Symbol(E, Decl(subtypesOfUnion.ts, 0, 0))
>e1 : Symbol(E.e1, Decl(subtypesOfUnion.ts, 0, 8))
>e2 : Symbol(E.e2, Decl(subtypesOfUnion.ts, 0, 12))
interface I8 { [x: string]: number[]; }
>I8 : Symbol(I8, Decl(subtypesOfUnion.ts, 0, 17))
>x : Symbol(x, Decl(subtypesOfUnion.ts, 1, 16))
class A { foo: number; }
>A : Symbol(A, Decl(subtypesOfUnion.ts, 1, 39))
>foo : Symbol(A.foo, Decl(subtypesOfUnion.ts, 2, 9))
class A2<T> { foo: T; }
>A2 : Symbol(A2, Decl(subtypesOfUnion.ts, 2, 24))
>T : Symbol(T, Decl(subtypesOfUnion.ts, 3, 9))
>foo : Symbol(A2.foo, Decl(subtypesOfUnion.ts, 3, 13))
>T : Symbol(T, Decl(subtypesOfUnion.ts, 3, 9))
function f() { }
>f : Symbol(f, Decl(subtypesOfUnion.ts, 3, 23), Decl(subtypesOfUnion.ts, 4, 16))
module f { export var bar = 1; }
>f : Symbol(f, Decl(subtypesOfUnion.ts, 3, 23), Decl(subtypesOfUnion.ts, 4, 16))
>bar : Symbol(bar, Decl(subtypesOfUnion.ts, 5, 21))
class c { baz: string }
>c : Symbol(c, Decl(subtypesOfUnion.ts, 5, 32), Decl(subtypesOfUnion.ts, 6, 23))
>baz : Symbol(c.baz, Decl(subtypesOfUnion.ts, 6, 9))
module c { export var bar = 1; }
>c : Symbol(c, Decl(subtypesOfUnion.ts, 5, 32), Decl(subtypesOfUnion.ts, 6, 23))
>bar : Symbol(bar, Decl(subtypesOfUnion.ts, 7, 21))
// A type T is a subtype of a union type U if T is a subtype of any type in U.
interface I1<T> {
>I1 : Symbol(I1, Decl(subtypesOfUnion.ts, 7, 32))
>T : Symbol(T, Decl(subtypesOfUnion.ts, 10, 13))
[x: string]: string | number;
>x : Symbol(x, Decl(subtypesOfUnion.ts, 11, 5))
foo: any; // ok
>foo : Symbol(I1.foo, Decl(subtypesOfUnion.ts, 11, 33))
foo2: string; // ok
>foo2 : Symbol(I1.foo2, Decl(subtypesOfUnion.ts, 12, 13))
foo3: number; // ok
>foo3 : Symbol(I1.foo3, Decl(subtypesOfUnion.ts, 13, 17))
foo4: boolean; // error
>foo4 : Symbol(I1.foo4, Decl(subtypesOfUnion.ts, 14, 17))
foo5: E; // ok - subtype of number
>foo5 : Symbol(I1.foo5, Decl(subtypesOfUnion.ts, 15, 18))
>E : Symbol(E, Decl(subtypesOfUnion.ts, 0, 0))
foo6: Date; // error
>foo6 : Symbol(I1.foo6, Decl(subtypesOfUnion.ts, 16, 12))
>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
foo7: RegExp; // error
>foo7 : Symbol(I1.foo7, Decl(subtypesOfUnion.ts, 17, 15))
>RegExp : Symbol(RegExp, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
foo8: { bar: number }; // error
>foo8 : Symbol(I1.foo8, Decl(subtypesOfUnion.ts, 18, 17))
>bar : Symbol(bar, Decl(subtypesOfUnion.ts, 19, 11))
foo9: I8; // error
>foo9 : Symbol(I1.foo9, Decl(subtypesOfUnion.ts, 19, 26))
>I8 : Symbol(I8, Decl(subtypesOfUnion.ts, 0, 17))
foo10: A; // error
>foo10 : Symbol(I1.foo10, Decl(subtypesOfUnion.ts, 20, 13))
>A : Symbol(A, Decl(subtypesOfUnion.ts, 1, 39))
foo11: A2<number>; // error
>foo11 : Symbol(I1.foo11, Decl(subtypesOfUnion.ts, 21, 13))
>A2 : Symbol(A2, Decl(subtypesOfUnion.ts, 2, 24))
foo12: (x) => number; //error
>foo12 : Symbol(I1.foo12, Decl(subtypesOfUnion.ts, 22, 22))
>x : Symbol(x, Decl(subtypesOfUnion.ts, 23, 12))
foo13: <T>(x: T) => T; // error
>foo13 : Symbol(I1.foo13, Decl(subtypesOfUnion.ts, 23, 25))
>T : Symbol(T, Decl(subtypesOfUnion.ts, 24, 12))
>x : Symbol(x, Decl(subtypesOfUnion.ts, 24, 15))
>T : Symbol(T, Decl(subtypesOfUnion.ts, 24, 12))
>T : Symbol(T, Decl(subtypesOfUnion.ts, 24, 12))
foo14: typeof f; // error
>foo14 : Symbol(I1.foo14, Decl(subtypesOfUnion.ts, 24, 26))
>f : Symbol(f, Decl(subtypesOfUnion.ts, 3, 23), Decl(subtypesOfUnion.ts, 4, 16))
foo15: typeof c; // error
>foo15 : Symbol(I1.foo15, Decl(subtypesOfUnion.ts, 25, 20))
>c : Symbol(c, Decl(subtypesOfUnion.ts, 5, 32), Decl(subtypesOfUnion.ts, 6, 23))
foo16: T; // error
>foo16 : Symbol(I1.foo16, Decl(subtypesOfUnion.ts, 26, 20))
>T : Symbol(T, Decl(subtypesOfUnion.ts, 10, 13))
foo17: Object; // error
>foo17 : Symbol(I1.foo17, Decl(subtypesOfUnion.ts, 27, 13))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
foo18: {}; // error
>foo18 : Symbol(I1.foo18, Decl(subtypesOfUnion.ts, 28, 18))
}
interface I2<T> {
>I2 : Symbol(I2, Decl(subtypesOfUnion.ts, 30, 1))
>T : Symbol(T, Decl(subtypesOfUnion.ts, 31, 13))
[x: string]: E | number;
>x : Symbol(x, Decl(subtypesOfUnion.ts, 32, 5))
>E : Symbol(E, Decl(subtypesOfUnion.ts, 0, 0))
foo: any; // ok
>foo : Symbol(I2.foo, Decl(subtypesOfUnion.ts, 32, 28))
foo2: string; // error
>foo2 : Symbol(I2.foo2, Decl(subtypesOfUnion.ts, 33, 13))
foo3: number; // ok
>foo3 : Symbol(I2.foo3, Decl(subtypesOfUnion.ts, 34, 17))
foo4: boolean; // error
>foo4 : Symbol(I2.foo4, Decl(subtypesOfUnion.ts, 35, 17))
foo5: E; // ok
>foo5 : Symbol(I2.foo5, Decl(subtypesOfUnion.ts, 36, 18))
>E : Symbol(E, Decl(subtypesOfUnion.ts, 0, 0))
foo6: Date; // error
>foo6 : Symbol(I2.foo6, Decl(subtypesOfUnion.ts, 37, 12))
>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
foo7: RegExp; // error
>foo7 : Symbol(I2.foo7, Decl(subtypesOfUnion.ts, 38, 15))
>RegExp : Symbol(RegExp, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
foo8: { bar: number }; // error
>foo8 : Symbol(I2.foo8, Decl(subtypesOfUnion.ts, 39, 17))
>bar : Symbol(bar, Decl(subtypesOfUnion.ts, 40, 11))
foo9: I8; // error
>foo9 : Symbol(I2.foo9, Decl(subtypesOfUnion.ts, 40, 26))
>I8 : Symbol(I8, Decl(subtypesOfUnion.ts, 0, 17))
foo10: A; // error
>foo10 : Symbol(I2.foo10, Decl(subtypesOfUnion.ts, 41, 13))
>A : Symbol(A, Decl(subtypesOfUnion.ts, 1, 39))
foo11: A2<number>; // error
>foo11 : Symbol(I2.foo11, Decl(subtypesOfUnion.ts, 42, 13))
>A2 : Symbol(A2, Decl(subtypesOfUnion.ts, 2, 24))
foo12: (x) => number; //error
>foo12 : Symbol(I2.foo12, Decl(subtypesOfUnion.ts, 43, 22))
>x : Symbol(x, Decl(subtypesOfUnion.ts, 44, 12))
foo13: <T>(x: T) => T; // error
>foo13 : Symbol(I2.foo13, Decl(subtypesOfUnion.ts, 44, 25))
>T : Symbol(T, Decl(subtypesOfUnion.ts, 45, 12))
>x : Symbol(x, Decl(subtypesOfUnion.ts, 45, 15))
>T : Symbol(T, Decl(subtypesOfUnion.ts, 45, 12))
>T : Symbol(T, Decl(subtypesOfUnion.ts, 45, 12))
foo14: typeof f; // error
>foo14 : Symbol(I2.foo14, Decl(subtypesOfUnion.ts, 45, 26))
>f : Symbol(f, Decl(subtypesOfUnion.ts, 3, 23), Decl(subtypesOfUnion.ts, 4, 16))
foo15: typeof c; // error
>foo15 : Symbol(I2.foo15, Decl(subtypesOfUnion.ts, 46, 20))
>c : Symbol(c, Decl(subtypesOfUnion.ts, 5, 32), Decl(subtypesOfUnion.ts, 6, 23))
foo16: T; // error
>foo16 : Symbol(I2.foo16, Decl(subtypesOfUnion.ts, 47, 20))
>T : Symbol(T, Decl(subtypesOfUnion.ts, 31, 13))
foo17: Object; // error
>foo17 : Symbol(I2.foo17, Decl(subtypesOfUnion.ts, 48, 13))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
foo18: {}; // error
>foo18 : Symbol(I2.foo18, Decl(subtypesOfUnion.ts, 49, 18))
}