mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-15 02:59:33 +07:00
Fixed false positive for 'yield' expressions in lambdas (PY-11663)
This commit is contained in:
@@ -33,7 +33,7 @@ public class ReturnAnnotator extends PyAnnotator {
|
||||
|
||||
public void visitPyYieldExpression(final PyYieldExpression node) {
|
||||
final ScopeOwner owner = ScopeUtil.getScopeOwner(node);
|
||||
if (!(owner instanceof PyFunction)) {
|
||||
if (!(owner instanceof PyFunction || owner instanceof PyLambdaExpression)) {
|
||||
getHolder().createErrorAnnotation(node, "'yield' outside of function");
|
||||
}
|
||||
}
|
||||
|
||||
1
python/testData/highlighting/yieldInLambda.py
Normal file
1
python/testData/highlighting/yieldInLambda.py
Normal file
@@ -0,0 +1 @@
|
||||
g = lambda: (yield 10)
|
||||
@@ -114,6 +114,11 @@ public class PythonHighlightingTest extends PyTestCase {
|
||||
public void testYieldInDefaultValue() {
|
||||
doTest(LanguageLevel.PYTHON34, true, false);
|
||||
}
|
||||
|
||||
// PY-11663
|
||||
public void testYieldInLambda() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testImportStarAtTopLevel() {
|
||||
doTest(true, false);
|
||||
|
||||
Reference in New Issue
Block a user