TypeScript/tests/baselines/reference/superAccess2.types
Wenlu Wang dc237b317e
Change static fields emits (#43114)
* use emit into iife

* Update emit

* Revert un-related changes

* Allow super in static context

* Allow this and super in static property declaration

* Add more tests

* Avoid errors

* Accept baseline

* Accept baseline

* Add decorated classes test

* Add errors

* Avoid this in emitter

* make lint happy

* Add class expression tests

* Add computed name test

* Avoid super if target below es6

* Adjust function boundary

* Add internal

* Fix minor CR issues

* accept baseline

* Update behavior

* Avoid spaces

* Make lint happy

* Avoid function boundary utils

* Update baseline

* Avoid errors

* Accept baseline

* Accept baseline

* Accept baseline

* Accept baseline

* Use substitutions

* Full coverage for super, this, merge static and private context

* Fix use-before-def in static fields

Co-authored-by: Ron Buckton <ron.buckton@microsoft.com>
2021-06-25 15:49:27 -07:00

89 lines
1.3 KiB
Plaintext

=== tests/cases/compiler/superAccess2.ts ===
class P {
>P : P
x() { }
>x : () => void
static y() { }
>y : () => void
}
class Q extends P {
>Q : Q
>P : P
xx = super;
>xx : any
>super : any
>super : P
> : any
static yy = super; // error for static initializer accessing super
>yy : any
>super : any
>super : typeof P
> : any
// Super is not allowed in constructor args
constructor(public z = super, zz = super, zzz = () => super) {
>z : any
>super : any
>super : any
> : any
>zz : any
>super : any
>super : any
> : any
>zzz : () => any
>() => super : () => any
>super : any
>super : P
> : any
super();
>super() : void
>super : typeof P
}
foo(zz = super) {
>foo : (zz?: any) => void
>zz : any
>super : any
>super : P
> : any
super.x();
>super.x() : void
>super.x : () => void
>super : P
>x : () => void
super.y(); // error
>super.y() : any
>super.y : any
>super : P
>y : any
}
static bar(zz = super) {
>bar : (zz?: any) => void
>zz : any
>super : any
>super : typeof P
> : any
super.x(); // error
>super.x() : any
>super.x : any
>super : typeof P
>x : any
super.y();
>super.y() : void
>super.y : () => void
>super : typeof P
>y : () => void
}
}