* 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
140 lines
2.3 KiB
Plaintext
140 lines
2.3 KiB
Plaintext
=== tests/cases/compiler/gettersAndSetters.ts ===
|
|
// classes
|
|
class C {
|
|
>C : C
|
|
|
|
public fooBack = "";
|
|
>fooBack : string
|
|
>"" : ""
|
|
|
|
static barBack:string = "";
|
|
>barBack : string
|
|
>"" : ""
|
|
|
|
public bazBack = "";
|
|
>bazBack : string
|
|
>"" : ""
|
|
|
|
public get Foo() { return this.fooBack;} // ok
|
|
>Foo : string
|
|
>this.fooBack : string
|
|
>this : this
|
|
>fooBack : string
|
|
|
|
public set Foo(foo:string) {this.fooBack = foo;} // ok
|
|
>Foo : string
|
|
>foo : string
|
|
>this.fooBack = foo : string
|
|
>this.fooBack : string
|
|
>this : this
|
|
>fooBack : string
|
|
>foo : string
|
|
|
|
static get Bar() {return C.barBack;} // ok
|
|
>Bar : string
|
|
>C.barBack : string
|
|
>C : typeof C
|
|
>barBack : string
|
|
|
|
static set Bar(bar:string) {C.barBack = bar;} // ok
|
|
>Bar : string
|
|
>bar : string
|
|
>C.barBack = bar : string
|
|
>C.barBack : string
|
|
>C : typeof C
|
|
>barBack : string
|
|
>bar : string
|
|
|
|
public get = function() {} // ok
|
|
>get : () => void
|
|
>function() {} : () => void
|
|
|
|
public set = function() {} // ok
|
|
>set : () => void
|
|
>function() {} : () => void
|
|
}
|
|
|
|
var c = new C();
|
|
>c : C
|
|
>new C() : C
|
|
>C : typeof C
|
|
|
|
var foo = c.Foo;
|
|
>foo : string
|
|
>c.Foo : string
|
|
>c : C
|
|
>Foo : string
|
|
|
|
c.Foo = "foov";
|
|
>c.Foo = "foov" : "foov"
|
|
>c.Foo : string
|
|
>c : C
|
|
>Foo : string
|
|
>"foov" : "foov"
|
|
|
|
var bar = C.Bar;
|
|
>bar : string
|
|
>C.Bar : string
|
|
>C : typeof C
|
|
>Bar : string
|
|
|
|
C.Bar = "barv";
|
|
>C.Bar = "barv" : "barv"
|
|
>C.Bar : string
|
|
>C : typeof C
|
|
>Bar : string
|
|
>"barv" : "barv"
|
|
|
|
var baz = c.Baz;
|
|
>baz : any
|
|
>c.Baz : any
|
|
>c : C
|
|
>Baz : any
|
|
|
|
c.Baz = "bazv";
|
|
>c.Baz = "bazv" : "bazv"
|
|
>c.Baz : any
|
|
>c : C
|
|
>Baz : any
|
|
>"bazv" : "bazv"
|
|
|
|
// The Foo accessors' return and param types should be contextually typed to the Foo field
|
|
var o : {Foo:number;} = {get Foo() {return 0;}, set Foo(val:number){val}}; // o
|
|
>o : { Foo: number; }
|
|
>Foo : number
|
|
>{get Foo() {return 0;}, set Foo(val:number){val}} : { Foo: number; }
|
|
>Foo : number
|
|
>0 : 0
|
|
>Foo : number
|
|
>val : number
|
|
>val : number
|
|
|
|
var ofg = o.Foo;
|
|
>ofg : number
|
|
>o.Foo : number
|
|
>o : { Foo: number; }
|
|
>Foo : number
|
|
|
|
o.Foo = 0;
|
|
>o.Foo = 0 : 0
|
|
>o.Foo : number
|
|
>o : { Foo: number; }
|
|
>Foo : number
|
|
>0 : 0
|
|
|
|
|
|
interface I1 {
|
|
>I1 : I1
|
|
|
|
(n:number):number;
|
|
>n : number
|
|
}
|
|
|
|
var i:I1 = function (n) {return n;}
|
|
>i : I1
|
|
>I1 : I1
|
|
>function (n) {return n;} : (n: number) => number
|
|
>n : number
|
|
>n : number
|
|
|