Skip to content

Commit

Permalink
Update lint types
Browse files Browse the repository at this point in the history
  • Loading branch information
Pluu committed Aug 9, 2024
1 parent c55ebeb commit 7f54b96
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lint/src/main/java/androidx/compose/lint/PsiUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import com.intellij.psi.PsiClass
import com.intellij.psi.PsiClassOwner
import com.intellij.psi.PsiMethod
import com.intellij.psi.PsiType
import com.intellij.psi.PsiTypes
import com.intellij.psi.util.InheritanceUtil

/** Returns whether [this] has [packageName] as its package name. */
Expand All @@ -35,11 +36,11 @@ val PsiMethod.returnsUnit
/**
* Whether this [PsiType] is `void` or [Unit]
*
* In Kotlin 1.6 some expressions now explicitly return [Unit] instead of just being [PsiType.VOID],
* In Kotlin 1.6 some expressions now explicitly return [Unit] instead of just being [PsiTypes.voidType],
* so this returns whether this type is either.
*/
val PsiType?.isVoidOrUnit
get() = this == PsiType.VOID || this?.canonicalText == "kotlin.Unit"
get() = this == PsiTypes.voidType() || this?.canonicalText == "kotlin.Unit"

/** @return whether [this] inherits from [name]. Returns `true` if [this] _is_ directly [name]. */
fun PsiType.inheritsFrom(name: Name) = InheritanceUtil.isInheritor(this, name.javaFqn)
Expand Down

0 comments on commit 7f54b96

Please sign in to comment.