[FIR] Support IntegerLiteralTypes

This commit is contained in:
Dmitriy Novozhilov
2019-12-09 15:02:55 +03:00
parent 5577f0f8cb
commit b76c984b26
145 changed files with 1815 additions and 585 deletions
@@ -1,3 +1,4 @@
// IGNORE_BACKEND_FIR: JVM_IR
fun box() : String {
val s = "notA"
val id = when (s) {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// WITH_RUNTIME
fun box(): String {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// WITH_RUNTIME
fun box(): String {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
fun foo(x: Long, y: Int, z: Double, s: String) {}
fun box(): String {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// IGNORE_BACKEND: JS_IR
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TODO: muted automatically, investigate should it be ran for JS or not
// DONT_RUN_GENERATED_CODE: JS
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// FULL_JDK
@@ -1,5 +1,5 @@
// !LANGUAGE: +ProperIeee754Comparisons +NewInference
// IGNORE_BACKEND_FIR: JVM_IR
// !LANGUAGE: +ProperIeee754Comparisons +NewInference
fun box(): String {
if (-0.0 < 0.0) return "Fail 1"
@@ -1,4 +1,4 @@
// IGNORE_BACKEND_FIR: JVM_IR
class A {
class B1
class B2(val x: Int)
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class CInt(val value: Int)
val nCInt3: CInt? = CInt(3)
@@ -1,4 +1,5 @@
// IGNORE_BACKEND_FIR: JVM_IR
fun box(): String {
if (1 >= 1.9) return "Fail #1"
if (1.compareTo(1.1) >= 0) return "Fail #2"
+1 -1
View File
@@ -1,4 +1,4 @@
// IGNORE_BACKEND_FIR: JVM_IR
fun f(x: Long, zzz: Long = 1): Long
{
return if (x <= 1) zzz
@@ -1,3 +1,4 @@
// IGNORE_BACKEND_FIR: JVM_IR
fun foo(x: Int) = x
fun bar(x: Comparable<Int>) = if (x is Int) foo(x) else 0
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
fun box(): String {
lateinit var ok: String
run {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
lateinit var ok: String
fun box(): String {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
fun abs(x: Int) = if (x < 0) -x else x
fun abs(x: Long) = if (x < 0) -x else x
+1
View File
@@ -1,3 +1,4 @@
// IGNORE_BACKEND_FIR: JVM_IR
// IGNORE_BACKEND: JS_IR
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// WITH_RUNTIME
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// WITH_RUNTIME
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// WITH_RUNTIME
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// WITH_RUNTIME
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// WITH_RUNTIME
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class LongR {
operator fun contains(l : Long): Boolean = l == 5.toLong()
}
@@ -1,11 +1,12 @@
FILE fqName:<root> fileName:/genericConstructorCallWithTypeArguments.kt
FUN name:testSimple visibility:public modality:FINAL <> () returnType:IrErrorType
FUN name:testSimple visibility:public modality:FINAL <> () returnType:<root>.Box<kotlin.Long>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun testSimple (): IrErrorType declared in <root>'
ERROR_CALL 'Unresolved reference: <Inapplicable(INAPPLICABLE): [/Box.Box]>#' type=IrErrorType
CALL 'public final fun times (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null
$this: CONST Int type=kotlin.Int value=2
other: CONST Int type=kotlin.Int value=3
RETURN type=kotlin.Nothing from='public final fun testSimple (): <root>.Box<kotlin.Long> declared in <root>'
CONSTRUCTOR_CALL 'public constructor <init> (value: T of <root>.Box) [primary] declared in <root>.Box' type=<root>.Box<kotlin.Long> origin=null
<class: T>: kotlin.Long
value: CALL 'public final fun times (other: kotlin.Long): kotlin.Long [operator] declared in kotlin.Long' type=kotlin.Long origin=null
$this: CONST Long type=kotlin.Long value=2
other: CONST Long type=kotlin.Long value=3
FUN name:testArray visibility:public modality:FINAL <T> (n:kotlin.Int, block:kotlin.Function0<T of <root>.testArray>) returnType:kotlin.Array<T of <root>.testArray> [inline]
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
VALUE_PARAMETER name:n index:0 type:kotlin.Int
+3 -3
View File
@@ -123,7 +123,7 @@ FILE fqName:<root> fileName:/literals.kt
PROPERTY name:testB visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:testB type:kotlin.Byte visibility:private [final,static]
EXPRESSION_BODY
CONST Int type=kotlin.Int value=1
CONST Byte type=kotlin.Byte value=1
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-testB> visibility:public modality:FINAL <> () returnType:kotlin.Byte
correspondingProperty: PROPERTY name:testB visibility:public modality:FINAL [val]
BLOCK_BODY
@@ -132,7 +132,7 @@ FILE fqName:<root> fileName:/literals.kt
PROPERTY name:testS visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:testS type:kotlin.Short visibility:private [final,static]
EXPRESSION_BODY
CONST Int type=kotlin.Int value=1
CONST Short type=kotlin.Short value=1
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-testS> visibility:public modality:FINAL <> () returnType:kotlin.Short
correspondingProperty: PROPERTY name:testS visibility:public modality:FINAL [val]
BLOCK_BODY
@@ -150,7 +150,7 @@ FILE fqName:<root> fileName:/literals.kt
PROPERTY name:testL visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:testL type:kotlin.Long visibility:private [final,static]
EXPRESSION_BODY
CONST Int type=kotlin.Int value=1
CONST Long type=kotlin.Long value=1
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-testL> visibility:public modality:FINAL <> () returnType:kotlin.Long
correspondingProperty: PROPERTY name:testL visibility:public modality:FINAL [val]
BLOCK_BODY
@@ -2,7 +2,7 @@ FILE fqName:<root> fileName:/primitivesImplicitConversions.kt
PROPERTY name:test1 visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:test1 type:kotlin.Long visibility:private [final,static]
EXPRESSION_BODY
CONST Int type=kotlin.Int value=42
CONST Long type=kotlin.Long value=42
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-test1> visibility:public modality:FINAL <> () returnType:kotlin.Long
correspondingProperty: PROPERTY name:test1 visibility:public modality:FINAL [val]
BLOCK_BODY
@@ -11,7 +11,7 @@ FILE fqName:<root> fileName:/primitivesImplicitConversions.kt
PROPERTY name:test2 visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:test2 type:kotlin.Short visibility:private [final,static]
EXPRESSION_BODY
CONST Int type=kotlin.Int value=42
CONST Short type=kotlin.Short value=42
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-test2> visibility:public modality:FINAL <> () returnType:kotlin.Short
correspondingProperty: PROPERTY name:test2 visibility:public modality:FINAL [val]
BLOCK_BODY
@@ -20,7 +20,7 @@ FILE fqName:<root> fileName:/primitivesImplicitConversions.kt
PROPERTY name:test3 visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:test3 type:kotlin.Byte visibility:private [final,static]
EXPRESSION_BODY
CONST Int type=kotlin.Int value=42
CONST Byte type=kotlin.Byte value=42
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-test3> visibility:public modality:FINAL <> () returnType:kotlin.Byte
correspondingProperty: PROPERTY name:test3 visibility:public modality:FINAL [val]
BLOCK_BODY
@@ -61,7 +61,7 @@ FILE fqName:<root> fileName:/primitivesImplicitConversions.kt
VAR name:test1 type:kotlin.Int? [val]
CONST Int type=kotlin.Int value=42
VAR name:test2 type:kotlin.Long [val]
CONST Int type=kotlin.Int value=42
CONST Long type=kotlin.Long value=42
VAR name:test3 type:kotlin.Long? [val]
CONST Int type=kotlin.Int value=42
VAR name:test4 type:kotlin.Long? [val]
@@ -6,10 +6,10 @@ FILE fqName:<root> fileName:/whenUnusedExpression.kt
WHEN type=kotlin.Int? origin=IF
BRANCH
if: GET_VAR 'b: kotlin.Boolean declared in <root>.test' type=kotlin.Boolean origin=null
then: BLOCK type=kotlin.Int? origin=WHEN
then: BLOCK type=kotlin.Int origin=WHEN
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.Int [val]
GET_VAR 'i: kotlin.Int declared in <root>.test' type=kotlin.Int origin=null
WHEN type=kotlin.Int? origin=WHEN
WHEN type=kotlin.Int origin=WHEN
BRANCH
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'val tmp_0: kotlin.Int [val] declared in <root>.test' type=kotlin.Int origin=null
@@ -88,22 +88,22 @@ FILE fqName:<root> fileName:/multipleImplicitReceivers.kt
<T>: <root>.A
<R>: kotlin.Int
receiver: GET_OBJECT 'CLASS OBJECT name:A modality:FINAL visibility:public superTypes:[kotlin.Any]' type=<root>.A
block: FUN_EXPR type=kotlin.Function1<<root>.A, kotlin.Unit> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.Unit
block: FUN_EXPR type=kotlin.Function1<<root>.A, kotlin.Int> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.Int
BLOCK_BODY
CALL 'public final fun with <T, R> (receiver: T of kotlin.with, block: kotlin.Function1<T of kotlin.with, R of kotlin.with>): R of kotlin.with [inline] declared in kotlin' type=kotlin.Int origin=null
<T>: <root>.IFoo
<R>: kotlin.Int
receiver: GET_VAR 'fooImpl: <root>.IFoo declared in <root>.test' type=<root>.IFoo origin=null
block: FUN_EXPR type=kotlin.Function1<<root>.IFoo, kotlin.Unit> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.Unit
block: FUN_EXPR type=kotlin.Function1<<root>.IFoo, kotlin.Int> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.Int
BLOCK_BODY
CALL 'public final fun with <T, R> (receiver: T of kotlin.with, block: kotlin.Function1<T of kotlin.with, R of kotlin.with>): R of kotlin.with [inline] declared in kotlin' type=kotlin.Int origin=null
<T>: <root>.IInvoke
<R>: kotlin.Int
receiver: GET_VAR 'invokeImpl: <root>.IInvoke declared in <root>.test' type=<root>.IInvoke origin=null
block: FUN_EXPR type=kotlin.Function1<<root>.IInvoke, kotlin.Unit> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.Unit
block: FUN_EXPR type=kotlin.Function1<<root>.IInvoke, kotlin.Int> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.Int
BLOCK_BODY
CALL 'public open fun invoke (): kotlin.Int [operator] declared in <root>.IInvoke' type=kotlin.Int origin=null
$this: GET_VAR '<this>: <root>.IInvoke declared in <root>.IInvoke' type=<root>.IInvoke origin=null