Implement special desugaring for numeric comparisons in PSI2IR

This introduces the following IR built-in functions required for proper
implementation of the number comparisons:

- ieee754Equals(T, T): Boolean,
    for each T in {Float?, Double?}

- less(T, T): Boolean
  lessOrEqual(T, T): Boolean
  greater(T, T): Boolean
  greaterOrEqual(T, T): Boolean
    for each T in {Int, Long, Float, Double}
This commit is contained in:
Dmitry Petrov
2018-02-01 16:18:01 +03:00
parent f4ed4ec9d9
commit 9137e68d4e
33 changed files with 1566 additions and 233 deletions
@@ -57,11 +57,10 @@ FILE fqName:<root> fileName:/forWithImplicitReceivers.kt
$receiver: VALUE_PARAMETER name:<this> type:IntCell flags:
BLOCK_BODY
RETURN type=kotlin.Nothing from='hasNext() on IntCell: Boolean'
CALL 'GT0(Int): Boolean' type=kotlin.Boolean origin=GT
arg0: CALL 'compareTo(Int): Int' type=kotlin.Int origin=GT
$this: CALL '<get-value>(): Int' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR 'this@hasNext: IntCell' type=IntCell origin=null
other: CONST Int type=kotlin.Int value=0
CALL 'greater(Int, Int): Boolean' type=kotlin.Boolean origin=GT
arg0: CALL '<get-value>(): Int' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR 'this@hasNext: IntCell' type=IntCell origin=null
arg1: CONST Int type=kotlin.Int value=0
FUN name:next visibility:public modality:OPEN <> ($this:IReceiver, $receiver:IntCell) returnType:Int flags:
$this: VALUE_PARAMETER name:<this> type:IReceiver flags:
$receiver: VALUE_PARAMETER name:<this> type:IntCell flags:
@@ -106,4 +105,3 @@ FILE fqName:<root> fileName:/forWithImplicitReceivers.kt
BLOCK type=kotlin.Unit origin=null
CALL 'println(Int): Unit' type=kotlin.Unit origin=null
message: GET_VAR 'i: Int' type=kotlin.Int origin=null