[FIR] Use resolvedType instead of coneTypeOrNull in FIR2IR
#KT-61367
This commit is contained in:
committed by
Space Team
parent
c3abe28049
commit
b1565d547c
@@ -30,6 +30,7 @@ import org.jetbrains.kotlin.fir.extensions.generatedMembers
|
||||
import org.jetbrains.kotlin.fir.extensions.generatedNestedClassifiers
|
||||
import org.jetbrains.kotlin.fir.resolve.ScopeSession
|
||||
import org.jetbrains.kotlin.fir.symbols.lazyDeclarationResolver
|
||||
import org.jetbrains.kotlin.fir.types.resolvedType
|
||||
import org.jetbrains.kotlin.ir.PsiIrFileEntry
|
||||
import org.jetbrains.kotlin.ir.IrBuiltIns
|
||||
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
|
||||
@@ -279,7 +280,7 @@ class Fir2IrConverter(
|
||||
|
||||
val irFragmentFunction = symbolTable.declareSimpleFunction(signature, { IrSimpleFunctionPublicSymbolImpl(signature) }) { irSymbol ->
|
||||
val lastStatement = codeFragment.block.statements.lastOrNull()
|
||||
val returnType = (lastStatement as? FirExpression)?.coneTypeOrNull?.toIrType(typeConverter) ?: irBuiltIns.unitType
|
||||
val returnType = (lastStatement as? FirExpression)?.resolvedType?.toIrType(typeConverter) ?: irBuiltIns.unitType
|
||||
|
||||
irFactory.createSimpleFunction(
|
||||
UNDEFINED_OFFSET, UNDEFINED_OFFSET,
|
||||
|
||||
@@ -1563,11 +1563,7 @@ class Fir2IrVisitor(
|
||||
private fun convertToArrayLiteral(arrayLiteral: FirArrayLiteral): IrVararg {
|
||||
return arrayLiteral.convertWithOffsets { startOffset, endOffset ->
|
||||
val arrayType = arrayLiteral.resolvedType.toIrType()
|
||||
val elementType = if (arrayLiteral.coneTypeOrNull != null) {
|
||||
arrayType.getArrayElementType(irBuiltIns)
|
||||
} else {
|
||||
createErrorType()
|
||||
}
|
||||
val elementType = arrayType.getArrayElementType(irBuiltIns)
|
||||
IrVarargImpl(
|
||||
startOffset, endOffset,
|
||||
type = arrayType,
|
||||
|
||||
+1
-1
@@ -553,7 +553,7 @@ internal class AdapterGenerator(
|
||||
|
||||
private fun needSamConversion(argument: FirExpression, parameter: FirValueParameter): Boolean {
|
||||
// If the type of the argument is already an explicitly subtype of the type of the parameter, we don't need SAM conversion.
|
||||
if (argument.coneTypeOrNull == null ||
|
||||
if (
|
||||
AbstractTypeChecker.isSubtypeOf(
|
||||
session.typeContext.newTypeCheckerState(
|
||||
errorTypesEqualToAnything = false, stubTypesEqualToAnything = true
|
||||
|
||||
Reference in New Issue
Block a user