mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
PY-48011 Pattern Matching: Type inference
Merge-request: IJ-MR-154823 Merged-by: Aleksandr Govenko <aleksandr.govenko@jetbrains.com> GitOrigin-RevId: 42cb07bee63f34127c85574fc9c09e6043bc7591
This commit is contained in:
committed by
intellij-monorepo-bot
parent
6860d4accc
commit
0073c7a8bb
@@ -3,5 +3,5 @@ package com.jetbrains.python.psi;
|
||||
|
||||
import com.jetbrains.python.ast.PyAstPattern;
|
||||
|
||||
public interface PyPattern extends PyAstPattern, PyElement {
|
||||
public interface PyPattern extends PyAstPattern, PyTypedElement {
|
||||
}
|
||||
|
||||
@@ -2,6 +2,14 @@
|
||||
package com.jetbrains.python.psi;
|
||||
|
||||
import com.jetbrains.python.ast.PyAstSequencePattern;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static com.jetbrains.python.ast.PyAstElementKt.findChildrenByClass;
|
||||
|
||||
public interface PySequencePattern extends PyAstSequencePattern, PyPattern {
|
||||
default @NotNull List<@NotNull PyPattern> getElements() {
|
||||
return List.of(findChildrenByClass(this, PyPattern.class));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,21 @@
|
||||
package com.jetbrains.python.psi;
|
||||
|
||||
import com.jetbrains.python.ast.PyAstSingleStarPattern;
|
||||
import com.jetbrains.python.psi.types.PyType;
|
||||
import com.jetbrains.python.psi.types.TypeEvalContext;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import static com.jetbrains.python.ast.PyAstElementKt.findChildByClass;
|
||||
|
||||
public interface PySingleStarPattern extends PyAstSingleStarPattern, PyPattern {
|
||||
@NotNull
|
||||
default PyPattern getPattern() {
|
||||
return Objects.requireNonNull(findChildByClass(this, PyPattern.class));
|
||||
}
|
||||
|
||||
@NotNull List<@Nullable PyType> getCapturedTypesFromSequenceType(@Nullable PyType sequenceType, @NotNull TypeEvalContext context);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,11 @@
|
||||
package com.jetbrains.python.psi;
|
||||
|
||||
import com.jetbrains.python.ast.PyAstValuePattern;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public interface PyValuePattern extends PyAstValuePattern, PyPattern {
|
||||
@Override
|
||||
default @NotNull PyReferenceExpression getValue() {
|
||||
return (PyReferenceExpression)PyAstValuePattern.super.getValue();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user