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

186 lines
3.6 KiB
Plaintext

=== tests/cases/compiler/vararg.ts ===
module M {
>M : typeof M
export class C {
>C : C
public f(x:string,...rest:number[]) {
>f : (x: string, ...rest: number[]) => string
>x : string
>rest : number[]
var sum=0;
>sum : number
>0 : 0
for (var i=0;i<rest.length;i++) {
>i : number
>0 : 0
>i<rest.length : boolean
>i : number
>rest.length : number
>rest : number[]
>length : number
>i++ : number
>i : number
sum+=rest[i];
>sum+=rest[i] : number
>sum : number
>rest[i] : number
>rest : number[]
>i : number
}
result+=(x+": "+sum);
>result+=(x+": "+sum) : string
>result : string
>(x+": "+sum) : string
>x+": "+sum : string
>x+": " : string
>x : string
>": " : ": "
>sum : number
return result;
>result : string
}
public fnope(x:string,...rest:number) {
>fnope : (x: string, ...rest: number) => void
>x : string
>rest : number
}
public fonly(...rest:string[]) {
>fonly : (...rest: string[]) => any
>rest : string[]
builder="";
>builder="" : ""
>builder : any
>"" : ""
for (var i=0;i<rest.length;i++) {
>i : number
>0 : 0
>i<rest.length : boolean
>i : number
>rest.length : number
>rest : string[]
>length : number
>i++ : number
>i : number
builder+=rest[i];
>builder+=rest[i] : string
>builder : any
>rest[i] : string
>rest : string[]
>i : number
}
return builder;
>builder : any
}
}
}
var x=new M.C();
>x : M.C
>new M.C() : M.C
>M.C : typeof M.C
>M : typeof M
>C : typeof M.C
var result="";
>result : string
>"" : ""
result+=x.f(x,3,3); // bad first param
>result+=x.f(x,3,3) : string
>result : string
>x.f(x,3,3) : string
>x.f : (x: string, ...rest: number[]) => string
>x : M.C
>f : (x: string, ...rest: number[]) => string
>x : M.C
>3 : 3
>3 : 3
result+=x.f(3,"hello",3); // bad second param
>result+=x.f(3,"hello",3) : string
>result : string
>x.f(3,"hello",3) : string
>x.f : (x: string, ...rest: number[]) => string
>x : M.C
>f : (x: string, ...rest: number[]) => string
>3 : 3
>"hello" : "hello"
>3 : 3
result+=x.f("hello",3,3,3,3,3); // ok
>result+=x.f("hello",3,3,3,3,3) : string
>result : string
>x.f("hello",3,3,3,3,3) : string
>x.f : (x: string, ...rest: number[]) => string
>x : M.C
>f : (x: string, ...rest: number[]) => string
>"hello" : "hello"
>3 : 3
>3 : 3
>3 : 3
>3 : 3
>3 : 3
result+=x.f("hello"); // ok varargs length 0
>result+=x.f("hello") : string
>result : string
>x.f("hello") : string
>x.f : (x: string, ...rest: number[]) => string
>x : M.C
>f : (x: string, ...rest: number[]) => string
>"hello" : "hello"
result+=x.fonly(3); // ok conversion
>result+=x.fonly(3) : string
>result : string
>x.fonly(3) : any
>x.fonly : (...rest: string[]) => any
>x : M.C
>fonly : (...rest: string[]) => any
>3 : 3
result+=x.fonly(x); // bad param
>result+=x.fonly(x) : string
>result : string
>x.fonly(x) : any
>x.fonly : (...rest: string[]) => any
>x : M.C
>fonly : (...rest: string[]) => any
>x : M.C
result+=x.fonly("a"); // ok
>result+=x.fonly("a") : string
>result : string
>x.fonly("a") : any
>x.fonly : (...rest: string[]) => any
>x : M.C
>fonly : (...rest: string[]) => any
>"a" : "a"
result+=x.fonly("a","b","c","d"); //ok
>result+=x.fonly("a","b","c","d") : string
>result : string
>x.fonly("a","b","c","d") : any
>x.fonly : (...rest: string[]) => any
>x : M.C
>fonly : (...rest: string[]) => any
>"a" : "a"
>"b" : "b"
>"c" : "c"
>"d" : "d"