mirror of
https://github.com/github/codeql.git
synced 2025-12-22 11:46:32 +01:00
Kotlin: Remove some casts in useSimpleType
This commit is contained in:
@@ -637,15 +637,23 @@ open class KotlinUsesExtractor(
|
||||
return TypeResults(javaResult, kotlinResult)
|
||||
}
|
||||
|
||||
val owner = s.classifier.owner
|
||||
val primitiveInfo = primitiveTypeMapping.getPrimitiveInfo(s)
|
||||
|
||||
when {
|
||||
primitiveInfo != null -> return primitiveType(
|
||||
s.classifier.owner as IrClass,
|
||||
primitiveInfo.primitiveName, primitiveInfo.otherIsPrimitive,
|
||||
primitiveInfo.javaClass,
|
||||
primitiveInfo.kotlinPackageName, primitiveInfo.kotlinClassName
|
||||
)
|
||||
primitiveInfo != null -> {
|
||||
if (owner is IrClass) {
|
||||
return primitiveType(
|
||||
owner,
|
||||
primitiveInfo.primitiveName, primitiveInfo.otherIsPrimitive,
|
||||
primitiveInfo.javaClass,
|
||||
primitiveInfo.kotlinPackageName, primitiveInfo.kotlinClassName
|
||||
)
|
||||
} else {
|
||||
logger.error("Got primitive info for non-class (${owner.javaClass}) for ${s.render()}")
|
||||
return extractErrorType()
|
||||
}
|
||||
}
|
||||
|
||||
(s.isBoxedArray && s.arguments.isNotEmpty()) || s.isPrimitiveArray() -> {
|
||||
|
||||
@@ -689,15 +697,13 @@ open class KotlinUsesExtractor(
|
||||
)
|
||||
}
|
||||
|
||||
s.classifier.owner is IrClass -> {
|
||||
val classifier: IrClassifierSymbol = s.classifier
|
||||
val cls: IrClass = classifier.owner as IrClass
|
||||
owner is IrClass -> {
|
||||
val args = if (s.isRawType()) null else s.arguments
|
||||
|
||||
return useSimpleTypeClass(cls, args, s.hasQuestionMark)
|
||||
return useSimpleTypeClass(owner, args, s.hasQuestionMark)
|
||||
}
|
||||
s.classifier.owner is IrTypeParameter -> {
|
||||
val javaResult = useTypeParameter(s.classifier.owner as IrTypeParameter)
|
||||
owner is IrTypeParameter -> {
|
||||
val javaResult = useTypeParameter(owner as IrTypeParameter)
|
||||
val aClassId = makeClass("kotlin", "TypeParam") // TODO: Wrong
|
||||
val kotlinResult = if (true) TypeResult(fakeKotlinType(), "TODO", "TODO") else
|
||||
if (s.hasQuestionMark) {
|
||||
|
||||
Reference in New Issue
Block a user