mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-09 07:55:10 -05:00
addressed PR feedback
This commit is contained in:
@@ -7095,7 +7095,7 @@ namespace ts {
|
||||
|
||||
if (container.parent.kind === SyntaxKind.ObjectLiteralExpression) {
|
||||
if (languageVersion < ScriptTarget.ES6) {
|
||||
error(node, Diagnostics.super_in_members_of_object_literal_expressions_is_only_allowed_when_option_target_is_ES2015_or_higher);
|
||||
error(node, Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher);
|
||||
return unknownType;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -1759,7 +1759,7 @@
|
||||
"category": "Error",
|
||||
"code": 2658
|
||||
},
|
||||
"'super' in members of object literal expressions is only allowed when option 'target' is 'ES2015' or higher.": {
|
||||
"'super' is only allowed in members of object literal expressions when option 'target' is 'ES2015' or higher.": {
|
||||
"category": "Error",
|
||||
"code": 2659
|
||||
},
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
tests/cases/compiler/superInObjectLiterals_ES5.ts(7,9): error TS2659: 'super' in members of object literal expressions is only allowed when option 'target' is 'ES2015' or higher.
|
||||
tests/cases/compiler/superInObjectLiterals_ES5.ts(10,9): error TS2659: 'super' in members of object literal expressions is only allowed when option 'target' is 'ES2015' or higher.
|
||||
tests/cases/compiler/superInObjectLiterals_ES5.ts(14,9): error TS2659: 'super' in members of object literal expressions is only allowed when option 'target' is 'ES2015' or higher.
|
||||
tests/cases/compiler/superInObjectLiterals_ES5.ts(7,9): error TS2659: 'super' is only allowed in members of object literal expressions when option 'target' is 'ES2015' or higher.
|
||||
tests/cases/compiler/superInObjectLiterals_ES5.ts(10,9): error TS2659: 'super' is only allowed in members of object literal expressions when option 'target' is 'ES2015' or higher.
|
||||
tests/cases/compiler/superInObjectLiterals_ES5.ts(14,9): error TS2659: 'super' is only allowed in members of object literal expressions when option 'target' is 'ES2015' or higher.
|
||||
tests/cases/compiler/superInObjectLiterals_ES5.ts(17,9): error TS2660: 'super' can only be referenced in members of derived classes or object literal expressions.
|
||||
tests/cases/compiler/superInObjectLiterals_ES5.ts(20,9): error TS2660: 'super' can only be referenced in members of derived classes or object literal expressions.
|
||||
tests/cases/compiler/superInObjectLiterals_ES5.ts(23,9): error TS2660: 'super' can only be referenced in members of derived classes or object literal expressions.
|
||||
tests/cases/compiler/superInObjectLiterals_ES5.ts(39,17): error TS2659: 'super' in members of object literal expressions is only allowed when option 'target' is 'ES2015' or higher.
|
||||
tests/cases/compiler/superInObjectLiterals_ES5.ts(42,17): error TS2659: 'super' in members of object literal expressions is only allowed when option 'target' is 'ES2015' or higher.
|
||||
tests/cases/compiler/superInObjectLiterals_ES5.ts(46,17): error TS2659: 'super' in members of object literal expressions is only allowed when option 'target' is 'ES2015' or higher.
|
||||
tests/cases/compiler/superInObjectLiterals_ES5.ts(39,17): error TS2659: 'super' is only allowed in members of object literal expressions when option 'target' is 'ES2015' or higher.
|
||||
tests/cases/compiler/superInObjectLiterals_ES5.ts(42,17): error TS2659: 'super' is only allowed in members of object literal expressions when option 'target' is 'ES2015' or higher.
|
||||
tests/cases/compiler/superInObjectLiterals_ES5.ts(46,17): error TS2659: 'super' is only allowed in members of object literal expressions when option 'target' is 'ES2015' or higher.
|
||||
tests/cases/compiler/superInObjectLiterals_ES5.ts(49,17): error TS2660: 'super' can only be referenced in members of derived classes or object literal expressions.
|
||||
tests/cases/compiler/superInObjectLiterals_ES5.ts(52,17): error TS2660: 'super' can only be referenced in members of derived classes or object literal expressions.
|
||||
|
||||
@@ -20,18 +20,18 @@ tests/cases/compiler/superInObjectLiterals_ES5.ts(52,17): error TS2660: 'super'
|
||||
method() {
|
||||
super.method();
|
||||
~~~~~
|
||||
!!! error TS2659: 'super' in members of object literal expressions is only allowed when option 'target' is 'ES2015' or higher.
|
||||
!!! error TS2659: 'super' is only allowed in members of object literal expressions when option 'target' is 'ES2015' or higher.
|
||||
},
|
||||
get prop() {
|
||||
super.method();
|
||||
~~~~~
|
||||
!!! error TS2659: 'super' in members of object literal expressions is only allowed when option 'target' is 'ES2015' or higher.
|
||||
!!! error TS2659: 'super' is only allowed in members of object literal expressions when option 'target' is 'ES2015' or higher.
|
||||
return 10;
|
||||
},
|
||||
set prop(value) {
|
||||
super.method();
|
||||
~~~~~
|
||||
!!! error TS2659: 'super' in members of object literal expressions is only allowed when option 'target' is 'ES2015' or higher.
|
||||
!!! error TS2659: 'super' is only allowed in members of object literal expressions when option 'target' is 'ES2015' or higher.
|
||||
},
|
||||
p1: function () {
|
||||
super.method();
|
||||
@@ -64,18 +64,18 @@ tests/cases/compiler/superInObjectLiterals_ES5.ts(52,17): error TS2660: 'super'
|
||||
method() {
|
||||
super.method();
|
||||
~~~~~
|
||||
!!! error TS2659: 'super' in members of object literal expressions is only allowed when option 'target' is 'ES2015' or higher.
|
||||
!!! error TS2659: 'super' is only allowed in members of object literal expressions when option 'target' is 'ES2015' or higher.
|
||||
},
|
||||
get prop() {
|
||||
super.method();
|
||||
~~~~~
|
||||
!!! error TS2659: 'super' in members of object literal expressions is only allowed when option 'target' is 'ES2015' or higher.
|
||||
!!! error TS2659: 'super' is only allowed in members of object literal expressions when option 'target' is 'ES2015' or higher.
|
||||
return 10;
|
||||
},
|
||||
set prop(value) {
|
||||
super.method();
|
||||
~~~~~
|
||||
!!! error TS2659: 'super' in members of object literal expressions is only allowed when option 'target' is 'ES2015' or higher.
|
||||
!!! error TS2659: 'super' is only allowed in members of object literal expressions when option 'target' is 'ES2015' or higher.
|
||||
},
|
||||
p1: function () {
|
||||
super.method();
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
tests/cases/compiler/super_inside-object-literal-getters-and-setters.ts(4,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/super_inside-object-literal-getters-and-setters.ts(5,20): error TS2659: 'super' in members of object literal expressions is only allowed when option 'target' is 'ES2015' or higher.
|
||||
tests/cases/compiler/super_inside-object-literal-getters-and-setters.ts(5,20): error TS2659: 'super' is only allowed in members of object literal expressions when option 'target' is 'ES2015' or higher.
|
||||
tests/cases/compiler/super_inside-object-literal-getters-and-setters.ts(7,13): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/super_inside-object-literal-getters-and-setters.ts(8,13): error TS2659: 'super' in members of object literal expressions is only allowed when option 'target' is 'ES2015' or higher.
|
||||
tests/cases/compiler/super_inside-object-literal-getters-and-setters.ts(8,13): error TS2659: 'super' is only allowed in members of object literal expressions when option 'target' is 'ES2015' or higher.
|
||||
tests/cases/compiler/super_inside-object-literal-getters-and-setters.ts(11,20): error TS2660: 'super' can only be referenced in members of derived classes or object literal expressions.
|
||||
tests/cases/compiler/super_inside-object-literal-getters-and-setters.ts(20,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/super_inside-object-literal-getters-and-setters.ts(21,24): error TS2659: 'super' in members of object literal expressions is only allowed when option 'target' is 'ES2015' or higher.
|
||||
tests/cases/compiler/super_inside-object-literal-getters-and-setters.ts(21,24): error TS2659: 'super' is only allowed in members of object literal expressions when option 'target' is 'ES2015' or higher.
|
||||
|
||||
|
||||
==== tests/cases/compiler/super_inside-object-literal-getters-and-setters.ts (7 errors) ====
|
||||
@@ -16,14 +16,14 @@ tests/cases/compiler/super_inside-object-literal-getters-and-setters.ts(21,24):
|
||||
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
return super._foo;
|
||||
~~~~~
|
||||
!!! error TS2659: 'super' in members of object literal expressions is only allowed when option 'target' is 'ES2015' or higher.
|
||||
!!! error TS2659: 'super' is only allowed in members of object literal expressions when option 'target' is 'ES2015' or higher.
|
||||
},
|
||||
set foo(value: string) {
|
||||
~~~
|
||||
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
super._foo = value;
|
||||
~~~~~
|
||||
!!! error TS2659: 'super' in members of object literal expressions is only allowed when option 'target' is 'ES2015' or higher.
|
||||
!!! error TS2659: 'super' is only allowed in members of object literal expressions when option 'target' is 'ES2015' or higher.
|
||||
},
|
||||
test: function () {
|
||||
return super._foo;
|
||||
@@ -42,7 +42,7 @@ tests/cases/compiler/super_inside-object-literal-getters-and-setters.ts(21,24):
|
||||
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
return super.test();
|
||||
~~~~~
|
||||
!!! error TS2659: 'super' in members of object literal expressions is only allowed when option 'target' is 'ES2015' or higher.
|
||||
!!! error TS2659: 'super' is only allowed in members of object literal expressions when option 'target' is 'ES2015' or higher.
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
34
tests/cases/fourslash/getOccurrencesSuper3.ts
Normal file
34
tests/cases/fourslash/getOccurrencesSuper3.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
////let x = {
|
||||
//// a() {
|
||||
//// return [|s/**/uper|].b();
|
||||
//// },
|
||||
//// b() {
|
||||
//// return [|super|].a();
|
||||
//// },
|
||||
//// c: function () {
|
||||
//// return [|super|].a();
|
||||
//// }
|
||||
//// d: () => [|super|].b();
|
||||
////}
|
||||
|
||||
function checkRange(r: FourSlashInterface.Range, expectedOccurences: FourSlashInterface.Range[]): void {
|
||||
goTo.position(r.start);
|
||||
if (expectedOccurences.length) {
|
||||
for (const expected of expectedOccurences) {
|
||||
verify.occurrencesAtPositionContains(expected);
|
||||
}
|
||||
}
|
||||
else {
|
||||
verify.occurrencesAtPositionCount(0);
|
||||
}
|
||||
}
|
||||
|
||||
let [r0, r1, r2, r3] = test.ranges();
|
||||
|
||||
checkRange(r0, [r0, r1]);
|
||||
checkRange(r1, [r0, r1]);
|
||||
checkRange(r0, [r0, r1]);
|
||||
checkRange(r2, []);
|
||||
checkRange(r3, []);
|
||||
Reference in New Issue
Block a user