diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 04766f22c4e..e81da871809 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -7897,7 +7897,7 @@ module ts { function checkYieldExpression(node: YieldExpression): void { // Grammar checking if (!(node.parserContextFlags & ParserContextFlags.Yield)) { - grammarErrorOnFirstToken(node, Diagnostics.yield_expression_must_be_contained_within_a_generator_declaration); + grammarErrorOnFirstToken(node, Diagnostics.A_yield_expression_is_only_allowed_in_a_generator_declaration); } else { grammarErrorOnFirstToken(node, Diagnostics.yield_expressions_are_not_currently_supported); diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 14163e81195..21c953e21c2 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -120,7 +120,7 @@ module ts { Unterminated_template_literal: { code: 1160, category: DiagnosticCategory.Error, key: "Unterminated template literal." }, Unterminated_regular_expression_literal: { code: 1161, category: DiagnosticCategory.Error, key: "Unterminated regular expression literal." }, An_object_member_cannot_be_declared_optional: { code: 1162, category: DiagnosticCategory.Error, key: "An object member cannot be declared optional." }, - yield_expression_must_be_contained_within_a_generator_declaration: { code: 1163, category: DiagnosticCategory.Error, key: "'yield' expression must be contained_within a generator declaration." }, + A_yield_expression_is_only_allowed_in_a_generator_declaration: { code: 1163, category: DiagnosticCategory.Error, key: "A 'yield' expression is only allowed in a generator declaration." }, Computed_property_names_are_not_allowed_in_enums: { code: 1164, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in enums." }, A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol: { code: 1165, category: DiagnosticCategory.Error, key: "A computed property name in an ambient context must directly refer to a built-in symbol." }, A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol: { code: 1166, category: DiagnosticCategory.Error, key: "A computed property name in a class property declaration must directly refer to a built-in symbol." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 18c98928dda..f7ca2171fea 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -467,7 +467,7 @@ "category": "Error", "code": 1162 }, - "'yield' expression must be contained_within a generator declaration.": { + "A 'yield' expression is only allowed in a generator declaration.": { "category": "Error", "code": 1163 }, diff --git a/tests/baselines/reference/YieldExpression12_es6.errors.txt b/tests/baselines/reference/YieldExpression12_es6.errors.txt index 10843421a3f..3f007c07b6d 100644 --- a/tests/baselines/reference/YieldExpression12_es6.errors.txt +++ b/tests/baselines/reference/YieldExpression12_es6.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es6/yieldExpressions/YieldExpression12_es6.ts(3,6): error TS1163: 'yield' expression must be contained_within a generator declaration. +tests/cases/conformance/es6/yieldExpressions/YieldExpression12_es6.ts(3,6): error TS1163: A 'yield' expression is only allowed in a generator declaration. ==== tests/cases/conformance/es6/yieldExpressions/YieldExpression12_es6.ts (1 errors) ==== @@ -6,6 +6,6 @@ tests/cases/conformance/es6/yieldExpressions/YieldExpression12_es6.ts(3,6): erro constructor() { yield foo ~~~~~ -!!! error TS1163: 'yield' expression must be contained_within a generator declaration. +!!! error TS1163: A 'yield' expression is only allowed in a generator declaration. } } \ No newline at end of file diff --git a/tests/baselines/reference/YieldExpression14_es6.errors.txt b/tests/baselines/reference/YieldExpression14_es6.errors.txt index baeaf3ba30e..3a47ad2bf39 100644 --- a/tests/baselines/reference/YieldExpression14_es6.errors.txt +++ b/tests/baselines/reference/YieldExpression14_es6.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es6/yieldExpressions/YieldExpression14_es6.ts(3,6): error TS1163: 'yield' expression must be contained_within a generator declaration. +tests/cases/conformance/es6/yieldExpressions/YieldExpression14_es6.ts(3,6): error TS1163: A 'yield' expression is only allowed in a generator declaration. ==== tests/cases/conformance/es6/yieldExpressions/YieldExpression14_es6.ts (1 errors) ==== @@ -6,6 +6,6 @@ tests/cases/conformance/es6/yieldExpressions/YieldExpression14_es6.ts(3,6): erro foo() { yield foo ~~~~~ -!!! error TS1163: 'yield' expression must be contained_within a generator declaration. +!!! error TS1163: A 'yield' expression is only allowed in a generator declaration. } } \ No newline at end of file diff --git a/tests/baselines/reference/YieldExpression15_es6.errors.txt b/tests/baselines/reference/YieldExpression15_es6.errors.txt index 5e548799f5d..ded6fa9aeb8 100644 --- a/tests/baselines/reference/YieldExpression15_es6.errors.txt +++ b/tests/baselines/reference/YieldExpression15_es6.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/es6/yieldExpressions/YieldExpression15_es6.ts(2,6): error TS1163: 'yield' expression must be contained_within a generator declaration. +tests/cases/conformance/es6/yieldExpressions/YieldExpression15_es6.ts(2,6): error TS1163: A 'yield' expression is only allowed in a generator declaration. ==== tests/cases/conformance/es6/yieldExpressions/YieldExpression15_es6.ts (1 errors) ==== var v = () => { yield foo ~~~~~ -!!! error TS1163: 'yield' expression must be contained_within a generator declaration. +!!! error TS1163: A 'yield' expression is only allowed in a generator declaration. } \ No newline at end of file diff --git a/tests/baselines/reference/YieldExpression16_es6.errors.txt b/tests/baselines/reference/YieldExpression16_es6.errors.txt index c0d2e4c8fc8..304d4eca05c 100644 --- a/tests/baselines/reference/YieldExpression16_es6.errors.txt +++ b/tests/baselines/reference/YieldExpression16_es6.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/es6/yieldExpressions/YieldExpression16_es6.ts(1,9): error TS9001: Generators are not currently supported. -tests/cases/conformance/es6/yieldExpressions/YieldExpression16_es6.ts(3,5): error TS1163: 'yield' expression must be contained_within a generator declaration. +tests/cases/conformance/es6/yieldExpressions/YieldExpression16_es6.ts(3,5): error TS1163: A 'yield' expression is only allowed in a generator declaration. ==== tests/cases/conformance/es6/yieldExpressions/YieldExpression16_es6.ts (2 errors) ==== @@ -9,6 +9,6 @@ tests/cases/conformance/es6/yieldExpressions/YieldExpression16_es6.ts(3,5): erro function bar() { yield foo; ~~~~~ -!!! error TS1163: 'yield' expression must be contained_within a generator declaration. +!!! error TS1163: A 'yield' expression is only allowed in a generator declaration. } } \ No newline at end of file diff --git a/tests/baselines/reference/YieldExpression17_es6.errors.txt b/tests/baselines/reference/YieldExpression17_es6.errors.txt index b39f47b07f9..59b728ac495 100644 --- a/tests/baselines/reference/YieldExpression17_es6.errors.txt +++ b/tests/baselines/reference/YieldExpression17_es6.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/es6/yieldExpressions/YieldExpression17_es6.ts(1,15): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/es6/yieldExpressions/YieldExpression17_es6.ts(1,15): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. -tests/cases/conformance/es6/yieldExpressions/YieldExpression17_es6.ts(1,23): error TS1163: 'yield' expression must be contained_within a generator declaration. +tests/cases/conformance/es6/yieldExpressions/YieldExpression17_es6.ts(1,23): error TS1163: A 'yield' expression is only allowed in a generator declaration. ==== tests/cases/conformance/es6/yieldExpressions/YieldExpression17_es6.ts (3 errors) ==== @@ -10,4 +10,4 @@ tests/cases/conformance/es6/yieldExpressions/YieldExpression17_es6.ts(1,23): err ~~~ !!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. ~~~~~ -!!! error TS1163: 'yield' expression must be contained_within a generator declaration. \ No newline at end of file +!!! error TS1163: A 'yield' expression is only allowed in a generator declaration. \ No newline at end of file diff --git a/tests/baselines/reference/YieldExpression18_es6.errors.txt b/tests/baselines/reference/YieldExpression18_es6.errors.txt index 3a67acdebcd..274592904ed 100644 --- a/tests/baselines/reference/YieldExpression18_es6.errors.txt +++ b/tests/baselines/reference/YieldExpression18_es6.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/es6/yieldExpressions/YieldExpression18_es6.ts(2,1): error TS1163: 'yield' expression must be contained_within a generator declaration. +tests/cases/conformance/es6/yieldExpressions/YieldExpression18_es6.ts(2,1): error TS1163: A 'yield' expression is only allowed in a generator declaration. ==== tests/cases/conformance/es6/yieldExpressions/YieldExpression18_es6.ts (1 errors) ==== "use strict"; yield(foo); ~~~~~ -!!! error TS1163: 'yield' expression must be contained_within a generator declaration. \ No newline at end of file +!!! error TS1163: A 'yield' expression is only allowed in a generator declaration. \ No newline at end of file diff --git a/tests/baselines/reference/YieldExpression2_es6.errors.txt b/tests/baselines/reference/YieldExpression2_es6.errors.txt index 553dab51fc2..280f0b88f93 100644 --- a/tests/baselines/reference/YieldExpression2_es6.errors.txt +++ b/tests/baselines/reference/YieldExpression2_es6.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/yieldExpressions/YieldExpression2_es6.ts(1,1): error TS1163: 'yield' expression must be contained_within a generator declaration. +tests/cases/conformance/es6/yieldExpressions/YieldExpression2_es6.ts(1,1): error TS1163: A 'yield' expression is only allowed in a generator declaration. ==== tests/cases/conformance/es6/yieldExpressions/YieldExpression2_es6.ts (1 errors) ==== yield foo; ~~~~~ -!!! error TS1163: 'yield' expression must be contained_within a generator declaration. \ No newline at end of file +!!! error TS1163: A 'yield' expression is only allowed in a generator declaration. \ No newline at end of file