[FIR] Support constant unary operators for integer literal operators

^KT-38895
This commit is contained in:
Dmitriy Novozhilov
2022-02-04 11:06:27 +03:00
committed by teamcity
parent 52b72a7dac
commit 1591518cf6
14 changed files with 116 additions and 20 deletions
@@ -0,0 +1,31 @@
FILE: constantUnaryOperators.kt
public final val i1: R|kotlin/Int| = Int(2).R|kotlin/Int.plus|(Int(2).R|kotlin/Int.times|(Int(3))).R|kotlin/Int.inv|()
public get(): R|kotlin/Int|
public final val l1: R|kotlin/Long| = Int(2).R|kotlin/Int.plus|(Int(2).R|kotlin/Int.times|(Int(3))).R|kotlin/Int.inv|().R|kotlin/Int.toLong|()
public get(): R|kotlin/Long|
public final val ll1: R|kotlin/Long| = Long(3000000000).R|kotlin/Long.times|(Int(2)).R|kotlin/Long.plus|(Int(1)).R|kotlin/Long.inv|()
public get(): R|kotlin/Long|
public final val i2: R|kotlin/Int| = Int(2).R|kotlin/Int.plus|(Int(2).R|kotlin/Int.times|(Int(3))).R|kotlin/Int.unaryPlus|()
public get(): R|kotlin/Int|
public final val l2: R|kotlin/Long| = Int(2).R|kotlin/Int.plus|(Int(2).R|kotlin/Int.times|(Int(3))).R|kotlin/Int.unaryPlus|().R|kotlin/Int.toLong|()
public get(): R|kotlin/Long|
public final val ll2: R|kotlin/Long| = Long(3000000000).R|kotlin/Long.times|(Int(2)).R|kotlin/Long.plus|(Int(1)).R|kotlin/Long.unaryPlus|()
public get(): R|kotlin/Long|
public final val i3: R|kotlin/Int| = Int(2).R|kotlin/Int.plus|(Int(2).R|kotlin/Int.times|(Int(3))).R|kotlin/Int.unaryMinus|()
public get(): R|kotlin/Int|
public final val l3: R|kotlin/Long| = Int(2).R|kotlin/Int.plus|(Int(2).R|kotlin/Int.times|(Int(3))).R|kotlin/Int.unaryMinus|().R|kotlin/Int.toLong|()
public get(): R|kotlin/Long|
public final val ll3: R|kotlin/Long| = Long(3000000000).R|kotlin/Long.times|(Int(2)).R|kotlin/Long.plus|(Int(1)).R|kotlin/Long.unaryMinus|()
public get(): R|kotlin/Long|
public final val i4: R|kotlin/Int| = Int(2).R|kotlin/Int.plus|(Int(2).R|kotlin/Int.times|(Int(3))).R|kotlin/Int.inc|()
public get(): R|kotlin/Int|
public final val l4: R|kotlin/Long| = Int(2).R|kotlin/Int.plus|(Int(2).R|kotlin/Int.times|(Int(3))).<CS errors: kotlin/Int.inc>#()
public get(): R|kotlin/Long|
public final val ll4: R|kotlin/Long| = Long(3000000000).R|kotlin/Long.times|(Int(2)).R|kotlin/Long.plus|(Int(1)).R|kotlin/Long.inc|()
public get(): R|kotlin/Long|
public final val i5: R|kotlin/Int| = Int(2).R|kotlin/Int.plus|(Int(2).R|kotlin/Int.times|(Int(3))).R|kotlin/Int.dec|()
public get(): R|kotlin/Int|
public final val l5: R|kotlin/Long| = Int(2).R|kotlin/Int.plus|(Int(2).R|kotlin/Int.times|(Int(3))).<CS errors: kotlin/Int.dec>#()
public get(): R|kotlin/Long|
public final val ll5: R|kotlin/Long| = Long(3000000000).R|kotlin/Long.times|(Int(2)).R|kotlin/Long.plus|(Int(1)).R|kotlin/Long.dec|()
public get(): R|kotlin/Long|
@@ -0,0 +1,27 @@
// FIR_IDENTICAL
// SKIP_TXT
// FIR_DUMP
// ------------- const -------------
val i1 = (2 + 2 * 3).inv()
val l1: Long = (2 + 2 * 3).inv()
val ll1 = (3000000000 * 2 + 1).inv()
val i2 = (2 + 2 * 3).unaryPlus()
val l2: Long = (2 + 2 * 3).unaryPlus()
val ll2 = (3000000000 * 2 + 1).unaryPlus()
val i3 = (2 + 2 * 3).unaryMinus()
val l3: Long = (2 + 2 * 3).unaryMinus()
val ll3 = (3000000000 * 2 + 1).unaryMinus()
// ------------- non const -------------
val i4 = (2 + 2 * 3).inc()
val l4: Long = <!TYPE_MISMATCH!>(2 + 2 * 3).inc()<!>
val ll4 = (3000000000 * 2 + 1).inc()
val i5 = (2 + 2 * 3).dec()
val l5: Long = <!TYPE_MISMATCH!>(2 + 2 * 3).dec()<!>
val ll5 = (3000000000 * 2 + 1).dec()