mirror of
https://github.com/github/codeql.git
synced 2025-12-23 04:06:37 +01:00
Account for route to IrSimpleType.kotlinType changing as of v1.7.0
This commit is contained in:
@@ -2,6 +2,7 @@ package com.github.codeql
|
|||||||
|
|
||||||
import com.github.codeql.utils.*
|
import com.github.codeql.utils.*
|
||||||
import com.github.codeql.utils.versions.codeQlWithHasQuestionMark
|
import com.github.codeql.utils.versions.codeQlWithHasQuestionMark
|
||||||
|
import com.github.codeql.utils.versions.getKotlinType
|
||||||
import com.github.codeql.utils.versions.isRawType
|
import com.github.codeql.utils.versions.isRawType
|
||||||
import com.semmle.extractor.java.OdasaOutput
|
import com.semmle.extractor.java.OdasaOutput
|
||||||
import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext
|
import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext
|
||||||
@@ -671,7 +672,7 @@ open class KotlinUsesExtractor(
|
|||||||
javaClass: IrClass,
|
javaClass: IrClass,
|
||||||
kotlinPackageName: String, kotlinClassName: String): TypeResults {
|
kotlinPackageName: String, kotlinClassName: String): TypeResults {
|
||||||
// Note the use of `hasEnhancedNullability` here covers cases like `@NotNull Integer`, which must be extracted as `Integer` not `int`.
|
// Note the use of `hasEnhancedNullability` here covers cases like `@NotNull Integer`, which must be extracted as `Integer` not `int`.
|
||||||
val javaResult = if ((context == TypeContext.RETURN || (context == TypeContext.OTHER && otherIsPrimitive)) && !s.isNullable() && s.kotlinType?.hasEnhancedNullability() != true && primitiveName != null) {
|
val javaResult = if ((context == TypeContext.RETURN || (context == TypeContext.OTHER && otherIsPrimitive)) && !s.isNullable() && getKotlinType(s)?.hasEnhancedNullability() != true && primitiveName != null) {
|
||||||
val label: Label<DbPrimitive> = tw.getLabelFor("@\"type;$primitiveName\"", {
|
val label: Label<DbPrimitive> = tw.getLabelFor("@\"type;$primitiveName\"", {
|
||||||
tw.writePrimitives(it, primitiveName)
|
tw.writePrimitives(it, primitiveName)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
package com.github.codeql.utils.versions
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.ir.types.IrSimpleType
|
||||||
|
import org.jetbrains.kotlin.ir.types.impl.IrTypeBase
|
||||||
|
|
||||||
|
fun getKotlinType(s: IrSimpleType) = (s as? IrTypeBase)?.kotlinType
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
package com.github.codeql.utils.versions
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.ir.types.IrSimpleType
|
||||||
|
|
||||||
|
fun getKotlinType(s: IrSimpleType) = s.kotlinType
|
||||||
Reference in New Issue
Block a user