mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-84570 Do not consider bare list literal as a valid type alias
(cherry picked from commit f0bcd2445735caa7917944351140a2877d0b4ffe) GitOrigin-RevId: 5f0a0bff41ee01b4e8b4f7e73c1062d523854c2c
This commit is contained in:
committed by
intellij-monorepo-bot
parent
3b8f47d347
commit
fcf1abdbb7
@@ -3169,6 +3169,26 @@ public class PyTypeHintsInspectionTest extends PyInspectionTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
// PY-84570
|
||||
public void testListLiteralIsNotConsideredTypeAlias() {
|
||||
doTestByText("""
|
||||
from enum import Enum
|
||||
from typing import TypeAlias
|
||||
|
||||
class Direction(Enum):
|
||||
NORTH = "N"
|
||||
SOUTH = "S"
|
||||
EAST = "E"
|
||||
WEST = "W"
|
||||
|
||||
CARTESIAN = [Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST]
|
||||
print(CARTESIAN[0])
|
||||
|
||||
type Alias = <warning descr="Type hint is invalid or refers to the expression which is not a correct type">[int, str]</warning>
|
||||
myAlias: TypeAlias = <warning descr="Assigned value of type alias must be a correct type">[int, str]</warning>
|
||||
""");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected Class<? extends PyInspection> getInspectionClass() {
|
||||
|
||||
Reference in New Issue
Block a user