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

99 lines
1.5 KiB
Plaintext

=== tests/cases/conformance/types/localTypes/localTypes4.ts ===
function f1() {
>f1 : () => void
// Type parameters are in scope in parameters and return types
function f<T>(x: T): T {
>f : <T>(x: T) => T
>T : T
>x : T
>T : T
>T : T
return undefined;
>undefined : undefined
}
}
function f2() {
>f2 : () => void
// Local types are not in scope in parameters and return types
function f(x: T): T {
>f : (x: any) => any
>x : any
>T : No type information available!
>T : No type information available!
interface T { }
>T : T
return undefined;
>undefined : undefined
}
}
function f3() {
>f3 : () => void
// Type parameters and top-level local types are in same declaration space
function f<T>() {
>f : <T>() => any
>T : T
interface T { }
>T : T
return undefined;
>undefined : undefined
}
}
function f4() {
>f4 : () => void
// Local types are block scoped
interface T { x: number }
>T : T
>x : number
let v: T;
>v : T
>T : T
v.x = 10;
>v.x = 10 : 10
>v.x : number
>v : T
>x : number
>10 : 10
if (true) {
>true : true
interface T { x: string }
>T : T
>x : string
let v: T;
>v : T
>T : T
v.x = "hello";
>v.x = "hello" : "hello"
>v.x : string
>v : T
>x : string
>"hello" : "hello"
}
else {
v.x = 20;
>v.x = 20 : 20
>v.x : number
>v : T
>x : number
>20 : 20
}
}