From 657d46539896a4dd436ededc4e2138dab82455a7 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Tue, 3 Feb 2015 17:43:31 -0800 Subject: [PATCH] Added ES5 tests for computed properties. --- .../computedPropertyNames10_ES5.errors.txt | 52 ++++++++ .../reference/computedPropertyNames10_ES5.js | 46 +++++++ .../computedPropertyNames11_ES5.errors.txt | 85 +++++++++++++ .../reference/computedPropertyNames11_ES5.js | 52 ++++++++ .../computedPropertyNames12_ES5.errors.txt | 52 ++++++++ .../reference/computedPropertyNames12_ES5.js | 31 +++++ .../computedPropertyNames13_ES5.errors.txt | 52 ++++++++ .../reference/computedPropertyNames13_ES5.js | 49 ++++++++ .../computedPropertyNames14_ES5.errors.txt | 48 ++++++++ .../reference/computedPropertyNames14_ES5.js | 30 +++++ .../computedPropertyNames15_ES5.errors.txt | 26 ++++ .../reference/computedPropertyNames15_ES5.js | 25 ++++ .../computedPropertyNames16_ES5.errors.txt | 52 ++++++++ .../reference/computedPropertyNames16_ES5.js | 99 +++++++++++++++ .../computedPropertyNames17_ES5.errors.txt | 48 ++++++++ .../reference/computedPropertyNames17_ES5.js | 57 +++++++++ .../computedPropertyNames18_ES5.errors.txt | 11 ++ .../reference/computedPropertyNames18_ES5.js | 13 ++ .../computedPropertyNames19_ES5.errors.txt | 14 +++ .../reference/computedPropertyNames19_ES5.js | 14 +++ .../computedPropertyNames1_ES5.errors.txt | 19 +++ .../reference/computedPropertyNames1_ES5.js | 14 +++ .../computedPropertyNames20_ES5.errors.txt | 9 ++ .../reference/computedPropertyNames20_ES5.js | 9 ++ .../computedPropertyNames21_ES5.errors.txt | 15 +++ .../reference/computedPropertyNames21_ES5.js | 19 +++ .../computedPropertyNames22_ES5.errors.txt | 14 +++ .../reference/computedPropertyNames22_ES5.js | 23 ++++ .../computedPropertyNames23_ES5.errors.txt | 22 ++++ .../reference/computedPropertyNames23_ES5.js | 21 ++++ .../computedPropertyNames24_ES5.errors.txt | 19 +++ .../reference/computedPropertyNames24_ES5.js | 38 ++++++ .../computedPropertyNames25_ES5.errors.txt | 19 +++ .../reference/computedPropertyNames25_ES5.js | 44 +++++++ .../computedPropertyNames26_ES5.errors.txt | 26 ++++ .../reference/computedPropertyNames26_ES5.js | 40 ++++++ .../computedPropertyNames27_ES5.errors.txt | 14 +++ .../reference/computedPropertyNames27_ES5.js | 28 +++++ .../computedPropertyNames28_ES5.errors.txt | 16 +++ .../reference/computedPropertyNames28_ES5.js | 35 ++++++ .../computedPropertyNames29_ES5.errors.txt | 16 +++ .../reference/computedPropertyNames29_ES5.js | 28 +++++ .../computedPropertyNames2_ES5.errors.txt | 37 ++++++ .../reference/computedPropertyNames2_ES5.js | 48 ++++++++ .../computedPropertyNames30_ES5.errors.txt | 24 ++++ .../reference/computedPropertyNames30_ES5.js | 45 +++++++ .../computedPropertyNames31_ES5.errors.txt | 21 ++++ .../reference/computedPropertyNames31_ES5.js | 49 ++++++++ .../computedPropertyNames32_ES5.errors.txt | 16 +++ .../reference/computedPropertyNames32_ES5.js | 23 ++++ .../computedPropertyNames33_ES5.errors.txt | 15 +++ .../reference/computedPropertyNames33_ES5.js | 27 +++++ .../computedPropertyNames34_ES5.errors.txt | 18 +++ .../reference/computedPropertyNames34_ES5.js | 27 +++++ .../computedPropertyNames35_ES5.errors.txt | 14 +++ .../reference/computedPropertyNames35_ES5.js | 11 ++ .../computedPropertyNames36_ES5.errors.txt | 22 ++++ .../reference/computedPropertyNames36_ES5.js | 42 +++++++ .../computedPropertyNames37_ES5.errors.txt | 19 +++ .../reference/computedPropertyNames37_ES5.js | 42 +++++++ .../computedPropertyNames38_ES5.errors.txt | 22 ++++ .../reference/computedPropertyNames38_ES5.js | 42 +++++++ .../computedPropertyNames39_ES5.errors.txt | 22 ++++ .../reference/computedPropertyNames39_ES5.js | 42 +++++++ .../computedPropertyNames3_ES5.errors.txt | 48 ++++++++ .../reference/computedPropertyNames3_ES5.js | 47 ++++++++ .../computedPropertyNames40_ES5.errors.txt | 22 ++++ .../reference/computedPropertyNames40_ES5.js | 35 ++++++ .../computedPropertyNames41_ES5.errors.txt | 15 +++ .../reference/computedPropertyNames41_ES5.js | 31 +++++ .../computedPropertyNames42_ES5.errors.txt | 18 +++ .../reference/computedPropertyNames42_ES5.js | 27 +++++ .../computedPropertyNames43_ES5.errors.txt | 24 ++++ .../reference/computedPropertyNames43_ES5.js | 57 +++++++++ .../computedPropertyNames44_ES5.errors.txt | 26 ++++ .../reference/computedPropertyNames44_ES5.js | 55 +++++++++ .../computedPropertyNames45_ES5.errors.txt | 24 ++++ .../reference/computedPropertyNames45_ES5.js | 56 +++++++++ .../computedPropertyNames46_ES5.errors.txt | 9 ++ .../reference/computedPropertyNames46_ES5.js | 9 ++ .../computedPropertyNames47_ES5.errors.txt | 11 ++ .../reference/computedPropertyNames47_ES5.js | 19 +++ .../computedPropertyNames48_ES5.errors.txt | 38 ++++++ .../reference/computedPropertyNames48_ES5.js | 34 ++++++ .../computedPropertyNames4_ES5.errors.txt | 52 ++++++++ .../reference/computedPropertyNames4_ES5.js | 35 ++++++ .../computedPropertyNames5_ES5.errors.txt | 48 ++++++++ .../reference/computedPropertyNames5_ES5.js | 21 ++++ .../computedPropertyNames6_ES5.errors.txt | 26 ++++ .../reference/computedPropertyNames6_ES5.js | 19 +++ .../computedPropertyNames7_ES5.errors.txt | 12 ++ .../reference/computedPropertyNames7_ES5.js | 16 +++ .../computedPropertyNames8_ES5.errors.txt | 23 ++++ .../reference/computedPropertyNames8_ES5.js | 19 +++ .../computedPropertyNames9_ES5.errors.txt | 25 ++++ .../reference/computedPropertyNames9_ES5.js | 20 +++ ...opertyNamesContextualType10_ES5.errors.txt | 26 ++++ ...mputedPropertyNamesContextualType10_ES5.js | 15 +++ ...ropertyNamesContextualType1_ES5.errors.txt | 18 +++ ...omputedPropertyNamesContextualType1_ES5.js | 18 +++ ...ropertyNamesContextualType2_ES5.errors.txt | 18 +++ ...omputedPropertyNamesContextualType2_ES5.js | 18 +++ ...ropertyNamesContextualType3_ES5.errors.txt | 17 +++ ...omputedPropertyNamesContextualType3_ES5.js | 17 +++ ...ropertyNamesContextualType4_ES5.errors.txt | 18 +++ ...omputedPropertyNamesContextualType4_ES5.js | 16 +++ ...ropertyNamesContextualType5_ES5.errors.txt | 18 +++ ...omputedPropertyNamesContextualType5_ES5.js | 16 +++ ...ropertyNamesContextualType6_ES5.errors.txt | 34 ++++++ ...omputedPropertyNamesContextualType6_ES5.js | 24 ++++ ...ropertyNamesContextualType7_ES5.errors.txt | 34 ++++++ ...omputedPropertyNamesContextualType7_ES5.js | 24 ++++ ...ropertyNamesContextualType8_ES5.errors.txt | 27 +++++ ...omputedPropertyNamesContextualType8_ES5.js | 16 +++ ...ropertyNamesContextualType9_ES5.errors.txt | 27 +++++ ...omputedPropertyNamesContextualType9_ES5.js | 16 +++ ...opertyNamesDeclarationEmit1_ES5.errors.txt | 17 +++ ...mputedPropertyNamesDeclarationEmit1_ES5.js | 28 +++++ ...opertyNamesDeclarationEmit2_ES5.errors.txt | 17 +++ ...mputedPropertyNamesDeclarationEmit2_ES5.js | 28 +++++ ...opertyNamesDeclarationEmit3_ES5.errors.txt | 9 ++ ...mputedPropertyNamesDeclarationEmit3_ES5.js | 6 + ...opertyNamesDeclarationEmit4_ES5.errors.txt | 9 ++ ...mputedPropertyNamesDeclarationEmit4_ES5.js | 7 ++ ...opertyNamesDeclarationEmit5_ES5.errors.txt | 27 +++++ ...mputedPropertyNamesDeclarationEmit5_ES5.js | 19 +++ ...tedPropertyNamesOnOverloads_ES5.errors.txt | 19 +++ .../computedPropertyNamesOnOverloads_ES5.js | 19 +++ ...utedPropertyNamesSourceMap1_ES5.errors.txt | 11 ++ .../computedPropertyNamesSourceMap1_ES5.js | 17 +++ ...computedPropertyNamesSourceMap1_ES5.js.map | 2 + ...dPropertyNamesSourceMap1_ES5.sourcemap.txt | 114 ++++++++++++++++++ ...utedPropertyNamesSourceMap2_ES5.errors.txt | 11 ++ .../computedPropertyNamesSourceMap2_ES5.js | 14 +++ ...computedPropertyNamesSourceMap2_ES5.js.map | 2 + ...dPropertyNamesSourceMap2_ES5.sourcemap.txt | 73 +++++++++++ .../computedPropertyNames10_ES5.ts | 17 +++ .../computedPropertyNames11_ES5.ts | 17 +++ .../computedPropertyNames12_ES5.ts | 17 +++ .../computedPropertyNames13_ES5.ts | 17 +++ .../computedPropertyNames14_ES5.ts | 10 ++ .../computedPropertyNames15_ES5.ts | 9 ++ .../computedPropertyNames16_ES5.ts | 17 +++ .../computedPropertyNames17_ES5.ts | 10 ++ .../computedPropertyNames18_ES5.ts | 6 + .../computedPropertyNames19_ES5.ts | 6 + .../computedPropertyNames1_ES5.ts | 5 + .../computedPropertyNames20_ES5.ts | 4 + .../computedPropertyNames21_ES5.ts | 7 ++ .../computedPropertyNames22_ES5.ts | 9 ++ .../computedPropertyNames23_ES5.ts | 9 ++ .../computedPropertyNames24_ES5.ts | 11 ++ .../computedPropertyNames25_ES5.ts | 14 +++ .../computedPropertyNames26_ES5.ts | 13 ++ .../computedPropertyNames27_ES5.ts | 6 + .../computedPropertyNames28_ES5.ts | 11 ++ .../computedPropertyNames29_ES5.ts | 11 ++ .../computedPropertyNames2_ES5.ts | 11 ++ .../computedPropertyNames30_ES5.ts | 16 +++ .../computedPropertyNames31_ES5.ts | 16 +++ .../computedPropertyNames32_ES5.ts | 8 ++ .../computedPropertyNames33_ES5.ts | 10 ++ .../computedPropertyNames34_ES5.ts | 10 ++ .../computedPropertyNames35_ES5.ts | 6 + .../computedPropertyNames36_ES5.ts | 11 ++ .../computedPropertyNames37_ES5.ts | 11 ++ .../computedPropertyNames38_ES5.ts | 11 ++ .../computedPropertyNames39_ES5.ts | 11 ++ .../computedPropertyNames3_ES5.ts | 10 ++ .../computedPropertyNames40_ES5.ts | 11 ++ .../computedPropertyNames41_ES5.ts | 10 ++ .../computedPropertyNames42_ES5.ts | 10 ++ .../computedPropertyNames43_ES5.ts | 13 ++ .../computedPropertyNames44_ES5.ts | 12 ++ .../computedPropertyNames45_ES5.ts | 13 ++ .../computedPropertyNames46_ES5.ts | 4 + .../computedPropertyNames47_ES5.ts | 6 + .../computedPropertyNames48_ES5.ts | 18 +++ .../computedPropertyNames4_ES5.ts | 17 +++ .../computedPropertyNames5_ES5.ts | 10 ++ .../computedPropertyNames6_ES5.ts | 9 ++ .../computedPropertyNames7_ES5.ts | 7 ++ .../computedPropertyNames8_ES5.ts | 9 ++ .../computedPropertyNames9_ES5.ts | 11 ++ ...mputedPropertyNamesContextualType10_ES5.ts | 9 ++ ...omputedPropertyNamesContextualType1_ES5.ts | 10 ++ ...omputedPropertyNamesContextualType2_ES5.ts | 10 ++ ...omputedPropertyNamesContextualType3_ES5.ts | 9 ++ ...omputedPropertyNamesContextualType4_ES5.ts | 10 ++ ...omputedPropertyNamesContextualType5_ES5.ts | 10 ++ ...omputedPropertyNamesContextualType6_ES5.ts | 14 +++ ...omputedPropertyNamesContextualType7_ES5.ts | 14 +++ ...omputedPropertyNamesContextualType8_ES5.ts | 10 ++ ...omputedPropertyNamesContextualType9_ES5.ts | 10 ++ ...mputedPropertyNamesDeclarationEmit1_ES5.ts | 7 ++ ...mputedPropertyNamesDeclarationEmit2_ES5.ts | 7 ++ ...mputedPropertyNamesDeclarationEmit3_ES5.ts | 5 + ...mputedPropertyNamesDeclarationEmit4_ES5.ts | 5 + ...mputedPropertyNamesDeclarationEmit5_ES5.ts | 8 ++ .../computedPropertyNamesOnOverloads_ES5.ts | 8 ++ .../computedPropertyNamesSourceMap1_ES5.ts | 7 ++ .../computedPropertyNamesSourceMap2_ES5.ts | 7 ++ 202 files changed, 4436 insertions(+) create mode 100644 tests/baselines/reference/computedPropertyNames10_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames10_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames11_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames11_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames12_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames12_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames13_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames13_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames14_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames14_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames15_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames15_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames16_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames16_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames17_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames17_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames18_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames18_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames19_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames19_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames1_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames1_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames20_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames20_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames21_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames21_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames22_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames22_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames23_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames23_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames24_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames24_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames25_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames25_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames26_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames26_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames27_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames27_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames28_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames28_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames29_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames29_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames2_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames2_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames30_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames30_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames31_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames31_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames32_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames32_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames33_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames33_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames34_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames34_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames35_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames35_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames36_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames36_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames37_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames37_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames38_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames38_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames39_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames39_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames3_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames3_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames40_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames40_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames41_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames41_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames42_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames42_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames43_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames43_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames44_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames44_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames45_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames45_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames46_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames46_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames47_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames47_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames48_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames48_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames4_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames4_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames5_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames5_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames6_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames6_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames7_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames7_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames8_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames8_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames9_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames9_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNamesContextualType10_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNamesContextualType10_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNamesContextualType1_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNamesContextualType1_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNamesContextualType2_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNamesContextualType3_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNamesContextualType3_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNamesContextualType4_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNamesContextualType4_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNamesContextualType5_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNamesContextualType5_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNamesContextualType6_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNamesContextualType6_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNamesContextualType7_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNamesContextualType7_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNamesContextualType8_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNamesContextualType8_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNamesContextualType9_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNamesContextualType9_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNamesOnOverloads_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNamesOnOverloads_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.js.map create mode 100644 tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.sourcemap.txt create mode 100644 tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map create mode 100644 tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames18_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames20_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames21_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames22_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames23_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames24_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames25_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames27_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames28_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames29_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames31_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames32_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames33_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames34_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames37_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames41_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames46_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames47_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames7_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType1_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType2_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType3_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType4_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType5_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit1_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit2_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES5.ts diff --git a/tests/baselines/reference/computedPropertyNames10_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames10_ES5.errors.txt new file mode 100644 index 00000000000..30a5f07c271 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames10_ES5.errors.txt @@ -0,0 +1,52 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts(5,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts(6,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts(7,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts(8,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts(9,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts(10,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts(11,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts(12,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts(13,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts(14,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts(15,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts (11 errors) ==== + var s: string; + var n: number; + var a: any; + var v = { + [s]() { }, + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [n]() { }, + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [s + s]() { }, + ~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [s + n]() { }, + ~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [+s]() { }, + ~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [""]() { }, + ~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [0]() { }, + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [a]() { }, + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [true]() { }, + ~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [`hello bye`]() { }, + ~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [`hello ${a} bye`]() { } + ~~~~~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames10_ES5.js b/tests/baselines/reference/computedPropertyNames10_ES5.js new file mode 100644 index 00000000000..cb015e76dff --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames10_ES5.js @@ -0,0 +1,46 @@ +//// [computedPropertyNames10_ES5.ts] +var s: string; +var n: number; +var a: any; +var v = { + [s]() { }, + [n]() { }, + [s + s]() { }, + [s + n]() { }, + [+s]() { }, + [""]() { }, + [0]() { }, + [a]() { }, + [true]() { }, + [`hello bye`]() { }, + [`hello ${a} bye`]() { } +} + +//// [computedPropertyNames10_ES5.js] +var s; +var n; +var a; +var v = { + [s]: function () { + }, + [n]: function () { + }, + [s + s]: function () { + }, + [s + n]: function () { + }, + [+s]: function () { + }, + [""]: function () { + }, + [0]: function () { + }, + [a]: function () { + }, + [true]: function () { + }, + ["hello bye"]: function () { + }, + ["hello " + a + " bye"]: function () { + } +}; diff --git a/tests/baselines/reference/computedPropertyNames11_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames11_ES5.errors.txt new file mode 100644 index 00000000000..21f8c8ef0eb --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames11_ES5.errors.txt @@ -0,0 +1,85 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(5,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(5,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(6,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(6,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(7,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(7,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(8,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(8,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(9,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(9,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(10,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(10,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(11,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(11,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(12,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(12,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(13,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(13,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(14,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(14,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(15,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(15,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts (22 errors) ==== + var s: string; + var n: number; + var a: any; + var v = { + get [s]() { return 0; }, + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + set [n](v) { }, + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + get [s + s]() { return 0; }, + ~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + set [s + n](v) { }, + ~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + get [+s]() { return 0; }, + ~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + set [""](v) { }, + ~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + get [0]() { return 0; }, + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + set [a](v) { }, + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + get [true]() { return 0; }, + ~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + set [`hello bye`](v) { }, + ~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + get [`hello ${a} bye`]() { return 0; } + ~~~~~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames11_ES5.js b/tests/baselines/reference/computedPropertyNames11_ES5.js new file mode 100644 index 00000000000..e716515b95c --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames11_ES5.js @@ -0,0 +1,52 @@ +//// [computedPropertyNames11_ES5.ts] +var s: string; +var n: number; +var a: any; +var v = { + get [s]() { return 0; }, + set [n](v) { }, + get [s + s]() { return 0; }, + set [s + n](v) { }, + get [+s]() { return 0; }, + set [""](v) { }, + get [0]() { return 0; }, + set [a](v) { }, + get [true]() { return 0; }, + set [`hello bye`](v) { }, + get [`hello ${a} bye`]() { return 0; } +} + +//// [computedPropertyNames11_ES5.js] +var s; +var n; +var a; +var v = { + get [s]() { + return 0; + }, + set [n](v) { + }, + get [s + s]() { + return 0; + }, + set [s + n](v) { + }, + get [+s]() { + return 0; + }, + set [""](v) { + }, + get [0]() { + return 0; + }, + set [a](v) { + }, + get [true]() { + return 0; + }, + set ["hello bye"](v) { + }, + get ["hello " + a + " bye"]() { + return 0; + } +}; diff --git a/tests/baselines/reference/computedPropertyNames12_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames12_ES5.errors.txt new file mode 100644 index 00000000000..ab25e1b1614 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames12_ES5.errors.txt @@ -0,0 +1,52 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(5,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(6,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(7,12): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(8,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(9,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(10,12): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(11,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(12,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(13,12): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(14,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(15,12): error TS1166: Computed property names are not allowed in class property declarations. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts (11 errors) ==== + var s: string; + var n: number; + var a: any; + class C { + [s]: number; + ~~~ +!!! error TS1166: Computed property names are not allowed in class property declarations. + [n] = n; + ~~~ +!!! error TS1166: Computed property names are not allowed in class property declarations. + static [s + s]: string; + ~~~~~~~ +!!! error TS1166: Computed property names are not allowed in class property declarations. + [s + n] = 2; + ~~~~~~~ +!!! error TS1166: Computed property names are not allowed in class property declarations. + [+s]: typeof s; + ~~~~ +!!! error TS1166: Computed property names are not allowed in class property declarations. + static [""]: number; + ~~~~ +!!! error TS1166: Computed property names are not allowed in class property declarations. + [0]: number; + ~~~ +!!! error TS1166: Computed property names are not allowed in class property declarations. + [a]: number; + ~~~ +!!! error TS1166: Computed property names are not allowed in class property declarations. + static [true]: number; + ~~~~~~~~~~~ +!!! error TS1166: Computed property names are not allowed in class property declarations. + [`hello bye`] = 0; + ~~~~~~~~~~~~~ +!!! error TS1166: Computed property names are not allowed in class property declarations. + static [`hello ${a} bye`] = 0 + ~~~~~~~~~~~~~~~~~~ +!!! error TS1166: Computed property names are not allowed in class property declarations. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames12_ES5.js b/tests/baselines/reference/computedPropertyNames12_ES5.js new file mode 100644 index 00000000000..c73ea11286f --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames12_ES5.js @@ -0,0 +1,31 @@ +//// [computedPropertyNames12_ES5.ts] +var s: string; +var n: number; +var a: any; +class C { + [s]: number; + [n] = n; + static [s + s]: string; + [s + n] = 2; + [+s]: typeof s; + static [""]: number; + [0]: number; + [a]: number; + static [true]: number; + [`hello bye`] = 0; + static [`hello ${a} bye`] = 0 +} + +//// [computedPropertyNames12_ES5.js] +var s; +var n; +var a; +var C = (function () { + function C() { + this[n] = n; + this[s + n] = 2; + this["hello bye"] = 0; + } + C["hello " + a + " bye"] = 0; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames13_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames13_ES5.errors.txt new file mode 100644 index 00000000000..15d43c41c91 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames13_ES5.errors.txt @@ -0,0 +1,52 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts(5,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts(6,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts(7,12): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts(8,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts(9,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts(10,12): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts(11,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts(12,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts(13,12): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts(14,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts(15,12): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts (11 errors) ==== + var s: string; + var n: number; + var a: any; + class C { + [s]() {} + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [n]() { } + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + static [s + s]() { } + ~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [s + n]() { } + ~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [+s]() { } + ~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + static [""]() { } + ~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [0]() { } + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [a]() { } + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + static [true]() { } + ~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [`hello bye`]() { } + ~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + static [`hello ${a} bye`]() { } + ~~~~~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames13_ES5.js b/tests/baselines/reference/computedPropertyNames13_ES5.js new file mode 100644 index 00000000000..7933d6f9830 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames13_ES5.js @@ -0,0 +1,49 @@ +//// [computedPropertyNames13_ES5.ts] +var s: string; +var n: number; +var a: any; +class C { + [s]() {} + [n]() { } + static [s + s]() { } + [s + n]() { } + [+s]() { } + static [""]() { } + [0]() { } + [a]() { } + static [true]() { } + [`hello bye`]() { } + static [`hello ${a} bye`]() { } +} + +//// [computedPropertyNames13_ES5.js] +var s; +var n; +var a; +var C = (function () { + function C() { + } + C.prototype[s] = function () { + }; + C.prototype[n] = function () { + }; + C[s + s] = function () { + }; + C.prototype[s + n] = function () { + }; + C.prototype[+s] = function () { + }; + C[""] = function () { + }; + C.prototype[0] = function () { + }; + C.prototype[a] = function () { + }; + C[true] = function () { + }; + C.prototype["hello bye"] = function () { + }; + C["hello " + a + " bye"] = function () { + }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames14_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames14_ES5.errors.txt new file mode 100644 index 00000000000..b1a59252b61 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames14_ES5.errors.txt @@ -0,0 +1,48 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(3,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(4,12): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(4,12): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(5,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(5,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(6,12): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(6,12): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(7,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(8,12): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(8,12): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts (12 errors) ==== + var b: boolean; + class C { + [b]() {} + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + static [true]() { } + ~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + [[]]() { } + ~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + static [{}]() { } + ~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + [undefined]() { } + ~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + static [null]() { } + ~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames14_ES5.js b/tests/baselines/reference/computedPropertyNames14_ES5.js new file mode 100644 index 00000000000..3a53e4106fc --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames14_ES5.js @@ -0,0 +1,30 @@ +//// [computedPropertyNames14_ES5.ts] +var b: boolean; +class C { + [b]() {} + static [true]() { } + [[]]() { } + static [{}]() { } + [undefined]() { } + static [null]() { } +} + +//// [computedPropertyNames14_ES5.js] +var b; +var C = (function () { + function C() { + } + C.prototype[b] = function () { + }; + C[true] = function () { + }; + C.prototype[[]] = function () { + }; + C[{}] = function () { + }; + C.prototype[undefined] = function () { + }; + C[null] = function () { + }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames15_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames15_ES5.errors.txt new file mode 100644 index 00000000000..8d450c673cd --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames15_ES5.errors.txt @@ -0,0 +1,26 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES5.ts(5,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES5.ts(6,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES5.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES5.ts(7,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES5.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES5.ts (5 errors) ==== + var p1: number | string; + var p2: number | number[]; + var p3: string | boolean; + class C { + [p1]() { } + ~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [p2]() { } + ~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + [p3]() { } + ~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames15_ES5.js b/tests/baselines/reference/computedPropertyNames15_ES5.js new file mode 100644 index 00000000000..7e0db9855dd --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames15_ES5.js @@ -0,0 +1,25 @@ +//// [computedPropertyNames15_ES5.ts] +var p1: number | string; +var p2: number | number[]; +var p3: string | boolean; +class C { + [p1]() { } + [p2]() { } + [p3]() { } +} + +//// [computedPropertyNames15_ES5.js] +var p1; +var p2; +var p3; +var C = (function () { + function C() { + } + C.prototype[p1] = function () { + }; + C.prototype[p2] = function () { + }; + C.prototype[p3] = function () { + }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames16_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames16_ES5.errors.txt new file mode 100644 index 00000000000..bb98073f363 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames16_ES5.errors.txt @@ -0,0 +1,52 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts(5,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts(6,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts(7,16): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts(8,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts(9,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts(10,16): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts(11,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts(12,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts(13,16): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts(14,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts(15,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts (11 errors) ==== + var s: string; + var n: number; + var a: any; + class C { + get [s]() { return 0;} + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + set [n](v) { } + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + static get [s + s]() { return 0; } + ~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + set [s + n](v) { } + ~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + get [+s]() { return 0; } + ~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + static set [""](v) { } + ~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + get [0]() { return 0; } + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + set [a](v) { } + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + static get [true]() { return 0; } + ~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + set [`hello bye`](v) { } + ~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + get [`hello ${a} bye`]() { return 0; } + ~~~~~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames16_ES5.js b/tests/baselines/reference/computedPropertyNames16_ES5.js new file mode 100644 index 00000000000..b8c4991bee4 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames16_ES5.js @@ -0,0 +1,99 @@ +//// [computedPropertyNames16_ES5.ts] +var s: string; +var n: number; +var a: any; +class C { + get [s]() { return 0;} + set [n](v) { } + static get [s + s]() { return 0; } + set [s + n](v) { } + get [+s]() { return 0; } + static set [""](v) { } + get [0]() { return 0; } + set [a](v) { } + static get [true]() { return 0; } + set [`hello bye`](v) { } + get [`hello ${a} bye`]() { return 0; } +} + +//// [computedPropertyNames16_ES5.js] +var s; +var n; +var a; +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, s, { + get: function () { + return 0; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, n, { + set: function (v) { + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, s + s, { + get: function () { + return 0; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, s + n, { + set: function (v) { + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, +s, { + get: function () { + return 0; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, "", { + set: function (v) { + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, 0, { + get: function () { + return 0; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, a, { + set: function (v) { + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, true, { + get: function () { + return 0; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, "hello bye", { + set: function (v) { + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, "hello " + a + " bye", { + get: function () { + return 0; + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames17_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames17_ES5.errors.txt new file mode 100644 index 00000000000..3b6da1d1e08 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames17_ES5.errors.txt @@ -0,0 +1,48 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(3,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(3,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(4,16): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(4,16): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(5,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(6,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(7,16): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(8,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(8,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts (12 errors) ==== + var b: boolean; + class C { + get [b]() { return 0;} + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + static set [true](v) { } + ~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + get [[]]() { return 0; } + ~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + set [{}](v) { } + ~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + static get [undefined]() { return 0; } + ~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + set [null](v) { } + ~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames17_ES5.js b/tests/baselines/reference/computedPropertyNames17_ES5.js new file mode 100644 index 00000000000..33bc5bfd3c8 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames17_ES5.js @@ -0,0 +1,57 @@ +//// [computedPropertyNames17_ES5.ts] +var b: boolean; +class C { + get [b]() { return 0;} + static set [true](v) { } + get [[]]() { return 0; } + set [{}](v) { } + static get [undefined]() { return 0; } + set [null](v) { } +} + +//// [computedPropertyNames17_ES5.js] +var b; +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, b, { + get: function () { + return 0; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, true, { + set: function (v) { + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, [], { + get: function () { + return 0; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, {}, { + set: function (v) { + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, undefined, { + get: function () { + return 0; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, null, { + set: function (v) { + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames18_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames18_ES5.errors.txt new file mode 100644 index 00000000000..69b787530cd --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames18_ES5.errors.txt @@ -0,0 +1,11 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames18_ES5.ts(3,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames18_ES5.ts (1 errors) ==== + function foo() { + var obj = { + [this.bar]: 0 + ~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames18_ES5.js b/tests/baselines/reference/computedPropertyNames18_ES5.js new file mode 100644 index 00000000000..8472e355cd1 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames18_ES5.js @@ -0,0 +1,13 @@ +//// [computedPropertyNames18_ES5.ts] +function foo() { + var obj = { + [this.bar]: 0 + } +} + +//// [computedPropertyNames18_ES5.js] +function foo() { + var obj = { + [this.bar]: 0 + }; +} diff --git a/tests/baselines/reference/computedPropertyNames19_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames19_ES5.errors.txt new file mode 100644 index 00000000000..9fbad563f8a --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames19_ES5.errors.txt @@ -0,0 +1,14 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES5.ts(3,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES5.ts(3,10): error TS2331: 'this' cannot be referenced in a module body. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES5.ts (2 errors) ==== + module M { + var obj = { + [this.bar]: 0 + ~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~ +!!! error TS2331: 'this' cannot be referenced in a module body. + } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames19_ES5.js b/tests/baselines/reference/computedPropertyNames19_ES5.js new file mode 100644 index 00000000000..50fbd89595d --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames19_ES5.js @@ -0,0 +1,14 @@ +//// [computedPropertyNames19_ES5.ts] +module M { + var obj = { + [this.bar]: 0 + } +} + +//// [computedPropertyNames19_ES5.js] +var M; +(function (M) { + var obj = { + [this.bar]: 0 + }; +})(M || (M = {})); diff --git a/tests/baselines/reference/computedPropertyNames1_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames1_ES5.errors.txt new file mode 100644 index 00000000000..f5c28a0cab8 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames1_ES5.errors.txt @@ -0,0 +1,19 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES5.ts(2,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES5.ts(2,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES5.ts(3,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES5.ts(3,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES5.ts (4 errors) ==== + var v = { + get [0 + 1]() { return 0 }, + ~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + set [0 + 1](v: string) { } //No error + ~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames1_ES5.js b/tests/baselines/reference/computedPropertyNames1_ES5.js new file mode 100644 index 00000000000..3c58cca5b22 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames1_ES5.js @@ -0,0 +1,14 @@ +//// [computedPropertyNames1_ES5.ts] +var v = { + get [0 + 1]() { return 0 }, + set [0 + 1](v: string) { } //No error +} + +//// [computedPropertyNames1_ES5.js] +var v = { + get [0 + 1]() { + return 0; + }, + set [0 + 1](v) { + } //No error +}; diff --git a/tests/baselines/reference/computedPropertyNames20_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames20_ES5.errors.txt new file mode 100644 index 00000000000..c8f79ea944a --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames20_ES5.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames20_ES5.ts(2,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames20_ES5.ts (1 errors) ==== + var obj = { + [this.bar]: 0 + ~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames20_ES5.js b/tests/baselines/reference/computedPropertyNames20_ES5.js new file mode 100644 index 00000000000..347bbd71abc --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames20_ES5.js @@ -0,0 +1,9 @@ +//// [computedPropertyNames20_ES5.ts] +var obj = { + [this.bar]: 0 +} + +//// [computedPropertyNames20_ES5.js] +var obj = { + [this.bar]: 0 +}; diff --git a/tests/baselines/reference/computedPropertyNames21_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames21_ES5.errors.txt new file mode 100644 index 00000000000..437417107a6 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames21_ES5.errors.txt @@ -0,0 +1,15 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames21_ES5.ts(5,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames21_ES5.ts(5,6): error TS2465: 'this' cannot be referenced in a computed property name. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames21_ES5.ts (2 errors) ==== + class C { + bar() { + return 0; + } + [this.bar()]() { } + ~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~ +!!! error TS2465: 'this' cannot be referenced in a computed property name. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames21_ES5.js b/tests/baselines/reference/computedPropertyNames21_ES5.js new file mode 100644 index 00000000000..2678cdc2286 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames21_ES5.js @@ -0,0 +1,19 @@ +//// [computedPropertyNames21_ES5.ts] +class C { + bar() { + return 0; + } + [this.bar()]() { } +} + +//// [computedPropertyNames21_ES5.js] +var C = (function () { + function C() { + } + C.prototype.bar = function () { + return 0; + }; + C.prototype[this.bar()] = function () { + }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames22_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames22_ES5.errors.txt new file mode 100644 index 00000000000..1ec6413b117 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames22_ES5.errors.txt @@ -0,0 +1,14 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames22_ES5.ts(4,13): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames22_ES5.ts (1 errors) ==== + class C { + bar() { + var obj = { + [this.bar()]() { } + ~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + }; + return 0; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames22_ES5.js b/tests/baselines/reference/computedPropertyNames22_ES5.js new file mode 100644 index 00000000000..a3881b01845 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames22_ES5.js @@ -0,0 +1,23 @@ +//// [computedPropertyNames22_ES5.ts] +class C { + bar() { + var obj = { + [this.bar()]() { } + }; + return 0; + } +} + +//// [computedPropertyNames22_ES5.js] +var C = (function () { + function C() { + } + C.prototype.bar = function () { + var obj = { + [this.bar()]: function () { + } + }; + return 0; + }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames23_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames23_ES5.errors.txt new file mode 100644 index 00000000000..76227dccaf5 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames23_ES5.errors.txt @@ -0,0 +1,22 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames23_ES5.ts(5,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames23_ES5.ts(6,11): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames23_ES5.ts(6,12): error TS2465: 'this' cannot be referenced in a computed property name. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames23_ES5.ts (3 errors) ==== + class C { + bar() { + return 0; + } + [ + ~ + { [this.bar()]: 1 }[0] + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~ +!!! error TS2465: 'this' cannot be referenced in a computed property name. + ]() { } + ~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames23_ES5.js b/tests/baselines/reference/computedPropertyNames23_ES5.js new file mode 100644 index 00000000000..6e0e63dcf6a --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames23_ES5.js @@ -0,0 +1,21 @@ +//// [computedPropertyNames23_ES5.ts] +class C { + bar() { + return 0; + } + [ + { [this.bar()]: 1 }[0] + ]() { } +} + +//// [computedPropertyNames23_ES5.js] +var C = (function () { + function C() { + } + C.prototype.bar = function () { + return 0; + }; + C.prototype[{ [this.bar()]: 1 }[0]] = function () { + }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames24_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames24_ES5.errors.txt new file mode 100644 index 00000000000..2cb804133aa --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames24_ES5.errors.txt @@ -0,0 +1,19 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames24_ES5.ts(9,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames24_ES5.ts(9,6): error TS2466: 'super' cannot be referenced in a computed property name. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames24_ES5.ts (2 errors) ==== + class Base { + bar() { + return 0; + } + } + class C extends Base { + // Gets emitted as super, not _super, which is consistent with + // use of super in static properties initializers. + [super.bar()]() { } + ~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~ +!!! error TS2466: 'super' cannot be referenced in a computed property name. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames24_ES5.js b/tests/baselines/reference/computedPropertyNames24_ES5.js new file mode 100644 index 00000000000..d24f406c1ad --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames24_ES5.js @@ -0,0 +1,38 @@ +//// [computedPropertyNames24_ES5.ts] +class Base { + bar() { + return 0; + } +} +class C extends Base { + // Gets emitted as super, not _super, which is consistent with + // use of super in static properties initializers. + [super.bar()]() { } +} + +//// [computedPropertyNames24_ES5.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Base = (function () { + function Base() { + } + Base.prototype.bar = function () { + return 0; + }; + return Base; +})(); +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.apply(this, arguments); + } + // Gets emitted as super, not _super, which is consistent with + // use of super in static properties initializers. + C.prototype[super.bar.call(this)] = function () { + }; + return C; +})(Base); diff --git a/tests/baselines/reference/computedPropertyNames25_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames25_ES5.errors.txt new file mode 100644 index 00000000000..38142b2d177 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames25_ES5.errors.txt @@ -0,0 +1,19 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames25_ES5.ts(9,13): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames25_ES5.ts (1 errors) ==== + class Base { + bar() { + return 0; + } + } + class C extends Base { + foo() { + var obj = { + [super.bar()]() { } + ~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + }; + return 0; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames25_ES5.js b/tests/baselines/reference/computedPropertyNames25_ES5.js new file mode 100644 index 00000000000..532751416f2 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames25_ES5.js @@ -0,0 +1,44 @@ +//// [computedPropertyNames25_ES5.ts] +class Base { + bar() { + return 0; + } +} +class C extends Base { + foo() { + var obj = { + [super.bar()]() { } + }; + return 0; + } +} + +//// [computedPropertyNames25_ES5.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Base = (function () { + function Base() { + } + Base.prototype.bar = function () { + return 0; + }; + return Base; +})(); +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.apply(this, arguments); + } + C.prototype.foo = function () { + var obj = { + [_super.prototype.bar.call(this)]: function () { + } + }; + return 0; + }; + return C; +})(Base); diff --git a/tests/baselines/reference/computedPropertyNames26_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames26_ES5.errors.txt new file mode 100644 index 00000000000..fbef1d95ad4 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames26_ES5.errors.txt @@ -0,0 +1,26 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES5.ts(9,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES5.ts(10,11): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES5.ts(10,12): error TS2466: 'super' cannot be referenced in a computed property name. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES5.ts (3 errors) ==== + class Base { + bar() { + return 0; + } + } + class C extends Base { + // Gets emitted as super, not _super, which is consistent with + // use of super in static properties initializers. + [ + ~ + { [super.bar()]: 1 }[0] + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~ +!!! error TS2466: 'super' cannot be referenced in a computed property name. + ]() { } + ~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames26_ES5.js b/tests/baselines/reference/computedPropertyNames26_ES5.js new file mode 100644 index 00000000000..fd76bf20ed8 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames26_ES5.js @@ -0,0 +1,40 @@ +//// [computedPropertyNames26_ES5.ts] +class Base { + bar() { + return 0; + } +} +class C extends Base { + // Gets emitted as super, not _super, which is consistent with + // use of super in static properties initializers. + [ + { [super.bar()]: 1 }[0] + ]() { } +} + +//// [computedPropertyNames26_ES5.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Base = (function () { + function Base() { + } + Base.prototype.bar = function () { + return 0; + }; + return Base; +})(); +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.apply(this, arguments); + } + // Gets emitted as super, not _super, which is consistent with + // use of super in static properties initializers. + C.prototype[{ [super.bar.call(this)]: 1 }[0]] = function () { + }; + return C; +})(Base); diff --git a/tests/baselines/reference/computedPropertyNames27_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames27_ES5.errors.txt new file mode 100644 index 00000000000..4508574cde1 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames27_ES5.errors.txt @@ -0,0 +1,14 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames27_ES5.ts(4,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames27_ES5.ts(4,7): error TS2466: 'super' cannot be referenced in a computed property name. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames27_ES5.ts (2 errors) ==== + class Base { + } + class C extends Base { + [(super(), "prop")]() { } + ~~~~~~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~ +!!! error TS2466: 'super' cannot be referenced in a computed property name. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames27_ES5.js b/tests/baselines/reference/computedPropertyNames27_ES5.js new file mode 100644 index 00000000000..2f550731dfb --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames27_ES5.js @@ -0,0 +1,28 @@ +//// [computedPropertyNames27_ES5.ts] +class Base { +} +class C extends Base { + [(super(), "prop")]() { } +} + +//// [computedPropertyNames27_ES5.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Base = (function () { + function Base() { + } + return Base; +})(); +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.apply(this, arguments); + } + C.prototype[(_super.call(this), "prop")] = function () { + }; + return C; +})(Base); diff --git a/tests/baselines/reference/computedPropertyNames28_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames28_ES5.errors.txt new file mode 100644 index 00000000000..1e52db34288 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames28_ES5.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames28_ES5.ts(7,13): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames28_ES5.ts (1 errors) ==== + class Base { + } + class C extends Base { + constructor() { + super(); + var obj = { + [(super(), "prop")]() { } + ~~~~~~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + }; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames28_ES5.js b/tests/baselines/reference/computedPropertyNames28_ES5.js new file mode 100644 index 00000000000..c79357908da --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames28_ES5.js @@ -0,0 +1,35 @@ +//// [computedPropertyNames28_ES5.ts] +class Base { +} +class C extends Base { + constructor() { + super(); + var obj = { + [(super(), "prop")]() { } + }; + } +} + +//// [computedPropertyNames28_ES5.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Base = (function () { + function Base() { + } + return Base; +})(); +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.call(this); + var obj = { + [(_super.call(this), "prop")]: function () { + } + }; + } + return C; +})(Base); diff --git a/tests/baselines/reference/computedPropertyNames29_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames29_ES5.errors.txt new file mode 100644 index 00000000000..0b248e0d9ca --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames29_ES5.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames29_ES5.ts(5,17): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames29_ES5.ts (1 errors) ==== + class C { + bar() { + () => { + var obj = { + [this.bar()]() { } // needs capture + ~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + }; + } + return 0; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames29_ES5.js b/tests/baselines/reference/computedPropertyNames29_ES5.js new file mode 100644 index 00000000000..de0667a874c --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames29_ES5.js @@ -0,0 +1,28 @@ +//// [computedPropertyNames29_ES5.ts] +class C { + bar() { + () => { + var obj = { + [this.bar()]() { } // needs capture + }; + } + return 0; + } +} + +//// [computedPropertyNames29_ES5.js] +var C = (function () { + function C() { + } + C.prototype.bar = function () { + var _this = this; + (function () { + var obj = { + [_this.bar()]: function () { + } // needs capture + }; + }); + return 0; + }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames2_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames2_ES5.errors.txt new file mode 100644 index 00000000000..e25f3b765e9 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames2_ES5.errors.txt @@ -0,0 +1,37 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts(4,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts(5,12): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts(6,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts(6,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts(7,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts(8,16): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts(8,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts(9,16): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts (8 errors) ==== + var methodName = "method"; + var accessorName = "accessor"; + class C { + [methodName]() { } + ~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + static [methodName]() { } + ~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + get [accessorName]() { } + ~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~~~~~~~~ +!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. + set [accessorName](v) { } + ~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + static get [accessorName]() { } + ~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~~~~~~~~ +!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. + static set [accessorName](v) { } + ~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames2_ES5.js b/tests/baselines/reference/computedPropertyNames2_ES5.js new file mode 100644 index 00000000000..97d9a673bbb --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames2_ES5.js @@ -0,0 +1,48 @@ +//// [computedPropertyNames2_ES5.ts] +var methodName = "method"; +var accessorName = "accessor"; +class C { + [methodName]() { } + static [methodName]() { } + get [accessorName]() { } + set [accessorName](v) { } + static get [accessorName]() { } + static set [accessorName](v) { } +} + +//// [computedPropertyNames2_ES5.js] +var methodName = "method"; +var accessorName = "accessor"; +var C = (function () { + function C() { + } + C.prototype[methodName] = function () { + }; + C[methodName] = function () { + }; + Object.defineProperty(C.prototype, accessorName, { + get: function () { + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, accessorName, { + set: function (v) { + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, accessorName, { + get: function () { + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, accessorName, { + set: function (v) { + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames30_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames30_ES5.errors.txt new file mode 100644 index 00000000000..a8c51a03246 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames30_ES5.errors.txt @@ -0,0 +1,24 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES5.ts(11,17): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES5.ts(11,19): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES5.ts (2 errors) ==== + class Base { + } + class C extends Base { + constructor() { + super(); + () => { + var obj = { + // Ideally, we would capture this. But the reference is + // illegal, and not capturing this is consistent with + //treatment of other similar violations. + [(super(), "prop")]() { } + ~~~~~~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~ +!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors + }; + } + } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames30_ES5.js b/tests/baselines/reference/computedPropertyNames30_ES5.js new file mode 100644 index 00000000000..995cb2f8bf0 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames30_ES5.js @@ -0,0 +1,45 @@ +//// [computedPropertyNames30_ES5.ts] +class Base { +} +class C extends Base { + constructor() { + super(); + () => { + var obj = { + // Ideally, we would capture this. But the reference is + // illegal, and not capturing this is consistent with + //treatment of other similar violations. + [(super(), "prop")]() { } + }; + } + } +} + +//// [computedPropertyNames30_ES5.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Base = (function () { + function Base() { + } + return Base; +})(); +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.call(this); + (function () { + var obj = { + // Ideally, we would capture this. But the reference is + // illegal, and not capturing this is consistent with + //treatment of other similar violations. + [(_super.call(this), "prop")]: function () { + } + }; + }); + } + return C; +})(Base); diff --git a/tests/baselines/reference/computedPropertyNames31_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames31_ES5.errors.txt new file mode 100644 index 00000000000..ab2f4783e36 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames31_ES5.errors.txt @@ -0,0 +1,21 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames31_ES5.ts(10,17): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames31_ES5.ts (1 errors) ==== + class Base { + bar() { + return 0; + } + } + class C extends Base { + foo() { + () => { + var obj = { + [super.bar()]() { } // needs capture + ~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + }; + } + return 0; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames31_ES5.js b/tests/baselines/reference/computedPropertyNames31_ES5.js new file mode 100644 index 00000000000..81d91a3ba31 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames31_ES5.js @@ -0,0 +1,49 @@ +//// [computedPropertyNames31_ES5.ts] +class Base { + bar() { + return 0; + } +} +class C extends Base { + foo() { + () => { + var obj = { + [super.bar()]() { } // needs capture + }; + } + return 0; + } +} + +//// [computedPropertyNames31_ES5.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Base = (function () { + function Base() { + } + Base.prototype.bar = function () { + return 0; + }; + return Base; +})(); +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.apply(this, arguments); + } + C.prototype.foo = function () { + var _this = this; + (function () { + var obj = { + [_super.prototype.bar.call(_this)]: function () { + } // needs capture + }; + }); + return 0; + }; + return C; +})(Base); diff --git a/tests/baselines/reference/computedPropertyNames32_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames32_ES5.errors.txt new file mode 100644 index 00000000000..2cbba4b9b62 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames32_ES5.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames32_ES5.ts(6,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames32_ES5.ts(6,10): error TS2466: A computed property name cannot reference a type parameter from its containing type. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames32_ES5.ts (2 errors) ==== + function foo() { return '' } + class C { + bar() { + return 0; + } + [foo()]() { } + ~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~ +!!! error TS2466: A computed property name cannot reference a type parameter from its containing type. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames32_ES5.js b/tests/baselines/reference/computedPropertyNames32_ES5.js new file mode 100644 index 00000000000..5a541202582 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames32_ES5.js @@ -0,0 +1,23 @@ +//// [computedPropertyNames32_ES5.ts] +function foo() { return '' } +class C { + bar() { + return 0; + } + [foo()]() { } +} + +//// [computedPropertyNames32_ES5.js] +function foo() { + return ''; +} +var C = (function () { + function C() { + } + C.prototype.bar = function () { + return 0; + }; + C.prototype[foo()] = function () { + }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames33_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames33_ES5.errors.txt new file mode 100644 index 00000000000..ce79d83627c --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames33_ES5.errors.txt @@ -0,0 +1,15 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames33_ES5.ts(5,13): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames33_ES5.ts (1 errors) ==== + function foo() { return '' } + class C { + bar() { + var obj = { + [foo()]() { } + ~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + }; + return 0; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames33_ES5.js b/tests/baselines/reference/computedPropertyNames33_ES5.js new file mode 100644 index 00000000000..982f6e69c46 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames33_ES5.js @@ -0,0 +1,27 @@ +//// [computedPropertyNames33_ES5.ts] +function foo() { return '' } +class C { + bar() { + var obj = { + [foo()]() { } + }; + return 0; + } +} + +//// [computedPropertyNames33_ES5.js] +function foo() { + return ''; +} +var C = (function () { + function C() { + } + C.prototype.bar = function () { + var obj = { + [foo()]: function () { + } + }; + return 0; + }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames34_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames34_ES5.errors.txt new file mode 100644 index 00000000000..99f53d8b13b --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames34_ES5.errors.txt @@ -0,0 +1,18 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames34_ES5.ts(5,13): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames34_ES5.ts(5,18): error TS2302: Static members cannot reference class type parameters. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames34_ES5.ts (2 errors) ==== + function foo() { return '' } + class C { + static bar() { + var obj = { + [foo()]() { } + ~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~ +!!! error TS2302: Static members cannot reference class type parameters. + }; + return 0; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames34_ES5.js b/tests/baselines/reference/computedPropertyNames34_ES5.js new file mode 100644 index 00000000000..3c588af07df --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames34_ES5.js @@ -0,0 +1,27 @@ +//// [computedPropertyNames34_ES5.ts] +function foo() { return '' } +class C { + static bar() { + var obj = { + [foo()]() { } + }; + return 0; + } +} + +//// [computedPropertyNames34_ES5.js] +function foo() { + return ''; +} +var C = (function () { + function C() { + } + C.bar = function () { + var obj = { + [foo()]: function () { + } + }; + return 0; + }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames35_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames35_ES5.errors.txt new file mode 100644 index 00000000000..4f94b54d3c7 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames35_ES5.errors.txt @@ -0,0 +1,14 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES5.ts(4,5): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES5.ts(4,10): error TS2466: A computed property name cannot reference a type parameter from its containing type. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES5.ts (2 errors) ==== + function foo() { return '' } + interface I { + bar(): string; + [foo()](): void; + ~~~~~~~~~~ +!!! error TS1169: Computed property names are not allowed in interfaces. + ~ +!!! error TS2466: A computed property name cannot reference a type parameter from its containing type. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames35_ES5.js b/tests/baselines/reference/computedPropertyNames35_ES5.js new file mode 100644 index 00000000000..b55743a2d83 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames35_ES5.js @@ -0,0 +1,11 @@ +//// [computedPropertyNames35_ES5.ts] +function foo() { return '' } +interface I { + bar(): string; + [foo()](): void; +} + +//// [computedPropertyNames35_ES5.js] +function foo() { + return ''; +} diff --git a/tests/baselines/reference/computedPropertyNames36_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames36_ES5.errors.txt new file mode 100644 index 00000000000..fe90ccf2a71 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames36_ES5.errors.txt @@ -0,0 +1,22 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES5.ts(8,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES5.ts(8,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES5.ts(9,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES5.ts (3 errors) ==== + class Foo { x } + class Foo2 { x; y } + + class C { + [s: string]: Foo2; + + // Computed properties + get ["get1"]() { return new Foo } + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. + ~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + set ["set1"](p: Foo2) { } + ~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames36_ES5.js b/tests/baselines/reference/computedPropertyNames36_ES5.js new file mode 100644 index 00000000000..fa92da7b7b6 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames36_ES5.js @@ -0,0 +1,42 @@ +//// [computedPropertyNames36_ES5.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: Foo2; + + // Computed properties + get ["get1"]() { return new Foo } + set ["set1"](p: Foo2) { } +} + +//// [computedPropertyNames36_ES5.js] +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "get1", { + // Computed properties + get: function () { + return new Foo; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, "set1", { + set: function (p) { + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames37_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames37_ES5.errors.txt new file mode 100644 index 00000000000..562f3756e59 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames37_ES5.errors.txt @@ -0,0 +1,19 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames37_ES5.ts(8,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames37_ES5.ts(9,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames37_ES5.ts (2 errors) ==== + class Foo { x } + class Foo2 { x; y } + + class C { + [s: number]: Foo2; + + // Computed properties + get ["get1"]() { return new Foo } + ~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + set ["set1"](p: Foo2) { } + ~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames37_ES5.js b/tests/baselines/reference/computedPropertyNames37_ES5.js new file mode 100644 index 00000000000..f185e93db3c --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames37_ES5.js @@ -0,0 +1,42 @@ +//// [computedPropertyNames37_ES5.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + [s: number]: Foo2; + + // Computed properties + get ["get1"]() { return new Foo } + set ["set1"](p: Foo2) { } +} + +//// [computedPropertyNames37_ES5.js] +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "get1", { + // Computed properties + get: function () { + return new Foo; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, "set1", { + set: function (p) { + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames38_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames38_ES5.errors.txt new file mode 100644 index 00000000000..7f7579d9eea --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames38_ES5.errors.txt @@ -0,0 +1,22 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES5.ts(8,5): error TS2411: Property '[1 << 6]' of type 'Foo' is not assignable to string index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES5.ts(8,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES5.ts(9,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES5.ts (3 errors) ==== + class Foo { x } + class Foo2 { x; y } + + class C { + [s: string]: Foo2; + + // Computed properties + get [1 << 6]() { return new Foo } + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2411: Property '[1 << 6]' of type 'Foo' is not assignable to string index type 'Foo2'. + ~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + set [1 << 6](p: Foo2) { } + ~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames38_ES5.js b/tests/baselines/reference/computedPropertyNames38_ES5.js new file mode 100644 index 00000000000..42115927b30 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames38_ES5.js @@ -0,0 +1,42 @@ +//// [computedPropertyNames38_ES5.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: Foo2; + + // Computed properties + get [1 << 6]() { return new Foo } + set [1 << 6](p: Foo2) { } +} + +//// [computedPropertyNames38_ES5.js] +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, 1 << 6, { + // Computed properties + get: function () { + return new Foo; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, 1 << 6, { + set: function (p) { + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames39_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames39_ES5.errors.txt new file mode 100644 index 00000000000..7f4389794fb --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames39_ES5.errors.txt @@ -0,0 +1,22 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES5.ts(8,5): error TS2412: Property '[1 << 6]' of type 'Foo' is not assignable to numeric index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES5.ts(8,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES5.ts(9,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES5.ts (3 errors) ==== + class Foo { x } + class Foo2 { x; y } + + class C { + [s: number]: Foo2; + + // Computed properties + get [1 << 6]() { return new Foo } + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2412: Property '[1 << 6]' of type 'Foo' is not assignable to numeric index type 'Foo2'. + ~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + set [1 << 6](p: Foo2) { } + ~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames39_ES5.js b/tests/baselines/reference/computedPropertyNames39_ES5.js new file mode 100644 index 00000000000..12cc55f1315 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames39_ES5.js @@ -0,0 +1,42 @@ +//// [computedPropertyNames39_ES5.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + [s: number]: Foo2; + + // Computed properties + get [1 << 6]() { return new Foo } + set [1 << 6](p: Foo2) { } +} + +//// [computedPropertyNames39_ES5.js] +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, 1 << 6, { + // Computed properties + get: function () { + return new Foo; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, 1 << 6, { + set: function (p) { + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames3_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames3_ES5.errors.txt new file mode 100644 index 00000000000..b484ee7269f --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames3_ES5.errors.txt @@ -0,0 +1,48 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(3,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(4,12): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(4,12): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(5,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(5,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(6,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(7,16): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(7,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(8,16): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts (12 errors) ==== + var id; + class C { + [0 + 1]() { } + ~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + static [() => { }]() { } + ~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + get [delete id]() { } + ~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~~~~~ +!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. + ~~~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + set [[0, 1]](v) { } + ~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + static get [""]() { } + ~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~~~~~~ +!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. + ~~~~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + static set [id.toString()](v) { } + ~~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames3_ES5.js b/tests/baselines/reference/computedPropertyNames3_ES5.js new file mode 100644 index 00000000000..fe0b0ec1841 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames3_ES5.js @@ -0,0 +1,47 @@ +//// [computedPropertyNames3_ES5.ts] +var id; +class C { + [0 + 1]() { } + static [() => { }]() { } + get [delete id]() { } + set [[0, 1]](v) { } + static get [""]() { } + static set [id.toString()](v) { } +} + +//// [computedPropertyNames3_ES5.js] +var id; +var C = (function () { + function C() { + } + C.prototype[0 + 1] = function () { + }; + C[function () { + }] = function () { + }; + Object.defineProperty(C.prototype, delete id, { + get: function () { + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, [0, 1], { + set: function (v) { + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, "", { + get: function () { + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, id.toString(), { + set: function (v) { + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames40_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames40_ES5.errors.txt new file mode 100644 index 00000000000..762d2d44e20 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames40_ES5.errors.txt @@ -0,0 +1,22 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES5.ts(8,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES5.ts(8,5): error TS2411: Property '[""]' of type '() => Foo' is not assignable to string index type '() => Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES5.ts(9,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES5.ts (3 errors) ==== + class Foo { x } + class Foo2 { x; y } + + class C { + [s: string]: () => Foo2; + + // Computed properties + [""]() { return new Foo } + ~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2411: Property '[""]' of type '() => Foo' is not assignable to string index type '() => Foo2'. + [""]() { return new Foo2 } + ~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames40_ES5.js b/tests/baselines/reference/computedPropertyNames40_ES5.js new file mode 100644 index 00000000000..887c5c3847e --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames40_ES5.js @@ -0,0 +1,35 @@ +//// [computedPropertyNames40_ES5.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: () => Foo2; + + // Computed properties + [""]() { return new Foo } + [""]() { return new Foo2 } +} + +//// [computedPropertyNames40_ES5.js] +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + // Computed properties + C.prototype[""] = function () { + return new Foo; + }; + C.prototype[""] = function () { + return new Foo2; + }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames41_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames41_ES5.errors.txt new file mode 100644 index 00000000000..a2251da6a86 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames41_ES5.errors.txt @@ -0,0 +1,15 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames41_ES5.ts(8,12): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames41_ES5.ts (1 errors) ==== + class Foo { x } + class Foo2 { x; y } + + class C { + [s: string]: () => Foo2; + + // Computed properties + static [""]() { return new Foo } + ~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames41_ES5.js b/tests/baselines/reference/computedPropertyNames41_ES5.js new file mode 100644 index 00000000000..b4223ec5217 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames41_ES5.js @@ -0,0 +1,31 @@ +//// [computedPropertyNames41_ES5.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: () => Foo2; + + // Computed properties + static [""]() { return new Foo } +} + +//// [computedPropertyNames41_ES5.js] +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + // Computed properties + C[""] = function () { + return new Foo; + }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames42_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames42_ES5.errors.txt new file mode 100644 index 00000000000..35a47c4e54a --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames42_ES5.errors.txt @@ -0,0 +1,18 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES5.ts(8,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES5.ts(8,5): error TS2411: Property '[""]' of type 'Foo' is not assignable to string index type 'Foo2'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES5.ts (2 errors) ==== + class Foo { x } + class Foo2 { x; y } + + class C { + [s: string]: Foo2; + + // Computed properties + [""]: Foo; + ~~~~ +!!! error TS1166: Computed property names are not allowed in class property declarations. + ~~~~~~~~~~ +!!! error TS2411: Property '[""]' of type 'Foo' is not assignable to string index type 'Foo2'. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames42_ES5.js b/tests/baselines/reference/computedPropertyNames42_ES5.js new file mode 100644 index 00000000000..f4fda8fc829 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames42_ES5.js @@ -0,0 +1,27 @@ +//// [computedPropertyNames42_ES5.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: Foo2; + + // Computed properties + [""]: Foo; +} + +//// [computedPropertyNames42_ES5.js] +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames43_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames43_ES5.errors.txt new file mode 100644 index 00000000000..2654d0076e3 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames43_ES5.errors.txt @@ -0,0 +1,24 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES5.ts(10,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES5.ts(10,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES5.ts(11,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES5.ts (3 errors) ==== + class Foo { x } + class Foo2 { x; y } + + class C { + [s: string]: Foo2; + } + + class D extends C { + // Computed properties + get ["get1"]() { return new Foo } + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. + ~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + set ["set1"](p: Foo2) { } + ~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames43_ES5.js b/tests/baselines/reference/computedPropertyNames43_ES5.js new file mode 100644 index 00000000000..f7faa347986 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames43_ES5.js @@ -0,0 +1,57 @@ +//// [computedPropertyNames43_ES5.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: Foo2; +} + +class D extends C { + // Computed properties + get ["get1"]() { return new Foo } + set ["set1"](p: Foo2) { } +} + +//// [computedPropertyNames43_ES5.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + return C; +})(); +var D = (function (_super) { + __extends(D, _super); + function D() { + _super.apply(this, arguments); + } + Object.defineProperty(D.prototype, "get1", { + // Computed properties + get: function () { + return new Foo; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(D.prototype, "set1", { + set: function (p) { + }, + enumerable: true, + configurable: true + }); + return D; +})(C); diff --git a/tests/baselines/reference/computedPropertyNames44_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames44_ES5.errors.txt new file mode 100644 index 00000000000..27921efa1fb --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames44_ES5.errors.txt @@ -0,0 +1,26 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts(6,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts(6,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts(10,5): error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts(10,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts (4 errors) ==== + class Foo { x } + class Foo2 { x; y } + + class C { + [s: string]: Foo2; + get ["get1"]() { return new Foo } + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. + ~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } + + class D extends C { + set ["set1"](p: Foo) { } + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'. + ~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames44_ES5.js b/tests/baselines/reference/computedPropertyNames44_ES5.js new file mode 100644 index 00000000000..072b3e90681 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames44_ES5.js @@ -0,0 +1,55 @@ +//// [computedPropertyNames44_ES5.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: Foo2; + get ["get1"]() { return new Foo } +} + +class D extends C { + set ["set1"](p: Foo) { } +} + +//// [computedPropertyNames44_ES5.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "get1", { + get: function () { + return new Foo; + }, + enumerable: true, + configurable: true + }); + return C; +})(); +var D = (function (_super) { + __extends(D, _super); + function D() { + _super.apply(this, arguments); + } + Object.defineProperty(D.prototype, "set1", { + set: function (p) { + }, + enumerable: true, + configurable: true + }); + return D; +})(C); diff --git a/tests/baselines/reference/computedPropertyNames45_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames45_ES5.errors.txt new file mode 100644 index 00000000000..92b87702561 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames45_ES5.errors.txt @@ -0,0 +1,24 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES5.ts(5,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES5.ts(11,5): error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES5.ts(11,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES5.ts (3 errors) ==== + class Foo { x } + class Foo2 { x; y } + + class C { + get ["get1"]() { return new Foo } + ~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } + + class D extends C { + // No error when the indexer is in a class more derived than the computed property + [s: string]: Foo2; + set ["set1"](p: Foo) { } + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'. + ~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames45_ES5.js b/tests/baselines/reference/computedPropertyNames45_ES5.js new file mode 100644 index 00000000000..4389b32a835 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames45_ES5.js @@ -0,0 +1,56 @@ +//// [computedPropertyNames45_ES5.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + get ["get1"]() { return new Foo } +} + +class D extends C { + // No error when the indexer is in a class more derived than the computed property + [s: string]: Foo2; + set ["set1"](p: Foo) { } +} + +//// [computedPropertyNames45_ES5.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "get1", { + get: function () { + return new Foo; + }, + enumerable: true, + configurable: true + }); + return C; +})(); +var D = (function (_super) { + __extends(D, _super); + function D() { + _super.apply(this, arguments); + } + Object.defineProperty(D.prototype, "set1", { + set: function (p) { + }, + enumerable: true, + configurable: true + }); + return D; +})(C); diff --git a/tests/baselines/reference/computedPropertyNames46_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames46_ES5.errors.txt new file mode 100644 index 00000000000..6af18c9e685 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames46_ES5.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames46_ES5.ts(2,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames46_ES5.ts (1 errors) ==== + var o = { + ["" || 0]: 0 + ~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + }; \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames46_ES5.js b/tests/baselines/reference/computedPropertyNames46_ES5.js new file mode 100644 index 00000000000..6c7a393ccbe --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames46_ES5.js @@ -0,0 +1,9 @@ +//// [computedPropertyNames46_ES5.ts] +var o = { + ["" || 0]: 0 +}; + +//// [computedPropertyNames46_ES5.js] +var o = { + ["" || 0]: 0 +}; diff --git a/tests/baselines/reference/computedPropertyNames47_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames47_ES5.errors.txt new file mode 100644 index 00000000000..2f5af797b64 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames47_ES5.errors.txt @@ -0,0 +1,11 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames47_ES5.ts(4,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames47_ES5.ts (1 errors) ==== + enum E1 { x } + enum E2 { x } + var o = { + [E1.x || E2.x]: 0 + ~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + }; \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames47_ES5.js b/tests/baselines/reference/computedPropertyNames47_ES5.js new file mode 100644 index 00000000000..10e31bd9599 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames47_ES5.js @@ -0,0 +1,19 @@ +//// [computedPropertyNames47_ES5.ts] +enum E1 { x } +enum E2 { x } +var o = { + [E1.x || E2.x]: 0 +}; + +//// [computedPropertyNames47_ES5.js] +var E1; +(function (E1) { + E1[E1["x"] = 0] = "x"; +})(E1 || (E1 = {})); +var E2; +(function (E2) { + E2[E2["x"] = 0] = "x"; +})(E2 || (E2 = {})); +var o = { + [0 /* x */ || 0 /* x */]: 0 +}; diff --git a/tests/baselines/reference/computedPropertyNames48_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames48_ES5.errors.txt new file mode 100644 index 00000000000..cbda0c73c1f --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames48_ES5.errors.txt @@ -0,0 +1,38 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES5.ts(8,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES5.ts(8,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES5.ts(12,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES5.ts(12,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES5.ts(16,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES5.ts(16,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES5.ts (6 errors) ==== + declare function extractIndexer(p: { [n: number]: T }): T; + + enum E { x } + + var a: any; + + extractIndexer({ + [a]: "" + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + }); // Should return string + + extractIndexer({ + [E.x]: "" + ~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + }); // Should return string + + extractIndexer({ + ["" || 0]: "" + ~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + }); // Should return any (widened form of undefined) \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames48_ES5.js b/tests/baselines/reference/computedPropertyNames48_ES5.js new file mode 100644 index 00000000000..eb1c50857c7 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames48_ES5.js @@ -0,0 +1,34 @@ +//// [computedPropertyNames48_ES5.ts] +declare function extractIndexer(p: { [n: number]: T }): T; + +enum E { x } + +var a: any; + +extractIndexer({ + [a]: "" +}); // Should return string + +extractIndexer({ + [E.x]: "" +}); // Should return string + +extractIndexer({ + ["" || 0]: "" +}); // Should return any (widened form of undefined) + +//// [computedPropertyNames48_ES5.js] +var E; +(function (E) { + E[E["x"] = 0] = "x"; +})(E || (E = {})); +var a; +extractIndexer({ + [a]: "" +}); // Should return string +extractIndexer({ + [0 /* x */]: "" +}); // Should return string +extractIndexer({ + ["" || 0]: "" +}); // Should return any (widened form of undefined) diff --git a/tests/baselines/reference/computedPropertyNames4_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames4_ES5.errors.txt new file mode 100644 index 00000000000..39765b8365e --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames4_ES5.errors.txt @@ -0,0 +1,52 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts(5,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts(6,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts(7,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts(8,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts(9,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts(10,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts(11,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts(12,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts(13,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts(14,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts(15,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts (11 errors) ==== + var s: string; + var n: number; + var a: any; + var v = { + [s]: 0, + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [n]: n, + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [s + s]: 1, + ~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [s + n]: 2, + ~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [+s]: s, + ~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [""]: 0, + ~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [0]: 0, + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [a]: 1, + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [true]: 0, + ~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [`hello bye`]: 0, + ~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [`hello ${a} bye`]: 0 + ~~~~~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames4_ES5.js b/tests/baselines/reference/computedPropertyNames4_ES5.js new file mode 100644 index 00000000000..f5a41bd58aa --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames4_ES5.js @@ -0,0 +1,35 @@ +//// [computedPropertyNames4_ES5.ts] +var s: string; +var n: number; +var a: any; +var v = { + [s]: 0, + [n]: n, + [s + s]: 1, + [s + n]: 2, + [+s]: s, + [""]: 0, + [0]: 0, + [a]: 1, + [true]: 0, + [`hello bye`]: 0, + [`hello ${a} bye`]: 0 +} + +//// [computedPropertyNames4_ES5.js] +var s; +var n; +var a; +var v = { + [s]: 0, + [n]: n, + [s + s]: 1, + [s + n]: 2, + [+s]: s, + [""]: 0, + [0]: 0, + [a]: 1, + [true]: 0, + ["hello bye"]: 0, + ["hello " + a + " bye"]: 0 +}; diff --git a/tests/baselines/reference/computedPropertyNames5_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames5_ES5.errors.txt new file mode 100644 index 00000000000..b65197056f7 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames5_ES5.errors.txt @@ -0,0 +1,48 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(3,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(4,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(4,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(5,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(5,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(6,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(7,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(8,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(8,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts (12 errors) ==== + var b: boolean; + var v = { + [b]: 0, + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + [true]: 1, + ~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + [[]]: 0, + ~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + [{}]: 0, + ~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + [undefined]: undefined, + ~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + [null]: null + ~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames5_ES5.js b/tests/baselines/reference/computedPropertyNames5_ES5.js new file mode 100644 index 00000000000..5bdeb8a6637 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames5_ES5.js @@ -0,0 +1,21 @@ +//// [computedPropertyNames5_ES5.ts] +var b: boolean; +var v = { + [b]: 0, + [true]: 1, + [[]]: 0, + [{}]: 0, + [undefined]: undefined, + [null]: null +} + +//// [computedPropertyNames5_ES5.js] +var b; +var v = { + [b]: 0, + [true]: 1, + [[]]: 0, + [{}]: 0, + [undefined]: undefined, + [null]: null +}; diff --git a/tests/baselines/reference/computedPropertyNames6_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames6_ES5.errors.txt new file mode 100644 index 00000000000..c7cc95a06ae --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames6_ES5.errors.txt @@ -0,0 +1,26 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES5.ts(5,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES5.ts(6,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES5.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES5.ts(7,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES5.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES5.ts (5 errors) ==== + var p1: number | string; + var p2: number | number[]; + var p3: string | boolean; + var v = { + [p1]: 0, + ~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [p2]: 1, + ~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + [p3]: 2 + ~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames6_ES5.js b/tests/baselines/reference/computedPropertyNames6_ES5.js new file mode 100644 index 00000000000..5772dc9ab89 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames6_ES5.js @@ -0,0 +1,19 @@ +//// [computedPropertyNames6_ES5.ts] +var p1: number | string; +var p2: number | number[]; +var p3: string | boolean; +var v = { + [p1]: 0, + [p2]: 1, + [p3]: 2 +} + +//// [computedPropertyNames6_ES5.js] +var p1; +var p2; +var p3; +var v = { + [p1]: 0, + [p2]: 1, + [p3]: 2 +}; diff --git a/tests/baselines/reference/computedPropertyNames7_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames7_ES5.errors.txt new file mode 100644 index 00000000000..389d47c2e0e --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames7_ES5.errors.txt @@ -0,0 +1,12 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames7_ES5.ts(5,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames7_ES5.ts (1 errors) ==== + enum E { + member + } + var v = { + [E.member]: 0 + ~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames7_ES5.js b/tests/baselines/reference/computedPropertyNames7_ES5.js new file mode 100644 index 00000000000..32a0bdc70d1 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames7_ES5.js @@ -0,0 +1,16 @@ +//// [computedPropertyNames7_ES5.ts] +enum E { + member +} +var v = { + [E.member]: 0 +} + +//// [computedPropertyNames7_ES5.js] +var E; +(function (E) { + E[E["member"] = 0] = "member"; +})(E || (E = {})); +var v = { + [0 /* member */]: 0 +}; diff --git a/tests/baselines/reference/computedPropertyNames8_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames8_ES5.errors.txt new file mode 100644 index 00000000000..e66d445fdda --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames8_ES5.errors.txt @@ -0,0 +1,23 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES5.ts(5,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES5.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES5.ts(6,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES5.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES5.ts (4 errors) ==== + function f() { + var t: T; + var u: U; + var v = { + [t]: 0, + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + [u]: 1 + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + }; + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames8_ES5.js b/tests/baselines/reference/computedPropertyNames8_ES5.js new file mode 100644 index 00000000000..8381a681534 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames8_ES5.js @@ -0,0 +1,19 @@ +//// [computedPropertyNames8_ES5.ts] +function f() { + var t: T; + var u: U; + var v = { + [t]: 0, + [u]: 1 + }; +} + +//// [computedPropertyNames8_ES5.js] +function f() { + var t; + var u; + var v = { + [t]: 0, + [u]: 1 + }; +} diff --git a/tests/baselines/reference/computedPropertyNames9_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames9_ES5.errors.txt new file mode 100644 index 00000000000..1b97c1bfc5c --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames9_ES5.errors.txt @@ -0,0 +1,25 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES5.ts(7,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES5.ts(8,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES5.ts(9,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES5.ts(9,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES5.ts (4 errors) ==== + function f(s: string): string; + function f(n: number): number; + function f(x: T): T; + function f(x): any { } + + var v = { + [f("")]: 0, + ~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [f(0)]: 0, + ~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [f(true)]: 0 + ~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames9_ES5.js b/tests/baselines/reference/computedPropertyNames9_ES5.js new file mode 100644 index 00000000000..e1092d0d3ec --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames9_ES5.js @@ -0,0 +1,20 @@ +//// [computedPropertyNames9_ES5.ts] +function f(s: string): string; +function f(n: number): number; +function f(x: T): T; +function f(x): any { } + +var v = { + [f("")]: 0, + [f(0)]: 0, + [f(true)]: 0 +} + +//// [computedPropertyNames9_ES5.js] +function f(x) { +} +var v = { + [f("")]: 0, + [f(0)]: 0, + [f(true)]: 0 +}; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.errors.txt new file mode 100644 index 00000000000..5bfd1959647 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.errors.txt @@ -0,0 +1,26 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10_ES5.ts(5,5): error TS2322: Type '{ [x: number]: string | number; }' is not assignable to type 'I'. + Index signatures are incompatible. + Type 'string | number' is not assignable to type 'boolean'. + Type 'string' is not assignable to type 'boolean'. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10_ES5.ts(6,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10_ES5.ts(7,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10_ES5.ts (3 errors) ==== + interface I { + [s: number]: boolean; + } + + var o: I = { + ~ +!!! error TS2322: Type '{ [x: number]: string | number; }' is not assignable to type 'I'. +!!! error TS2322: Index signatures are incompatible. +!!! error TS2322: Type 'string | number' is not assignable to type 'boolean'. +!!! error TS2322: Type 'string' is not assignable to type 'boolean'. + [+"foo"]: "", + ~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [+"bar"]: 0 + ~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.js new file mode 100644 index 00000000000..0435789b210 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.js @@ -0,0 +1,15 @@ +//// [computedPropertyNamesContextualType10_ES5.ts] +interface I { + [s: number]: boolean; +} + +var o: I = { + [+"foo"]: "", + [+"bar"]: 0 +} + +//// [computedPropertyNamesContextualType10_ES5.js] +var o = { + [+"foo"]: "", + [+"bar"]: 0 +}; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.errors.txt new file mode 100644 index 00000000000..571a7142527 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.errors.txt @@ -0,0 +1,18 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType1_ES5.ts(7,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType1_ES5.ts(8,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType1_ES5.ts (2 errors) ==== + interface I { + [s: string]: (x: string) => number; + [s: number]: (x: any) => number; // Doesn't get hit + } + + var o: I = { + ["" + 0](y) { return y.length; }, + ~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ["" + 1]: y => y.length + ~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.js new file mode 100644 index 00000000000..e58a4dfc86b --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.js @@ -0,0 +1,18 @@ +//// [computedPropertyNamesContextualType1_ES5.ts] +interface I { + [s: string]: (x: string) => number; + [s: number]: (x: any) => number; // Doesn't get hit +} + +var o: I = { + ["" + 0](y) { return y.length; }, + ["" + 1]: y => y.length +} + +//// [computedPropertyNamesContextualType1_ES5.js] +var o = { + ["" + 0]: function (y) { + return y.length; + }, + ["" + 1]: function (y) { return y.length; } +}; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.errors.txt new file mode 100644 index 00000000000..930d67155e0 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.errors.txt @@ -0,0 +1,18 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType2_ES5.ts(7,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType2_ES5.ts(8,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType2_ES5.ts (2 errors) ==== + interface I { + [s: string]: (x: any) => number; // Doesn't get hit + [s: number]: (x: string) => number; + } + + var o: I = { + [+"foo"](y) { return y.length; }, + ~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [+"bar"]: y => y.length + ~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js new file mode 100644 index 00000000000..d7ebdedddbb --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js @@ -0,0 +1,18 @@ +//// [computedPropertyNamesContextualType2_ES5.ts] +interface I { + [s: string]: (x: any) => number; // Doesn't get hit + [s: number]: (x: string) => number; +} + +var o: I = { + [+"foo"](y) { return y.length; }, + [+"bar"]: y => y.length +} + +//// [computedPropertyNamesContextualType2_ES5.js] +var o = { + [+"foo"]: function (y) { + return y.length; + }, + [+"bar"]: function (y) { return y.length; } +}; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.errors.txt new file mode 100644 index 00000000000..487fdd9a9a6 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.errors.txt @@ -0,0 +1,17 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType3_ES5.ts(6,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType3_ES5.ts(7,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType3_ES5.ts (2 errors) ==== + interface I { + [s: string]: (x: string) => number; + } + + var o: I = { + [+"foo"](y) { return y.length; }, + ~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [+"bar"]: y => y.length + ~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.js new file mode 100644 index 00000000000..92a18b720fe --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.js @@ -0,0 +1,17 @@ +//// [computedPropertyNamesContextualType3_ES5.ts] +interface I { + [s: string]: (x: string) => number; +} + +var o: I = { + [+"foo"](y) { return y.length; }, + [+"bar"]: y => y.length +} + +//// [computedPropertyNamesContextualType3_ES5.js] +var o = { + [+"foo"]: function (y) { + return y.length; + }, + [+"bar"]: function (y) { return y.length; } +}; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.errors.txt new file mode 100644 index 00000000000..76f6cfa990f --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.errors.txt @@ -0,0 +1,18 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType4_ES5.ts(7,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType4_ES5.ts(8,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType4_ES5.ts (2 errors) ==== + interface I { + [s: string]: any; + [s: number]: any; + } + + var o: I = { + [""+"foo"]: "", + ~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [""+"bar"]: 0 + ~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.js new file mode 100644 index 00000000000..8777f196d7c --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.js @@ -0,0 +1,16 @@ +//// [computedPropertyNamesContextualType4_ES5.ts] +interface I { + [s: string]: any; + [s: number]: any; +} + +var o: I = { + [""+"foo"]: "", + [""+"bar"]: 0 +} + +//// [computedPropertyNamesContextualType4_ES5.js] +var o = { + ["" + "foo"]: "", + ["" + "bar"]: 0 +}; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.errors.txt new file mode 100644 index 00000000000..4510a92ddf0 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.errors.txt @@ -0,0 +1,18 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType5_ES5.ts(7,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType5_ES5.ts(8,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType5_ES5.ts (2 errors) ==== + interface I { + [s: string]: any; + [s: number]: any; + } + + var o: I = { + [+"foo"]: "", + ~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [+"bar"]: 0 + ~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.js new file mode 100644 index 00000000000..e1197bddd30 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.js @@ -0,0 +1,16 @@ +//// [computedPropertyNamesContextualType5_ES5.ts] +interface I { + [s: string]: any; + [s: number]: any; +} + +var o: I = { + [+"foo"]: "", + [+"bar"]: 0 +} + +//// [computedPropertyNamesContextualType5_ES5.js] +var o = { + [+"foo"]: "", + [+"bar"]: 0 +}; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.errors.txt new file mode 100644 index 00000000000..a72b98c1efc --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.errors.txt @@ -0,0 +1,34 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES5.ts(10,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES5.ts(10,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES5.ts(11,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES5.ts(11,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES5.ts(12,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES5.ts(12,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES5.ts (6 errors) ==== + interface I { + [s: string]: T; + } + + declare function foo(obj: I): T + + foo({ + p: "", + 0: () => { }, + ["hi" + "bye"]: true, + ~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [0 + 1]: 0, + ~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [+"hi"]: [0] + ~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + }); \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.js new file mode 100644 index 00000000000..65bc1fd667c --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.js @@ -0,0 +1,24 @@ +//// [computedPropertyNamesContextualType6_ES5.ts] +interface I { + [s: string]: T; +} + +declare function foo(obj: I): T + +foo({ + p: "", + 0: () => { }, + ["hi" + "bye"]: true, + [0 + 1]: 0, + [+"hi"]: [0] +}); + +//// [computedPropertyNamesContextualType6_ES5.js] +foo({ + p: "", + 0: function () { + }, + ["hi" + "bye"]: true, + [0 + 1]: 0, + [+"hi"]: [0] +}); diff --git a/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.errors.txt new file mode 100644 index 00000000000..153bfc1fbde --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.errors.txt @@ -0,0 +1,34 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES5.ts(10,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES5.ts(10,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES5.ts(11,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES5.ts(11,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES5.ts(12,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES5.ts(12,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES5.ts (6 errors) ==== + interface I { + [s: number]: T; + } + + declare function foo(obj: I): T + + foo({ + p: "", + 0: () => { }, + ["hi" + "bye"]: true, + ~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [0 + 1]: 0, + ~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [+"hi"]: [0] + ~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + }); \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.js new file mode 100644 index 00000000000..2b87d4732ff --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.js @@ -0,0 +1,24 @@ +//// [computedPropertyNamesContextualType7_ES5.ts] +interface I { + [s: number]: T; +} + +declare function foo(obj: I): T + +foo({ + p: "", + 0: () => { }, + ["hi" + "bye"]: true, + [0 + 1]: 0, + [+"hi"]: [0] +}); + +//// [computedPropertyNamesContextualType7_ES5.js] +foo({ + p: "", + 0: function () { + }, + ["hi" + "bye"]: true, + [0 + 1]: 0, + [+"hi"]: [0] +}); diff --git a/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.errors.txt new file mode 100644 index 00000000000..74a235bf087 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.errors.txt @@ -0,0 +1,27 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts(6,5): error TS2322: Type '{ [x: string]: string | number; [x: number]: undefined; }' is not assignable to type 'I'. + Index signatures are incompatible. + Type 'string | number' is not assignable to type 'boolean'. + Type 'string' is not assignable to type 'boolean'. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts(7,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts(8,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts (3 errors) ==== + interface I { + [s: string]: boolean; + [s: number]: boolean; + } + + var o: I = { + ~ +!!! error TS2322: Type '{ [x: string]: string | number; [x: number]: undefined; }' is not assignable to type 'I'. +!!! error TS2322: Index signatures are incompatible. +!!! error TS2322: Type 'string | number' is not assignable to type 'boolean'. +!!! error TS2322: Type 'string' is not assignable to type 'boolean'. + [""+"foo"]: "", + ~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [""+"bar"]: 0 + ~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.js new file mode 100644 index 00000000000..1729c08fe5b --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.js @@ -0,0 +1,16 @@ +//// [computedPropertyNamesContextualType8_ES5.ts] +interface I { + [s: string]: boolean; + [s: number]: boolean; +} + +var o: I = { + [""+"foo"]: "", + [""+"bar"]: 0 +} + +//// [computedPropertyNamesContextualType8_ES5.js] +var o = { + ["" + "foo"]: "", + ["" + "bar"]: 0 +}; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.errors.txt new file mode 100644 index 00000000000..79807602de2 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.errors.txt @@ -0,0 +1,27 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES5.ts(6,5): error TS2322: Type '{ [x: string]: string | number; [x: number]: string | number; }' is not assignable to type 'I'. + Index signatures are incompatible. + Type 'string | number' is not assignable to type 'boolean'. + Type 'string' is not assignable to type 'boolean'. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES5.ts(7,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES5.ts(8,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES5.ts (3 errors) ==== + interface I { + [s: string]: boolean; + [s: number]: boolean; + } + + var o: I = { + ~ +!!! error TS2322: Type '{ [x: string]: string | number; [x: number]: string | number; }' is not assignable to type 'I'. +!!! error TS2322: Index signatures are incompatible. +!!! error TS2322: Type 'string | number' is not assignable to type 'boolean'. +!!! error TS2322: Type 'string' is not assignable to type 'boolean'. + [+"foo"]: "", + ~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [+"bar"]: 0 + ~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.js new file mode 100644 index 00000000000..8f57c58804f --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.js @@ -0,0 +1,16 @@ +//// [computedPropertyNamesContextualType9_ES5.ts] +interface I { + [s: string]: boolean; + [s: number]: boolean; +} + +var o: I = { + [+"foo"]: "", + [+"bar"]: 0 +} + +//// [computedPropertyNamesContextualType9_ES5.js] +var o = { + [+"foo"]: "", + [+"bar"]: 0 +}; diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES5.errors.txt new file mode 100644 index 00000000000..cc370681e4e --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES5.errors.txt @@ -0,0 +1,17 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit1_ES5.ts(2,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit1_ES5.ts(3,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit1_ES5.ts(4,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit1_ES5.ts (3 errors) ==== + class C { + ["" + ""]() { } + ~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + get ["" + ""]() { return 0; } + ~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + set ["" + ""](x) { } + ~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES5.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES5.js new file mode 100644 index 00000000000..246b22230bb --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES5.js @@ -0,0 +1,28 @@ +//// [computedPropertyNamesDeclarationEmit1_ES5.ts] +class C { + ["" + ""]() { } + get ["" + ""]() { return 0; } + set ["" + ""](x) { } +} + +//// [computedPropertyNamesDeclarationEmit1_ES5.js] +var C = (function () { + function C() { + } + C.prototype["" + ""] = function () { + }; + Object.defineProperty(C.prototype, "" + "", { + get: function () { + return 0; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, "" + "", { + set: function (x) { + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES5.errors.txt new file mode 100644 index 00000000000..01263bdd7cf --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES5.errors.txt @@ -0,0 +1,17 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit2_ES5.ts(2,12): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit2_ES5.ts(3,16): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit2_ES5.ts(4,16): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit2_ES5.ts (3 errors) ==== + class C { + static ["" + ""]() { } + ~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + static get ["" + ""]() { return 0; } + ~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + static set ["" + ""](x) { } + ~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES5.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES5.js new file mode 100644 index 00000000000..a3e4e6afd40 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES5.js @@ -0,0 +1,28 @@ +//// [computedPropertyNamesDeclarationEmit2_ES5.ts] +class C { + static ["" + ""]() { } + static get ["" + ""]() { return 0; } + static set ["" + ""](x) { } +} + +//// [computedPropertyNamesDeclarationEmit2_ES5.js] +var C = (function () { + function C() { + } + C["" + ""] = function () { + }; + Object.defineProperty(C, "" + "", { + get: function () { + return 0; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, "" + "", { + set: function (x) { + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES5.errors.txt new file mode 100644 index 00000000000..48deb3be505 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES5.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3_ES5.ts(2,5): error TS1169: Computed property names are not allowed in interfaces. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3_ES5.ts (1 errors) ==== + interface I { + ["" + ""](): void; + ~~~~~~~~~ +!!! error TS1169: Computed property names are not allowed in interfaces. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES5.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES5.js new file mode 100644 index 00000000000..1f339b36faf --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES5.js @@ -0,0 +1,6 @@ +//// [computedPropertyNamesDeclarationEmit3_ES5.ts] +interface I { + ["" + ""](): void; +} + +//// [computedPropertyNamesDeclarationEmit3_ES5.js] diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES5.errors.txt new file mode 100644 index 00000000000..ec16af85fa7 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES5.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4_ES5.ts(2,5): error TS1170: Computed property names are not allowed in type literals. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4_ES5.ts (1 errors) ==== + var v: { + ["" + ""](): void; + ~~~~~~~~~ +!!! error TS1170: Computed property names are not allowed in type literals. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES5.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES5.js new file mode 100644 index 00000000000..bca1ddbfdc7 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES5.js @@ -0,0 +1,7 @@ +//// [computedPropertyNamesDeclarationEmit4_ES5.ts] +var v: { + ["" + ""](): void; +} + +//// [computedPropertyNamesDeclarationEmit4_ES5.js] +var v; diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.errors.txt new file mode 100644 index 00000000000..4c8a2270d28 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.errors.txt @@ -0,0 +1,27 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5_ES5.ts(2,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5_ES5.ts(3,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5_ES5.ts(4,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5_ES5.ts(4,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5_ES5.ts(5,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5_ES5.ts(5,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5_ES5.ts (6 errors) ==== + var v = { + ["" + ""]: 0, + ~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ["" + ""]() { }, + ~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + get ["" + ""]() { return 0; }, + ~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + set ["" + ""](x) { } + ~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js new file mode 100644 index 00000000000..ced7e199a4c --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js @@ -0,0 +1,19 @@ +//// [computedPropertyNamesDeclarationEmit5_ES5.ts] +var v = { + ["" + ""]: 0, + ["" + ""]() { }, + get ["" + ""]() { return 0; }, + set ["" + ""](x) { } +} + +//// [computedPropertyNamesDeclarationEmit5_ES5.js] +var v = { + ["" + ""]: 0, + ["" + ""]: function () { + }, + get ["" + ""]() { + return 0; + }, + set ["" + ""](x) { + } +}; diff --git a/tests/baselines/reference/computedPropertyNamesOnOverloads_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesOnOverloads_ES5.errors.txt new file mode 100644 index 00000000000..d02a636938c --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesOnOverloads_ES5.errors.txt @@ -0,0 +1,19 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES5.ts(4,5): error TS1168: Computed property names are not allowed in method overloads. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES5.ts(5,5): error TS1168: Computed property names are not allowed in method overloads. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES5.ts(6,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES5.ts (3 errors) ==== + var methodName = "method"; + var accessorName = "accessor"; + class C { + [methodName](v: string); + ~~~~~~~~~~~~ +!!! error TS1168: Computed property names are not allowed in method overloads. + [methodName](); + ~~~~~~~~~~~~ +!!! error TS1168: Computed property names are not allowed in method overloads. + [methodName](v?: string) { } + ~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesOnOverloads_ES5.js b/tests/baselines/reference/computedPropertyNamesOnOverloads_ES5.js new file mode 100644 index 00000000000..c922b87f470 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesOnOverloads_ES5.js @@ -0,0 +1,19 @@ +//// [computedPropertyNamesOnOverloads_ES5.ts] +var methodName = "method"; +var accessorName = "accessor"; +class C { + [methodName](v: string); + [methodName](); + [methodName](v?: string) { } +} + +//// [computedPropertyNamesOnOverloads_ES5.js] +var methodName = "method"; +var accessorName = "accessor"; +var C = (function () { + function C() { + } + C.prototype[methodName] = function (v) { + }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.errors.txt new file mode 100644 index 00000000000..41ece97ba82 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.errors.txt @@ -0,0 +1,11 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1_ES5.ts(2,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1_ES5.ts (1 errors) ==== + class C { + ["hello"]() { + ~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + debugger; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.js b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.js new file mode 100644 index 00000000000..5b99f534002 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.js @@ -0,0 +1,17 @@ +//// [computedPropertyNamesSourceMap1_ES5.ts] +class C { + ["hello"]() { + debugger; + } +} + +//// [computedPropertyNamesSourceMap1_ES5.js] +var C = (function () { + function C() { + } + C.prototype["hello"] = function () { + debugger; + }; + return C; +})(); +//# sourceMappingURL=computedPropertyNamesSourceMap1_ES5.js.map \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.js.map b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.js.map new file mode 100644 index 00000000000..f3881a54bd5 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.js.map @@ -0,0 +1,2 @@ +//// [computedPropertyNamesSourceMap1_ES5.js.map] +{"version":3,"file":"computedPropertyNamesSourceMap1_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap1_ES5.ts"],"names":["C","C.constructor","C[\"hello\"]"],"mappings":"AAAA,IAAM,CAAC;IAAPA,SAAMA,CAACA;IAIPC,CAACA;IAHGD,YAACA,OAAOA,CAACA,GAATA;QACIE,QAAQA,CAACA;IACbA,CAACA;IACLF,QAACA;AAADA,CAACA,AAJD,IAIC"} \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.sourcemap.txt b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.sourcemap.txt new file mode 100644 index 00000000000..607d51ca5dc --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.sourcemap.txt @@ -0,0 +1,114 @@ +=================================================================== +JsFile: computedPropertyNamesSourceMap1_ES5.js +mapUrl: computedPropertyNamesSourceMap1_ES5.js.map +sourceRoot: +sources: computedPropertyNamesSourceMap1_ES5.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1_ES5.js +sourceFile:computedPropertyNamesSourceMap1_ES5.ts +------------------------------------------------------------------- +>>>var C = (function () { +1 > +2 >^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^-> +1 > +2 >class +3 > C +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(1, 7) + SourceIndex(0) +3 >Emitted(1, 6) Source(1, 8) + SourceIndex(0) +--- +>>> function C() { +1->^^^^ +2 > ^^^^^^^^^ +3 > ^ +1-> +2 > class +3 > C +1->Emitted(2, 5) Source(1, 1) + SourceIndex(0) name (C) +2 >Emitted(2, 14) Source(1, 7) + SourceIndex(0) name (C) +3 >Emitted(2, 15) Source(1, 8) + SourceIndex(0) name (C) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > { + > ["hello"]() { + > debugger; + > } + > +2 > } +1 >Emitted(3, 5) Source(5, 1) + SourceIndex(0) name (C.constructor) +2 >Emitted(3, 6) Source(5, 2) + SourceIndex(0) name (C.constructor) +--- +>>> C.prototype["hello"] = function () { +1->^^^^ +2 > ^^^^^^^^^^^^ +3 > ^^^^^^^ +4 > ^ +5 > ^^^ +1-> +2 > [ +3 > "hello" +4 > ] +5 > +1->Emitted(4, 5) Source(2, 5) + SourceIndex(0) name (C) +2 >Emitted(4, 17) Source(2, 6) + SourceIndex(0) name (C) +3 >Emitted(4, 24) Source(2, 13) + SourceIndex(0) name (C) +4 >Emitted(4, 25) Source(2, 14) + SourceIndex(0) name (C) +5 >Emitted(4, 28) Source(2, 5) + SourceIndex(0) name (C) +--- +>>> debugger; +1 >^^^^^^^^ +2 > ^^^^^^^^ +3 > ^ +1 >["hello"]() { + > +2 > debugger +3 > ; +1 >Emitted(5, 9) Source(3, 9) + SourceIndex(0) name (C["hello"]) +2 >Emitted(5, 17) Source(3, 17) + SourceIndex(0) name (C["hello"]) +3 >Emitted(5, 18) Source(3, 18) + SourceIndex(0) name (C["hello"]) +--- +>>> }; +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(6, 5) Source(4, 5) + SourceIndex(0) name (C["hello"]) +2 >Emitted(6, 6) Source(4, 6) + SourceIndex(0) name (C["hello"]) +--- +>>> return C; +1->^^^^ +2 > ^^^^^^^^ +1-> + > +2 > } +1->Emitted(7, 5) Source(5, 1) + SourceIndex(0) name (C) +2 >Emitted(7, 13) Source(5, 2) + SourceIndex(0) name (C) +--- +>>>})(); +1 > +2 >^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >} +3 > +4 > class C { + > ["hello"]() { + > debugger; + > } + > } +1 >Emitted(8, 1) Source(5, 1) + SourceIndex(0) name (C) +2 >Emitted(8, 2) Source(5, 2) + SourceIndex(0) name (C) +3 >Emitted(8, 2) Source(1, 1) + SourceIndex(0) +4 >Emitted(8, 6) Source(5, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=computedPropertyNamesSourceMap1_ES5.js.map \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.errors.txt new file mode 100644 index 00000000000..d95aa2a1adb --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.errors.txt @@ -0,0 +1,11 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES5.ts(2,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES5.ts (1 errors) ==== + var v = { + ["hello"]() { + ~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + debugger; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js new file mode 100644 index 00000000000..6d11c62050c --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js @@ -0,0 +1,14 @@ +//// [computedPropertyNamesSourceMap2_ES5.ts] +var v = { + ["hello"]() { + debugger; + } +} + +//// [computedPropertyNamesSourceMap2_ES5.js] +var v = { + ["hello"]: function () { + debugger; + } +}; +//# sourceMappingURL=computedPropertyNamesSourceMap2_ES5.js.map \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map new file mode 100644 index 00000000000..9f985290f09 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map @@ -0,0 +1,2 @@ +//// [computedPropertyNamesSourceMap2_ES5.js.map] +{"version":3,"file":"computedPropertyNamesSourceMap2_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES5.ts"],"names":["[\"hello\"]"],"mappings":"AAAA,IAAI,CAAC,GAAG;IACJ,CAAC,OAAO,CAAC;QACLA,QAAQA,CAACA;IACbA,CAACA;CACJ,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt new file mode 100644 index 00000000000..ff49e979ae3 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt @@ -0,0 +1,73 @@ +=================================================================== +JsFile: computedPropertyNamesSourceMap2_ES5.js +mapUrl: computedPropertyNamesSourceMap2_ES5.js.map +sourceRoot: +sources: computedPropertyNamesSourceMap2_ES5.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES5.js +sourceFile:computedPropertyNamesSourceMap2_ES5.ts +------------------------------------------------------------------- +>>>var v = { +1 > +2 >^^^^ +3 > ^ +4 > ^^^ +5 > ^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >var +3 > v +4 > = +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(1, 5) + SourceIndex(0) +3 >Emitted(1, 6) Source(1, 6) + SourceIndex(0) +4 >Emitted(1, 9) Source(1, 9) + SourceIndex(0) +--- +>>> ["hello"]: function () { +1->^^^^ +2 > ^ +3 > ^^^^^^^ +4 > ^ +5 > ^^^^^-> +1->{ + > +2 > [ +3 > "hello" +4 > ] +1->Emitted(2, 5) Source(2, 5) + SourceIndex(0) +2 >Emitted(2, 6) Source(2, 6) + SourceIndex(0) +3 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +4 >Emitted(2, 14) Source(2, 14) + SourceIndex(0) +--- +>>> debugger; +1->^^^^^^^^ +2 > ^^^^^^^^ +3 > ^ +1->() { + > +2 > debugger +3 > ; +1->Emitted(3, 9) Source(3, 9) + SourceIndex(0) name (["hello"]) +2 >Emitted(3, 17) Source(3, 17) + SourceIndex(0) name (["hello"]) +3 >Emitted(3, 18) Source(3, 18) + SourceIndex(0) name (["hello"]) +--- +>>> } +1 >^^^^ +2 > ^ +1 > + > +2 > } +1 >Emitted(4, 5) Source(4, 5) + SourceIndex(0) name (["hello"]) +2 >Emitted(4, 6) Source(4, 6) + SourceIndex(0) name (["hello"]) +--- +>>>}; +1 >^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +2 > +1 >Emitted(5, 2) Source(5, 2) + SourceIndex(0) +2 >Emitted(5, 3) Source(5, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=computedPropertyNamesSourceMap2_ES5.js.map \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts new file mode 100644 index 00000000000..59a8e9d3420 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts @@ -0,0 +1,17 @@ +// @target: es5 +var s: string; +var n: number; +var a: any; +var v = { + [s]() { }, + [n]() { }, + [s + s]() { }, + [s + n]() { }, + [+s]() { }, + [""]() { }, + [0]() { }, + [a]() { }, + [true]() { }, + [`hello bye`]() { }, + [`hello ${a} bye`]() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts new file mode 100644 index 00000000000..33288184b16 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts @@ -0,0 +1,17 @@ +// @target: es5 +var s: string; +var n: number; +var a: any; +var v = { + get [s]() { return 0; }, + set [n](v) { }, + get [s + s]() { return 0; }, + set [s + n](v) { }, + get [+s]() { return 0; }, + set [""](v) { }, + get [0]() { return 0; }, + set [a](v) { }, + get [true]() { return 0; }, + set [`hello bye`](v) { }, + get [`hello ${a} bye`]() { return 0; } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts new file mode 100644 index 00000000000..365ca67c1a3 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts @@ -0,0 +1,17 @@ +// @target: es5 +var s: string; +var n: number; +var a: any; +class C { + [s]: number; + [n] = n; + static [s + s]: string; + [s + n] = 2; + [+s]: typeof s; + static [""]: number; + [0]: number; + [a]: number; + static [true]: number; + [`hello bye`] = 0; + static [`hello ${a} bye`] = 0 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts new file mode 100644 index 00000000000..fb44bfb4145 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts @@ -0,0 +1,17 @@ +// @target: es5 +var s: string; +var n: number; +var a: any; +class C { + [s]() {} + [n]() { } + static [s + s]() { } + [s + n]() { } + [+s]() { } + static [""]() { } + [0]() { } + [a]() { } + static [true]() { } + [`hello bye`]() { } + static [`hello ${a} bye`]() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts new file mode 100644 index 00000000000..8f78f279eba --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +var b: boolean; +class C { + [b]() {} + static [true]() { } + [[]]() { } + static [{}]() { } + [undefined]() { } + static [null]() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES5.ts new file mode 100644 index 00000000000..2baa39cf61a --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES5.ts @@ -0,0 +1,9 @@ +// @target: es5 +var p1: number | string; +var p2: number | number[]; +var p3: string | boolean; +class C { + [p1]() { } + [p2]() { } + [p3]() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts new file mode 100644 index 00000000000..01204a1e619 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts @@ -0,0 +1,17 @@ +// @target: es5 +var s: string; +var n: number; +var a: any; +class C { + get [s]() { return 0;} + set [n](v) { } + static get [s + s]() { return 0; } + set [s + n](v) { } + get [+s]() { return 0; } + static set [""](v) { } + get [0]() { return 0; } + set [a](v) { } + static get [true]() { return 0; } + set [`hello bye`](v) { } + get [`hello ${a} bye`]() { return 0; } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts new file mode 100644 index 00000000000..e52067cc7f4 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +var b: boolean; +class C { + get [b]() { return 0;} + static set [true](v) { } + get [[]]() { return 0; } + set [{}](v) { } + static get [undefined]() { return 0; } + set [null](v) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames18_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames18_ES5.ts new file mode 100644 index 00000000000..3c929b20ddf --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames18_ES5.ts @@ -0,0 +1,6 @@ +// @target: es5 +function foo() { + var obj = { + [this.bar]: 0 + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES5.ts new file mode 100644 index 00000000000..87a1bf81178 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES5.ts @@ -0,0 +1,6 @@ +// @target: es5 +module M { + var obj = { + [this.bar]: 0 + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES5.ts new file mode 100644 index 00000000000..70ba98a818c --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES5.ts @@ -0,0 +1,5 @@ +// @target: es5 +var v = { + get [0 + 1]() { return 0 }, + set [0 + 1](v: string) { } //No error +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames20_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames20_ES5.ts new file mode 100644 index 00000000000..6cff3715d83 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames20_ES5.ts @@ -0,0 +1,4 @@ +// @target: es5 +var obj = { + [this.bar]: 0 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames21_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames21_ES5.ts new file mode 100644 index 00000000000..caee82c8ea3 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames21_ES5.ts @@ -0,0 +1,7 @@ +// @target: es5 +class C { + bar() { + return 0; + } + [this.bar()]() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames22_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames22_ES5.ts new file mode 100644 index 00000000000..41142951421 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames22_ES5.ts @@ -0,0 +1,9 @@ +// @target: es5 +class C { + bar() { + var obj = { + [this.bar()]() { } + }; + return 0; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames23_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames23_ES5.ts new file mode 100644 index 00000000000..e0a86c21842 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames23_ES5.ts @@ -0,0 +1,9 @@ +// @target: es5 +class C { + bar() { + return 0; + } + [ + { [this.bar()]: 1 }[0] + ]() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames24_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames24_ES5.ts new file mode 100644 index 00000000000..ff94b6c9617 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames24_ES5.ts @@ -0,0 +1,11 @@ +// @target: es5 +class Base { + bar() { + return 0; + } +} +class C extends Base { + // Gets emitted as super, not _super, which is consistent with + // use of super in static properties initializers. + [super.bar()]() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames25_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames25_ES5.ts new file mode 100644 index 00000000000..d791b8b9178 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames25_ES5.ts @@ -0,0 +1,14 @@ +// @target: es5 +class Base { + bar() { + return 0; + } +} +class C extends Base { + foo() { + var obj = { + [super.bar()]() { } + }; + return 0; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES5.ts new file mode 100644 index 00000000000..4b0d794b1a7 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES5.ts @@ -0,0 +1,13 @@ +// @target: es5 +class Base { + bar() { + return 0; + } +} +class C extends Base { + // Gets emitted as super, not _super, which is consistent with + // use of super in static properties initializers. + [ + { [super.bar()]: 1 }[0] + ]() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames27_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames27_ES5.ts new file mode 100644 index 00000000000..1cae37aa093 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames27_ES5.ts @@ -0,0 +1,6 @@ +// @target: es5 +class Base { +} +class C extends Base { + [(super(), "prop")]() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames28_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames28_ES5.ts new file mode 100644 index 00000000000..c82d7b000e2 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames28_ES5.ts @@ -0,0 +1,11 @@ +// @target: es5 +class Base { +} +class C extends Base { + constructor() { + super(); + var obj = { + [(super(), "prop")]() { } + }; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames29_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames29_ES5.ts new file mode 100644 index 00000000000..c650c6e6c3f --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames29_ES5.ts @@ -0,0 +1,11 @@ +// @target: es5 +class C { + bar() { + () => { + var obj = { + [this.bar()]() { } // needs capture + }; + } + return 0; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts new file mode 100644 index 00000000000..7c2517cd514 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts @@ -0,0 +1,11 @@ +// @target: es5 +var methodName = "method"; +var accessorName = "accessor"; +class C { + [methodName]() { } + static [methodName]() { } + get [accessorName]() { } + set [accessorName](v) { } + static get [accessorName]() { } + static set [accessorName](v) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES5.ts new file mode 100644 index 00000000000..528e9b7c583 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES5.ts @@ -0,0 +1,16 @@ +// @target: es5 +class Base { +} +class C extends Base { + constructor() { + super(); + () => { + var obj = { + // Ideally, we would capture this. But the reference is + // illegal, and not capturing this is consistent with + //treatment of other similar violations. + [(super(), "prop")]() { } + }; + } + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames31_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames31_ES5.ts new file mode 100644 index 00000000000..39c5ca2b747 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames31_ES5.ts @@ -0,0 +1,16 @@ +// @target: es5 +class Base { + bar() { + return 0; + } +} +class C extends Base { + foo() { + () => { + var obj = { + [super.bar()]() { } // needs capture + }; + } + return 0; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames32_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames32_ES5.ts new file mode 100644 index 00000000000..f9c17c632ae --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames32_ES5.ts @@ -0,0 +1,8 @@ +// @target: es5 +function foo() { return '' } +class C { + bar() { + return 0; + } + [foo()]() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames33_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames33_ES5.ts new file mode 100644 index 00000000000..0dcbabf4063 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames33_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +function foo() { return '' } +class C { + bar() { + var obj = { + [foo()]() { } + }; + return 0; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames34_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames34_ES5.ts new file mode 100644 index 00000000000..b6892f1bd80 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames34_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +function foo() { return '' } +class C { + static bar() { + var obj = { + [foo()]() { } + }; + return 0; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES5.ts new file mode 100644 index 00000000000..7d3df135b10 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES5.ts @@ -0,0 +1,6 @@ +// @target: es5 +function foo() { return '' } +interface I { + bar(): string; + [foo()](): void; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES5.ts new file mode 100644 index 00000000000..95099715ad8 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES5.ts @@ -0,0 +1,11 @@ +// @target: es5 +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: Foo2; + + // Computed properties + get ["get1"]() { return new Foo } + set ["set1"](p: Foo2) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames37_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames37_ES5.ts new file mode 100644 index 00000000000..cb931fc31d6 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames37_ES5.ts @@ -0,0 +1,11 @@ +// @target: es5 +class Foo { x } +class Foo2 { x; y } + +class C { + [s: number]: Foo2; + + // Computed properties + get ["get1"]() { return new Foo } + set ["set1"](p: Foo2) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES5.ts new file mode 100644 index 00000000000..5ea07aa1605 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES5.ts @@ -0,0 +1,11 @@ +// @target: es5 +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: Foo2; + + // Computed properties + get [1 << 6]() { return new Foo } + set [1 << 6](p: Foo2) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES5.ts new file mode 100644 index 00000000000..929332c5d32 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES5.ts @@ -0,0 +1,11 @@ +// @target: es5 +class Foo { x } +class Foo2 { x; y } + +class C { + [s: number]: Foo2; + + // Computed properties + get [1 << 6]() { return new Foo } + set [1 << 6](p: Foo2) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts new file mode 100644 index 00000000000..1f34f9ad287 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +var id; +class C { + [0 + 1]() { } + static [() => { }]() { } + get [delete id]() { } + set [[0, 1]](v) { } + static get [""]() { } + static set [id.toString()](v) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES5.ts new file mode 100644 index 00000000000..bba1068fef3 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES5.ts @@ -0,0 +1,11 @@ +// @target: es5 +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: () => Foo2; + + // Computed properties + [""]() { return new Foo } + [""]() { return new Foo2 } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames41_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames41_ES5.ts new file mode 100644 index 00000000000..1e8ed7d6cd1 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames41_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: () => Foo2; + + // Computed properties + static [""]() { return new Foo } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES5.ts new file mode 100644 index 00000000000..fc181d5a548 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: Foo2; + + // Computed properties + [""]: Foo; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES5.ts new file mode 100644 index 00000000000..c130692c118 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES5.ts @@ -0,0 +1,13 @@ +// @target: es5 +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: Foo2; +} + +class D extends C { + // Computed properties + get ["get1"]() { return new Foo } + set ["set1"](p: Foo2) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts new file mode 100644 index 00000000000..4c9422ed44e --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts @@ -0,0 +1,12 @@ +// @target: es5 +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: Foo2; + get ["get1"]() { return new Foo } +} + +class D extends C { + set ["set1"](p: Foo) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES5.ts new file mode 100644 index 00000000000..c1eb09275c5 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES5.ts @@ -0,0 +1,13 @@ +// @target: es5 +class Foo { x } +class Foo2 { x; y } + +class C { + get ["get1"]() { return new Foo } +} + +class D extends C { + // No error when the indexer is in a class more derived than the computed property + [s: string]: Foo2; + set ["set1"](p: Foo) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames46_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames46_ES5.ts new file mode 100644 index 00000000000..d009c960d6b --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames46_ES5.ts @@ -0,0 +1,4 @@ +// @target: es5 +var o = { + ["" || 0]: 0 +}; \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames47_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames47_ES5.ts new file mode 100644 index 00000000000..b158ef76447 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames47_ES5.ts @@ -0,0 +1,6 @@ +// @target: es5 +enum E1 { x } +enum E2 { x } +var o = { + [E1.x || E2.x]: 0 +}; \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES5.ts new file mode 100644 index 00000000000..1c854603b09 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES5.ts @@ -0,0 +1,18 @@ +// @target: es5 +declare function extractIndexer(p: { [n: number]: T }): T; + +enum E { x } + +var a: any; + +extractIndexer({ + [a]: "" +}); // Should return string + +extractIndexer({ + [E.x]: "" +}); // Should return string + +extractIndexer({ + ["" || 0]: "" +}); // Should return any (widened form of undefined) \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts new file mode 100644 index 00000000000..17089b7244f --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts @@ -0,0 +1,17 @@ +// @target: es5 +var s: string; +var n: number; +var a: any; +var v = { + [s]: 0, + [n]: n, + [s + s]: 1, + [s + n]: 2, + [+s]: s, + [""]: 0, + [0]: 0, + [a]: 1, + [true]: 0, + [`hello bye`]: 0, + [`hello ${a} bye`]: 0 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts new file mode 100644 index 00000000000..e9d7d6ffab4 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +var b: boolean; +var v = { + [b]: 0, + [true]: 1, + [[]]: 0, + [{}]: 0, + [undefined]: undefined, + [null]: null +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES5.ts new file mode 100644 index 00000000000..0521873d70c --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES5.ts @@ -0,0 +1,9 @@ +// @target: es5 +var p1: number | string; +var p2: number | number[]; +var p3: string | boolean; +var v = { + [p1]: 0, + [p2]: 1, + [p3]: 2 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames7_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames7_ES5.ts new file mode 100644 index 00000000000..e3b379602b9 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames7_ES5.ts @@ -0,0 +1,7 @@ +// @target: es5 +enum E { + member +} +var v = { + [E.member]: 0 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES5.ts new file mode 100644 index 00000000000..0723552edc2 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES5.ts @@ -0,0 +1,9 @@ +// @target: es5 +function f() { + var t: T; + var u: U; + var v = { + [t]: 0, + [u]: 1 + }; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES5.ts new file mode 100644 index 00000000000..e1c675d95e4 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES5.ts @@ -0,0 +1,11 @@ +// @target: es5 +function f(s: string): string; +function f(n: number): number; +function f(x: T): T; +function f(x): any { } + +var v = { + [f("")]: 0, + [f(0)]: 0, + [f(true)]: 0 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10_ES5.ts new file mode 100644 index 00000000000..dd208340520 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10_ES5.ts @@ -0,0 +1,9 @@ +// @target: es5 +interface I { + [s: number]: boolean; +} + +var o: I = { + [+"foo"]: "", + [+"bar"]: 0 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType1_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType1_ES5.ts new file mode 100644 index 00000000000..d8aad5bf468 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType1_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +interface I { + [s: string]: (x: string) => number; + [s: number]: (x: any) => number; // Doesn't get hit +} + +var o: I = { + ["" + 0](y) { return y.length; }, + ["" + 1]: y => y.length +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType2_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType2_ES5.ts new file mode 100644 index 00000000000..c9a425b5a99 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType2_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +interface I { + [s: string]: (x: any) => number; // Doesn't get hit + [s: number]: (x: string) => number; +} + +var o: I = { + [+"foo"](y) { return y.length; }, + [+"bar"]: y => y.length +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType3_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType3_ES5.ts new file mode 100644 index 00000000000..3f5a6f7f91f --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType3_ES5.ts @@ -0,0 +1,9 @@ +// @target: es5 +interface I { + [s: string]: (x: string) => number; +} + +var o: I = { + [+"foo"](y) { return y.length; }, + [+"bar"]: y => y.length +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType4_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType4_ES5.ts new file mode 100644 index 00000000000..8ce0503c449 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType4_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +interface I { + [s: string]: any; + [s: number]: any; +} + +var o: I = { + [""+"foo"]: "", + [""+"bar"]: 0 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType5_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType5_ES5.ts new file mode 100644 index 00000000000..42acf42ee2a --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType5_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +interface I { + [s: string]: any; + [s: number]: any; +} + +var o: I = { + [+"foo"]: "", + [+"bar"]: 0 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES5.ts new file mode 100644 index 00000000000..9e6248878b9 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES5.ts @@ -0,0 +1,14 @@ +// @target: es5 +interface I { + [s: string]: T; +} + +declare function foo(obj: I): T + +foo({ + p: "", + 0: () => { }, + ["hi" + "bye"]: true, + [0 + 1]: 0, + [+"hi"]: [0] +}); \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES5.ts new file mode 100644 index 00000000000..722891c2f6a --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES5.ts @@ -0,0 +1,14 @@ +// @target: es5 +interface I { + [s: number]: T; +} + +declare function foo(obj: I): T + +foo({ + p: "", + 0: () => { }, + ["hi" + "bye"]: true, + [0 + 1]: 0, + [+"hi"]: [0] +}); \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts new file mode 100644 index 00000000000..5e6835b5948 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +interface I { + [s: string]: boolean; + [s: number]: boolean; +} + +var o: I = { + [""+"foo"]: "", + [""+"bar"]: 0 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES5.ts new file mode 100644 index 00000000000..aa30d333d11 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +interface I { + [s: string]: boolean; + [s: number]: boolean; +} + +var o: I = { + [+"foo"]: "", + [+"bar"]: 0 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit1_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit1_ES5.ts new file mode 100644 index 00000000000..1091304b6b2 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit1_ES5.ts @@ -0,0 +1,7 @@ +// @target: es5 +// @declaration: true +class C { + ["" + ""]() { } + get ["" + ""]() { return 0; } + set ["" + ""](x) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit2_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit2_ES5.ts new file mode 100644 index 00000000000..b30b8e13062 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit2_ES5.ts @@ -0,0 +1,7 @@ +// @target: es5 +// @declaration: true +class C { + static ["" + ""]() { } + static get ["" + ""]() { return 0; } + static set ["" + ""](x) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3_ES5.ts new file mode 100644 index 00000000000..aa4e3b2cf2f --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3_ES5.ts @@ -0,0 +1,5 @@ +// @target: es5 +// @declaration: true +interface I { + ["" + ""](): void; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4_ES5.ts new file mode 100644 index 00000000000..9a6e17f4c93 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4_ES5.ts @@ -0,0 +1,5 @@ +// @target: es5 +// @declaration: true +var v: { + ["" + ""](): void; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5_ES5.ts new file mode 100644 index 00000000000..eb12ea9b471 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5_ES5.ts @@ -0,0 +1,8 @@ +// @target: es5 +// @declaration: true +var v = { + ["" + ""]: 0, + ["" + ""]() { }, + get ["" + ""]() { return 0; }, + set ["" + ""](x) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES5.ts new file mode 100644 index 00000000000..a025a074e31 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES5.ts @@ -0,0 +1,8 @@ +// @target: es5 +var methodName = "method"; +var accessorName = "accessor"; +class C { + [methodName](v: string); + [methodName](); + [methodName](v?: string) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1_ES5.ts new file mode 100644 index 00000000000..9454483cdb4 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1_ES5.ts @@ -0,0 +1,7 @@ +// @target: es5 +// @sourceMap: true +class C { + ["hello"]() { + debugger; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES5.ts new file mode 100644 index 00000000000..3d35cd12430 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES5.ts @@ -0,0 +1,7 @@ +// @target: es5 +// @sourceMap: true +var v = { + ["hello"]() { + debugger; + } +} \ No newline at end of file