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
@@ -119,10 +119,9 @@ FILE fqName:<root> fileName:/breakContinueInLoopHeader.kt
GET_VAR 'j: Int' type=kotlin.Int origin=PREFIX_INCR
condition: WHEN type=kotlin.Boolean origin=null
BRANCH
if: CALL 'GTEQ0(Int): Boolean' type=kotlin.Boolean origin=GTEQ
arg0: CALL 'compareTo(Int): Int' type=kotlin.Int origin=GTEQ
$this: GET_VAR 'j: Int' type=kotlin.Int origin=null
other: CONST Int type=kotlin.Int value=3
if: CALL 'greaterOrEqual(Int, Int): Boolean' type=kotlin.Boolean origin=GTEQ
arg0: GET_VAR 'j: Int' type=kotlin.Int origin=null
arg1: CONST Int type=kotlin.Int value=3
then: CONST Boolean type=kotlin.Boolean value=false
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
@@ -133,4 +132,3 @@ FILE fqName:<root> fileName:/breakContinueInLoopHeader.kt
arg0: GET_VAR 'i: Int' type=kotlin.Int origin=null
arg1: CONST Int type=kotlin.Int value=3
then: BREAK label=null loop.label=Outer