TypeScript/tests/baselines/reference/objectLiteralErrors.errors.txt
Ryan Cavanaugh ff233a9ac2
Variant accessors (#42425)
Allows accessors to have different access modifiers and types

Fixes #2845, #2521
2021-03-26 20:11:02 -07:00

276 lines
19 KiB
Plaintext

tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(2,18): error TS2300: Duplicate identifier 'a'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(3,19): error TS2300: Duplicate identifier 'a'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(4,18): error TS2300: Duplicate identifier 'a'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(5,21): error TS2300: Duplicate identifier 'a'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(6,19): error TS2300: Duplicate identifier 'a'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(7,18): error TS2300: Duplicate identifier ''a''.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(8,20): error TS2300: Duplicate identifier 'a'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(9,20): error TS2300: Duplicate identifier '"a"'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(10,20): error TS2300: Duplicate identifier ''a''.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(11,21): error TS2300: Duplicate identifier ''a''.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(12,21): error TS2300: Duplicate identifier ''1''.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(13,19): error TS2300: Duplicate identifier '0'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(14,19): error TS2300: Duplicate identifier '0'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(15,19): error TS2300: Duplicate identifier '0x0'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(16,19): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o0'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(16,19): error TS2300: Duplicate identifier '000'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(17,23): error TS2300: Duplicate identifier '1e2'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(18,22): error TS2300: Duplicate identifier '3.2e1'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(19,25): error TS2300: Duplicate identifier 'a'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(22,12): error TS2300: Duplicate identifier 'a'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(22,22): error TS1119: An object literal cannot have property and accessor with the same name.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(22,22): error TS2300: Duplicate identifier 'a'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(23,12): error TS2300: Duplicate identifier 'a'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(23,23): error TS1119: An object literal cannot have property and accessor with the same name.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(23,23): error TS2300: Duplicate identifier 'a'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(24,12): error TS2300: Duplicate identifier 'a'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(24,22): error TS1119: An object literal cannot have property and accessor with the same name.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(24,22): error TS2300: Duplicate identifier 'a'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(25,12): error TS2300: Duplicate identifier 'a'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(25,25): error TS1119: An object literal cannot have property and accessor with the same name.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(25,25): error TS2300: Duplicate identifier 'a'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(26,12): error TS2300: Duplicate identifier 'a'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(26,23): error TS1119: An object literal cannot have property and accessor with the same name.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(26,23): error TS2300: Duplicate identifier 'a'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(27,12): error TS2300: Duplicate identifier 'a'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(27,22): error TS1119: An object literal cannot have property and accessor with the same name.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(27,22): error TS2300: Duplicate identifier ''a''.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(28,12): error TS2300: Duplicate identifier ''a''.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(28,24): error TS1119: An object literal cannot have property and accessor with the same name.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(28,24): error TS2300: Duplicate identifier 'a'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(29,12): error TS2300: Duplicate identifier ''a''.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(29,24): error TS1119: An object literal cannot have property and accessor with the same name.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(29,24): error TS2300: Duplicate identifier '"a"'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(30,12): error TS2300: Duplicate identifier ''a''.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(30,24): error TS1119: An object literal cannot have property and accessor with the same name.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(30,24): error TS2300: Duplicate identifier ''a''.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(31,13): error TS2300: Duplicate identifier '"a"'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(31,25): error TS1119: An object literal cannot have property and accessor with the same name.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(31,25): error TS2300: Duplicate identifier ''a''.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(32,13): error TS2300: Duplicate identifier '1.0'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(32,25): error TS1119: An object literal cannot have property and accessor with the same name.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(32,25): error TS2300: Duplicate identifier ''1''.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(33,13): error TS2300: Duplicate identifier '0'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(33,23): error TS1119: An object literal cannot have property and accessor with the same name.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(33,23): error TS2300: Duplicate identifier '0'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(34,13): error TS2300: Duplicate identifier '0'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(34,23): error TS1119: An object literal cannot have property and accessor with the same name.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(34,23): error TS2300: Duplicate identifier '0'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(35,13): error TS2300: Duplicate identifier '0'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(35,23): error TS1119: An object literal cannot have property and accessor with the same name.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(35,23): error TS2300: Duplicate identifier '0x0'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(36,13): error TS2300: Duplicate identifier '0'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(36,23): error TS1119: An object literal cannot have property and accessor with the same name.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(36,23): error TS2300: Duplicate identifier '000'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(37,13): error TS2300: Duplicate identifier '"100"'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(37,27): error TS1119: An object literal cannot have property and accessor with the same name.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(37,27): error TS2300: Duplicate identifier '1e2'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(38,13): error TS2300: Duplicate identifier '0x20'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(38,26): error TS1119: An object literal cannot have property and accessor with the same name.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(38,26): error TS2300: Duplicate identifier '3.2e1'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(39,13): error TS2300: Duplicate identifier 'a'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(39,46): error TS1119: An object literal cannot have property and accessor with the same name.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(39,46): error TS2300: Duplicate identifier 'a'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(42,16): error TS2380: The return type of a 'get' accessor must be assignable to its 'set' accessor type
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(43,22): error TS2322: Type 'number' is not assignable to type 'string'.
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(44,16): error TS2380: The return type of a 'get' accessor must be assignable to its 'set' accessor type
==== tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts (76 errors) ====
// Multiple properties with the same name
var e1 = { a: 0, a: 0 };
~
!!! error TS2300: Duplicate identifier 'a'.
var e2 = { a: '', a: '' };
~
!!! error TS2300: Duplicate identifier 'a'.
var e3 = { a: 0, a: '' };
~
!!! error TS2300: Duplicate identifier 'a'.
var e4 = { a: true, a: false };
~
!!! error TS2300: Duplicate identifier 'a'.
var e5 = { a: {}, a: {} };
~
!!! error TS2300: Duplicate identifier 'a'.
var e6 = { a: 0, 'a': 0 };
~~~
!!! error TS2300: Duplicate identifier ''a''.
var e7 = { 'a': 0, a: 0 };
~
!!! error TS2300: Duplicate identifier 'a'.
var e8 = { 'a': 0, "a": 0 };
~~~
!!! error TS2300: Duplicate identifier '"a"'.
var e9 = { 'a': 0, 'a': 0 };
~~~
!!! error TS2300: Duplicate identifier ''a''.
var e10 = { "a": 0, 'a': 0 };
~~~
!!! error TS2300: Duplicate identifier ''a''.
var e11 = { 1.0: 0, '1': 0 };
~~~
!!! error TS2300: Duplicate identifier ''1''.
var e12 = { 0: 0, 0: 0 };
~
!!! error TS2300: Duplicate identifier '0'.
var e13 = { 0: 0, 0: 0 };
~
!!! error TS2300: Duplicate identifier '0'.
var e14 = { 0: 0, 0x0: 0 };
~~~
!!! error TS2300: Duplicate identifier '0x0'.
var e14 = { 0: 0, 000: 0 };
~~~
!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o0'.
~~~
!!! error TS2300: Duplicate identifier '000'.
var e15 = { "100": 0, 1e2: 0 };
~~~
!!! error TS2300: Duplicate identifier '1e2'.
var e16 = { 0x20: 0, 3.2e1: 0 };
~~~~~
!!! error TS2300: Duplicate identifier '3.2e1'.
var e17 = { a: 0, b: 1, a: 0 };
~
!!! error TS2300: Duplicate identifier 'a'.
// Accessor and property with the same name
var f1 = { a: 0, get a() { return 0; } };
~
!!! error TS2300: Duplicate identifier 'a'.
~
!!! error TS1119: An object literal cannot have property and accessor with the same name.
~
!!! error TS2300: Duplicate identifier 'a'.
var f2 = { a: '', get a() { return ''; } };
~
!!! error TS2300: Duplicate identifier 'a'.
~
!!! error TS1119: An object literal cannot have property and accessor with the same name.
~
!!! error TS2300: Duplicate identifier 'a'.
var f3 = { a: 0, get a() { return ''; } };
~
!!! error TS2300: Duplicate identifier 'a'.
~
!!! error TS1119: An object literal cannot have property and accessor with the same name.
~
!!! error TS2300: Duplicate identifier 'a'.
var f4 = { a: true, get a() { return false; } };
~
!!! error TS2300: Duplicate identifier 'a'.
~
!!! error TS1119: An object literal cannot have property and accessor with the same name.
~
!!! error TS2300: Duplicate identifier 'a'.
var f5 = { a: {}, get a() { return {}; } };
~
!!! error TS2300: Duplicate identifier 'a'.
~
!!! error TS1119: An object literal cannot have property and accessor with the same name.
~
!!! error TS2300: Duplicate identifier 'a'.
var f6 = { a: 0, get 'a'() { return 0; } };
~
!!! error TS2300: Duplicate identifier 'a'.
~~~
!!! error TS1119: An object literal cannot have property and accessor with the same name.
~~~
!!! error TS2300: Duplicate identifier ''a''.
var f7 = { 'a': 0, get a() { return 0; } };
~~~
!!! error TS2300: Duplicate identifier ''a''.
~
!!! error TS1119: An object literal cannot have property and accessor with the same name.
~
!!! error TS2300: Duplicate identifier 'a'.
var f8 = { 'a': 0, get "a"() { return 0; } };
~~~
!!! error TS2300: Duplicate identifier ''a''.
~~~
!!! error TS1119: An object literal cannot have property and accessor with the same name.
~~~
!!! error TS2300: Duplicate identifier '"a"'.
var f9 = { 'a': 0, get 'a'() { return 0; } };
~~~
!!! error TS2300: Duplicate identifier ''a''.
~~~
!!! error TS1119: An object literal cannot have property and accessor with the same name.
~~~
!!! error TS2300: Duplicate identifier ''a''.
var f10 = { "a": 0, get 'a'() { return 0; } };
~~~
!!! error TS2300: Duplicate identifier '"a"'.
~~~
!!! error TS1119: An object literal cannot have property and accessor with the same name.
~~~
!!! error TS2300: Duplicate identifier ''a''.
var f11 = { 1.0: 0, get '1'() { return 0; } };
~~~
!!! error TS2300: Duplicate identifier '1.0'.
~~~
!!! error TS1119: An object literal cannot have property and accessor with the same name.
~~~
!!! error TS2300: Duplicate identifier ''1''.
var f12 = { 0: 0, get 0() { return 0; } };
~
!!! error TS2300: Duplicate identifier '0'.
~
!!! error TS1119: An object literal cannot have property and accessor with the same name.
~
!!! error TS2300: Duplicate identifier '0'.
var f13 = { 0: 0, get 0() { return 0; } };
~
!!! error TS2300: Duplicate identifier '0'.
~
!!! error TS1119: An object literal cannot have property and accessor with the same name.
~
!!! error TS2300: Duplicate identifier '0'.
var f14 = { 0: 0, get 0x0() { return 0; } };
~
!!! error TS2300: Duplicate identifier '0'.
~~~
!!! error TS1119: An object literal cannot have property and accessor with the same name.
~~~
!!! error TS2300: Duplicate identifier '0x0'.
var f14 = { 0: 0, get 000() { return 0; } };
~
!!! error TS2300: Duplicate identifier '0'.
~~~
!!! error TS1119: An object literal cannot have property and accessor with the same name.
~~~
!!! error TS2300: Duplicate identifier '000'.
var f15 = { "100": 0, get 1e2() { return 0; } };
~~~~~
!!! error TS2300: Duplicate identifier '"100"'.
~~~
!!! error TS1119: An object literal cannot have property and accessor with the same name.
~~~
!!! error TS2300: Duplicate identifier '1e2'.
var f16 = { 0x20: 0, get 3.2e1() { return 0; } };
~~~~
!!! error TS2300: Duplicate identifier '0x20'.
~~~~~
!!! error TS1119: An object literal cannot have property and accessor with the same name.
~~~~~
!!! error TS2300: Duplicate identifier '3.2e1'.
var f17 = { a: 0, get b() { return 1; }, get a() { return 0; } };
~
!!! error TS2300: Duplicate identifier 'a'.
~
!!! error TS1119: An object literal cannot have property and accessor with the same name.
~
!!! error TS2300: Duplicate identifier 'a'.
// Get and set accessor with mismatched type annotations
var g1 = { get a(): number { return 4; }, set a(n: string) { } };
~
!!! error TS2380: The return type of a 'get' accessor must be assignable to its 'set' accessor type
var g2 = { get a() { return 4; }, set a(n: string) { } };
~~~~~~~~~
!!! error TS2322: Type 'number' is not assignable to type 'string'.
var g3 = { get a(): number { return undefined; }, set a(n: string) { } };
~
!!! error TS2380: The return type of a 'get' accessor must be assignable to its 'set' accessor type