mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Scan types of yield expressions in classes too
Also, drop the other cases where they were ignored, since they're forbidden in enums, and the others are fine wrt the comment that was there. Fixes #34892
This commit is contained in:
1 parent
20b246c83a
commit
f017fa04c4
9 files changed
+9
-12
No files matched your search
@@ -1221,11 +1221,8 @@ namespace ts {
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
case SyntaxKind.TypeAliasDeclaration:
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
case SyntaxKind.ClassExpression:
|
||||
// These are not allowed inside a generator now, but eventually they may be allowed
|
||||
// as local types. Regardless, any yield statements contained within them should be
|
||||
// skipped in this traversal.
|
||||
// as local types. Regardless, skip them to avoid the work.
|
||||
return;
|
||||
default:
|
||||
if (isFunctionLike(node)) {
|
||||
|
||||
@@ -8,7 +8,7 @@ function decorator(x: any) {
|
||||
>y : any
|
||||
}
|
||||
function* g() {
|
||||
>g : () => Generator<never, void, unknown>
|
||||
>g : () => Generator<number, void, any>
|
||||
|
||||
@decorator(yield 0)
|
||||
>decorator(yield 0) : (y: any) => void
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck40.ts ===
|
||||
function* g() {
|
||||
>g : () => Generator<never, void, unknown>
|
||||
>g : () => Generator<number, void, unknown>
|
||||
|
||||
class C extends (yield 0) { }
|
||||
>C : C
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck55.ts ===
|
||||
function* g() {
|
||||
>g : () => Generator<never, void, unknown>
|
||||
>g : () => Generator<any, void, unknown>
|
||||
|
||||
var x = class C extends (yield) {};
|
||||
>x : typeof C
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck56.ts ===
|
||||
function* g() {
|
||||
>g : () => Generator<never, void, unknown>
|
||||
>g : () => Generator<number, void, unknown>
|
||||
|
||||
var x = class C {
|
||||
>x : typeof C
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck57.ts ===
|
||||
function* g() {
|
||||
>g : () => Generator<never, void, unknown>
|
||||
>g : () => Generator<number, void, unknown>
|
||||
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck58.ts ===
|
||||
function* g() {
|
||||
>g : () => Generator<never, void, unknown>
|
||||
>g : () => Generator<number, void, unknown>
|
||||
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck60.ts ===
|
||||
function* g() {
|
||||
>g : () => Generator<never, void, unknown>
|
||||
>g : () => Generator<any, void, unknown>
|
||||
|
||||
class C extends (yield) {};
|
||||
>C : C
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck61.ts ===
|
||||
function * g() {
|
||||
>g : () => Generator<never, void, unknown>
|
||||
>g : () => Generator<number, void, unknown>
|
||||
|
||||
@(yield 0)
|
||||
>(yield 0) : any
|
||||
|
||||
Reference in new issue
Block a user