K2: build SAM-based function type for a given captured type properly

Before this commit, we assumed (erroneously) that a captured type
cannot have an associated SAM-based function type.
In this commit we changed this assumption, replacing a captured type
with its lower type for this purpose

#KT-63379 Fixed
This commit is contained in:
Mikhail Glukhikh
2023-12-20 17:11:46 +01:00
committed by Space Team
parent 8588588760
commit a02cf76d6c
10 changed files with 68 additions and 19 deletions
@@ -81,10 +81,11 @@ class FirSamResolver(
}
is ConeStubType, is ConeTypeParameterType, is ConeTypeVariableType,
is ConeCapturedType, is ConeDefinitelyNotNullType, is ConeIntersectionType,
is ConeIntegerLiteralType,
is ConeDefinitelyNotNullType, is ConeIntersectionType, is ConeIntegerLiteralType,
-> null
is ConeCapturedType -> type.lowerType?.let { getFunctionTypeForPossibleSamType(it) }
is ConeLookupTagBasedType -> unreachableBranch(type)
}
}