mirror of
https://github.com/github/codeql.git
synced 2025-12-21 03:06:31 +01:00
Clean up and document erase function
This commit is contained in:
committed by
Ian Lynagh
parent
65f3016a13
commit
1ecbf8e84b
@@ -948,6 +948,12 @@ open class KotlinUsesExtractor(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns `t` with generic types replaced by raw types, and type parameters replaced by their first bound.
|
||||
*
|
||||
* Note that `Array<T>` is retained (with `T` itself erased) because these are expected to be lowered to Java
|
||||
* arrays, which are not generic.
|
||||
*/
|
||||
fun erase (t: IrType): IrType {
|
||||
if (t is IrSimpleType) {
|
||||
val classifier = t.classifier
|
||||
@@ -956,8 +962,7 @@ open class KotlinUsesExtractor(
|
||||
return eraseTypeParameter(owner)
|
||||
}
|
||||
|
||||
// todo: fix this:
|
||||
if (t.makeNotNull().isArray()) {
|
||||
if (t.isArray() || t.isNullableArray()) {
|
||||
val elementType = t.getArrayElementType(pluginContext.irBuiltIns)
|
||||
val erasedElementType = erase(elementType)
|
||||
return withQuestionMark((classifier as IrClassSymbol).typeWith(erasedElementType), t.hasQuestionMark)
|
||||
|
||||
Reference in New Issue
Block a user