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

53 lines
1.8 KiB
Plaintext

=== tests/cases/conformance/types/spread/spreadUnion3.ts ===
function f(x: { y: string } | undefined): { y: string } {
>f : Symbol(f, Decl(spreadUnion3.ts, 0, 0))
>x : Symbol(x, Decl(spreadUnion3.ts, 0, 11))
>y : Symbol(y, Decl(spreadUnion3.ts, 0, 15))
>y : Symbol(y, Decl(spreadUnion3.ts, 0, 43))
return { y: 123, ...x } // y: string | number
>y : Symbol(y, Decl(spreadUnion3.ts, 1, 12))
>x : Symbol(x, Decl(spreadUnion3.ts, 0, 11))
}
f(undefined)
>f : Symbol(f, Decl(spreadUnion3.ts, 0, 0))
>undefined : Symbol(undefined)
function g(t?: { a: number } | null): void {
>g : Symbol(g, Decl(spreadUnion3.ts, 3, 12))
>t : Symbol(t, Decl(spreadUnion3.ts, 6, 11))
>a : Symbol(a, Decl(spreadUnion3.ts, 6, 16))
let b = { ...t };
>b : Symbol(b, Decl(spreadUnion3.ts, 7, 7))
>t : Symbol(t, Decl(spreadUnion3.ts, 6, 11))
let c: number = b.a; // might not have 'a'
>c : Symbol(c, Decl(spreadUnion3.ts, 8, 7))
>b : Symbol(b, Decl(spreadUnion3.ts, 7, 7))
}
g()
>g : Symbol(g, Decl(spreadUnion3.ts, 3, 12))
g(undefined)
>g : Symbol(g, Decl(spreadUnion3.ts, 3, 12))
>undefined : Symbol(undefined)
g(null)
>g : Symbol(g, Decl(spreadUnion3.ts, 3, 12))
// spreading nothing but null and undefined is not allowed
declare const nullAndUndefinedUnion: null | undefined;
>nullAndUndefinedUnion : Symbol(nullAndUndefinedUnion, Decl(spreadUnion3.ts, 15, 13))
var x = { ...nullAndUndefinedUnion, ...nullAndUndefinedUnion };
>x : Symbol(x, Decl(spreadUnion3.ts, 16, 3))
>nullAndUndefinedUnion : Symbol(nullAndUndefinedUnion, Decl(spreadUnion3.ts, 15, 13))
>nullAndUndefinedUnion : Symbol(nullAndUndefinedUnion, Decl(spreadUnion3.ts, 15, 13))
var y = { ...nullAndUndefinedUnion };
>y : Symbol(y, Decl(spreadUnion3.ts, 17, 3))
>nullAndUndefinedUnion : Symbol(nullAndUndefinedUnion, Decl(spreadUnion3.ts, 15, 13))