mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[python] Use Any in place of unresolved object (PyTypeHintsInspection.kt)
GitOrigin-RevId: 701463ca2d95e6483f9ca640dcf39e173e47c0c3
This commit is contained in:
committed by
intellij-monorepo-bot
parent
cadcf82786
commit
53a7528022
+2
-4
@@ -126,8 +126,7 @@ class PyTypeHintsInspection : PyInspection() {
|
||||
}
|
||||
|
||||
override fun visitPyTypeParameter(typeParameter: PyTypeParameter) {
|
||||
val defaultExpression = typeParameter.defaultExpression
|
||||
if (defaultExpression == null) return
|
||||
val defaultExpression = typeParameter.defaultExpression ?: return
|
||||
when(typeParameter.kind) {
|
||||
PyAstTypeParameter.Kind.TypeVar -> {
|
||||
val typeVarType = PyTypingTypeProvider.getTypeParameterTypeFromTypeParameter(typeParameter, myTypeEvalContext) as? PyTypeVarType
|
||||
@@ -1439,8 +1438,7 @@ class PyTypeHintsInspection : PyInspection() {
|
||||
private fun validateTypeVarDefaultType(typeVarType: PyTypeVarType, defaultType: PyType?, defaultExpression: PyExpression) {
|
||||
val defaultTypes = when (defaultType) {
|
||||
is PyTypeVarType -> defaultType.constraints.ifEmpty {
|
||||
val objectType = PyBuiltinCache.getInstance(defaultExpression).objectType ?: return
|
||||
listOf(defaultType.bound ?: objectType)
|
||||
listOf(defaultType.bound ?: PyBuiltinCache.getInstance(defaultExpression).objectType)
|
||||
}
|
||||
else -> listOf(defaultType)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user