-
-
Notifications
You must be signed in to change notification settings - Fork 759
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
Add KotlinBuiltIns extensions #7376
base: main
Are you sure you want to change the base?
Conversation
These would ideally be provided by org.jetbrains.kotlin.types.typeUtil which has wrappers for most KotlinBuiltIns functions. Those that are missing that would be generally useful can be added to detekt's TypeUtils.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7376 +/- ##
============================================
+ Coverage 84.50% 84.51% +0.01%
- Complexity 4168 4169 +1
============================================
Files 573 573
Lines 11897 11899 +2
Branches 2461 2461
============================================
+ Hits 10053 10056 +3
Misses 591 591
+ Partials 1253 1252 -1 ☔ View full report in Codecov by Sentry. |
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.
Should we forbid the usages of the KotlinBuildIns
? With a message to point to these functions.
@@ -21,6 +22,10 @@ fun KotlinType.fqNameOrNull(): FqName? { | |||
return TypeUtils.getClassDescriptor(this)?.fqNameOrNull() | |||
} | |||
|
|||
fun KotlinType?.isString(): Boolean = KotlinBuiltIns.isString(this) |
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.
In general I'm not a big fan of extensions over nullable. Should null.isString()
be true or false? To me that's something that the caller should decide.
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.
+1
+1 to this 👍 |
@3flex this can be rebase and merged |
These would ideally be provided by org.jetbrains.kotlin.types.typeUtil which has wrappers for most KotlinBuiltIns functions. Those that are missing that would be generally useful can be added to detekt's TypeUtils.