- smart casts handling separated from expression generation
- improved infrastructure for desugaring
This commit is contained in:
Dmitry Petrov
2016-08-16 15:43:23 +03:00
committed by Dmitry Petrov
parent ecf6ab9e25
commit 0a57eb8ea4
21 changed files with 363 additions and 215 deletions
+6
View File
@@ -0,0 +1,6 @@
// <<< augmentedAssignment1.txt
fun test(): Int {
var x = 0
x += 10
return x
}
+12
View File
@@ -0,0 +1,12 @@
IrFile /augmentedAssignment1.kt
IrFunction public fun test(): kotlin.Int
IrExpressionBody
BLOCK type=<no-type> hasResult=false isDesugared=false
VAR var x: kotlin.Int
LITERAL Int type=kotlin.Int value='0'
SET_VAR x type=<no-type>
CALL .plus type=kotlin.Int operator=PLUSEQ
$this: GET_VAR x type=kotlin.Int
other: LITERAL Int type=kotlin.Int value='10'
RETURN type=<no-type>
GET_VAR x type=kotlin.Int
+8
View File
@@ -0,0 +1,8 @@
class A
operator fun A.plusAssign(s: String) {}
fun test() { // <<< augmentedAssignment2.txt
val a = A()
a += ""
}
+8
View File
@@ -0,0 +1,8 @@
IrFunction public fun test(): kotlin.Unit
IrExpressionBody
BLOCK type=<no-type> hasResult=false isDesugared=false
VAR val a: A
CALL .<init> type=A operator=
CALL .plusAssign type=kotlin.Unit operator=PLUSEQ
$receiver: GET_VAR a type=A
s: ? IrStringConcatenationExpressionImpl type=kotlin.String
+1 -1
View File
@@ -10,5 +10,5 @@ IrFile /dotQualified.kt
BLOCK type=<no-type> hasResult=false isDesugared=true
RETURN type=<no-type>
GET_PROPERTY ?.length type=kotlin.Int?
$this: TYPE_OP operator=SMART_AS typeOperand=kotlin.String
$this: TYPE_OP operator=IMPLICIT_CAST typeOperand=kotlin.String
GET_VAR s type=kotlin.String?
+6 -6
View File
@@ -21,18 +21,18 @@ IrFile /smartCasts.kt
DUMMY KtIfExpression type=kotlin.Unit
CALL .println type=kotlin.Unit operator=
message: GET_PROPERTY .length type=kotlin.Int
$this: TYPE_OP operator=SMART_AS typeOperand=kotlin.String
$this: TYPE_OP operator=IMPLICIT_CAST typeOperand=kotlin.String
GET_VAR x type=kotlin.Any
CALL .expectsString type=kotlin.Unit operator=
s: TYPE_OP operator=SMART_AS typeOperand=kotlin.String
s: TYPE_OP operator=IMPLICIT_CAST typeOperand=kotlin.String
GET_VAR x type=kotlin.Any
CALL .expectsInt type=kotlin.Unit operator=
i: GET_PROPERTY .length type=kotlin.Int
$this: TYPE_OP operator=SMART_AS typeOperand=kotlin.String
$this: TYPE_OP operator=IMPLICIT_CAST typeOperand=kotlin.String
GET_VAR x type=kotlin.Any
CALL .expectsString type=kotlin.Unit operator=
s: CALL .overloaded type=kotlin.String operator=
s: TYPE_OP operator=SMART_AS typeOperand=kotlin.String
s: TYPE_OP operator=IMPLICIT_CAST typeOperand=kotlin.String
GET_VAR x type=kotlin.Any
IrFunction public fun test2(/*0*/ x: kotlin.Any): kotlin.String
IrExpressionBody
@@ -40,12 +40,12 @@ IrFile /smartCasts.kt
DUMMY KtIfExpression type=kotlin.Unit
RETURN type=<no-type>
CALL .overloaded type=kotlin.String operator=
s: TYPE_OP operator=SMART_AS typeOperand=kotlin.String
s: TYPE_OP operator=IMPLICIT_CAST typeOperand=kotlin.String
GET_VAR x type=kotlin.Any
IrFunction public fun test3(/*0*/ x: kotlin.Any): kotlin.String
IrExpressionBody
BLOCK type=<no-type> hasResult=false isDesugared=false
DUMMY KtIfExpression type=kotlin.Unit
RETURN type=<no-type>
TYPE_OP operator=SMART_AS typeOperand=kotlin.String
TYPE_OP operator=IMPLICIT_CAST typeOperand=kotlin.String
GET_VAR x type=kotlin.Any
@@ -22,5 +22,5 @@ IrFile /smartCastsWithDestructuring.kt
$receiver: GET_VAR tmp0 type=I1
VAR val c2: kotlin.String
CALL .component2 type=kotlin.String operator=COMPONENT_N(index=2)
$receiver: TYPE_OP operator=SMART_AS typeOperand=I2
$receiver: TYPE_OP operator=IMPLICIT_CAST typeOperand=I2
GET_VAR tmp0 type=I1