TypeScript/tests/baselines/reference/subtypesOfUnion.types
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

194 lines
2.9 KiB
Plaintext

=== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfUnion.ts ===
enum E { e1, e2 }
>E : E
>e1 : E.e1
>e2 : E.e2
interface I8 { [x: string]: number[]; }
>I8 : I8
>x : string
class A { foo: number; }
>A : A
>foo : number
class A2<T> { foo: T; }
>A2 : A2<T>
>T : T
>foo : T
>T : T
function f() { }
>f : typeof f
module f { export var bar = 1; }
>f : typeof f
>bar : number
>1 : 1
class c { baz: string }
>c : c
>baz : string
module c { export var bar = 1; }
>c : typeof c
>bar : number
>1 : 1
// 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 : I1<T>
>T : T
[x: string]: string | number;
>x : string
foo: any; // ok
>foo : any
foo2: string; // ok
>foo2 : string
foo3: number; // ok
>foo3 : number
foo4: boolean; // error
>foo4 : boolean
foo5: E; // ok - subtype of number
>foo5 : E
>E : E
foo6: Date; // error
>foo6 : Date
>Date : Date
foo7: RegExp; // error
>foo7 : RegExp
>RegExp : RegExp
foo8: { bar: number }; // error
>foo8 : { bar: number; }
>bar : number
foo9: I8; // error
>foo9 : I8
>I8 : I8
foo10: A; // error
>foo10 : A
>A : A
foo11: A2<number>; // error
>foo11 : A2<number>
>A2 : A2<T>
foo12: (x) => number; //error
>foo12 : (x: any) => number
>x : any
foo13: <T>(x: T) => T; // error
>foo13 : <T>(x: T) => T
>T : T
>x : T
>T : T
>T : T
foo14: typeof f; // error
>foo14 : typeof f
>f : typeof f
foo15: typeof c; // error
>foo15 : typeof c
>c : typeof c
foo16: T; // error
>foo16 : T
>T : T
foo17: Object; // error
>foo17 : Object
>Object : Object
foo18: {}; // error
>foo18 : {}
}
interface I2<T> {
>I2 : I2<T>
>T : T
[x: string]: E | number;
>x : string
>E : E
foo: any; // ok
>foo : any
foo2: string; // error
>foo2 : string
foo3: number; // ok
>foo3 : number
foo4: boolean; // error
>foo4 : boolean
foo5: E; // ok
>foo5 : E
>E : E
foo6: Date; // error
>foo6 : Date
>Date : Date
foo7: RegExp; // error
>foo7 : RegExp
>RegExp : RegExp
foo8: { bar: number }; // error
>foo8 : { bar: number; }
>bar : number
foo9: I8; // error
>foo9 : I8
>I8 : I8
foo10: A; // error
>foo10 : A
>A : A
foo11: A2<number>; // error
>foo11 : A2<number>
>A2 : A2<T>
foo12: (x) => number; //error
>foo12 : (x: any) => number
>x : any
foo13: <T>(x: T) => T; // error
>foo13 : <T>(x: T) => T
>T : T
>x : T
>T : T
>T : T
foo14: typeof f; // error
>foo14 : typeof f
>f : typeof f
foo15: typeof c; // error
>foo15 : typeof c
>c : typeof c
foo16: T; // error
>foo16 : T
>T : T
foo17: Object; // error
>foo17 : Object
>Object : Object
foo18: {}; // error
>foo18 : {}
}