2014-07-24 01:45:23 +02:00
|
|
|
==== tests/cases/conformance/classes/propertyMemberDeclarations/twoAccessorsWithSameName.ts (14 errors) ====
|
2014-07-13 01:04:16 +02:00
|
|
|
class C {
|
|
|
|
get x() { return 1; }
|
|
|
|
~
|
|
|
|
!!! Accessors are only available when targeting ECMAScript 5 and higher.
|
|
|
|
get x() { return 1; } // error
|
|
|
|
~
|
|
|
|
!!! Accessors are only available when targeting ECMAScript 5 and higher.
|
|
|
|
~
|
|
|
|
!!! Duplicate identifier 'x'.
|
|
|
|
}
|
|
|
|
|
|
|
|
class D {
|
|
|
|
set x(v) { }
|
|
|
|
~
|
|
|
|
!!! Accessors are only available when targeting ECMAScript 5 and higher.
|
|
|
|
set x(v) { } // error
|
|
|
|
~
|
|
|
|
!!! Accessors are only available when targeting ECMAScript 5 and higher.
|
|
|
|
~
|
|
|
|
!!! Duplicate identifier 'x'.
|
|
|
|
}
|
|
|
|
|
|
|
|
class E {
|
|
|
|
get x() {
|
|
|
|
~
|
|
|
|
!!! Accessors are only available when targeting ECMAScript 5 and higher.
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
set x(v) { }
|
|
|
|
~
|
|
|
|
!!! Accessors are only available when targeting ECMAScript 5 and higher.
|
|
|
|
}
|
|
|
|
|
|
|
|
var x = {
|
|
|
|
get x() {
|
|
|
|
~
|
|
|
|
!!! Accessors are only available when targeting ECMAScript 5 and higher.
|
|
|
|
return 1;
|
|
|
|
},
|
|
|
|
|
|
|
|
// error
|
|
|
|
get x() {
|
|
|
|
~
|
|
|
|
!!! Accessors are only available when targeting ECMAScript 5 and higher.
|
|
|
|
~
|
2014-07-24 01:45:23 +02:00
|
|
|
!!! An object literal cannot have multiple get/set accessors with the same name.
|
|
|
|
~
|
2014-07-13 01:04:16 +02:00
|
|
|
!!! Duplicate identifier 'x'.
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var y = {
|
|
|
|
get x() {
|
|
|
|
~
|
|
|
|
!!! Accessors are only available when targeting ECMAScript 5 and higher.
|
|
|
|
return 1;
|
|
|
|
},
|
|
|
|
set x(v) { }
|
|
|
|
~
|
|
|
|
!!! Accessors are only available when targeting ECMAScript 5 and higher.
|
|
|
|
}
|