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

233 lines
2.7 KiB
Plaintext

=== tests/cases/compiler/classUpdateTests.ts ===
//
// test codegen for instance properties
//
class A {
>A : A
public p1 = 0;
>p1 : number
>0 : 0
private p2 = 0;
>p2 : number
>0 : 0
p3;
>p3 : any
}
class B {
>B : B
public p1 = 0;
>p1 : number
>0 : 0
private p2 = 0;
>p2 : number
>0 : 0
p3;
>p3 : any
constructor() {}
}
class C {
>C : C
constructor(public p1=0, private p2=0, p3=0) {}
>p1 : number
>0 : 0
>p2 : number
>0 : 0
>p3 : number
>0 : 0
}
//
// test requirements for super calls
//
class D { // NO ERROR
>D : D
}
class E extends D { // NO ERROR
>E : E
>D : D
public p1 = 0;
>p1 : number
>0 : 0
}
class F extends E {
>F : F
>E : E
constructor() {} // ERROR - super call required
}
class G extends D {
>G : G
>D : D
public p1 = 0;
>p1 : number
>0 : 0
constructor() { super(); } // NO ERROR
>super() : void
>super : typeof D
}
class H {
>H : H
constructor() { super(); } // ERROR - no super call allowed
>super() : void
>super : any
}
class I extends Object {
>I : I
>Object : Object
constructor() { super(); } // ERROR - no super call allowed
>super() : void
>super : ObjectConstructor
}
class J extends G {
>J : J
>G : G
constructor(public p1:number) {
>p1 : number
super(); // NO ERROR
>super() : void
>super : typeof G
}
}
class K extends G {
>K : K
>G : G
constructor(public p1:number) { // ERROR
>p1 : number
var i = 0;
>i : number
>0 : 0
super();
>super() : void
>super : typeof G
}
}
class L extends G {
>L : L
>G : G
constructor(private p1:number) {
>p1 : number
super(); // NO ERROR
>super() : void
>super : typeof G
}
}
class M extends G {
>M : M
>G : G
constructor(private p1:number) { // ERROR
>p1 : number
var i = 0;
>i : number
>0 : 0
super();
>super() : void
>super : typeof G
}
}
//
// test this reference in field initializers
//
class N {
>N : N
public p1 = 0;
>p1 : number
>0 : 0
public p2 = this.p1;
>p2 : number
>this.p1 : number
>this : this
>p1 : number
constructor() {
this.p2 = 0;
>this.p2 = 0 : 0
>this.p2 : number
>this : this
>p2 : number
>0 : 0
}
}
//
// test error on property declarations within class constructors
//
class O {
>O : O
constructor() {
public p1 = 0; // ERROR
>p1 : number
>0 : 0
}
}
class P {
>P : P
constructor() {
private p1 = 0; // ERROR
>p1 : number
>0 : 0
}
}
class Q {
>Q : Q
constructor() {
public this.p1 = 0; // ERROR
>this : any
>p1 : number
>0 : 0
}
}
class R {
>R : R
constructor() {
private this.p1 = 0; // ERROR
>this : any
>p1 : number
>0 : 0
}
}