-
-
Notifications
You must be signed in to change notification settings - Fork 770
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UnnecessaryNotNullCheck: fix false negative with smart casted arguments #5380
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great stuff!
|
||
fun KotlinType.fqNameOrNull(): FqName? { | ||
return TypeUtils.getClassDescriptor(this)?.fqNameOrNull() | ||
} | ||
|
||
@Suppress("ReturnCount") | ||
fun KtExpression.getDataFlowAwareTypes( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a comment on this function with a couple of example of what it does?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -86,21 +87,22 @@ class NullableToStringCall(config: Config = Config.empty) : Rule(config) { | |||
} | |||
|
|||
private fun KtExpression.isNullable(): Boolean { | |||
if (bindingContext == BindingContext.EMPTY) return false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (bindingContext == BindingContext.EMPTY) return false |
The rules annotated with @RequiresTypeResolution
are not called by the core if the BindingContext
is empty so we don't need this line any more.
Codecov Report
@@ Coverage Diff @@
## main #5380 +/- ##
===========================================
+ Coverage 0 86.08% +86.08%
- Complexity 0 3642 +3642
===========================================
Files 0 515 +515
Lines 0 12101 +12101
Branches 0 2166 +2166
===========================================
+ Hits 0 10417 +10417
- Misses 0 611 +611
- Partials 0 1073 +1073
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Fixes #5379