mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-06 03:21:12 +07:00
Overriding a coroutine method does not add the "async" keyword (PY-19312)
This commit is contained in:
@@ -203,6 +203,9 @@ public class PyOverrideImplementUtil {
|
||||
if (anno != null && level.isAtLeast(LanguageLevel.PYTHON30)) {
|
||||
pyFunctionBuilder.annotation(anno.getText());
|
||||
}
|
||||
if (baseFunction.isAsync()) {
|
||||
pyFunctionBuilder.makeAsync();
|
||||
}
|
||||
final TypeEvalContext context = TypeEvalContext.userInitiated(baseFunction.getProject(), baseFunction.getContainingFile());
|
||||
final List<PyCallableParameter> baseParams = baseFunction.getParameters(context);
|
||||
for (PyCallableParameter parameter : baseParams) {
|
||||
|
||||
6
python/testData/override/asyncMethod.py
Normal file
6
python/testData/override/asyncMethod.py
Normal file
@@ -0,0 +1,6 @@
|
||||
class A:
|
||||
async def foo(self):
|
||||
pass
|
||||
|
||||
class B(A):
|
||||
<caret>pass
|
||||
8
python/testData/override/asyncMethod_after.py
Normal file
8
python/testData/override/asyncMethod_after.py
Normal file
@@ -0,0 +1,8 @@
|
||||
class A:
|
||||
async def foo(self):
|
||||
pass
|
||||
|
||||
class B(A):
|
||||
async def foo(self):
|
||||
return super().foo()
|
||||
|
||||
@@ -188,4 +188,9 @@ public class PyOverrideTest extends PyTestCase {
|
||||
PyOverrideImplementUtil.overrideMethods(myFixture.getEditor(), cls, Collections.singletonList(new PyMethodMember(method)), false);
|
||||
myFixture.checkResultByFile("override/" + getTestName(true) + "_after.py", true);
|
||||
}
|
||||
|
||||
// PY-19312
|
||||
public void testAsyncMethod() {
|
||||
runWithLanguageLevel(LanguageLevel.PYTHON36, () -> doTest());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user