diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/IrTypeOperatorCall.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/IrTypeOperatorCall.kt index 1776d14a422..f2b3017e84e 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/IrTypeOperatorCall.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/IrTypeOperatorCall.kt @@ -20,14 +20,30 @@ import org.jetbrains.kotlin.ir.symbols.IrClassifierSymbol import org.jetbrains.kotlin.ir.types.IrType enum class IrTypeOperator { + /** Explicit cast: `e as Type` */ CAST, + /** Implicit cast: value of type `A` is used where a value of type `B` is expected */ IMPLICIT_CAST, + /** Implicit cast from a value of nullability flexible type `A!` to non-null type `B`, `B :> A` */ IMPLICIT_NOTNULL, + /** Implicit coercion to Unit: expression of type `A, !(A <: kotlin.Unit)` is used where `kotlin.Unit` is expected */ IMPLICIT_COERCION_TO_UNIT, + /** + * Implicit integer coercion: expression of integer type `A` (`kotlin.Int`, `kotlin.Byte`, ...) + * is used where another integer type `B` (`kotlin.Int`, `kotlin.Byte`, ...) is expected. + * This mostly happens for constant expressions. + */ IMPLICIT_INTEGER_COERCION, + /** Safe cast: `e as? Type` */ SAFE_CAST, + /** Instance-of check: `a is Type` */ INSTANCEOF, - NOT_INSTANCEOF, + /** Instance-of check: `a !is Type` */ + NOT_INSTANCEOF, // TODO drop and replace with `INSTANCEOF(x).not()`? + /** + * SAM conversion: value of functional type F is used where Single Abstract Method interface value is expected. + * Currently this is possible in Kotlin/JVM only, however, there's a big demand for SAM conversion for Kotlin interfaces. + */ SAM_CONVERSION; } @@ -37,4 +53,3 @@ interface IrTypeOperatorCall : IrExpression { val typeOperand: IrType val typeOperandClassifier: IrClassifierSymbol } -