KT-16671 Calls to members imported from objects should be desugared in PSI2IR

This commit is contained in:
Dmitry Petrov
2017-03-06 17:41:56 +03:00
parent 4ba8268a29
commit 6bc6c1b6cc
8 changed files with 143 additions and 17 deletions
@@ -0,0 +1,16 @@
import A.foo
import A.bar
import A.fooExt
import A.barExt
object A {
fun foo() = 1
fun Int.fooExt() = 2
val bar = 42
val Int.barExt get() = 43
}
val test1 = foo()
val test2 = bar
val test3 = 1.fooExt()
val test4 = 1.barExt
@@ -0,0 +1,66 @@
FILE /membersImportedFromObject.kt
CLASS OBJECT A
CONSTRUCTOR private constructor A()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'constructor Any()'
INSTANCE_INITIALIZER_CALL classDescriptor='A'
FUN public final fun foo(): kotlin.Int
BLOCK_BODY
RETURN type=kotlin.Nothing from='foo(): Int'
CONST Int type=kotlin.Int value='1'
FUN public final fun kotlin.Int.fooExt(): kotlin.Int
BLOCK_BODY
RETURN type=kotlin.Nothing from='fooExt() on Int: Int'
CONST Int type=kotlin.Int value='2'
PROPERTY public final val bar: kotlin.Int = 42
FIELD PROPERTY_BACKING_FIELD public final val bar: kotlin.Int = 42
EXPRESSION_BODY
CONST Int type=kotlin.Int value='42'
FUN DEFAULT_PROPERTY_ACCESSOR public final fun <get-bar>(): kotlin.Int
BLOCK_BODY
RETURN type=kotlin.Nothing from='<get-bar>(): Int'
GET_FIELD 'bar: Int' type=kotlin.Int origin=null
receiver: GET_VAR '<receiver: A>' type=A origin=null
PROPERTY public final val kotlin.Int.barExt: kotlin.Int
FUN public final fun kotlin.Int.<get-barExt>(): kotlin.Int
BLOCK_BODY
RETURN type=kotlin.Nothing from='<get-barExt>() on Int: Int'
CONST Int type=kotlin.Int value='43'
PROPERTY public val test1: kotlin.Int
FIELD PROPERTY_BACKING_FIELD public val test1: kotlin.Int
EXPRESSION_BODY
CALL 'foo(): Int' type=kotlin.Int origin=null
$this: GET_OBJECT 'A' type=A
FUN DEFAULT_PROPERTY_ACCESSOR public fun <get-test1>(): kotlin.Int
BLOCK_BODY
RETURN type=kotlin.Nothing from='<get-test1>(): Int'
GET_FIELD 'test1: Int' type=kotlin.Int origin=null
PROPERTY public val test2: kotlin.Int = 42
FIELD PROPERTY_BACKING_FIELD public val test2: kotlin.Int = 42
EXPRESSION_BODY
CALL '<get-bar>(): Int' type=kotlin.Int origin=GET_PROPERTY
$this: GET_OBJECT 'A' type=A
FUN DEFAULT_PROPERTY_ACCESSOR public fun <get-test2>(): kotlin.Int
BLOCK_BODY
RETURN type=kotlin.Nothing from='<get-test2>(): Int'
GET_FIELD 'test2: Int' type=kotlin.Int origin=null
PROPERTY public val test3: kotlin.Int
FIELD PROPERTY_BACKING_FIELD public val test3: kotlin.Int
EXPRESSION_BODY
CALL 'fooExt() on Int: Int' type=kotlin.Int origin=null
$this: GET_OBJECT 'A' type=A
$receiver: CONST Int type=kotlin.Int value='1'
FUN DEFAULT_PROPERTY_ACCESSOR public fun <get-test3>(): kotlin.Int
BLOCK_BODY
RETURN type=kotlin.Nothing from='<get-test3>(): Int'
GET_FIELD 'test3: Int' type=kotlin.Int origin=null
PROPERTY public val test4: kotlin.Int
FIELD PROPERTY_BACKING_FIELD public val test4: kotlin.Int
EXPRESSION_BODY
CALL '<get-barExt>() on Int: Int' type=kotlin.Int origin=GET_PROPERTY
$this: GET_OBJECT 'A' type=A
$receiver: CONST Int type=kotlin.Int value='1'
FUN DEFAULT_PROPERTY_ACCESSOR public fun <get-test4>(): kotlin.Int
BLOCK_BODY
RETURN type=kotlin.Nothing from='<get-test4>(): Int'
GET_FIELD 'test4: Int' type=kotlin.Int origin=null