K2 Inference: Add doc to the substituteNonFixedToVariables function

This commit is contained in:
Simon Ogorodnik
2023-12-04 12:25:44 +01:00
committed by Space Team
parent 8bf7c30407
commit 2037714eec
@@ -320,6 +320,21 @@ class FirBuilderInferenceSession(
)
}
/**
* This function substitutes stub types in constraint with the corresponding type variable
* Please make sure to pass correct {Stub(Tv) => Tv} substitutor
*
* E.g.:
* ```
* nonFixedToVariablesSubstitutor = {Stub(Tv) => Tv, Stub(Ov) => Ov}
* constraint: A<Stub(Tv)> <: B<Stub(Ov)> -> A<Tv> <: B<Ov>
* ```
*
* The main reason for this function's existence is the custom handling of captured types.
* See KT-64027
*
* @return Constraint, substituted according to the [nonFixedToVariablesSubstitutor]
*/
private fun InitialConstraint.substituteNonFixedToVariables(
nonFixedToVariablesSubstitutor: ConeSubstitutor,
fixedTypeVariables: Map<TypeConstructorMarker, KotlinTypeMarker>