Skip to content

Commit 8c2415a

Browse files
authored
Fix invalid checks for typing module (#23)
1 parent cb5d5ea commit 8c2415a

File tree

1 file changed

+4
-5
lines changed
  • src/main/kotlin/space/whitememory/pythoninlayparams/types/hints

1 file changed

+4
-5
lines changed

src/main/kotlin/space/whitememory/pythoninlayparams/types/hints/HintResolver.kt

+4-5
Original file line numberDiff line numberDiff line change
@@ -66,21 +66,20 @@ enum class HintResolver {
6666
// Handle case 'var = await async_func()` which return `Coroutine` inside
6767
if (assignedValue is PyPrefixExpression && assignedValue.operator == PyTokenTypes.AWAIT_KEYWORD) return true
6868

69-
if (typeAnnotation is PyClassType && isElementInsideTypingModule(typeAnnotation.pyClass)) return false
70-
71-
7269
if (assignedValue is PySubscriptionExpression) {
7370
assignedValue.rootOperand.reference?.resolve()?.let {
74-
if (isElementInsideTypingModule(it as PyElement)) return false
71+
return !isElementInsideTypingModule(it as PyElement)
7572
}
7673
}
7774

7875
if (assignedValue is PyReferenceExpression) {
7976
assignedValue.reference.resolve()?.let {
80-
if (isElementInsideTypingModule(it as PyElement)) return false
77+
return !isElementInsideTypingModule(it as PyElement)
8178
}
8279
}
8380

81+
if (typeAnnotation is PyClassType && isElementInsideTypingModule(typeAnnotation.pyClass)) return false
82+
8483
return true
8584
}
8685
},

0 commit comments

Comments
 (0)