UnnecessaryNotNullCheck: fix false negative with smart casted arguments#5380
Merged
picklebento merged 3 commits intodetekt:mainfrom Oct 9, 2022
Merged
UnnecessaryNotNullCheck: fix false negative with smart casted arguments#5380picklebento merged 3 commits intodetekt:mainfrom
picklebento merged 3 commits intodetekt:mainfrom
Conversation
cortinico
approved these changes
Oct 6, 2022
| } | ||
|
|
||
| @Suppress("ReturnCount") | ||
| fun KtExpression.getDataFlowAwareTypes( |
Member
There was a problem hiding this comment.
Can we add a comment on this function with a couple of example of what it does?
BraisGabin
reviewed
Oct 6, 2022
| } | ||
|
|
||
| private fun KtExpression.isNullable(): Boolean { | ||
| if (bindingContext == BindingContext.EMPTY) return false |
Member
There was a problem hiding this comment.
Suggested change
| 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. |
BraisGabin
approved these changes
Oct 6, 2022
picklebento
approved these changes
Oct 9, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #5379