| 1 |
[case testLambdaInheritsCheckedContextFromFunc] |
| 2 |
def g(): |
| 3 |
return lambda x: UNDEFINED in x |
| 4 |
[out] |
| 5 |
MypyFile:1( |
| 6 |
FuncDef:1( |
| 7 |
g |
| 8 |
Block:2( |
| 9 |
ReturnStmt:2( |
| 10 |
LambdaExpr:2( |
| 11 |
Args( |
| 12 |
Var(x)) |
| 13 |
Block:2( |
| 14 |
ReturnStmt:2( |
| 15 |
ComparisonExpr:2( |
| 16 |
in |
| 17 |
NameExpr(UNDEFINED) |
| 18 |
NameExpr(x [l]))))))))) |
| 19 |
|
| 20 |
[case testLambdaInheritsCheckedContextFromFuncForced] |
| 21 |
# flags: --check-untyped-defs |
| 22 |
def g(): |
| 23 |
return lambda x: UNDEFINED in x # E: Name "UNDEFINED" is not defined |
| 24 |
|
| 25 |
[case testLambdaInheritsCheckedContextFromTypedFunc] |
| 26 |
def g() -> None: |
| 27 |
return lambda x: UNDEFINED in x # E: Name "UNDEFINED" is not defined |
| 28 |
|
| 29 |
[case testLambdaInheritsCheckedContextFromTypedFuncForced] |
| 30 |
# flags: --check-untyped-defs |
| 31 |
def g() -> None: |
| 32 |
return lambda x: UNDEFINED in x # E: Name "UNDEFINED" is not defined |
| 33 |
|
| 34 |
[case testLambdaInheritsCheckedContextFromModule] |
| 35 |
g = lambda x: UNDEFINED in x # E: Name "UNDEFINED" is not defined |
| 36 |
|
| 37 |
[case testLambdaInheritsCheckedContextFromModuleForce] |
| 38 |
# flags: --check-untyped-defs |
| 39 |
g = lambda x: UNDEFINED in x # E: Name "UNDEFINED" is not defined |
| 40 |
|
| 41 |
[case testLambdaInheritsCheckedContextFromModuleLambdaStack] |
| 42 |
g = lambda: lambda: lambda x: UNDEFINED in x # E: Name "UNDEFINED" is not defined |
| 43 |
|
| 44 |
[case testLambdaInheritsCheckedContextFromModuleLambdaStackForce] |
| 45 |
# flags: --check-untyped-defs |
| 46 |
g = lambda: lambda: lambda x: UNDEFINED in x # E: Name "UNDEFINED" is not defined |
| 47 |
|
| 48 |
[case testLambdaInheritsCheckedContextFromFuncLambdaStack] |
| 49 |
def g(): |
| 50 |
return lambda: lambda: lambda x: UNDEFINED in x |
| 51 |
[out] |
| 52 |
MypyFile:1( |
| 53 |
FuncDef:1( |
| 54 |
g |
| 55 |
Block:2( |
| 56 |
ReturnStmt:2( |
| 57 |
LambdaExpr:2( |
| 58 |
Block:2( |
| 59 |
ReturnStmt:2( |
| 60 |
LambdaExpr:2( |
| 61 |
Block:2( |
| 62 |
ReturnStmt:2( |
| 63 |
LambdaExpr:2( |
| 64 |
Args( |
| 65 |
Var(x)) |
| 66 |
Block:2( |
| 67 |
ReturnStmt:2( |
| 68 |
ComparisonExpr:2( |
| 69 |
in |
| 70 |
NameExpr(UNDEFINED) |
| 71 |
NameExpr(x [l]))))))))))))))) |
| 72 |
|
| 73 |
[case testLambdaInheritsCheckedContextFromFuncLambdaStackForce] |
| 74 |
# flags: --check-untyped-defs |
| 75 |
def g(): |
| 76 |
return lambda: lambda: lambda x: UNDEFINED in x # E: Name "UNDEFINED" is not defined |
| 77 |
|
| 78 |
[case testLambdaInheritsCheckedContextFromTypedFuncLambdaStack] |
| 79 |
def g() -> None: |
| 80 |
return lambda: lambda: lambda x: UNDEFINED in x # E: Name "UNDEFINED" is not defined |
| 81 |
|
| 82 |
[case testLambdaInheritsCheckedContextFromTypedFuncLambdaStackForce] |
| 83 |
# flags: --check-untyped-defs |
| 84 |
def g() -> None: |
| 85 |
return lambda: lambda: lambda x: UNDEFINED in x # E: Name "UNDEFINED" is not defined |
| 86 |
|
| 87 |
[case testLambdaInheritsCheckedContextFromClassLambdaStack] |
| 88 |
class A: |
| 89 |
g = lambda: lambda: lambda x: UNDEFINED in x # E: Name "UNDEFINED" is not defined |
| 90 |
|
| 91 |
[case testLambdaInheritsCheckedContextFromClassLambdaStackForce] |
| 92 |
# flags: --check-untyped-defs |
| 93 |
class A: |
| 94 |
g = lambda: lambda: lambda x: UNDEFINED in x # E: Name "UNDEFINED" is not defined |