[FIR] Completely unwrap original argument when computing type arguments
When computing the conversion type for a type operator call, the argument needs to be fully unwrapped before getting the resolved type. This avoids the situation when the argument is a when-subject and the assumed original type is not correct. Before, only smart-casts were unwrapped, and this change will also unwrap when-subjects (as well as a few other FirExpressions). ^KT-62114 Fixed
This commit is contained in:
+1
-1
@@ -839,7 +839,7 @@ open class FirExpressionsResolveTransformer(transformer: FirAbstractBodyResolveT
|
||||
val firClass = type.lookupTag.toSymbol(session)?.fir ?: return this
|
||||
if (firClass.typeParameters.isEmpty()) return this
|
||||
|
||||
val originalType = argument.unwrapSmartcastExpression().resolvedType
|
||||
val originalType = argument.unwrapExpression().resolvedType
|
||||
val newType = components.computeRepresentativeTypeForBareType(type, originalType)
|
||||
?: if (firClass.isLocal && (operation == FirOperation.AS || operation == FirOperation.SAFE_AS)) {
|
||||
(firClass as FirClass).defaultType()
|
||||
|
||||
Reference in New Issue
Block a user