diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 467cd7e5d95..353f6611151 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -38687,7 +38687,7 @@ namespace ts { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); } else if (isClassLike(node.parent)) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind, "export"); } else if (node.kind === SyntaxKind.Parameter) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); @@ -38710,7 +38710,7 @@ namespace ts { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } else if (isClassLike(node.parent) && !isPropertyDeclaration(node)) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind, "declare"); } else if (node.kind === SyntaxKind.Parameter) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 511f41157a5..d3573d73cb5 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -99,7 +99,7 @@ "category": "Error", "code": 1030 }, - "'{0}' modifier cannot appear on a class element.": { + "'{0}' modifier cannot appear on class elements of this kind.": { "category": "Error", "code": 1031 }, diff --git a/tests/baselines/reference/classExpressionPropertyModifiers.errors.txt b/tests/baselines/reference/classExpressionPropertyModifiers.errors.txt index cb01d656126..c469545c823 100644 --- a/tests/baselines/reference/classExpressionPropertyModifiers.errors.txt +++ b/tests/baselines/reference/classExpressionPropertyModifiers.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/classExpressionPropertyModifiers.ts(2,36): error TS1039: Initializers are not allowed in ambient contexts. -tests/cases/compiler/classExpressionPropertyModifiers.ts(3,5): error TS1031: 'export' modifier cannot appear on a class element. +tests/cases/compiler/classExpressionPropertyModifiers.ts(3,5): error TS1031: 'export' modifier cannot appear on class elements of this kind. ==== tests/cases/compiler/classExpressionPropertyModifiers.ts (2 errors) ==== @@ -9,6 +9,6 @@ tests/cases/compiler/classExpressionPropertyModifiers.ts(3,5): error TS1031: 'ex !!! error TS1039: Initializers are not allowed in ambient contexts. export foo = 1; ~~~~~~ -!!! error TS1031: 'export' modifier cannot appear on a class element. +!!! error TS1031: 'export' modifier cannot appear on class elements of this kind. } \ No newline at end of file diff --git a/tests/baselines/reference/derivedUninitializedPropertyDeclaration.errors.txt b/tests/baselines/reference/derivedUninitializedPropertyDeclaration.errors.txt index b66987ac4fb..6bd95538836 100644 --- a/tests/baselines/reference/derivedUninitializedPropertyDeclaration.errors.txt +++ b/tests/baselines/reference/derivedUninitializedPropertyDeclaration.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/classes/propertyMemberDeclarations/derivedUninitializedPropertyDeclaration.ts(12,21): error TS1255: A definite assignment assertion '!' is not permitted in this context. -tests/cases/conformance/classes/propertyMemberDeclarations/derivedUninitializedPropertyDeclaration.ts(15,5): error TS1031: 'declare' modifier cannot appear on a class element. +tests/cases/conformance/classes/propertyMemberDeclarations/derivedUninitializedPropertyDeclaration.ts(15,5): error TS1031: 'declare' modifier cannot appear on class elements of this kind. tests/cases/conformance/classes/propertyMemberDeclarations/derivedUninitializedPropertyDeclaration.ts(15,17): error TS1183: An implementation cannot be declared in ambient contexts. tests/cases/conformance/classes/propertyMemberDeclarations/derivedUninitializedPropertyDeclaration.ts(17,24): error TS1039: Initializers are not allowed in ambient contexts. tests/cases/conformance/classes/propertyMemberDeclarations/derivedUninitializedPropertyDeclaration.ts(24,5): error TS2564: Property 'p' has no initializer and is not definitely assigned in the constructor. @@ -25,7 +25,7 @@ tests/cases/conformance/classes/propertyMemberDeclarations/derivedUninitializedP class BOther extends A { declare m() { return 2 } // not allowed on methods ~~~~~~~ -!!! error TS1031: 'declare' modifier cannot appear on a class element. +!!! error TS1031: 'declare' modifier cannot appear on class elements of this kind. ~ !!! error TS1183: An implementation cannot be declared in ambient contexts. declare nonce: any; // ok, even though it's not in the base diff --git a/tests/baselines/reference/illegalModifiersOnClassElements.errors.txt b/tests/baselines/reference/illegalModifiersOnClassElements.errors.txt index 99ba043b52a..53f99fec365 100644 --- a/tests/baselines/reference/illegalModifiersOnClassElements.errors.txt +++ b/tests/baselines/reference/illegalModifiersOnClassElements.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/illegalModifiersOnClassElements.ts(2,19): error TS1039: Initializers are not allowed in ambient contexts. -tests/cases/compiler/illegalModifiersOnClassElements.ts(3,5): error TS1031: 'export' modifier cannot appear on a class element. +tests/cases/compiler/illegalModifiersOnClassElements.ts(3,5): error TS1031: 'export' modifier cannot appear on class elements of this kind. ==== tests/cases/compiler/illegalModifiersOnClassElements.ts (2 errors) ==== @@ -9,5 +9,5 @@ tests/cases/compiler/illegalModifiersOnClassElements.ts(3,5): error TS1031: 'exp !!! error TS1039: Initializers are not allowed in ambient contexts. export bar = 1; ~~~~~~ -!!! error TS1031: 'export' modifier cannot appear on a class element. +!!! error TS1031: 'export' modifier cannot appear on class elements of this kind. } \ No newline at end of file diff --git a/tests/baselines/reference/parserConstructorDeclaration3.errors.txt b/tests/baselines/reference/parserConstructorDeclaration3.errors.txt index d7680e5d118..5960ee078aa 100644 --- a/tests/baselines/reference/parserConstructorDeclaration3.errors.txt +++ b/tests/baselines/reference/parserConstructorDeclaration3.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/parser/ecmascript5/ConstructorDeclarations/parserConstructorDeclaration3.ts(2,3): error TS1031: 'export' modifier cannot appear on a class element. +tests/cases/conformance/parser/ecmascript5/ConstructorDeclarations/parserConstructorDeclaration3.ts(2,3): error TS1031: 'export' modifier cannot appear on class elements of this kind. ==== tests/cases/conformance/parser/ecmascript5/ConstructorDeclarations/parserConstructorDeclaration3.ts (1 errors) ==== class C { export constructor() { } ~~~~~~ -!!! error TS1031: 'export' modifier cannot appear on a class element. +!!! error TS1031: 'export' modifier cannot appear on class elements of this kind. } \ No newline at end of file diff --git a/tests/baselines/reference/parserConstructorDeclaration4.errors.txt b/tests/baselines/reference/parserConstructorDeclaration4.errors.txt index bd27ccbb255..f815f07ccb7 100644 --- a/tests/baselines/reference/parserConstructorDeclaration4.errors.txt +++ b/tests/baselines/reference/parserConstructorDeclaration4.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/parser/ecmascript5/ConstructorDeclarations/parserConstructorDeclaration4.ts(2,3): error TS1031: 'declare' modifier cannot appear on a class element. +tests/cases/conformance/parser/ecmascript5/ConstructorDeclarations/parserConstructorDeclaration4.ts(2,3): error TS1031: 'declare' modifier cannot appear on class elements of this kind. ==== tests/cases/conformance/parser/ecmascript5/ConstructorDeclarations/parserConstructorDeclaration4.ts (1 errors) ==== class C { declare constructor() { } ~~~~~~~ -!!! error TS1031: 'declare' modifier cannot appear on a class element. +!!! error TS1031: 'declare' modifier cannot appear on class elements of this kind. } \ No newline at end of file diff --git a/tests/baselines/reference/parserMemberAccessorDeclaration10.errors.txt b/tests/baselines/reference/parserMemberAccessorDeclaration10.errors.txt index ece110db165..9e898da50f0 100644 --- a/tests/baselines/reference/parserMemberAccessorDeclaration10.errors.txt +++ b/tests/baselines/reference/parserMemberAccessorDeclaration10.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration10.ts(2,5): error TS1031: 'export' modifier cannot appear on a class element. +tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration10.ts(2,5): error TS1031: 'export' modifier cannot appear on class elements of this kind. tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration10.ts(2,16): error TS2378: A 'get' accessor must return a value. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemb class C { export get Foo() { } ~~~~~~ -!!! error TS1031: 'export' modifier cannot appear on a class element. +!!! error TS1031: 'export' modifier cannot appear on class elements of this kind. ~~~ !!! error TS2378: A 'get' accessor must return a value. } \ No newline at end of file diff --git a/tests/baselines/reference/parserMemberAccessorDeclaration11.errors.txt b/tests/baselines/reference/parserMemberAccessorDeclaration11.errors.txt index 3a04bfbbd02..b8df5300af3 100644 --- a/tests/baselines/reference/parserMemberAccessorDeclaration11.errors.txt +++ b/tests/baselines/reference/parserMemberAccessorDeclaration11.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration11.ts(2,5): error TS1031: 'declare' modifier cannot appear on a class element. +tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration11.ts(2,5): error TS1031: 'declare' modifier cannot appear on class elements of this kind. tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration11.ts(2,17): error TS2378: A 'get' accessor must return a value. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemb class C { declare get Foo() { } ~~~~~~~ -!!! error TS1031: 'declare' modifier cannot appear on a class element. +!!! error TS1031: 'declare' modifier cannot appear on class elements of this kind. ~~~ !!! error TS2378: A 'get' accessor must return a value. } \ No newline at end of file diff --git a/tests/baselines/reference/parserMemberFunctionDeclaration4.errors.txt b/tests/baselines/reference/parserMemberFunctionDeclaration4.errors.txt index 9b665cc0627..05aca03b774 100644 --- a/tests/baselines/reference/parserMemberFunctionDeclaration4.errors.txt +++ b/tests/baselines/reference/parserMemberFunctionDeclaration4.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/parser/ecmascript5/MemberFunctionDeclarations/parserMemberFunctionDeclaration4.ts(2,5): error TS1031: 'export' modifier cannot appear on a class element. +tests/cases/conformance/parser/ecmascript5/MemberFunctionDeclarations/parserMemberFunctionDeclaration4.ts(2,5): error TS1031: 'export' modifier cannot appear on class elements of this kind. ==== tests/cases/conformance/parser/ecmascript5/MemberFunctionDeclarations/parserMemberFunctionDeclaration4.ts (1 errors) ==== class C { export Foo() { } ~~~~~~ -!!! error TS1031: 'export' modifier cannot appear on a class element. +!!! error TS1031: 'export' modifier cannot appear on class elements of this kind. } \ No newline at end of file diff --git a/tests/baselines/reference/parserMemberFunctionDeclaration5.errors.txt b/tests/baselines/reference/parserMemberFunctionDeclaration5.errors.txt index 402355919a0..10a546d6d74 100644 --- a/tests/baselines/reference/parserMemberFunctionDeclaration5.errors.txt +++ b/tests/baselines/reference/parserMemberFunctionDeclaration5.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/MemberFunctionDeclarations/parserMemberFunctionDeclaration5.ts(2,5): error TS1031: 'declare' modifier cannot appear on a class element. +tests/cases/conformance/parser/ecmascript5/MemberFunctionDeclarations/parserMemberFunctionDeclaration5.ts(2,5): error TS1031: 'declare' modifier cannot appear on class elements of this kind. tests/cases/conformance/parser/ecmascript5/MemberFunctionDeclarations/parserMemberFunctionDeclaration5.ts(2,19): error TS1183: An implementation cannot be declared in ambient contexts. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/MemberFunctionDeclarations/parserMemb class C { declare Foo() { } ~~~~~~~ -!!! error TS1031: 'declare' modifier cannot appear on a class element. +!!! error TS1031: 'declare' modifier cannot appear on class elements of this kind. ~ !!! error TS1183: An implementation cannot be declared in ambient contexts. } \ No newline at end of file diff --git a/tests/baselines/reference/parserMemberVariableDeclaration4.errors.txt b/tests/baselines/reference/parserMemberVariableDeclaration4.errors.txt index ee28c06162f..ffe70749ecd 100644 --- a/tests/baselines/reference/parserMemberVariableDeclaration4.errors.txt +++ b/tests/baselines/reference/parserMemberVariableDeclaration4.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/parser/ecmascript5/MemberVariableDeclarations/parserMemberVariableDeclaration4.ts(2,3): error TS1031: 'export' modifier cannot appear on a class element. +tests/cases/conformance/parser/ecmascript5/MemberVariableDeclarations/parserMemberVariableDeclaration4.ts(2,3): error TS1031: 'export' modifier cannot appear on class elements of this kind. ==== tests/cases/conformance/parser/ecmascript5/MemberVariableDeclarations/parserMemberVariableDeclaration4.ts (1 errors) ==== class C { export Foo; ~~~~~~ -!!! error TS1031: 'export' modifier cannot appear on a class element. +!!! error TS1031: 'export' modifier cannot appear on class elements of this kind. } \ No newline at end of file