2014-09-12 22:35:07 +02:00
|
|
|
tests/cases/compiler/getAndSetNotIdenticalType2.ts(5,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
|
|
tests/cases/compiler/getAndSetNotIdenticalType2.ts(8,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
|
|
tests/cases/compiler/getAndSetNotIdenticalType2.ts(5,5): error TS2380: 'get' and 'set' accessor must have the same type.
|
|
|
|
tests/cases/compiler/getAndSetNotIdenticalType2.ts(8,5): error TS2380: 'get' and 'set' accessor must have the same type.
|
2014-11-05 21:26:03 +01:00
|
|
|
tests/cases/compiler/getAndSetNotIdenticalType2.ts(9,9): error TS2322: Type 'A<string>' is not assignable to type 'A<T>'.
|
2014-09-12 22:35:07 +02:00
|
|
|
Type 'string' is not assignable to type 'T'.
|
|
|
|
|
|
|
|
|
2014-07-13 01:04:16 +02:00
|
|
|
==== tests/cases/compiler/getAndSetNotIdenticalType2.ts (5 errors) ====
|
|
|
|
class A<T> { foo: T; }
|
|
|
|
|
|
|
|
class C<T> {
|
|
|
|
data: A<T>;
|
|
|
|
get x(): A<T> {
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
2014-07-13 01:04:16 +02:00
|
|
|
~~~~~~~~~~~~~~~
|
|
|
|
return this.data;
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
}
|
|
|
|
~~~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2380: 'get' and 'set' accessor must have the same type.
|
2014-07-13 01:04:16 +02:00
|
|
|
set x(v: A<string>) {
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
2014-07-13 01:04:16 +02:00
|
|
|
~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
this.data = v;
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
~~~~~~~~~
|
2014-11-05 21:26:03 +01:00
|
|
|
!!! error TS2322: Type 'A<string>' is not assignable to type 'A<T>'.
|
|
|
|
!!! error TS2322: Type 'string' is not assignable to type 'T'.
|
2014-07-13 01:04:16 +02:00
|
|
|
}
|
|
|
|
~~~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2380: 'get' and 'set' accessor must have the same type.
|
2014-07-13 01:04:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
var x = new C();
|
|
|
|
var r = x.x;
|
|
|
|
x.x = r;
|