This was we don't get noisy baselines just because a different phase of the compiler reported the diagnostic. This helps with Yui's refactoring work to move grammar checks into the type checker.
67 lines
No EOL
2.9 KiB
Text
67 lines
No EOL
2.9 KiB
Text
tests/cases/compiler/gettersAndSetters.ts(7,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
tests/cases/compiler/gettersAndSetters.ts(8,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
tests/cases/compiler/gettersAndSetters.ts(10,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
tests/cases/compiler/gettersAndSetters.ts(11,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
tests/cases/compiler/gettersAndSetters.ts(25,13): error TS2339: Property 'Baz' does not exist on type 'C'.
|
|
tests/cases/compiler/gettersAndSetters.ts(26,3): error TS2339: Property 'Baz' does not exist on type 'C'.
|
|
tests/cases/compiler/gettersAndSetters.ts(29,30): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
tests/cases/compiler/gettersAndSetters.ts(29,53): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
|
|
|
|
==== tests/cases/compiler/gettersAndSetters.ts (8 errors) ====
|
|
// classes
|
|
class C {
|
|
public fooBack = "";
|
|
static barBack:string = "";
|
|
public bazBack = "";
|
|
|
|
public get Foo() { return this.fooBack;} // ok
|
|
~~~
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
public set Foo(foo:string) {this.fooBack = foo;} // ok
|
|
~~~
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
|
|
static get Bar() {return C.barBack;} // ok
|
|
~~~
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
static set Bar(bar:string) {C.barBack = bar;} // ok
|
|
~~~
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
|
|
public get = function() {} // ok
|
|
public set = function() {} // ok
|
|
}
|
|
|
|
var c = new C();
|
|
|
|
var foo = c.Foo;
|
|
c.Foo = "foov";
|
|
|
|
var bar = C.Bar;
|
|
C.Bar = "barv";
|
|
|
|
var baz = c.Baz;
|
|
~~~
|
|
!!! error TS2339: Property 'Baz' does not exist on type 'C'.
|
|
c.Baz = "bazv";
|
|
~~~
|
|
!!! error TS2339: Property 'Baz' does not exist on type 'C'.
|
|
|
|
// 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
|
|
~~~
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
~~~
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
|
|
var ofg = o.Foo;
|
|
o.Foo = 0;
|
|
|
|
|
|
interface I1 {
|
|
(n:number):number;
|
|
}
|
|
|
|
var i:I1 = function (n) {return n;}
|
|
|