Return empty NotFixedToInferredTypesSubstitutor if the current substitutor is empty

This commit is contained in:
Victor Petukhov
2021-05-24 15:01:52 +03:00
parent d8c68aacdd
commit be22078bd1
@@ -206,8 +206,11 @@ class BuilderInferenceSession(
override fun currentConstraintSystem() = ConstraintStorage.Empty
fun getNotFixedToInferredTypesSubstitutor(): NewTypeSubstitutor =
ComposedSubstitutor(commonSystem.buildCurrentSubstitutor() as NewTypeSubstitutor, createNonFixedTypeToVariableSubstitutor())
fun getNotFixedToInferredTypesSubstitutor(): NewTypeSubstitutor {
val currentSubstitutor =
commonSystem.buildCurrentSubstitutor().cast<NewTypeSubstitutor>().takeIf { !it.isEmpty } ?: return EmptySubstitutor
return ComposedSubstitutor(currentSubstitutor, createNonFixedTypeToVariableSubstitutor())
}
override fun inferPostponedVariables(
lambda: ResolvedLambdaAtom,