[FIR2IR] Use IR built-in types, their symbols & constructors directly
This commit is contained in:
+10
-1
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.fir.backend
|
|||||||
import org.jetbrains.kotlin.descriptors.*
|
import org.jetbrains.kotlin.descriptors.*
|
||||||
import org.jetbrains.kotlin.fir.declarations.*
|
import org.jetbrains.kotlin.fir.declarations.*
|
||||||
import org.jetbrains.kotlin.fir.resolve.firProvider
|
import org.jetbrains.kotlin.fir.resolve.firProvider
|
||||||
|
import org.jetbrains.kotlin.fir.symbols.StandardClassIds
|
||||||
import org.jetbrains.kotlin.fir.symbols.impl.FirClassSymbol
|
import org.jetbrains.kotlin.fir.symbols.impl.FirClassSymbol
|
||||||
import org.jetbrains.kotlin.fir.symbols.impl.FirTypeParameterSymbol
|
import org.jetbrains.kotlin.fir.symbols.impl.FirTypeParameterSymbol
|
||||||
import org.jetbrains.kotlin.fir.types.FirTypeRef
|
import org.jetbrains.kotlin.fir.types.FirTypeRef
|
||||||
@@ -243,7 +244,7 @@ class Fir2IrClassifierStorage(
|
|||||||
}
|
}
|
||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
val parent = simpleCachedParameter.parent
|
val parent = simpleCachedParameter.parent
|
||||||
if (parent !is IrSimpleFunction || parent.returnType == typeConverter.unitType) {
|
if (parent !is IrSimpleFunction || parent.returnType == irBuiltIns.unitType) {
|
||||||
return simpleCachedParameter
|
return simpleCachedParameter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -328,6 +329,14 @@ class Fir2IrClassifierStorage(
|
|||||||
fun getIrClassSymbol(firClassSymbol: FirClassSymbol<*>): IrClassSymbol {
|
fun getIrClassSymbol(firClassSymbol: FirClassSymbol<*>): IrClassSymbol {
|
||||||
val firClass = firClassSymbol.fir
|
val firClass = firClassSymbol.fir
|
||||||
getCachedIrClass(firClass)?.let { return symbolTable.referenceClass(it.descriptor) }
|
getCachedIrClass(firClass)?.let { return symbolTable.referenceClass(it.descriptor) }
|
||||||
|
val builtinClassSymbol = when (firClassSymbol.classId) {
|
||||||
|
StandardClassIds.Any -> irBuiltIns.anyClass
|
||||||
|
else -> null
|
||||||
|
}
|
||||||
|
if (builtinClassSymbol != null && firClass is FirRegularClass) {
|
||||||
|
classCache[firClass] = builtinClassSymbol.owner
|
||||||
|
return symbolTable.referenceClass(builtinClassSymbol.descriptor)
|
||||||
|
}
|
||||||
// TODO: remove all this code and change to unbound symbol creation
|
// TODO: remove all this code and change to unbound symbol creation
|
||||||
val irClass = createIrClass(firClass)
|
val irClass = createIrClass(firClass)
|
||||||
if (firClass is FirAnonymousObject || firClass is FirRegularClass && firClass.visibility == Visibilities.LOCAL) {
|
if (firClass is FirAnonymousObject || firClass is FirRegularClass && firClass.visibility == Visibilities.LOCAL) {
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ class Fir2IrConverter(
|
|||||||
processClassMembers(regularClass, irClass)
|
processClassMembers(regularClass, irClass)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun registerFileAndClasses(file: FirFile) {
|
fun registerFileAndClasses(file: FirFile): IrFile {
|
||||||
val irFile = IrFileImpl(
|
val irFile = IrFileImpl(
|
||||||
sourceManager.getOrCreateFileEntry(file.psi as KtFile),
|
sourceManager.getOrCreateFileEntry(file.psi as KtFile),
|
||||||
moduleDescriptor.getPackage(file.packageFqName).fragments.first()
|
moduleDescriptor.getPackage(file.packageFqName).fragments.first()
|
||||||
@@ -51,6 +51,7 @@ class Fir2IrConverter(
|
|||||||
registerClassAndNestedClasses(it, irFile)
|
registerClassAndNestedClasses(it, irFile)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return irFile
|
||||||
}
|
}
|
||||||
|
|
||||||
fun processClassHeaders(file: FirFile) {
|
fun processClassHeaders(file: FirFile) {
|
||||||
@@ -175,13 +176,17 @@ class Fir2IrConverter(
|
|||||||
components.declarationStorage = declarationStorage
|
components.declarationStorage = declarationStorage
|
||||||
components.classifierStorage = classifierStorage
|
components.classifierStorage = classifierStorage
|
||||||
components.typeConverter = typeConverter
|
components.typeConverter = typeConverter
|
||||||
typeConverter.initBuiltinTypes()
|
|
||||||
val irFiles = mutableListOf<IrFile>()
|
val irFiles = mutableListOf<IrFile>()
|
||||||
|
|
||||||
val converter = Fir2IrConverter(moduleDescriptor, sourceManager, components)
|
val converter = Fir2IrConverter(moduleDescriptor, sourceManager, components)
|
||||||
for (firFile in firFiles) {
|
for (firFile in firFiles) {
|
||||||
converter.registerFileAndClasses(firFile)
|
irFiles += converter.registerFileAndClasses(firFile)
|
||||||
}
|
}
|
||||||
|
val irModuleFragment = IrModuleFragmentImpl(moduleDescriptor, builtIns, irFiles)
|
||||||
|
val externalDependenciesGenerator = ExternalDependenciesGenerator(
|
||||||
|
symbolTable, generateTypicalIrProviderList(irModuleFragment.descriptor, builtIns, symbolTable)
|
||||||
|
)
|
||||||
|
externalDependenciesGenerator.generateUnboundSymbolsAsDependencies()
|
||||||
for (firFile in firFiles) {
|
for (firFile in firFiles) {
|
||||||
converter.processClassHeaders(firFile)
|
converter.processClassHeaders(firFile)
|
||||||
}
|
}
|
||||||
@@ -194,22 +199,10 @@ class Fir2IrConverter(
|
|||||||
val irFile = firFile.accept(fir2irVisitor, null) as IrFile
|
val irFile = firFile.accept(fir2irVisitor, null) as IrFile
|
||||||
val fileEntry = sourceManager.getOrCreateFileEntry(firFile.psi as KtFile)
|
val fileEntry = sourceManager.getOrCreateFileEntry(firFile.psi as KtFile)
|
||||||
sourceManager.putFileEntry(irFile, fileEntry)
|
sourceManager.putFileEntry(irFile, fileEntry)
|
||||||
irFiles += irFile
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val irModuleFragment = IrModuleFragmentImpl(moduleDescriptor, builtIns, irFiles)
|
externalDependenciesGenerator.generateUnboundSymbolsAsDependencies()
|
||||||
generateUnboundSymbolsAsDependencies(irModuleFragment, symbolTable, builtIns)
|
|
||||||
return Fir2IrResult(irModuleFragment, symbolTable, sourceManager)
|
return Fir2IrResult(irModuleFragment, symbolTable, sourceManager)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun generateUnboundSymbolsAsDependencies(
|
|
||||||
irModule: IrModuleFragment,
|
|
||||||
symbolTable: SymbolTable,
|
|
||||||
builtIns: IrBuiltIns
|
|
||||||
) {
|
|
||||||
// TODO: provide StubGeneratorExtensions for correct lazy stub IR generation on JVM
|
|
||||||
ExternalDependenciesGenerator(symbolTable, generateTypicalIrProviderList(irModule.descriptor, builtIns, symbolTable))
|
|
||||||
.generateUnboundSymbolsAsDependencies()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+13
-1
@@ -19,6 +19,7 @@ import org.jetbrains.kotlin.fir.render
|
|||||||
import org.jetbrains.kotlin.fir.resolve.*
|
import org.jetbrains.kotlin.fir.resolve.*
|
||||||
import org.jetbrains.kotlin.fir.scopes.impl.FirClassSubstitutionScope
|
import org.jetbrains.kotlin.fir.scopes.impl.FirClassSubstitutionScope
|
||||||
import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol
|
import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol
|
||||||
|
import org.jetbrains.kotlin.fir.symbols.StandardClassIds
|
||||||
import org.jetbrains.kotlin.fir.symbols.impl.*
|
import org.jetbrains.kotlin.fir.symbols.impl.*
|
||||||
import org.jetbrains.kotlin.fir.types.ConeKotlinType
|
import org.jetbrains.kotlin.fir.types.ConeKotlinType
|
||||||
import org.jetbrains.kotlin.fir.types.FirTypeRef
|
import org.jetbrains.kotlin.fir.types.FirTypeRef
|
||||||
@@ -33,6 +34,7 @@ import org.jetbrains.kotlin.ir.expressions.impl.IrErrorExpressionImpl
|
|||||||
import org.jetbrains.kotlin.ir.expressions.impl.IrExpressionBodyImpl
|
import org.jetbrains.kotlin.ir.expressions.impl.IrExpressionBodyImpl
|
||||||
import org.jetbrains.kotlin.ir.symbols.*
|
import org.jetbrains.kotlin.ir.symbols.*
|
||||||
import org.jetbrains.kotlin.ir.types.IrType
|
import org.jetbrains.kotlin.ir.types.IrType
|
||||||
|
import org.jetbrains.kotlin.ir.util.constructors
|
||||||
import org.jetbrains.kotlin.name.ClassId
|
import org.jetbrains.kotlin.name.ClassId
|
||||||
import org.jetbrains.kotlin.name.FqName
|
import org.jetbrains.kotlin.name.FqName
|
||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
@@ -431,7 +433,7 @@ class Fir2IrDeclarationStorage(
|
|||||||
propertyAccessor?.psi?.endOffset ?: endOffset,
|
propertyAccessor?.psi?.endOffset ?: endOffset,
|
||||||
origin, descriptor
|
origin, descriptor
|
||||||
) { symbol ->
|
) { symbol ->
|
||||||
val accessorReturnType = if (isSetter) typeConverter.unitType else propertyType
|
val accessorReturnType = if (isSetter) irBuiltIns.unitType else propertyType
|
||||||
IrFunctionImpl(
|
IrFunctionImpl(
|
||||||
startOffset, endOffset, origin, symbol,
|
startOffset, endOffset, origin, symbol,
|
||||||
Name.special("<$prefix-${correspondingProperty.name}>"),
|
Name.special("<$prefix-${correspondingProperty.name}>"),
|
||||||
@@ -650,6 +652,16 @@ class Fir2IrDeclarationStorage(
|
|||||||
fun getIrConstructorSymbol(firConstructorSymbol: FirConstructorSymbol): IrConstructorSymbol {
|
fun getIrConstructorSymbol(firConstructorSymbol: FirConstructorSymbol): IrConstructorSymbol {
|
||||||
val firConstructor = firConstructorSymbol.fir
|
val firConstructor = firConstructorSymbol.fir
|
||||||
getCachedIrConstructor(firConstructor)?.let { return symbolTable.referenceConstructor(it.descriptor) }
|
getCachedIrConstructor(firConstructor)?.let { return symbolTable.referenceConstructor(it.descriptor) }
|
||||||
|
val builtinParent = when (firConstructorSymbol.callableId.classId) {
|
||||||
|
StandardClassIds.Any -> irBuiltIns.anyClass
|
||||||
|
else -> null
|
||||||
|
}
|
||||||
|
if (builtinParent != null) {
|
||||||
|
val constructorSymbol = builtinParent.constructors.first()
|
||||||
|
constructorCache[firConstructor] = constructorSymbol.owner
|
||||||
|
return symbolTable.referenceConstructor(constructorSymbol.descriptor)
|
||||||
|
}
|
||||||
|
|
||||||
val irParent = findIrParent(firConstructor) as IrClass
|
val irParent = findIrParent(firConstructor) as IrClass
|
||||||
val parentOrigin = (irParent as? IrDeclaration)?.origin ?: IrDeclarationOrigin.DEFINED
|
val parentOrigin = (irParent as? IrDeclaration)?.origin ?: IrDeclarationOrigin.DEFINED
|
||||||
val irDeclaration = createIrConstructor(firConstructor, irParent, origin = parentOrigin).apply {
|
val irDeclaration = createIrConstructor(firConstructor, irParent, origin = parentOrigin).apply {
|
||||||
|
|||||||
@@ -8,7 +8,8 @@ package org.jetbrains.kotlin.fir.backend
|
|||||||
import org.jetbrains.kotlin.fir.resolve.toSymbol
|
import org.jetbrains.kotlin.fir.resolve.toSymbol
|
||||||
import org.jetbrains.kotlin.fir.symbols.StandardClassIds
|
import org.jetbrains.kotlin.fir.symbols.StandardClassIds
|
||||||
import org.jetbrains.kotlin.fir.types.*
|
import org.jetbrains.kotlin.fir.types.*
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrClassifierSymbol
|
import org.jetbrains.kotlin.fir.types.impl.*
|
||||||
|
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
|
||||||
import org.jetbrains.kotlin.ir.types.IrType
|
import org.jetbrains.kotlin.ir.types.IrType
|
||||||
import org.jetbrains.kotlin.ir.types.IrTypeArgument
|
import org.jetbrains.kotlin.ir.types.IrTypeArgument
|
||||||
import org.jetbrains.kotlin.ir.types.impl.IrSimpleTypeImpl
|
import org.jetbrains.kotlin.ir.types.impl.IrSimpleTypeImpl
|
||||||
@@ -20,30 +21,59 @@ import org.jetbrains.kotlin.types.Variance
|
|||||||
class Fir2IrTypeConverter(
|
class Fir2IrTypeConverter(
|
||||||
private val components: Fir2IrComponents
|
private val components: Fir2IrComponents
|
||||||
) : Fir2IrComponents by components {
|
) : Fir2IrComponents by components {
|
||||||
lateinit var nothingType: IrType
|
private val classIdToSymbolMap = mapOf(
|
||||||
lateinit var unitType: IrType
|
StandardClassIds.Nothing to irBuiltIns.nothingClass,
|
||||||
lateinit var booleanType: IrType
|
StandardClassIds.Unit to irBuiltIns.unitClass,
|
||||||
lateinit var stringType: IrType
|
StandardClassIds.Boolean to irBuiltIns.booleanClass,
|
||||||
|
StandardClassIds.String to irBuiltIns.stringClass,
|
||||||
|
StandardClassIds.Any to irBuiltIns.anyClass,
|
||||||
|
StandardClassIds.Long to irBuiltIns.longClass,
|
||||||
|
StandardClassIds.Int to irBuiltIns.intClass,
|
||||||
|
StandardClassIds.Short to irBuiltIns.shortClass,
|
||||||
|
StandardClassIds.Byte to irBuiltIns.byteClass,
|
||||||
|
StandardClassIds.Float to irBuiltIns.floatClass,
|
||||||
|
StandardClassIds.Double to irBuiltIns.doubleClass,
|
||||||
|
StandardClassIds.Char to irBuiltIns.charClass,
|
||||||
|
StandardClassIds.Array to irBuiltIns.arrayClass
|
||||||
|
)
|
||||||
|
|
||||||
fun initBuiltinTypes() {
|
private val classIdToTypeMap = mapOf(
|
||||||
nothingType = session.builtinTypes.nothingType.toIrType()
|
StandardClassIds.Nothing to irBuiltIns.nothingType,
|
||||||
unitType = session.builtinTypes.unitType.toIrType()
|
StandardClassIds.Unit to irBuiltIns.unitType,
|
||||||
booleanType = session.builtinTypes.booleanType.toIrType()
|
StandardClassIds.Boolean to irBuiltIns.booleanType,
|
||||||
stringType = session.builtinTypes.stringType.toIrType()
|
StandardClassIds.String to irBuiltIns.stringType,
|
||||||
}
|
StandardClassIds.Any to irBuiltIns.anyType,
|
||||||
|
StandardClassIds.Long to irBuiltIns.longType,
|
||||||
|
StandardClassIds.Int to irBuiltIns.intType,
|
||||||
|
StandardClassIds.Short to irBuiltIns.shortType,
|
||||||
|
StandardClassIds.Byte to irBuiltIns.byteType,
|
||||||
|
StandardClassIds.Float to irBuiltIns.floatType,
|
||||||
|
StandardClassIds.Double to irBuiltIns.doubleType,
|
||||||
|
StandardClassIds.Char to irBuiltIns.charType
|
||||||
|
)
|
||||||
|
|
||||||
fun FirTypeRef.toIrType(typeContext: ConversionTypeContext = ConversionTypeContext.DEFAULT): IrType {
|
fun FirTypeRef.toIrType(typeContext: ConversionTypeContext = ConversionTypeContext.DEFAULT): IrType {
|
||||||
if (this !is FirResolvedTypeRef) {
|
return when (this) {
|
||||||
return createErrorType()
|
!is FirResolvedTypeRef -> createErrorType()
|
||||||
|
!is FirImplicitBuiltinTypeRef -> type.toIrType(typeContext)
|
||||||
|
is FirImplicitNothingTypeRef -> irBuiltIns.nothingType
|
||||||
|
is FirImplicitUnitTypeRef -> irBuiltIns.unitType
|
||||||
|
is FirImplicitBooleanTypeRef -> irBuiltIns.booleanType
|
||||||
|
is FirImplicitStringTypeRef -> irBuiltIns.stringType
|
||||||
|
is FirImplicitAnyTypeRef -> irBuiltIns.anyType
|
||||||
|
is FirImplicitIntTypeRef -> irBuiltIns.intType
|
||||||
|
is FirImplicitNullableAnyTypeRef -> irBuiltIns.anyNType
|
||||||
|
is FirImplicitNullableNothingTypeRef -> irBuiltIns.nothingNType
|
||||||
|
else -> type.toIrType(typeContext)
|
||||||
}
|
}
|
||||||
return type.toIrType(typeContext)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun ConeKotlinType.toIrType(typeContext: ConversionTypeContext = ConversionTypeContext.DEFAULT): IrType {
|
fun ConeKotlinType.toIrType(typeContext: ConversionTypeContext = ConversionTypeContext.DEFAULT): IrType {
|
||||||
return when (this) {
|
return when (this) {
|
||||||
is ConeKotlinErrorType -> createErrorType()
|
is ConeKotlinErrorType -> createErrorType()
|
||||||
is ConeLookupTagBasedType -> {
|
is ConeLookupTagBasedType -> {
|
||||||
val irSymbol = getArrayType(this.classId) ?: run {
|
val classId = this.classId
|
||||||
|
val irSymbol = getBuiltInClassSymbol(classId) ?: run {
|
||||||
val firSymbol = this.lookupTag.toSymbol(session) ?: return createErrorType()
|
val firSymbol = this.lookupTag.toSymbol(session) ?: return createErrorType()
|
||||||
firSymbol.toSymbol(session, classifierStorage, typeContext)
|
firSymbol.toSymbol(session, classifierStorage, typeContext)
|
||||||
}
|
}
|
||||||
@@ -91,22 +121,14 @@ class Fir2IrTypeConverter(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getArrayType(classId: ClassId?): IrClassifierSymbol? {
|
private fun getArrayClassSymbol(classId: ClassId?): IrClassSymbol? {
|
||||||
if (classId == StandardClassIds.Array) {
|
|
||||||
return irBuiltIns.arrayClass
|
|
||||||
}
|
|
||||||
val primitiveId = StandardClassIds.elementTypeByPrimitiveArrayType[classId] ?: return null
|
val primitiveId = StandardClassIds.elementTypeByPrimitiveArrayType[classId] ?: return null
|
||||||
val irType = when (primitiveId) {
|
val irType = classIdToTypeMap[primitiveId]
|
||||||
StandardClassIds.Boolean -> irBuiltIns.booleanType
|
return irBuiltIns.primitiveArrayForType[irType]
|
||||||
StandardClassIds.Byte -> irBuiltIns.byteType
|
?: throw AssertionError("Strange primitiveId $primitiveId from array: $classId")
|
||||||
StandardClassIds.Char -> irBuiltIns.charType
|
}
|
||||||
StandardClassIds.Double -> irBuiltIns.doubleType
|
|
||||||
StandardClassIds.Float -> irBuiltIns.floatType
|
private fun getBuiltInClassSymbol(classId: ClassId?): IrClassSymbol? {
|
||||||
StandardClassIds.Int -> irBuiltIns.intType
|
return classIdToSymbolMap[classId] ?: getArrayClassSymbol(classId)
|
||||||
StandardClassIds.Long -> irBuiltIns.longType
|
|
||||||
StandardClassIds.Short -> irBuiltIns.shortType
|
|
||||||
else -> throw AssertionError("Strange primitiveId $primitiveId from array: $classId")
|
|
||||||
}
|
|
||||||
return irBuiltIns.primitiveArrayForType.getValue(irType)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -234,7 +234,7 @@ class Fir2IrVisitor(
|
|||||||
val result = returnExpression.result
|
val result = returnExpression.result
|
||||||
val descriptor = irTarget.descriptor
|
val descriptor = irTarget.descriptor
|
||||||
IrReturnImpl(
|
IrReturnImpl(
|
||||||
startOffset, endOffset, typeConverter.nothingType,
|
startOffset, endOffset, irBuiltIns.nothingType,
|
||||||
when (descriptor) {
|
when (descriptor) {
|
||||||
is ClassConstructorDescriptor -> symbolTable.referenceConstructor(descriptor)
|
is ClassConstructorDescriptor -> symbolTable.referenceConstructor(descriptor)
|
||||||
else -> symbolTable.referenceSimpleFunction(descriptor)
|
else -> symbolTable.referenceSimpleFunction(descriptor)
|
||||||
@@ -396,7 +396,7 @@ class Fir2IrVisitor(
|
|||||||
is FirBlock -> expression.convertToIrExpressionOrBlock()
|
is FirBlock -> expression.convertToIrExpressionOrBlock()
|
||||||
is FirUnitExpression -> expression.convertWithOffsets { startOffset, endOffset ->
|
is FirUnitExpression -> expression.convertWithOffsets { startOffset, endOffset ->
|
||||||
IrGetObjectValueImpl(
|
IrGetObjectValueImpl(
|
||||||
startOffset, endOffset, this.typeConverter.unitType,
|
startOffset, endOffset, irBuiltIns.unitType,
|
||||||
this.symbolTable.referenceClass(this.irBuiltIns.builtIns.unit)
|
this.symbolTable.referenceClass(this.irBuiltIns.builtIns.unit)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -434,7 +434,7 @@ class Fir2IrVisitor(
|
|||||||
startOffset, endOffset,
|
startOffset, endOffset,
|
||||||
if (irStatements.isNotEmpty()) {
|
if (irStatements.isNotEmpty()) {
|
||||||
irStatements.filterNotNull().takeIf { it.isNotEmpty() }
|
irStatements.filterNotNull().takeIf { it.isNotEmpty() }
|
||||||
?: listOf(IrBlockImpl(startOffset, endOffset, this.typeConverter.unitType, null, emptyList()))
|
?: listOf(IrBlockImpl(startOffset, endOffset, irBuiltIns.unitType, null, emptyList()))
|
||||||
} else {
|
} else {
|
||||||
emptyList()
|
emptyList()
|
||||||
}
|
}
|
||||||
@@ -450,7 +450,7 @@ class Fir2IrVisitor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
val type =
|
val type =
|
||||||
(statements.lastOrNull() as? FirExpression)?.typeRef?.toIrType() ?: typeConverter.unitType
|
(statements.lastOrNull() as? FirExpression)?.typeRef?.toIrType() ?: irBuiltIns.unitType
|
||||||
return convertWithOffsets { startOffset, endOffset ->
|
return convertWithOffsets { startOffset, endOffset ->
|
||||||
IrBlockImpl(
|
IrBlockImpl(
|
||||||
startOffset, endOffset, type, origin,
|
startOffset, endOffset, type, origin,
|
||||||
@@ -522,7 +522,7 @@ class Fir2IrVisitor(
|
|||||||
val condition = whenBranch.condition
|
val condition = whenBranch.condition
|
||||||
val irResult = convertToIrExpression(whenBranch.result)
|
val irResult = convertToIrExpression(whenBranch.result)
|
||||||
if (condition is FirElseIfTrueCondition) {
|
if (condition is FirElseIfTrueCondition) {
|
||||||
IrElseBranchImpl(IrConstImpl.boolean(irResult.startOffset, irResult.endOffset, typeConverter.booleanType, true), irResult)
|
IrElseBranchImpl(IrConstImpl.boolean(irResult.startOffset, irResult.endOffset, irBuiltIns.booleanType, true), irResult)
|
||||||
} else {
|
} else {
|
||||||
IrBranchImpl(startOffset, endOffset, convertToIrExpression(condition), irResult)
|
IrBranchImpl(startOffset, endOffset, convertToIrExpression(condition), irResult)
|
||||||
}
|
}
|
||||||
@@ -541,7 +541,7 @@ class Fir2IrVisitor(
|
|||||||
override fun visitDoWhileLoop(doWhileLoop: FirDoWhileLoop, data: Any?): IrElement {
|
override fun visitDoWhileLoop(doWhileLoop: FirDoWhileLoop, data: Any?): IrElement {
|
||||||
return doWhileLoop.convertWithOffsets { startOffset, endOffset ->
|
return doWhileLoop.convertWithOffsets { startOffset, endOffset ->
|
||||||
IrDoWhileLoopImpl(
|
IrDoWhileLoopImpl(
|
||||||
startOffset, endOffset, typeConverter.unitType,
|
startOffset, endOffset, irBuiltIns.unitType,
|
||||||
IrStatementOrigin.DO_WHILE_LOOP
|
IrStatementOrigin.DO_WHILE_LOOP
|
||||||
).apply {
|
).apply {
|
||||||
loopMap[doWhileLoop] = this
|
loopMap[doWhileLoop] = this
|
||||||
@@ -557,7 +557,7 @@ class Fir2IrVisitor(
|
|||||||
return whileLoop.convertWithOffsets { startOffset, endOffset ->
|
return whileLoop.convertWithOffsets { startOffset, endOffset ->
|
||||||
val origin = if (whileLoop.psi is KtForExpression) IrStatementOrigin.FOR_LOOP_INNER_WHILE
|
val origin = if (whileLoop.psi is KtForExpression) IrStatementOrigin.FOR_LOOP_INNER_WHILE
|
||||||
else IrStatementOrigin.WHILE_LOOP
|
else IrStatementOrigin.WHILE_LOOP
|
||||||
IrWhileLoopImpl(startOffset, endOffset, typeConverter.unitType, origin).apply {
|
IrWhileLoopImpl(startOffset, endOffset, irBuiltIns.unitType, origin).apply {
|
||||||
loopMap[whileLoop] = this
|
loopMap[whileLoop] = this
|
||||||
label = whileLoop.label?.name
|
label = whileLoop.label?.name
|
||||||
condition = convertToIrExpression(whileLoop.condition)
|
condition = convertToIrExpression(whileLoop.condition)
|
||||||
@@ -574,7 +574,7 @@ class Fir2IrVisitor(
|
|||||||
val firLoop = target.labeledElement
|
val firLoop = target.labeledElement
|
||||||
val irLoop = loopMap[firLoop]
|
val irLoop = loopMap[firLoop]
|
||||||
if (irLoop == null) {
|
if (irLoop == null) {
|
||||||
IrErrorExpressionImpl(startOffset, endOffset, typeConverter.nothingType, "Unbound loop: ${render()}")
|
IrErrorExpressionImpl(startOffset, endOffset, irBuiltIns.nothingType, "Unbound loop: ${render()}")
|
||||||
} else {
|
} else {
|
||||||
f(startOffset, endOffset, irLoop).apply {
|
f(startOffset, endOffset, irLoop).apply {
|
||||||
label = irLoop.label.takeIf { target.labelName != null }
|
label = irLoop.label.takeIf { target.labelName != null }
|
||||||
@@ -585,19 +585,19 @@ class Fir2IrVisitor(
|
|||||||
|
|
||||||
override fun visitBreakExpression(breakExpression: FirBreakExpression, data: Any?): IrElement {
|
override fun visitBreakExpression(breakExpression: FirBreakExpression, data: Any?): IrElement {
|
||||||
return breakExpression.convertJumpWithOffsets { startOffset, endOffset, irLoop ->
|
return breakExpression.convertJumpWithOffsets { startOffset, endOffset, irLoop ->
|
||||||
IrBreakImpl(startOffset, endOffset, typeConverter.nothingType, irLoop)
|
IrBreakImpl(startOffset, endOffset, irBuiltIns.nothingType, irLoop)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun visitContinueExpression(continueExpression: FirContinueExpression, data: Any?): IrElement {
|
override fun visitContinueExpression(continueExpression: FirContinueExpression, data: Any?): IrElement {
|
||||||
return continueExpression.convertJumpWithOffsets { startOffset, endOffset, irLoop ->
|
return continueExpression.convertJumpWithOffsets { startOffset, endOffset, irLoop ->
|
||||||
IrContinueImpl(startOffset, endOffset, typeConverter.nothingType, irLoop)
|
IrContinueImpl(startOffset, endOffset, irBuiltIns.nothingType, irLoop)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun visitThrowExpression(throwExpression: FirThrowExpression, data: Any?): IrElement {
|
override fun visitThrowExpression(throwExpression: FirThrowExpression, data: Any?): IrElement {
|
||||||
return throwExpression.convertWithOffsets { startOffset, endOffset ->
|
return throwExpression.convertWithOffsets { startOffset, endOffset ->
|
||||||
IrThrowImpl(startOffset, endOffset, typeConverter.nothingType, convertToIrExpression(throwExpression.exception))
|
IrThrowImpl(startOffset, endOffset, irBuiltIns.nothingType, convertToIrExpression(throwExpression.exception))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -638,7 +638,7 @@ class Fir2IrVisitor(
|
|||||||
return primitiveOp2(
|
return primitiveOp2(
|
||||||
startOffset, endOffset,
|
startOffset, endOffset,
|
||||||
symbol!!,
|
symbol!!,
|
||||||
typeConverter.booleanType,
|
irBuiltIns.booleanType,
|
||||||
origin,
|
origin,
|
||||||
visitFunctionCall(comparisonExpression.compareToCall, null),
|
visitFunctionCall(comparisonExpression.compareToCall, null),
|
||||||
IrConstImpl.int(startOffset, endOffset, irBuiltIns.intType, 0)
|
IrConstImpl.int(startOffset, endOffset, irBuiltIns.intType, 0)
|
||||||
@@ -666,7 +666,7 @@ class Fir2IrVisitor(
|
|||||||
val (symbol, origin) = getSymbolAndOriginForComparison(operation, simpleType.classifierOrFail)
|
val (symbol, origin) = getSymbolAndOriginForComparison(operation, simpleType.classifierOrFail)
|
||||||
|
|
||||||
return primitiveOp2(
|
return primitiveOp2(
|
||||||
startOffset, endOffset, symbol!!, typeConverter.booleanType, origin,
|
startOffset, endOffset, symbol!!, irBuiltIns.booleanType, origin,
|
||||||
convertToIrExpression(comparisonExpression.left), convertToIrExpression(comparisonExpression.right)
|
convertToIrExpression(comparisonExpression.left), convertToIrExpression(comparisonExpression.right)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -688,11 +688,11 @@ class Fir2IrVisitor(
|
|||||||
startOffset: Int, endOffset: Int, operation: FirOperation, arguments: List<FirExpression>
|
startOffset: Int, endOffset: Int, operation: FirOperation, arguments: List<FirExpression>
|
||||||
): IrExpression {
|
): IrExpression {
|
||||||
val (type, symbol, origin) = when (operation) {
|
val (type, symbol, origin) = when (operation) {
|
||||||
FirOperation.EQ -> Triple(typeConverter.booleanType, irBuiltIns.eqeqSymbol, IrStatementOrigin.EQEQ)
|
FirOperation.EQ -> Triple(irBuiltIns.booleanType, irBuiltIns.eqeqSymbol, IrStatementOrigin.EQEQ)
|
||||||
FirOperation.NOT_EQ -> Triple(typeConverter.booleanType, irBuiltIns.eqeqSymbol, IrStatementOrigin.EXCLEQ)
|
FirOperation.NOT_EQ -> Triple(irBuiltIns.booleanType, irBuiltIns.eqeqSymbol, IrStatementOrigin.EXCLEQ)
|
||||||
FirOperation.IDENTITY -> Triple(typeConverter.booleanType, irBuiltIns.eqeqeqSymbol, IrStatementOrigin.EQEQEQ)
|
FirOperation.IDENTITY -> Triple(irBuiltIns.booleanType, irBuiltIns.eqeqeqSymbol, IrStatementOrigin.EQEQEQ)
|
||||||
FirOperation.NOT_IDENTITY -> Triple(typeConverter.booleanType, irBuiltIns.eqeqeqSymbol, IrStatementOrigin.EXCLEQEQ)
|
FirOperation.NOT_IDENTITY -> Triple(irBuiltIns.booleanType, irBuiltIns.eqeqeqSymbol, IrStatementOrigin.EXCLEQEQ)
|
||||||
FirOperation.EXCL -> Triple(typeConverter.booleanType, irBuiltIns.booleanNotSymbol, IrStatementOrigin.EXCL)
|
FirOperation.EXCL -> Triple(irBuiltIns.booleanType, irBuiltIns.booleanNotSymbol, IrStatementOrigin.EXCL)
|
||||||
FirOperation.LT, FirOperation.GT,
|
FirOperation.LT, FirOperation.GT,
|
||||||
FirOperation.LT_EQ, FirOperation.GT_EQ,
|
FirOperation.LT_EQ, FirOperation.GT_EQ,
|
||||||
FirOperation.OTHER, FirOperation.ASSIGN, FirOperation.PLUS_ASSIGN,
|
FirOperation.OTHER, FirOperation.ASSIGN, FirOperation.PLUS_ASSIGN,
|
||||||
@@ -713,7 +713,7 @@ class Fir2IrVisitor(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (operation !in NEGATED_OPERATIONS) return result
|
if (operation !in NEGATED_OPERATIONS) return result
|
||||||
return primitiveOp1(startOffset, endOffset, irBuiltIns.booleanNotSymbol, typeConverter.booleanType, origin, result)
|
return primitiveOp1(startOffset, endOffset, irBuiltIns.booleanNotSymbol, irBuiltIns.booleanType, origin, result)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun visitOperatorCall(operatorCall: FirOperatorCall, data: Any?): IrElement {
|
override fun visitOperatorCall(operatorCall: FirOperatorCall, data: Any?): IrElement {
|
||||||
@@ -725,7 +725,7 @@ class Fir2IrVisitor(
|
|||||||
override fun visitStringConcatenationCall(stringConcatenationCall: FirStringConcatenationCall, data: Any?): IrElement {
|
override fun visitStringConcatenationCall(stringConcatenationCall: FirStringConcatenationCall, data: Any?): IrElement {
|
||||||
return stringConcatenationCall.convertWithOffsets { startOffset, endOffset ->
|
return stringConcatenationCall.convertWithOffsets { startOffset, endOffset ->
|
||||||
IrStringConcatenationImpl(
|
IrStringConcatenationImpl(
|
||||||
startOffset, endOffset, typeConverter.stringType,
|
startOffset, endOffset, irBuiltIns.stringType,
|
||||||
stringConcatenationCall.arguments.map { convertToIrExpression(it) }
|
stringConcatenationCall.arguments.map { convertToIrExpression(it) }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -735,8 +735,8 @@ class Fir2IrVisitor(
|
|||||||
return typeOperatorCall.convertWithOffsets { startOffset, endOffset ->
|
return typeOperatorCall.convertWithOffsets { startOffset, endOffset ->
|
||||||
val irTypeOperand = typeOperatorCall.conversionTypeRef.toIrType()
|
val irTypeOperand = typeOperatorCall.conversionTypeRef.toIrType()
|
||||||
val (irType, irTypeOperator) = when (typeOperatorCall.operation) {
|
val (irType, irTypeOperator) = when (typeOperatorCall.operation) {
|
||||||
FirOperation.IS -> typeConverter.booleanType to IrTypeOperator.INSTANCEOF
|
FirOperation.IS -> irBuiltIns.booleanType to IrTypeOperator.INSTANCEOF
|
||||||
FirOperation.NOT_IS -> typeConverter.booleanType to IrTypeOperator.NOT_INSTANCEOF
|
FirOperation.NOT_IS -> irBuiltIns.booleanType to IrTypeOperator.NOT_INSTANCEOF
|
||||||
FirOperation.AS -> irTypeOperand to IrTypeOperator.CAST
|
FirOperation.AS -> irTypeOperand to IrTypeOperator.CAST
|
||||||
FirOperation.SAFE_AS -> irTypeOperand.makeNullable() to IrTypeOperator.SAFE_CAST
|
FirOperation.SAFE_AS -> irTypeOperand.makeNullable() to IrTypeOperator.SAFE_CAST
|
||||||
else -> TODO("Should not be here: ${typeOperatorCall.operation} in type operator call")
|
else -> TODO("Should not be here: ${typeOperatorCall.operation} in type operator call")
|
||||||
@@ -794,7 +794,7 @@ class Fir2IrVisitor(
|
|||||||
override fun visitAugmentedArraySetCall(augmentedArraySetCall: FirAugmentedArraySetCall, data: Any?): IrElement {
|
override fun visitAugmentedArraySetCall(augmentedArraySetCall: FirAugmentedArraySetCall, data: Any?): IrElement {
|
||||||
return augmentedArraySetCall.convertWithOffsets { startOffset, endOffset ->
|
return augmentedArraySetCall.convertWithOffsets { startOffset, endOffset ->
|
||||||
IrErrorCallExpressionImpl(
|
IrErrorCallExpressionImpl(
|
||||||
startOffset, endOffset, typeConverter.unitType,
|
startOffset, endOffset, irBuiltIns.unitType,
|
||||||
"FirArraySetCall (resolve isn't supported yet)"
|
"FirArraySetCall (resolve isn't supported yet)"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -87,7 +87,7 @@ internal class CallGenerator(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun convertToIrSetCall(variableAssignment: FirVariableAssignment): IrExpression {
|
fun convertToIrSetCall(variableAssignment: FirVariableAssignment): IrExpression {
|
||||||
val type = typeConverter.unitType
|
val type = irBuiltIns.unitType
|
||||||
val calleeReference = variableAssignment.calleeReference
|
val calleeReference = variableAssignment.calleeReference
|
||||||
val symbol = calleeReference.toSymbol(session, classifierStorage, declarationStorage)
|
val symbol = calleeReference.toSymbol(session, classifierStorage, declarationStorage)
|
||||||
val origin = IrStatementOrigin.EQ
|
val origin = IrStatementOrigin.EQ
|
||||||
|
|||||||
+2
-2
@@ -215,13 +215,13 @@ internal class ClassMemberGenerator(
|
|||||||
startOffset, endOffset,
|
startOffset, endOffset,
|
||||||
listOf(
|
listOf(
|
||||||
if (isSetter) {
|
if (isSetter) {
|
||||||
IrSetFieldImpl(startOffset, endOffset, fieldSymbol, typeConverter.unitType).apply {
|
IrSetFieldImpl(startOffset, endOffset, fieldSymbol, irBuiltIns.unitType).apply {
|
||||||
setReceiver(declaration)
|
setReceiver(declaration)
|
||||||
value = IrGetValueImpl(startOffset, endOffset, propertyType, valueParameters.first().symbol)
|
value = IrGetValueImpl(startOffset, endOffset, propertyType, valueParameters.first().symbol)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
IrReturnImpl(
|
IrReturnImpl(
|
||||||
startOffset, endOffset, typeConverter.nothingType, symbol,
|
startOffset, endOffset, irBuiltIns.nothingType, symbol,
|
||||||
IrGetFieldImpl(startOffset, endOffset, fieldSymbol, propertyType).setReceiver(declaration)
|
IrGetFieldImpl(startOffset, endOffset, fieldSymbol, propertyType).setReceiver(declaration)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -185,7 +185,7 @@ fun IrConstructor.callsSuper(irBuiltIns: IrBuiltIns): Boolean {
|
|||||||
else if (delegatingClass.descriptor != constructedClass.descriptor)
|
else if (delegatingClass.descriptor != constructedClass.descriptor)
|
||||||
throw AssertionError(
|
throw AssertionError(
|
||||||
"Expected either call to another constructor of the class being constructed or" +
|
"Expected either call to another constructor of the class being constructed or" +
|
||||||
" call to super class constructor. But was: $delegatingClass"
|
" call to super class constructor. But was: $delegatingClass with '${delegatingClass.name}' name"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// IGNORE_BACKEND: NATIVE
|
// IGNORE_BACKEND: NATIVE
|
||||||
// IGNORE_BACKEND: JS_IR
|
// IGNORE_BACKEND: JS_IR
|
||||||
// IGNORE_BACKEND: JS
|
// IGNORE_BACKEND: JS
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// IGNORE_BACKEND: JS_IR
|
// IGNORE_BACKEND: JS_IR
|
||||||
// IGNORE_BACKEND: JS
|
// IGNORE_BACKEND: JS
|
||||||
// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=always-enable
|
// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=always-enable
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
|
|
||||||
fun bar(b: ()-> Unit) { b() }
|
fun bar(b: ()-> Unit) { b() }
|
||||||
|
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
|
|
||||||
fun bar(b: ()-> Unit) { b() }
|
fun bar(b: ()-> Unit) { b() }
|
||||||
|
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// IGNORE_BACKEND: JS_IR
|
// IGNORE_BACKEND: JS_IR
|
||||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||||
// IGNORE_BACKEND: JS, NATIVE
|
// IGNORE_BACKEND: JS, NATIVE
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// IGNORE_BACKEND: JS_IR
|
// IGNORE_BACKEND: JS_IR
|
||||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||||
// IGNORE_BACKEND: JS, NATIVE
|
// IGNORE_BACKEND: JS, NATIVE
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// IGNORE_BACKEND: JS_IR
|
// IGNORE_BACKEND: JS_IR
|
||||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||||
// IGNORE_BACKEND: JS, NATIVE
|
// IGNORE_BACKEND: JS, NATIVE
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// IGNORE_BACKEND: JS_IR
|
// IGNORE_BACKEND: JS_IR
|
||||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||||
// IGNORE_BACKEND: JS, NATIVE
|
// IGNORE_BACKEND: JS, NATIVE
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// IGNORE_BACKEND: JS_IR
|
// IGNORE_BACKEND: JS_IR
|
||||||
// Won't ever work with JS backend.
|
// Won't ever work with JS backend.
|
||||||
// TODO: Consider rewriting this test without using threads, since the issue is not about threads at all.
|
// TODO: Consider rewriting this test without using threads, since the issue is not about threads at all.
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
public object SomeClass {
|
public object SomeClass {
|
||||||
private val work = object : Runnable {
|
private val work = object : Runnable {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
fun box() : String {
|
fun box() : String {
|
||||||
var i = 0
|
var i = 0
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
package foo
|
package foo
|
||||||
|
|
||||||
interface B {
|
interface B {
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
interface Callback {
|
interface Callback {
|
||||||
fun invoke(): String
|
fun invoke(): String
|
||||||
}
|
}
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
interface Callback {
|
interface Callback {
|
||||||
fun invoke(): String
|
fun invoke(): String
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
//KT-4656 Wrong capturing a function literal variable
|
//KT-4656 Wrong capturing a function literal variable
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
|
|||||||
Vendored
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
inline fun inlineCall(action: () -> Unit) {
|
inline fun inlineCall(action: () -> Unit) {
|
||||||
action()
|
action()
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// IGNORE_BACKEND: JS_IR
|
// IGNORE_BACKEND: JS_IR
|
||||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||||
// IGNORE_BACKEND: JS
|
// IGNORE_BACKEND: JS
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// IGNORE_BACKEND: JS_IR
|
// IGNORE_BACKEND: JS_IR
|
||||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||||
// IGNORE_BACKEND: JS
|
// IGNORE_BACKEND: JS
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
|
|
||||||
import java.io.*
|
import java.io.*
|
||||||
|
|||||||
-1
@@ -1,5 +1,4 @@
|
|||||||
// !LANGUAGE: -NormalizeConstructorCalls
|
// !LANGUAGE: -NormalizeConstructorCalls
|
||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
// FILE: test.kt
|
// FILE: test.kt
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
// !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts
|
// !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts
|
||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// IGNORE_BACKEND: NATIVE
|
// IGNORE_BACKEND: NATIVE
|
||||||
|
|
||||||
import kotlin.contracts.*
|
import kotlin.contracts.*
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
var i = 0
|
var i = 0
|
||||||
{
|
{
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
public inline fun fails(block: () -> Unit): Throwable? {
|
public inline fun fails(block: () -> Unit): Throwable? {
|
||||||
var thrown: Throwable? = null
|
var thrown: Throwable? = null
|
||||||
try {
|
try {
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
interface Callable {
|
interface Callable {
|
||||||
fun call(b: Boolean)
|
fun call(b: Boolean)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
// !LANGUAGE: +NewInference
|
// !LANGUAGE: +NewInference
|
||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
|
|
||||||
@file:OptIn(ExperimentalTypeInference::class)
|
@file:OptIn(ExperimentalTypeInference::class)
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
// WITH_COROUTINES
|
// WITH_COROUTINES
|
||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
package foo
|
package foo
|
||||||
|
|
||||||
import kotlin.reflect.KProperty
|
import kotlin.reflect.KProperty
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
package foo
|
package foo
|
||||||
|
|
||||||
import kotlin.reflect.KProperty
|
import kotlin.reflect.KProperty
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// SKIP_JDK6
|
// SKIP_JDK6
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// SKIP_JDK6
|
// SKIP_JDK6
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
// FILE: Base.java
|
// FILE: Base.java
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// SKIP_JDK6
|
// SKIP_JDK6
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
// FILE: Base.java
|
// FILE: Base.java
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
interface Callback {
|
interface Callback {
|
||||||
fun invoke(): String
|
fun invoke(): String
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
fun box() : String {
|
fun box() : String {
|
||||||
val fps : Double = 1.toDouble()
|
val fps : Double = 1.toDouble()
|
||||||
var mspf : Long
|
var mspf : Long
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
fun IntRange.forEach(body : (Int) -> Unit) {
|
fun IntRange.forEach(body : (Int) -> Unit) {
|
||||||
for(i in this) {
|
for(i in this) {
|
||||||
body(i)
|
body(i)
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// KJS_WITH_FULL_RUNTIME
|
// KJS_WITH_FULL_RUNTIME
|
||||||
// !LANGUAGE: +InlineClasses
|
// !LANGUAGE: +InlineClasses
|
||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
var a: Int
|
var a: Int
|
||||||
a = 12
|
a = 12
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
//KT-3042 Attempt to split long or double on the stack excepion
|
//KT-3042 Attempt to split long or double on the stack excepion
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
fun testBoolean(v: Boolean): Boolean {
|
fun testBoolean(v: Boolean): Boolean {
|
||||||
var value = false
|
var value = false
|
||||||
fun setValue(v: Boolean) {
|
fun setValue(v: Boolean) {
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
class A {
|
class A {
|
||||||
operator fun component1() = 1
|
operator fun component1() = 1
|
||||||
operator fun component2() = 2
|
operator fun component2() = 2
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
class A {
|
class A {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
class A {
|
class A {
|
||||||
operator fun component1() = 1
|
operator fun component1() = 1
|
||||||
operator fun component2() = 2
|
operator fun component2() = 2
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
interface ClassData
|
interface ClassData
|
||||||
|
|
||||||
fun f() = object : ClassData {
|
fun f() = object : ClassData {
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
interface IFoo {
|
interface IFoo {
|
||||||
fun foo(): String
|
fun foo(): String
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
fun box() : String {
|
fun box() : String {
|
||||||
var a = 1
|
var a = 1
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
interface N
|
interface N
|
||||||
|
|
||||||
open class Base(n: N)
|
open class Base(n: N)
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
|
|
||||||
package while_bug_1
|
package while_bug_1
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
interface IFn {
|
interface IFn {
|
||||||
operator fun invoke(): String
|
operator fun invoke(): String
|
||||||
}
|
}
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
interface IFn {
|
interface IFn {
|
||||||
operator fun invoke(): String
|
operator fun invoke(): String
|
||||||
}
|
}
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
interface IFn {
|
interface IFn {
|
||||||
operator fun invoke(): String
|
operator fun invoke(): String
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
class A(var b: Byte) {
|
class A(var b: Byte) {
|
||||||
fun c(d: Short) = (b + d.toByte()).toChar()
|
fun c(d: Short) = (b + d.toByte()).toChar()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// IGNORE_BACKEND: JS_IR
|
// IGNORE_BACKEND: JS_IR
|
||||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||||
// IGNORE_BACKEND: JS, NATIVE
|
// IGNORE_BACKEND: JS, NATIVE
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
|
|
||||||
// WITH_REFLECT
|
// WITH_REFLECT
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
|
|
||||||
// WITH_REFLECT
|
// WITH_REFLECT
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
// WITH_REFLECT
|
// WITH_REFLECT
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// KJS_WITH_FULL_RUNTIME
|
// KJS_WITH_FULL_RUNTIME
|
||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// IGNORE_BACKEND: JS_IR
|
// IGNORE_BACKEND: JS_IR
|
||||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||||
// IGNORE_BACKEND: JS, NATIVE
|
// IGNORE_BACKEND: JS, NATIVE
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
|
|
||||||
val b: First by lazy {
|
val b: First by lazy {
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
|
|
||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
|
|
||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
|
|
||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
|
|
||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// KJS_WITH_FULL_RUNTIME
|
// KJS_WITH_FULL_RUNTIME
|
||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// KJS_WITH_FULL_RUNTIME
|
// KJS_WITH_FULL_RUNTIME
|
||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
//KT-1572 Frontend doesn't mark all vars included in closure as refs.
|
//KT-1572 Frontend doesn't mark all vars included in closure as refs.
|
||||||
|
|
||||||
class A(val t : Int) {}
|
class A(val t : Int) {}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
|
|
||||||
var global = ""
|
var global = ""
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
|
|
||||||
// FILE: SingletonCollection.kt
|
// FILE: SingletonCollection.kt
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
// IGNORE_LIGHT_ANALYSIS
|
// IGNORE_LIGHT_ANALYSIS
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
|
|
||||||
// FILE: B.java
|
// FILE: B.java
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// KJS_WITH_FULL_RUNTIME
|
// KJS_WITH_FULL_RUNTIME
|
||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// KJS_WITH_FULL_RUNTIME
|
// KJS_WITH_FULL_RUNTIME
|
||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user