Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import com.github.codeql.KotlinUsesExtractor
import com.github.codeql.getJavaEquivalentClassId
import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext
import org.jetbrains.kotlin.backend.common.ir.createImplicitParameterDeclarationWithWrappedDescriptor
import org.jetbrains.kotlin.backend.common.lower.parents
import org.jetbrains.kotlin.descriptors.ClassKind
import org.jetbrains.kotlin.ir.builders.declarations.addConstructor
import org.jetbrains.kotlin.ir.builders.declarations.buildClass
Expand All @@ -27,6 +28,7 @@ import org.jetbrains.kotlin.ir.util.parentAsClass
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.types.Variance
import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull

fun IrType.substituteTypeArguments(params: List<IrTypeParameter>, arguments: List<IrTypeArgument>) =
when(this) {
Expand Down Expand Up @@ -219,12 +221,13 @@ fun isUnspecialised(paramsContainer: IrTypeParametersContainer, args: List<IrTyp
} ?: false
}
val remainingArgs = args.drop(paramsContainer.typeParameters.size)
val parent = paramsContainer.parent as? IrTypeParametersContainer

val parentClass = paramsContainer.parents.firstIsInstanceOrNull<IrClass>()

val parentUnspecialised = when {
remainingArgs.isEmpty() -> true
parent == null -> false
parent !is IrClass -> false
else -> isUnspecialised(paramsContainer.parentAsClass, remainingArgs)
parentClass == null -> false
else -> isUnspecialised(parentClass, remainingArgs)
}
return unspecialisedHere && parentUnspecialised
}
Expand Down
Empty file.
8 changes: 8 additions & 0 deletions java/ql/test/kotlin/library-tests/classes/diags.ql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import semmle.code.java.Diagnostics

from Diagnostic d
where d.getSeverity() > 2
select d, d.getGeneratedBy(), d.getSeverity(), d.getTag(), d.getMessage(),
d.getFullMessage()
.regexpReplaceAll("^\\[[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2} K\\] ",
"[DATE TIME K] ")