mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-05 01:50:56 +07:00
PY-78250 Call PyDataclassTypeProvider before PyTypingTypeProvider so that it has a chance to infer the dataclass type first
GitOrigin-RevId: 18230af949275e3f585ce806fec25144731e347b
This commit is contained in:
committed by
intellij-monorepo-bot
parent
cabd6ccecc
commit
93efb0ac16
@@ -530,7 +530,7 @@
|
||||
<customDecoratorStubType implementation="com.jetbrains.python.psi.stubs.PyDataclassTransformDecoratorStubType"/>
|
||||
|
||||
<!-- typing -->
|
||||
<typeProvider implementation="com.jetbrains.python.codeInsight.typing.PyTypingTypeProvider"/>
|
||||
<typeProvider id="pyTypingTypeProvider" implementation="com.jetbrains.python.codeInsight.typing.PyTypingTypeProvider" order="before pythonDocstringTypeProvider"/>
|
||||
<typeProvider implementation="com.jetbrains.python.pyi.PyiTypeProvider"/>
|
||||
<typeProvider implementation="com.jetbrains.python.codeInsight.typing.PyTypedDictTypeProvider"/>
|
||||
<typeProvider implementation="com.jetbrains.python.codeInsight.typing.PyTypingNewTypeTypeProvider"/>
|
||||
@@ -571,7 +571,9 @@
|
||||
<!--stdlib-->
|
||||
<canonicalPathProvider implementation="com.jetbrains.python.codeInsight.stdlib.PyStdlibCanonicalPathProvider"/>
|
||||
<inspectionExtension implementation="com.jetbrains.python.inspections.stdlib.PyStdlibInspectionExtension"/>
|
||||
<typeProvider implementation="com.jetbrains.python.codeInsight.stdlib.PyDataclassTypeProvider"/>
|
||||
<typeProvider implementation="com.jetbrains.python.codeInsight.stdlib.PyDataclassTypeProvider"
|
||||
order="before pyTypingTypeProvider"
|
||||
/>
|
||||
<typeProvider implementation="com.jetbrains.python.codeInsight.decorator.PyDecoratedFunctionTypeProvider"
|
||||
id="pyDecoratedFunctionTypeProvider"/>
|
||||
<typeProvider implementation="com.jetbrains.python.codeInsight.decorator.PyFunctoolsWrapsDecoratedFunctionTypeProvider"
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
from dataclasses import dataclass
|
||||
from typing import Generic
|
||||
|
||||
from typing_extensions import TypeVar
|
||||
|
||||
T = TypeVar('T', default=int)
|
||||
|
||||
@dataclass
|
||||
class MyDataclass(Generic[T]):
|
||||
x: T
|
||||
|
||||
MyDataclass(x=1)
|
||||
@@ -0,0 +1,12 @@
|
||||
from dataclasses import dataclass
|
||||
from typing import Generic
|
||||
|
||||
from typing_extensions import TypeVar
|
||||
|
||||
T = TypeVar('T', default=int)
|
||||
|
||||
@dataclass
|
||||
class MyDataclass(Generic[T]):
|
||||
x: T
|
||||
|
||||
MyDataclass(<warning descr="Parameter 'x' unfilled">)</warning>
|
||||
12
python/testData/paramInfo/InitializingGenericDataclass.py
Normal file
12
python/testData/paramInfo/InitializingGenericDataclass.py
Normal file
@@ -0,0 +1,12 @@
|
||||
from dataclasses import dataclass
|
||||
from typing import Generic
|
||||
|
||||
from typing import TypeVar
|
||||
|
||||
T = TypeVar('T')
|
||||
|
||||
@dataclass
|
||||
class MyDataclass(Generic[T]):
|
||||
x: T
|
||||
|
||||
MyDataclass(<arg1>)
|
||||
@@ -0,0 +1,12 @@
|
||||
from dataclasses import dataclass
|
||||
from typing import Generic
|
||||
|
||||
from typing import TypeVar
|
||||
|
||||
T = TypeVar('T', default=int)
|
||||
|
||||
@dataclass
|
||||
class MyDataclass(Generic[T]):
|
||||
x: T
|
||||
|
||||
MyDataclass(<arg1>)
|
||||
@@ -1351,6 +1351,22 @@ public class PyParameterInfoTest extends LightMarkedTestCase {
|
||||
feignCtrlP(marks.get("<arg1>").getTextOffset()).check("id: int, name: str, year: int, new: bool", new String[]{"id: int, "});
|
||||
}
|
||||
|
||||
// PY-78250
|
||||
public void testInitializingGenericDataclassWithDefaultType() {
|
||||
runWithLanguageLevel(LanguageLevel.PYTHON313, () -> {
|
||||
final Map<String, PsiElement> marks = loadTest(1);
|
||||
feignCtrlP(marks.get("<arg1>").getTextOffset()).check("x: T", new String[]{"x: T"});
|
||||
});
|
||||
}
|
||||
|
||||
// PY-78250
|
||||
public void testInitializingGenericDataclass() {
|
||||
runWithLanguageLevel(LanguageLevel.PYTHON313, () -> {
|
||||
final Map<String, PsiElement> marks = loadTest(1);
|
||||
feignCtrlP(marks.get("<arg1>").getTextOffset()).check("x: T", new String[]{"x: T"});
|
||||
});
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private Collector feignCtrlP(int offset) {
|
||||
return feignCtrlP(offset, myFixture.getFile(), true, myFixture.getEditor());
|
||||
|
||||
@@ -473,6 +473,16 @@ public class PyArgumentListInspectionTest extends PyInspectionTestCase {
|
||||
runWithLanguageLevel(LanguageLevel.PYTHON310, this::doTest);
|
||||
}
|
||||
|
||||
// PY-78250
|
||||
public void testInitializingGenericDataclassWithDefaultType() {
|
||||
runWithLanguageLevel(LanguageLevel.PYTHON313, this::doTest);
|
||||
}
|
||||
|
||||
// PY-78250
|
||||
public void testInitializingGenericDataclassWithDefaultTypeNoArgument() {
|
||||
runWithLanguageLevel(LanguageLevel.PYTHON313, this::doTest);
|
||||
}
|
||||
|
||||
// PY-73102
|
||||
public void testDeprecatedCall() {
|
||||
doMultiFileTest("client.py");
|
||||
|
||||
Reference in New Issue
Block a user