[FIR2IR] Use IR built-in types, their symbols & constructors directly

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