52 lines
1.2 KiB
Text
52 lines
1.2 KiB
Text
|
==== tests/cases/compiler/staticVisibility.ts (7 errors) ====
|
||
|
|
||
|
class C1 {
|
||
|
|
||
|
p: any;
|
||
|
static s: any;
|
||
|
|
||
|
constructor() {
|
||
|
var v = 0;
|
||
|
|
||
|
s = 1; // should be error
|
||
|
~
|
||
|
!!! Cannot find name 's'.
|
||
|
C1.s = 1; // should be ok
|
||
|
|
||
|
b(); // should be error
|
||
|
~
|
||
|
!!! Cannot find name 'b'.
|
||
|
C1.b(); // should be ok
|
||
|
}
|
||
|
|
||
|
static b() {
|
||
|
v = 1; // should be error
|
||
|
~
|
||
|
!!! Cannot find name 'v'.
|
||
|
this.p = 0; // should be error
|
||
|
~
|
||
|
!!! Property 'p' does not exist on type 'typeof C1'.
|
||
|
C1.s = 1; // should be ok
|
||
|
}
|
||
|
}
|
||
|
|
||
|
class C2 {
|
||
|
|
||
|
barback:string = "";
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
static get Bar() {return "bar";} // ok
|
||
|
~~~
|
||
|
!!! Accessors are only available when targeting ECMAScript 5 and higher.
|
||
|
|
||
|
static set Bar(bar:string) {barback = bar;} // not ok
|
||
|
~~~
|
||
|
!!! Accessors are only available when targeting ECMAScript 5 and higher.
|
||
|
~~~~~~~
|
||
|
!!! Cannot find name 'barback'.
|
||
|
|
||
|
}
|
||
|
|
||
|
|