Allow yield expressions, and allow generators only in ES6 and higher

This commit is contained in:
Jason Freeman
2015-05-04 16:00:18 -07:00
parent 8dac1bf033
commit 124fdb6048
53 changed files with 216 additions and 230 deletions
+7 -4
View File
@@ -7899,9 +7899,6 @@ module ts {
if (!(node.parserContextFlags & ParserContextFlags.Yield)) {
grammarErrorOnFirstToken(node, Diagnostics.A_yield_expression_is_only_allowed_in_a_generator_declaration);
}
else {
grammarErrorOnFirstToken(node, Diagnostics.yield_expressions_are_not_currently_supported);
}
}
function checkConditionalExpression(node: ConditionalExpression, contextualMapper?: TypeMapper): Type {
@@ -12549,7 +12546,13 @@ module ts {
function checkGrammarForGenerator(node: FunctionLikeDeclaration) {
if (node.asteriskToken) {
return grammarErrorOnNode(node.asteriskToken, Diagnostics.Generators_are_not_currently_supported);
Debug.assert(
node.kind === SyntaxKind.FunctionDeclaration ||
node.kind === SyntaxKind.FunctionExpression ||
node.kind === SyntaxKind.MethodDeclaration);
if (languageVersion < ScriptTarget.ES6) {
return grammarErrorOnNode(node.asteriskToken, Diagnostics.Generators_are_only_available_when_targeting_ECMAScript_6_or_higher);
}
}
}
@@ -174,6 +174,7 @@ module ts {
Type_expected_0_is_a_reserved_word_in_strict_mode: { code: 1215, category: DiagnosticCategory.Error, key: "Type expected. '{0}' is a reserved word in strict mode" },
Type_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode: { code: 1216, category: DiagnosticCategory.Error, key: "Type expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode." },
Export_assignment_is_not_supported_when_module_flag_is_system: { code: 1218, category: DiagnosticCategory.Error, key: "Export assignment is not supported when '--module' flag is 'system'." },
Generators_are_only_available_when_targeting_ECMAScript_6_or_higher: { code: 1219, category: DiagnosticCategory.Error, key: "Generators are only available when targeting ECMAScript 6 or higher." },
Duplicate_identifier_0: { code: 2300, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." },
Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: DiagnosticCategory.Error, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." },
Static_members_cannot_reference_class_type_parameters: { code: 2302, category: DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." },
@@ -539,8 +540,6 @@ module ts {
enum_declarations_can_only_be_used_in_a_ts_file: { code: 8015, category: DiagnosticCategory.Error, key: "'enum declarations' can only be used in a .ts file." },
type_assertion_expressions_can_only_be_used_in_a_ts_file: { code: 8016, category: DiagnosticCategory.Error, key: "'type assertion expressions' can only be used in a .ts file." },
decorators_can_only_be_used_in_a_ts_file: { code: 8017, category: DiagnosticCategory.Error, key: "'decorators' can only be used in a .ts file." },
yield_expressions_are_not_currently_supported: { code: 9000, category: DiagnosticCategory.Error, key: "'yield' expressions are not currently supported." },
Generators_are_not_currently_supported: { code: 9001, category: DiagnosticCategory.Error, key: "Generators are not currently supported." },
Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses: { code: 9002, category: DiagnosticCategory.Error, key: "Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses." },
class_expressions_are_not_currently_supported: { code: 9003, category: DiagnosticCategory.Error, key: "'class' expressions are not currently supported." },
class_declarations_are_only_supported_directly_inside_a_module_or_as_a_top_level_declaration: { code: 9004, category: DiagnosticCategory.Error, key: "'class' declarations are only supported directly inside a module or as a top level declaration." },
+5 -8
View File
@@ -682,8 +682,13 @@
"Export assignment is not supported when '--module' flag is 'system'.": {
"category": "Error",
"code": 1218
},
"Generators are only available when targeting ECMAScript 6 or higher.": {
"category": "Error",
"code": 1219
},
"Duplicate identifier '{0}'.": {
"category": "Error",
"code": 2300
@@ -2149,14 +2154,6 @@
"code": 8017
},
"'yield' expressions are not currently supported.": {
"category": "Error",
"code": 9000
},
"Generators are not currently supported.": {
"category": "Error",
"code": 9001
},
"Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses.": {
"category": "Error",
"code": 9002
@@ -1,8 +1,8 @@
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration10_es6.ts(1,10): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration10_es6.ts(1,10): error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration10_es6.ts (1 errors) ====
function * foo(a = yield => yield) {
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
}
@@ -1,8 +1,8 @@
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration11_es6.ts(1,10): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration11_es6.ts(1,10): error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration11_es6.ts (1 errors) ====
function * yield() {
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
}
@@ -1,11 +1,11 @@
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration13_es6.ts(1,10): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration13_es6.ts(1,10): error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration13_es6.ts(3,11): error TS2304: Cannot find name 'yield'.
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration13_es6.ts (2 errors) ====
function * foo() {
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
// Legal to use 'yield' in a type context.
var v: yield;
~~~~~
@@ -1,8 +1,8 @@
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration1_es6.ts(1,10): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration1_es6.ts(1,10): error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration1_es6.ts (1 errors) ====
function * foo() {
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
}
@@ -1,11 +1,11 @@
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration6_es6.ts(1,9): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration6_es6.ts(1,9): error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration6_es6.ts(1,18): error TS2304: Cannot find name 'yield'.
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration6_es6.ts (2 errors) ====
function*foo(a = yield) {
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
~~~~~
!!! error TS2304: Cannot find name 'yield'.
}
@@ -1,16 +1,16 @@
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts(1,9): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts(3,11): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts(1,9): error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts(3,11): error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts(3,20): error TS2304: Cannot find name 'yield'.
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts (3 errors) ====
function*bar() {
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
// 'yield' here is an identifier, and not a yield expression.
function*foo(a = yield) {
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
~~~~~
!!! error TS2304: Cannot find name 'yield'.
}
@@ -1,12 +1,9 @@
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts(1,10): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts(2,14): error TS9000: 'yield' expressions are not currently supported.
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts(1,10): error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts (2 errors) ====
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts (1 errors) ====
function * foo() {
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
var v = { [yield]: foo }
~~~~~
!!! error TS9000: 'yield' expressions are not currently supported.
}
@@ -1,7 +1,7 @@
tests/cases/conformance/es6/functionExpressions/FunctionExpression1_es6.ts(1,18): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/functionExpressions/FunctionExpression1_es6.ts(1,18): error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/es6/functionExpressions/FunctionExpression1_es6.ts (1 errors) ====
var v = function * () { }
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
@@ -1,7 +1,7 @@
tests/cases/conformance/es6/functionExpressions/FunctionExpression2_es6.ts(1,18): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/functionExpressions/FunctionExpression2_es6.ts(1,18): error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/es6/functionExpressions/FunctionExpression2_es6.ts (1 errors) ====
var v = function * foo() { }
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
@@ -1,7 +1,7 @@
tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments1_es6.ts(1,11): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments1_es6.ts(1,11): error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments1_es6.ts (1 errors) ====
var v = { *foo() { } }
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
@@ -1,10 +1,10 @@
tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts(1,11): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts(1,11): error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts(1,13): error TS2304: Cannot find name 'foo'.
==== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts (2 errors) ====
var v = { *[foo()]() { } }
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
~~~
!!! error TS2304: Cannot find name 'foo'.
@@ -1,9 +1,9 @@
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration1_es6.ts(2,4): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration1_es6.ts(2,4): error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration1_es6.ts (1 errors) ====
class C {
*foo() { }
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
}
@@ -1,9 +1,9 @@
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration2_es6.ts(2,11): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration2_es6.ts(2,11): error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration2_es6.ts (1 errors) ====
class C {
public * foo() { }
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
}
@@ -1,4 +1,4 @@
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration3_es6.ts(2,4): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration3_es6.ts(2,4): error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration3_es6.ts(2,6): error TS2304: Cannot find name 'foo'.
@@ -6,7 +6,7 @@ tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration
class C {
*[foo]() { }
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
~~~
!!! error TS2304: Cannot find name 'foo'.
}
@@ -1,9 +1,9 @@
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration7_es6.ts(2,4): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration7_es6.ts(2,4): error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration7_es6.ts (1 errors) ====
class C {
*foo<T>() { }
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
}
@@ -1,14 +1,11 @@
tests/cases/conformance/es6/yieldExpressions/YieldExpression10_es6.ts(1,11): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression10_es6.ts(2,5): error TS9000: 'yield' expressions are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression10_es6.ts(1,11): error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression10_es6.ts (2 errors) ====
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression10_es6.ts (1 errors) ====
var v = { * foo() {
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
yield(foo);
~~~~~
!!! error TS9000: 'yield' expressions are not currently supported.
}
}
@@ -1,14 +1,11 @@
tests/cases/conformance/es6/yieldExpressions/YieldExpression11_es6.ts(2,3): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression11_es6.ts(3,5): error TS9000: 'yield' expressions are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression11_es6.ts(2,3): error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression11_es6.ts (2 errors) ====
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression11_es6.ts (1 errors) ====
class C {
*foo() {
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
yield(foo);
~~~~~
!!! error TS9000: 'yield' expressions are not currently supported.
}
}
@@ -1,10 +1,7 @@
tests/cases/conformance/es6/yieldExpressions/YieldExpression13_es6.ts(1,9): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression13_es6.ts(1,19): error TS9000: 'yield' expressions are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression13_es6.ts(1,9): error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression13_es6.ts (2 errors) ====
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression13_es6.ts (1 errors) ====
function* foo() { yield }
~
!!! error TS9001: Generators are not currently supported.
~~~~~
!!! error TS9000: 'yield' expressions are not currently supported.
!!! error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
@@ -1,11 +1,11 @@
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(1,9): error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
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) ====
function* foo() {
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
function bar() {
yield foo;
~~~~~
@@ -1,19 +1,16 @@
tests/cases/conformance/es6/yieldExpressions/YieldExpression19_es6.ts(1,9): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression19_es6.ts(3,13): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression19_es6.ts(4,7): error TS9000: 'yield' expressions are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression19_es6.ts(1,9): error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
tests/cases/conformance/es6/yieldExpressions/YieldExpression19_es6.ts(3,13): error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression19_es6.ts (3 errors) ====
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression19_es6.ts (2 errors) ====
function*foo() {
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
function bar() {
function* quux() {
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
yield(foo);
~~~~~
!!! error TS9000: 'yield' expressions are not currently supported.
}
}
}
@@ -1,16 +1,10 @@
tests/cases/conformance/es6/yieldExpressions/YieldExpression3_es6.ts(1,9): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression3_es6.ts(2,3): error TS9000: 'yield' expressions are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression3_es6.ts(3,3): error TS9000: 'yield' expressions are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression3_es6.ts(1,9): error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression3_es6.ts (3 errors) ====
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression3_es6.ts (1 errors) ====
function* foo() {
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
yield
~~~~~
!!! error TS9000: 'yield' expressions are not currently supported.
yield
~~~~~
!!! error TS9000: 'yield' expressions are not currently supported.
}
@@ -1,16 +1,10 @@
tests/cases/conformance/es6/yieldExpressions/YieldExpression4_es6.ts(1,9): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression4_es6.ts(2,3): error TS9000: 'yield' expressions are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression4_es6.ts(3,3): error TS9000: 'yield' expressions are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression4_es6.ts(1,9): error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression4_es6.ts (3 errors) ====
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression4_es6.ts (1 errors) ====
function* foo() {
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
yield;
~~~~~
!!! error TS9000: 'yield' expressions are not currently supported.
yield;
~~~~~
!!! error TS9000: 'yield' expressions are not currently supported.
}
@@ -1,12 +1,9 @@
tests/cases/conformance/es6/yieldExpressions/YieldExpression6_es6.ts(1,9): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression6_es6.ts(2,3): error TS9000: 'yield' expressions are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression6_es6.ts(1,9): error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression6_es6.ts (2 errors) ====
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression6_es6.ts (1 errors) ====
function* foo() {
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
yield*foo
~~~~~
!!! error TS9000: 'yield' expressions are not currently supported.
}
@@ -1,12 +1,9 @@
tests/cases/conformance/es6/yieldExpressions/YieldExpression7_es6.ts(1,9): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression7_es6.ts(2,3): error TS9000: 'yield' expressions are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression7_es6.ts(1,9): error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression7_es6.ts (2 errors) ====
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression7_es6.ts (1 errors) ====
function* foo() {
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
yield foo
~~~~~
!!! error TS9000: 'yield' expressions are not currently supported.
}
@@ -1,16 +1,13 @@
tests/cases/conformance/es6/yieldExpressions/YieldExpression8_es6.ts(1,1): error TS2304: Cannot find name 'yield'.
tests/cases/conformance/es6/yieldExpressions/YieldExpression8_es6.ts(2,9): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression8_es6.ts(3,3): error TS9000: 'yield' expressions are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression8_es6.ts(2,9): error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression8_es6.ts (3 errors) ====
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression8_es6.ts (2 errors) ====
yield(foo);
~~~~~
!!! error TS2304: Cannot find name 'yield'.
function* foo() {
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
yield(foo);
~~~~~
!!! error TS9000: 'yield' expressions are not currently supported.
}
@@ -1,12 +1,9 @@
tests/cases/conformance/es6/yieldExpressions/YieldExpression9_es6.ts(1,17): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression9_es6.ts(2,3): error TS9000: 'yield' expressions are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression9_es6.ts(1,17): error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression9_es6.ts (2 errors) ====
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression9_es6.ts (1 errors) ====
var v = function*() {
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
yield(foo);
~~~~~
!!! error TS9000: 'yield' expressions are not currently supported.
}
@@ -1,12 +1,9 @@
tests/cases/conformance/es6/yieldExpressions/YieldStarExpression4_es6.ts(1,10): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldStarExpression4_es6.ts(2,5): error TS9000: 'yield' expressions are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldStarExpression4_es6.ts(1,10): error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/es6/yieldExpressions/YieldStarExpression4_es6.ts (2 errors) ====
==== tests/cases/conformance/es6/yieldExpressions/YieldStarExpression4_es6.ts (1 errors) ====
function *g() {
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
yield * [];
~~~~~
!!! error TS9000: 'yield' expressions are not currently supported.
}
@@ -1,12 +0,0 @@
tests/cases/compiler/generatorES6_1.ts(1,9): error TS9001: Generators are not currently supported.
tests/cases/compiler/generatorES6_1.ts(2,5): error TS9000: 'yield' expressions are not currently supported.
==== tests/cases/compiler/generatorES6_1.ts (2 errors) ====
function* foo() {
~
!!! error TS9001: Generators are not currently supported.
yield
~~~~~
!!! error TS9000: 'yield' expressions are not currently supported.
}
@@ -0,0 +1,6 @@
=== tests/cases/compiler/generatorES6_1.ts ===
function* foo() {
>foo : Symbol(foo, Decl(generatorES6_1.ts, 0, 0))
yield
}
@@ -0,0 +1,6 @@
=== tests/cases/compiler/generatorES6_1.ts ===
function* foo() {
>foo : () => void
yield
}
@@ -1,14 +0,0 @@
tests/cases/compiler/generatorES6_2.ts(2,12): error TS9001: Generators are not currently supported.
tests/cases/compiler/generatorES6_2.ts(3,9): error TS9000: 'yield' expressions are not currently supported.
==== tests/cases/compiler/generatorES6_2.ts (2 errors) ====
class C {
public * foo() {
~
!!! error TS9001: Generators are not currently supported.
yield 1
~~~~~
!!! error TS9000: 'yield' expressions are not currently supported.
}
}
@@ -0,0 +1,10 @@
=== tests/cases/compiler/generatorES6_2.ts ===
class C {
>C : Symbol(C, Decl(generatorES6_2.ts, 0, 0))
public * foo() {
>foo : Symbol(foo, Decl(generatorES6_2.ts, 0, 9))
yield 1
}
}
@@ -0,0 +1,10 @@
=== tests/cases/compiler/generatorES6_2.ts ===
class C {
>C : C
public * foo() {
>foo : () => void
yield 1
}
}
@@ -1,12 +0,0 @@
tests/cases/compiler/generatorES6_3.ts(1,17): error TS9001: Generators are not currently supported.
tests/cases/compiler/generatorES6_3.ts(2,5): error TS9000: 'yield' expressions are not currently supported.
==== tests/cases/compiler/generatorES6_3.ts (2 errors) ====
var v = function*() {
~
!!! error TS9001: Generators are not currently supported.
yield 0
~~~~~
!!! error TS9000: 'yield' expressions are not currently supported.
}
@@ -0,0 +1,6 @@
=== tests/cases/compiler/generatorES6_3.ts ===
var v = function*() {
>v : Symbol(v, Decl(generatorES6_3.ts, 0, 3))
yield 0
}
@@ -0,0 +1,7 @@
=== tests/cases/compiler/generatorES6_3.ts ===
var v = function*() {
>v : () => void
>function*() { yield 0} : () => void
yield 0
}
@@ -1,14 +0,0 @@
tests/cases/compiler/generatorES6_4.ts(2,4): error TS9001: Generators are not currently supported.
tests/cases/compiler/generatorES6_4.ts(3,8): error TS9000: 'yield' expressions are not currently supported.
==== tests/cases/compiler/generatorES6_4.ts (2 errors) ====
var v = {
*foo() {
~
!!! error TS9001: Generators are not currently supported.
yield 0
~~~~~
!!! error TS9000: 'yield' expressions are not currently supported.
}
}
@@ -0,0 +1,10 @@
=== tests/cases/compiler/generatorES6_4.ts ===
var v = {
>v : Symbol(v, Decl(generatorES6_4.ts, 0, 3))
*foo() {
>foo : Symbol(foo, Decl(generatorES6_4.ts, 0, 9))
yield 0
}
}
@@ -0,0 +1,11 @@
=== tests/cases/compiler/generatorES6_4.ts ===
var v = {
>v : { foo(): void; }
>{ *foo() { yield 0 }} : { foo(): void; }
*foo() {
>foo : () => void
yield 0
}
}
@@ -1,12 +0,0 @@
tests/cases/compiler/generatorES6_5.ts(1,9): error TS9001: Generators are not currently supported.
tests/cases/compiler/generatorES6_5.ts(2,5): error TS9000: 'yield' expressions are not currently supported.
==== tests/cases/compiler/generatorES6_5.ts (2 errors) ====
function* foo() {
~
!!! error TS9001: Generators are not currently supported.
yield a ? b : c;
~~~~~
!!! error TS9000: 'yield' expressions are not currently supported.
}
@@ -0,0 +1,6 @@
=== tests/cases/compiler/generatorES6_5.ts ===
function* foo() {
>foo : Symbol(foo, Decl(generatorES6_5.ts, 0, 0))
yield a ? b : c;
}
@@ -0,0 +1,10 @@
=== tests/cases/compiler/generatorES6_5.ts ===
function* foo() {
>foo : () => void
yield a ? b : c;
>a ? b : c : any
>a : any
>b : any
>c : any
}
@@ -1,14 +0,0 @@
tests/cases/compiler/generatorES6_6.ts(2,3): error TS9001: Generators are not currently supported.
tests/cases/compiler/generatorES6_6.ts(3,13): error TS9000: 'yield' expressions are not currently supported.
==== tests/cases/compiler/generatorES6_6.ts (2 errors) ====
class C {
*[Symbol.iterator]() {
~
!!! error TS9001: Generators are not currently supported.
let a = yield 1;
~~~~~
!!! error TS9000: 'yield' expressions are not currently supported.
}
}
@@ -0,0 +1,13 @@
=== tests/cases/compiler/generatorES6_6.ts ===
class C {
>C : Symbol(C, Decl(generatorES6_6.ts, 0, 0))
*[Symbol.iterator]() {
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11))
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31))
let a = yield 1;
>a : Symbol(a, Decl(generatorES6_6.ts, 2, 7))
}
}
@@ -0,0 +1,13 @@
=== tests/cases/compiler/generatorES6_6.ts ===
class C {
>C : C
*[Symbol.iterator]() {
>Symbol.iterator : symbol
>Symbol : SymbolConstructor
>iterator : symbol
let a = yield 1;
>a : any
}
}
@@ -1,14 +1,11 @@
tests/cases/conformance/es6/templates/templateStringInYieldKeyword.ts(1,9): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/templates/templateStringInYieldKeyword.ts(3,13): error TS9000: 'yield' expressions are not currently supported.
tests/cases/conformance/es6/templates/templateStringInYieldKeyword.ts(1,9): error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/es6/templates/templateStringInYieldKeyword.ts (2 errors) ====
==== tests/cases/conformance/es6/templates/templateStringInYieldKeyword.ts (1 errors) ====
function* gen() {
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
// Once this is supported, the inner expression does not need to be parenthesized.
var x = yield `abc${ x }def`;
~~~~~
!!! error TS9000: 'yield' expressions are not currently supported.
}
@@ -1,14 +0,0 @@
tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeywordES6.ts(1,9): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeywordES6.ts(3,20): error TS9000: 'yield' expressions are not currently supported.
==== tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeywordES6.ts (2 errors) ====
function* gen() {
~
!!! error TS9001: Generators are not currently supported.
// Once this is supported, yield *must* be parenthesized.
var x = `abc${ yield 10 }def`;
~~~~~
!!! error TS9000: 'yield' expressions are not currently supported.
}
@@ -0,0 +1,9 @@
=== tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeywordES6.ts ===
function* gen() {
>gen : Symbol(gen, Decl(templateStringWithEmbeddedYieldKeywordES6.ts, 0, 0))
// Once this is supported, yield *must* be parenthesized.
var x = `abc${ yield 10 }def`;
>x : Symbol(x, Decl(templateStringWithEmbeddedYieldKeywordES6.ts, 2, 7))
}
@@ -0,0 +1,10 @@
=== tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeywordES6.ts ===
function* gen() {
>gen : () => void
// Once this is supported, yield *must* be parenthesized.
var x = `abc${ yield 10 }def`;
>x : string
>`abc${ yield 10 }def` : string
}
@@ -1,12 +1,9 @@
tests/cases/compiler/yieldExpression1.ts(1,9): error TS9001: Generators are not currently supported.
tests/cases/compiler/yieldExpression1.ts(2,5): error TS9000: 'yield' expressions are not currently supported.
tests/cases/compiler/yieldExpression1.ts(1,9): error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
==== tests/cases/compiler/yieldExpression1.ts (2 errors) ====
==== tests/cases/compiler/yieldExpression1.ts (1 errors) ====
function* foo() {
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1218: Generators are only available when targeting ECMAScript 6 or higher.
yield
~~~~~
!!! error TS9000: 'yield' expressions are not currently supported.
}