TypeScript/tests/baselines/reference/twoAccessorsWithSameName.errors.txt

63 lines
1.7 KiB
Plaintext

==== tests/cases/conformance/classes/propertyMemberDeclarations/twoAccessorsWithSameName.ts (14 errors) ====
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.
~
!!! An object literal cannot have multiple get/set accessors with the same name.
~
!!! 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.
}