Comparisons:
- for primitive types and kotlin.String, use IrBinaryOperatorExpression - for others, use call to 'compareTo'
This commit is contained in:
committed by
Dmitry Petrov
parent
ace98b91cc
commit
1ddf889d8a
+28
-10
@@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.psi2ir.generators
|
package org.jetbrains.kotlin.psi2ir.generators
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||||
|
import org.jetbrains.kotlin.descriptors.CallableDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.impl.LocalVariableDescriptor
|
import org.jetbrains.kotlin.descriptors.impl.LocalVariableDescriptor
|
||||||
import org.jetbrains.kotlin.ir.expressions.*
|
import org.jetbrains.kotlin.ir.expressions.*
|
||||||
@@ -26,8 +28,8 @@ import org.jetbrains.kotlin.psi.KtExpression
|
|||||||
import org.jetbrains.kotlin.psi.KtPrefixExpression
|
import org.jetbrains.kotlin.psi.KtPrefixExpression
|
||||||
import org.jetbrains.kotlin.psi.psiUtil.endOffset
|
import org.jetbrains.kotlin.psi.psiUtil.endOffset
|
||||||
import org.jetbrains.kotlin.psi.psiUtil.startOffset
|
import org.jetbrains.kotlin.psi.psiUtil.startOffset
|
||||||
import org.jetbrains.kotlin.psi2ir.load
|
|
||||||
import org.jetbrains.kotlin.psi2ir.generators.values.*
|
import org.jetbrains.kotlin.psi2ir.generators.values.*
|
||||||
|
import org.jetbrains.kotlin.psi2ir.load
|
||||||
import org.jetbrains.kotlin.psi2ir.toExpectedType
|
import org.jetbrains.kotlin.psi2ir.toExpectedType
|
||||||
import org.jetbrains.kotlin.resolve.BindingContext
|
import org.jetbrains.kotlin.resolve.BindingContext
|
||||||
import org.jetbrains.kotlin.resolve.calls.callUtil.isSafeCall
|
import org.jetbrains.kotlin.resolve.calls.callUtil.isSafeCall
|
||||||
@@ -139,19 +141,35 @@ class IrOperatorExpressionGenerator(val irStatementGenerator: IrStatementGenerat
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun generateComparisonOperator(expression: KtBinaryExpression, irOperator: IrBinaryOperator): IrExpression {
|
private fun generateComparisonOperator(expression: KtBinaryExpression, irOperator: IrBinaryOperator): IrExpression {
|
||||||
val relatedCall = getResolvedCall(expression)!!
|
val compareToCall = getResolvedCall(expression)!!
|
||||||
val relatedDescriptor = relatedCall.resultingDescriptor
|
val compareToDescriptor = compareToCall.resultingDescriptor
|
||||||
|
|
||||||
val irCallGenerator = IrCallGenerator(irStatementGenerator)
|
val irCallGenerator = IrCallGenerator(irStatementGenerator)
|
||||||
val irArgument0 = irCallGenerator.generateReceiver(expression.left!!, relatedCall.dispatchReceiver, relatedDescriptor.dispatchReceiverParameter!!)!!
|
|
||||||
val valueParameter0 = relatedDescriptor.valueParameters[0]
|
return if (shouldKeepComparisonAsBinaryOperation(compareToDescriptor)) {
|
||||||
val irArgument1 = irCallGenerator.generateValueArgument(relatedCall.valueArgumentsByIndex!![0], valueParameter0)!!
|
val irArgument0 = irCallGenerator.generateReceiver(expression.left!!, compareToCall.dispatchReceiver, compareToDescriptor.dispatchReceiverParameter!!)!!
|
||||||
return IrBinaryOperatorExpressionImpl(
|
val valueParameter0 = compareToDescriptor.valueParameters[0]
|
||||||
expression.startOffset, expression.endOffset, context.builtIns.booleanType,
|
val irArgument1 = irCallGenerator.generateValueArgument(compareToCall.valueArgumentsByIndex!![0], valueParameter0)!!
|
||||||
irOperator, relatedDescriptor, irArgument0, irArgument1
|
IrBinaryOperatorExpressionImpl(
|
||||||
)
|
expression.startOffset, expression.endOffset, context.builtIns.booleanType,
|
||||||
|
irOperator, compareToDescriptor, irArgument0, irArgument1
|
||||||
|
)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
val irCompareToCall = irCallGenerator.generateCall(expression, compareToCall, irOperator)
|
||||||
|
IrBinaryOperatorExpressionImpl(
|
||||||
|
expression.startOffset, expression.endOffset, context.builtIns.booleanType,
|
||||||
|
irOperator, null, irCompareToCall,
|
||||||
|
IrLiteralExpressionImpl.int(expression.startOffset, expression.endOffset, context.builtIns.intType, 0)
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun shouldKeepComparisonAsBinaryOperation(compareToDescriptor: CallableDescriptor) =
|
||||||
|
compareToDescriptor.dispatchReceiverParameter?.type.let {
|
||||||
|
it != null && (KotlinBuiltIns.isPrimitiveType(it) || KotlinBuiltIns.isString(it))
|
||||||
|
}
|
||||||
|
|
||||||
private fun generateBinaryOperatorWithConventionalCall(expression: KtBinaryExpression, irOperator: IrOperator?): IrExpression {
|
private fun generateBinaryOperatorWithConventionalCall(expression: KtBinaryExpression, irOperator: IrOperator?): IrExpression {
|
||||||
val operatorCall = getResolvedCall(expression)!!
|
val operatorCall = getResolvedCall(expression)!!
|
||||||
return IrCallGenerator(irStatementGenerator).generateCall(expression, operatorCall, irOperator)
|
return IrCallGenerator(irStatementGenerator).generateCall(expression, operatorCall, irOperator)
|
||||||
|
|||||||
+10
-4
@@ -1,4 +1,10 @@
|
|||||||
fun test1(a: String, b: String) = a > b
|
interface IA
|
||||||
fun test2(a: String, b: String) = a < b
|
|
||||||
fun test3(a: String, b: String) = a >= b
|
interface IB {
|
||||||
fun test4(a: String, b: String) = a <= b
|
operator fun IA.compareTo(other: IA): Int
|
||||||
|
}
|
||||||
|
|
||||||
|
fun IB.test1(a1: IA, a2: IA) = a1 > a2
|
||||||
|
fun IB.test2(a1: IA, a2: IA) = a1 >= a2
|
||||||
|
fun IB.test3(a1: IA, a2: IA) = a1 < a2
|
||||||
|
fun IB.test4(a1: IA, a2: IA) = a1 <= a2
|
||||||
+30
-16
@@ -1,29 +1,43 @@
|
|||||||
IrFile /conventionComparisons.kt
|
IrFile /conventionComparisons.kt
|
||||||
IrFunction public fun test1(/*0*/ a: kotlin.String, /*1*/ b: kotlin.String): kotlin.Boolean
|
DUMMY IA
|
||||||
|
DUMMY IB
|
||||||
|
IrFunction public fun IB.test1(/*0*/ a1: IA, /*1*/ a2: IA): kotlin.Boolean
|
||||||
IrExpressionBody
|
IrExpressionBody
|
||||||
BLOCK type=<no-type> hasResult=false operator=null
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
RETURN type=<no-type>
|
RETURN type=<no-type>
|
||||||
BINARY_OP operator=GT type=kotlin.Boolean related=public open override /*1*/ fun compareTo(/*0*/ other: kotlin.String): kotlin.Int
|
BINARY_OP operator=GT type=kotlin.Boolean related=null
|
||||||
GET_VAR a type=kotlin.String operator=null
|
CALL .compareTo type=kotlin.Int operator=GT
|
||||||
GET_VAR b type=kotlin.String operator=null
|
$this: $RECEIVER of: test1 type=IB
|
||||||
IrFunction public fun test2(/*0*/ a: kotlin.String, /*1*/ b: kotlin.String): kotlin.Boolean
|
$receiver: GET_VAR a1 type=IA operator=null
|
||||||
|
other: GET_VAR a2 type=IA operator=null
|
||||||
|
LITERAL Int type=kotlin.Int value='0'
|
||||||
|
IrFunction public fun IB.test2(/*0*/ a1: IA, /*1*/ a2: IA): kotlin.Boolean
|
||||||
IrExpressionBody
|
IrExpressionBody
|
||||||
BLOCK type=<no-type> hasResult=false operator=null
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
RETURN type=<no-type>
|
RETURN type=<no-type>
|
||||||
BINARY_OP operator=LT type=kotlin.Boolean related=public open override /*1*/ fun compareTo(/*0*/ other: kotlin.String): kotlin.Int
|
BINARY_OP operator=GTEQ type=kotlin.Boolean related=null
|
||||||
GET_VAR a type=kotlin.String operator=null
|
CALL .compareTo type=kotlin.Int operator=GTEQ
|
||||||
GET_VAR b type=kotlin.String operator=null
|
$this: $RECEIVER of: test2 type=IB
|
||||||
IrFunction public fun test3(/*0*/ a: kotlin.String, /*1*/ b: kotlin.String): kotlin.Boolean
|
$receiver: GET_VAR a1 type=IA operator=null
|
||||||
|
other: GET_VAR a2 type=IA operator=null
|
||||||
|
LITERAL Int type=kotlin.Int value='0'
|
||||||
|
IrFunction public fun IB.test3(/*0*/ a1: IA, /*1*/ a2: IA): kotlin.Boolean
|
||||||
IrExpressionBody
|
IrExpressionBody
|
||||||
BLOCK type=<no-type> hasResult=false operator=null
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
RETURN type=<no-type>
|
RETURN type=<no-type>
|
||||||
BINARY_OP operator=GTEQ type=kotlin.Boolean related=public open override /*1*/ fun compareTo(/*0*/ other: kotlin.String): kotlin.Int
|
BINARY_OP operator=LT type=kotlin.Boolean related=null
|
||||||
GET_VAR a type=kotlin.String operator=null
|
CALL .compareTo type=kotlin.Int operator=LT
|
||||||
GET_VAR b type=kotlin.String operator=null
|
$this: $RECEIVER of: test3 type=IB
|
||||||
IrFunction public fun test4(/*0*/ a: kotlin.String, /*1*/ b: kotlin.String): kotlin.Boolean
|
$receiver: GET_VAR a1 type=IA operator=null
|
||||||
|
other: GET_VAR a2 type=IA operator=null
|
||||||
|
LITERAL Int type=kotlin.Int value='0'
|
||||||
|
IrFunction public fun IB.test4(/*0*/ a1: IA, /*1*/ a2: IA): kotlin.Boolean
|
||||||
IrExpressionBody
|
IrExpressionBody
|
||||||
BLOCK type=<no-type> hasResult=false operator=null
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
RETURN type=<no-type>
|
RETURN type=<no-type>
|
||||||
BINARY_OP operator=LTEQ type=kotlin.Boolean related=public open override /*1*/ fun compareTo(/*0*/ other: kotlin.String): kotlin.Int
|
BINARY_OP operator=LTEQ type=kotlin.Boolean related=null
|
||||||
GET_VAR a type=kotlin.String operator=null
|
CALL .compareTo type=kotlin.Int operator=LTEQ
|
||||||
GET_VAR b type=kotlin.String operator=null
|
$this: $RECEIVER of: test4 type=IB
|
||||||
|
$receiver: GET_VAR a1 type=IA operator=null
|
||||||
|
other: GET_VAR a2 type=IA operator=null
|
||||||
|
LITERAL Int type=kotlin.Int value='0'
|
||||||
|
|||||||
+29
-4
@@ -1,4 +1,29 @@
|
|||||||
fun test1(a: Int, b: Int) = a > b
|
fun btest1(a: Byte, b: Byte) = a > b
|
||||||
fun test2(a: Int, b: Int) = a < b
|
fun btest2(a: Byte, b: Byte) = a < b
|
||||||
fun test3(a: Int, b: Int) = a >= b
|
fun btest3(a: Byte, b: Byte) = a >= b
|
||||||
fun test4(a: Int, b: Int) = a <= b
|
fun btest4(a: Byte, b: Byte) = a <= b
|
||||||
|
|
||||||
|
fun stest1(a: Short, b: Short) = a > b
|
||||||
|
fun stest2(a: Short, b: Short) = a < b
|
||||||
|
fun stest3(a: Short, b: Short) = a >= b
|
||||||
|
fun stest4(a: Short, b: Short) = a <= b
|
||||||
|
|
||||||
|
fun itest1(a: Int, b: Int) = a > b
|
||||||
|
fun itest2(a: Int, b: Int) = a < b
|
||||||
|
fun itest3(a: Int, b: Int) = a >= b
|
||||||
|
fun itest4(a: Int, b: Int) = a <= b
|
||||||
|
|
||||||
|
fun ltest1(a: Long, b: Long) = a > b
|
||||||
|
fun ltest2(a: Long, b: Long) = a < b
|
||||||
|
fun ltest3(a: Long, b: Long) = a >= b
|
||||||
|
fun ltest4(a: Long, b: Long) = a <= b
|
||||||
|
|
||||||
|
fun ftest1(a: Float, b: Float) = a > b
|
||||||
|
fun ftest2(a: Float, b: Float) = a < b
|
||||||
|
fun ftest3(a: Float, b: Float) = a >= b
|
||||||
|
fun ftest4(a: Float, b: Float) = a <= b
|
||||||
|
|
||||||
|
fun dtest1(a: Double, b: Double) = a > b
|
||||||
|
fun dtest2(a: Double, b: Double) = a < b
|
||||||
|
fun dtest3(a: Double, b: Double) = a >= b
|
||||||
|
fun dtest4(a: Double, b: Double) = a <= b
|
||||||
|
|||||||
+144
-4
@@ -1,29 +1,169 @@
|
|||||||
IrFile /primitiveComparisons.kt
|
IrFile /primitiveComparisons.kt
|
||||||
IrFunction public fun test1(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int): kotlin.Boolean
|
IrFunction public fun btest1(/*0*/ a: kotlin.Byte, /*1*/ b: kotlin.Byte): kotlin.Boolean
|
||||||
|
IrExpressionBody
|
||||||
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
|
RETURN type=<no-type>
|
||||||
|
BINARY_OP operator=GT type=kotlin.Boolean related=public open override /*1*/ fun compareTo(/*0*/ other: kotlin.Byte): kotlin.Int
|
||||||
|
GET_VAR a type=kotlin.Byte operator=null
|
||||||
|
GET_VAR b type=kotlin.Byte operator=null
|
||||||
|
IrFunction public fun btest2(/*0*/ a: kotlin.Byte, /*1*/ b: kotlin.Byte): kotlin.Boolean
|
||||||
|
IrExpressionBody
|
||||||
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
|
RETURN type=<no-type>
|
||||||
|
BINARY_OP operator=LT type=kotlin.Boolean related=public open override /*1*/ fun compareTo(/*0*/ other: kotlin.Byte): kotlin.Int
|
||||||
|
GET_VAR a type=kotlin.Byte operator=null
|
||||||
|
GET_VAR b type=kotlin.Byte operator=null
|
||||||
|
IrFunction public fun btest3(/*0*/ a: kotlin.Byte, /*1*/ b: kotlin.Byte): kotlin.Boolean
|
||||||
|
IrExpressionBody
|
||||||
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
|
RETURN type=<no-type>
|
||||||
|
BINARY_OP operator=GTEQ type=kotlin.Boolean related=public open override /*1*/ fun compareTo(/*0*/ other: kotlin.Byte): kotlin.Int
|
||||||
|
GET_VAR a type=kotlin.Byte operator=null
|
||||||
|
GET_VAR b type=kotlin.Byte operator=null
|
||||||
|
IrFunction public fun btest4(/*0*/ a: kotlin.Byte, /*1*/ b: kotlin.Byte): kotlin.Boolean
|
||||||
|
IrExpressionBody
|
||||||
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
|
RETURN type=<no-type>
|
||||||
|
BINARY_OP operator=LTEQ type=kotlin.Boolean related=public open override /*1*/ fun compareTo(/*0*/ other: kotlin.Byte): kotlin.Int
|
||||||
|
GET_VAR a type=kotlin.Byte operator=null
|
||||||
|
GET_VAR b type=kotlin.Byte operator=null
|
||||||
|
IrFunction public fun stest1(/*0*/ a: kotlin.Short, /*1*/ b: kotlin.Short): kotlin.Boolean
|
||||||
|
IrExpressionBody
|
||||||
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
|
RETURN type=<no-type>
|
||||||
|
BINARY_OP operator=GT type=kotlin.Boolean related=public open override /*1*/ fun compareTo(/*0*/ other: kotlin.Short): kotlin.Int
|
||||||
|
GET_VAR a type=kotlin.Short operator=null
|
||||||
|
GET_VAR b type=kotlin.Short operator=null
|
||||||
|
IrFunction public fun stest2(/*0*/ a: kotlin.Short, /*1*/ b: kotlin.Short): kotlin.Boolean
|
||||||
|
IrExpressionBody
|
||||||
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
|
RETURN type=<no-type>
|
||||||
|
BINARY_OP operator=LT type=kotlin.Boolean related=public open override /*1*/ fun compareTo(/*0*/ other: kotlin.Short): kotlin.Int
|
||||||
|
GET_VAR a type=kotlin.Short operator=null
|
||||||
|
GET_VAR b type=kotlin.Short operator=null
|
||||||
|
IrFunction public fun stest3(/*0*/ a: kotlin.Short, /*1*/ b: kotlin.Short): kotlin.Boolean
|
||||||
|
IrExpressionBody
|
||||||
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
|
RETURN type=<no-type>
|
||||||
|
BINARY_OP operator=GTEQ type=kotlin.Boolean related=public open override /*1*/ fun compareTo(/*0*/ other: kotlin.Short): kotlin.Int
|
||||||
|
GET_VAR a type=kotlin.Short operator=null
|
||||||
|
GET_VAR b type=kotlin.Short operator=null
|
||||||
|
IrFunction public fun stest4(/*0*/ a: kotlin.Short, /*1*/ b: kotlin.Short): kotlin.Boolean
|
||||||
|
IrExpressionBody
|
||||||
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
|
RETURN type=<no-type>
|
||||||
|
BINARY_OP operator=LTEQ type=kotlin.Boolean related=public open override /*1*/ fun compareTo(/*0*/ other: kotlin.Short): kotlin.Int
|
||||||
|
GET_VAR a type=kotlin.Short operator=null
|
||||||
|
GET_VAR b type=kotlin.Short operator=null
|
||||||
|
IrFunction public fun itest1(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int): kotlin.Boolean
|
||||||
IrExpressionBody
|
IrExpressionBody
|
||||||
BLOCK type=<no-type> hasResult=false operator=null
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
RETURN type=<no-type>
|
RETURN type=<no-type>
|
||||||
BINARY_OP operator=GT type=kotlin.Boolean related=public open override /*1*/ fun compareTo(/*0*/ other: kotlin.Int): kotlin.Int
|
BINARY_OP operator=GT type=kotlin.Boolean related=public open override /*1*/ fun compareTo(/*0*/ other: kotlin.Int): kotlin.Int
|
||||||
GET_VAR a type=kotlin.Int operator=null
|
GET_VAR a type=kotlin.Int operator=null
|
||||||
GET_VAR b type=kotlin.Int operator=null
|
GET_VAR b type=kotlin.Int operator=null
|
||||||
IrFunction public fun test2(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int): kotlin.Boolean
|
IrFunction public fun itest2(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int): kotlin.Boolean
|
||||||
IrExpressionBody
|
IrExpressionBody
|
||||||
BLOCK type=<no-type> hasResult=false operator=null
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
RETURN type=<no-type>
|
RETURN type=<no-type>
|
||||||
BINARY_OP operator=LT type=kotlin.Boolean related=public open override /*1*/ fun compareTo(/*0*/ other: kotlin.Int): kotlin.Int
|
BINARY_OP operator=LT type=kotlin.Boolean related=public open override /*1*/ fun compareTo(/*0*/ other: kotlin.Int): kotlin.Int
|
||||||
GET_VAR a type=kotlin.Int operator=null
|
GET_VAR a type=kotlin.Int operator=null
|
||||||
GET_VAR b type=kotlin.Int operator=null
|
GET_VAR b type=kotlin.Int operator=null
|
||||||
IrFunction public fun test3(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int): kotlin.Boolean
|
IrFunction public fun itest3(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int): kotlin.Boolean
|
||||||
IrExpressionBody
|
IrExpressionBody
|
||||||
BLOCK type=<no-type> hasResult=false operator=null
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
RETURN type=<no-type>
|
RETURN type=<no-type>
|
||||||
BINARY_OP operator=GTEQ type=kotlin.Boolean related=public open override /*1*/ fun compareTo(/*0*/ other: kotlin.Int): kotlin.Int
|
BINARY_OP operator=GTEQ type=kotlin.Boolean related=public open override /*1*/ fun compareTo(/*0*/ other: kotlin.Int): kotlin.Int
|
||||||
GET_VAR a type=kotlin.Int operator=null
|
GET_VAR a type=kotlin.Int operator=null
|
||||||
GET_VAR b type=kotlin.Int operator=null
|
GET_VAR b type=kotlin.Int operator=null
|
||||||
IrFunction public fun test4(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int): kotlin.Boolean
|
IrFunction public fun itest4(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int): kotlin.Boolean
|
||||||
IrExpressionBody
|
IrExpressionBody
|
||||||
BLOCK type=<no-type> hasResult=false operator=null
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
RETURN type=<no-type>
|
RETURN type=<no-type>
|
||||||
BINARY_OP operator=LTEQ type=kotlin.Boolean related=public open override /*1*/ fun compareTo(/*0*/ other: kotlin.Int): kotlin.Int
|
BINARY_OP operator=LTEQ type=kotlin.Boolean related=public open override /*1*/ fun compareTo(/*0*/ other: kotlin.Int): kotlin.Int
|
||||||
GET_VAR a type=kotlin.Int operator=null
|
GET_VAR a type=kotlin.Int operator=null
|
||||||
GET_VAR b type=kotlin.Int operator=null
|
GET_VAR b type=kotlin.Int operator=null
|
||||||
|
IrFunction public fun ltest1(/*0*/ a: kotlin.Long, /*1*/ b: kotlin.Long): kotlin.Boolean
|
||||||
|
IrExpressionBody
|
||||||
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
|
RETURN type=<no-type>
|
||||||
|
BINARY_OP operator=GT type=kotlin.Boolean related=public open override /*1*/ fun compareTo(/*0*/ other: kotlin.Long): kotlin.Int
|
||||||
|
GET_VAR a type=kotlin.Long operator=null
|
||||||
|
GET_VAR b type=kotlin.Long operator=null
|
||||||
|
IrFunction public fun ltest2(/*0*/ a: kotlin.Long, /*1*/ b: kotlin.Long): kotlin.Boolean
|
||||||
|
IrExpressionBody
|
||||||
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
|
RETURN type=<no-type>
|
||||||
|
BINARY_OP operator=LT type=kotlin.Boolean related=public open override /*1*/ fun compareTo(/*0*/ other: kotlin.Long): kotlin.Int
|
||||||
|
GET_VAR a type=kotlin.Long operator=null
|
||||||
|
GET_VAR b type=kotlin.Long operator=null
|
||||||
|
IrFunction public fun ltest3(/*0*/ a: kotlin.Long, /*1*/ b: kotlin.Long): kotlin.Boolean
|
||||||
|
IrExpressionBody
|
||||||
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
|
RETURN type=<no-type>
|
||||||
|
BINARY_OP operator=GTEQ type=kotlin.Boolean related=public open override /*1*/ fun compareTo(/*0*/ other: kotlin.Long): kotlin.Int
|
||||||
|
GET_VAR a type=kotlin.Long operator=null
|
||||||
|
GET_VAR b type=kotlin.Long operator=null
|
||||||
|
IrFunction public fun ltest4(/*0*/ a: kotlin.Long, /*1*/ b: kotlin.Long): kotlin.Boolean
|
||||||
|
IrExpressionBody
|
||||||
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
|
RETURN type=<no-type>
|
||||||
|
BINARY_OP operator=LTEQ type=kotlin.Boolean related=public open override /*1*/ fun compareTo(/*0*/ other: kotlin.Long): kotlin.Int
|
||||||
|
GET_VAR a type=kotlin.Long operator=null
|
||||||
|
GET_VAR b type=kotlin.Long operator=null
|
||||||
|
IrFunction public fun ftest1(/*0*/ a: kotlin.Float, /*1*/ b: kotlin.Float): kotlin.Boolean
|
||||||
|
IrExpressionBody
|
||||||
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
|
RETURN type=<no-type>
|
||||||
|
BINARY_OP operator=GT type=kotlin.Boolean related=public open override /*1*/ fun compareTo(/*0*/ other: kotlin.Float): kotlin.Int
|
||||||
|
GET_VAR a type=kotlin.Float operator=null
|
||||||
|
GET_VAR b type=kotlin.Float operator=null
|
||||||
|
IrFunction public fun ftest2(/*0*/ a: kotlin.Float, /*1*/ b: kotlin.Float): kotlin.Boolean
|
||||||
|
IrExpressionBody
|
||||||
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
|
RETURN type=<no-type>
|
||||||
|
BINARY_OP operator=LT type=kotlin.Boolean related=public open override /*1*/ fun compareTo(/*0*/ other: kotlin.Float): kotlin.Int
|
||||||
|
GET_VAR a type=kotlin.Float operator=null
|
||||||
|
GET_VAR b type=kotlin.Float operator=null
|
||||||
|
IrFunction public fun ftest3(/*0*/ a: kotlin.Float, /*1*/ b: kotlin.Float): kotlin.Boolean
|
||||||
|
IrExpressionBody
|
||||||
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
|
RETURN type=<no-type>
|
||||||
|
BINARY_OP operator=GTEQ type=kotlin.Boolean related=public open override /*1*/ fun compareTo(/*0*/ other: kotlin.Float): kotlin.Int
|
||||||
|
GET_VAR a type=kotlin.Float operator=null
|
||||||
|
GET_VAR b type=kotlin.Float operator=null
|
||||||
|
IrFunction public fun ftest4(/*0*/ a: kotlin.Float, /*1*/ b: kotlin.Float): kotlin.Boolean
|
||||||
|
IrExpressionBody
|
||||||
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
|
RETURN type=<no-type>
|
||||||
|
BINARY_OP operator=LTEQ type=kotlin.Boolean related=public open override /*1*/ fun compareTo(/*0*/ other: kotlin.Float): kotlin.Int
|
||||||
|
GET_VAR a type=kotlin.Float operator=null
|
||||||
|
GET_VAR b type=kotlin.Float operator=null
|
||||||
|
IrFunction public fun dtest1(/*0*/ a: kotlin.Double, /*1*/ b: kotlin.Double): kotlin.Boolean
|
||||||
|
IrExpressionBody
|
||||||
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
|
RETURN type=<no-type>
|
||||||
|
BINARY_OP operator=GT type=kotlin.Boolean related=public open override /*1*/ fun compareTo(/*0*/ other: kotlin.Double): kotlin.Int
|
||||||
|
GET_VAR a type=kotlin.Double operator=null
|
||||||
|
GET_VAR b type=kotlin.Double operator=null
|
||||||
|
IrFunction public fun dtest2(/*0*/ a: kotlin.Double, /*1*/ b: kotlin.Double): kotlin.Boolean
|
||||||
|
IrExpressionBody
|
||||||
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
|
RETURN type=<no-type>
|
||||||
|
BINARY_OP operator=LT type=kotlin.Boolean related=public open override /*1*/ fun compareTo(/*0*/ other: kotlin.Double): kotlin.Int
|
||||||
|
GET_VAR a type=kotlin.Double operator=null
|
||||||
|
GET_VAR b type=kotlin.Double operator=null
|
||||||
|
IrFunction public fun dtest3(/*0*/ a: kotlin.Double, /*1*/ b: kotlin.Double): kotlin.Boolean
|
||||||
|
IrExpressionBody
|
||||||
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
|
RETURN type=<no-type>
|
||||||
|
BINARY_OP operator=GTEQ type=kotlin.Boolean related=public open override /*1*/ fun compareTo(/*0*/ other: kotlin.Double): kotlin.Int
|
||||||
|
GET_VAR a type=kotlin.Double operator=null
|
||||||
|
GET_VAR b type=kotlin.Double operator=null
|
||||||
|
IrFunction public fun dtest4(/*0*/ a: kotlin.Double, /*1*/ b: kotlin.Double): kotlin.Boolean
|
||||||
|
IrExpressionBody
|
||||||
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
|
RETURN type=<no-type>
|
||||||
|
BINARY_OP operator=LTEQ type=kotlin.Boolean related=public open override /*1*/ fun compareTo(/*0*/ other: kotlin.Double): kotlin.Int
|
||||||
|
GET_VAR a type=kotlin.Double operator=null
|
||||||
|
GET_VAR b type=kotlin.Double operator=null
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
fun test1(a: String, b: String) = a > b
|
||||||
|
fun test2(a: String, b: String) = a < b
|
||||||
|
fun test3(a: String, b: String) = a >= b
|
||||||
|
fun test4(a: String, b: String) = a <= b
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
IrFile /stringComparisons.kt
|
||||||
|
IrFunction public fun test1(/*0*/ a: kotlin.String, /*1*/ b: kotlin.String): kotlin.Boolean
|
||||||
|
IrExpressionBody
|
||||||
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
|
RETURN type=<no-type>
|
||||||
|
BINARY_OP operator=GT type=kotlin.Boolean related=public open override /*1*/ fun compareTo(/*0*/ other: kotlin.String): kotlin.Int
|
||||||
|
GET_VAR a type=kotlin.String operator=null
|
||||||
|
GET_VAR b type=kotlin.String operator=null
|
||||||
|
IrFunction public fun test2(/*0*/ a: kotlin.String, /*1*/ b: kotlin.String): kotlin.Boolean
|
||||||
|
IrExpressionBody
|
||||||
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
|
RETURN type=<no-type>
|
||||||
|
BINARY_OP operator=LT type=kotlin.Boolean related=public open override /*1*/ fun compareTo(/*0*/ other: kotlin.String): kotlin.Int
|
||||||
|
GET_VAR a type=kotlin.String operator=null
|
||||||
|
GET_VAR b type=kotlin.String operator=null
|
||||||
|
IrFunction public fun test3(/*0*/ a: kotlin.String, /*1*/ b: kotlin.String): kotlin.Boolean
|
||||||
|
IrExpressionBody
|
||||||
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
|
RETURN type=<no-type>
|
||||||
|
BINARY_OP operator=GTEQ type=kotlin.Boolean related=public open override /*1*/ fun compareTo(/*0*/ other: kotlin.String): kotlin.Int
|
||||||
|
GET_VAR a type=kotlin.String operator=null
|
||||||
|
GET_VAR b type=kotlin.String operator=null
|
||||||
|
IrFunction public fun test4(/*0*/ a: kotlin.String, /*1*/ b: kotlin.String): kotlin.Boolean
|
||||||
|
IrExpressionBody
|
||||||
|
BLOCK type=<no-type> hasResult=false operator=null
|
||||||
|
RETURN type=<no-type>
|
||||||
|
BINARY_OP operator=LTEQ type=kotlin.Boolean related=public open override /*1*/ fun compareTo(/*0*/ other: kotlin.String): kotlin.Int
|
||||||
|
GET_VAR a type=kotlin.String operator=null
|
||||||
|
GET_VAR b type=kotlin.String operator=null
|
||||||
@@ -191,6 +191,12 @@ public class IrTextTestCaseGenerated extends AbstractIrTextTestCase {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("stringComparisons.kt")
|
||||||
|
public void testStringComparisons() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/ir/irText/stringComparisons.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("stringPlus.kt")
|
@TestMetadata("stringPlus.kt")
|
||||||
public void testStringPlus() throws Exception {
|
public void testStringPlus() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/ir/irText/stringPlus.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/ir/irText/stringPlus.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user