From 3606a4104b85e5f804ee794677c652c1814fd553 Mon Sep 17 00:00:00 2001 From: Kristoffer Andersen Date: Mon, 20 Jan 2020 15:56:26 +0100 Subject: [PATCH] [JVM IR] Documentation for `remapTypeParameters` --- .../jetbrains/kotlin/backend/common/ir/IrUtils.kt | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/ir/IrUtils.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/ir/IrUtils.kt index a4e2a68ffca..1131b8da8e5 100644 --- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/ir/IrUtils.kt +++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/ir/IrUtils.kt @@ -308,9 +308,17 @@ fun IrFunctionAccessExpression.passTypeArgumentsFrom(irFunction: IrTypeParameter } } -/* - Type parameters should correspond to the function where they are defined. - `source` is where the type is originally taken from. +/** + * Perform a substitution of type parameters occuring in [this]. In order of + * precedence, parameter `P` is substituted with... + * + * 1) `T`, if `srcToDstParameterMap.get(P) == T` + * 2) `T`, if `source.typeParameters[i] == P` and + * `target.typeParameters[i] == T` + * 3) `P` + * + * If [srcToDstParameterMap] is total on the domain of type parameters in + * [this], this effectively performs a substitution according to that map. */ fun IrType.remapTypeParameters( source: IrTypeParametersContainer,