Skip to content

Commit 7ef2301

Browse files
committed
Kotlin: Create IrSimpleType factory function to support constructor changes introduced in Kotlin 2.3
1 parent eb05d48 commit 7ef2301

File tree

4 files changed

+42
-3
lines changed

4 files changed

+42
-3
lines changed

java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,7 @@ open class KotlinUsesExtractor(
725725
componentType.isNullableCodeQL()
726726
if (unchanged) arrayType
727727
else
728-
IrSimpleTypeImpl(
728+
codeqlIrSimpleTypeImpl(
729729
arrayType.classifier,
730730
true,
731731
listOf(makeTypeProjection(componentTypeBroadened, Variance.INVARIANT)),

java/kotlin-extractor/src/main/kotlin/utils/TypeSubstitution.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import org.jetbrains.kotlin.ir.types.IrStarProjection
2727
import org.jetbrains.kotlin.ir.types.IrType
2828
import org.jetbrains.kotlin.ir.types.IrTypeArgument
2929
import org.jetbrains.kotlin.ir.types.IrTypeProjection
30-
import org.jetbrains.kotlin.ir.types.impl.IrSimpleTypeImpl
3130
import org.jetbrains.kotlin.ir.types.impl.IrStarProjectionImpl
3231
import org.jetbrains.kotlin.ir.types.impl.makeTypeProjection
3332
import org.jetbrains.kotlin.ir.util.*
@@ -61,7 +60,7 @@ private fun IrSimpleType.substituteTypeArguments(
6160
}
6261
}
6362

64-
return IrSimpleTypeImpl(classifier, isNullableCodeQL(), newArguments, annotations)
63+
return codeqlIrSimpleTypeImpl(classifier, isNullableCodeQL(), newArguments, annotations)
6564
}
6665

6766
/**
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.github.codeql.utils.versions
2+
3+
import org.jetbrains.kotlin.ir.expressions.IrConstructorCall
4+
import org.jetbrains.kotlin.ir.symbols.IrClassifierSymbol
5+
import org.jetbrains.kotlin.ir.types.IrSimpleType
6+
import org.jetbrains.kotlin.ir.types.IrTypeArgument
7+
import org.jetbrains.kotlin.ir.types.impl.IrSimpleTypeImpl
8+
9+
fun codeqlIrSimpleTypeImpl(
10+
classifier: IrClassifierSymbol,
11+
isNullable: Boolean,
12+
arguments: List<IrTypeArgument>,
13+
annotations: List<IrConstructorCall>
14+
): IrSimpleType = IrSimpleTypeImpl(
15+
classifier,
16+
isNullable,
17+
arguments,
18+
annotations
19+
)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.github.codeql.utils.versions
2+
3+
import org.jetbrains.kotlin.ir.expressions.IrConstructorCall
4+
import org.jetbrains.kotlin.ir.symbols.IrClassifierSymbol
5+
import org.jetbrains.kotlin.ir.types.IrSimpleType
6+
import org.jetbrains.kotlin.ir.types.IrTypeArgument
7+
import org.jetbrains.kotlin.ir.types.SimpleTypeNullability
8+
import org.jetbrains.kotlin.ir.types.impl.IrSimpleTypeImpl
9+
10+
fun codeqlIrSimpleTypeImpl(
11+
classifier: IrClassifierSymbol,
12+
isNullable: Boolean,
13+
arguments: List<IrTypeArgument>,
14+
annotations: List<IrConstructorCall>
15+
): IrSimpleType = IrSimpleTypeImpl(
16+
classifier,
17+
SimpleTypeNullability.fromHasQuestionMark(isNullable),
18+
arguments,
19+
annotations,
20+
null // originalKotlinType - explicitly pass null to avoid default parameter issues
21+
)

0 commit comments

Comments
 (0)