[FIR] Support imported callable from object properly #KT-35730 Fixed

This commit is contained in:
Mikhail Glukhikh
2020-07-08 12:21:51 +03:00
parent 6b964cb61d
commit fbbf4e06ba
15 changed files with 218 additions and 28 deletions
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// MODULE: lib
// FILE: lib.kt
package test
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
import C.f
import C.p
import C.ext
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
import Class.C.f
import Class.C.p
import Class.C.ext
+48
View File
@@ -0,0 +1,48 @@
FILE fqName:<root> fileName:/kt35730.kt
CLASS INTERFACE name:Base modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Base
FUN name:foo visibility:public modality:OPEN <> ($this:<root>.Base) returnType:kotlin.Unit
$this: VALUE_PARAMETER name:<this> type:<root>.Base
BLOCK_BODY
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS OBJECT name:Derived modality:FINAL visibility:public superTypes:[<root>.Base]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Derived
CONSTRUCTOR visibility:private <> () returnType:<root>.Derived [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name:Derived modality:FINAL visibility:public superTypes:[<root>.Base]'
FUN FAKE_OVERRIDE name:foo visibility:public modality:OPEN <> ($this:<root>.Base) returnType:kotlin.Unit [fake_override]
overridden:
public open fun foo (): kotlin.Unit declared in <root>.Base
$this: VALUE_PARAMETER name:<this> type:<root>.Base
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN name:test visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
CALL 'public open fun foo (): kotlin.Unit declared in <root>.Base' type=kotlin.Unit origin=null
$this: GET_OBJECT 'CLASS OBJECT name:Derived modality:FINAL visibility:public superTypes:[<root>.Base]' type=<root>.Derived
CALL 'public open fun foo (): kotlin.Unit declared in <root>.Base' type=kotlin.Unit origin=null
$this: GET_OBJECT 'CLASS OBJECT name:Derived modality:FINAL visibility:public superTypes:[<root>.Base]' type=<root>.Derived
+10
View File
@@ -0,0 +1,10 @@
import Derived.foo
interface Base {
fun foo() {}
}
object Derived : Base
fun test() {
// Both calls resolved to Base.foo()
foo()
Derived.foo()
}
+48
View File
@@ -0,0 +1,48 @@
FILE fqName:<root> fileName:/kt35730.kt
CLASS INTERFACE name:Base modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Base
FUN name:foo visibility:public modality:OPEN <> ($this:<root>.Base) returnType:kotlin.Unit
$this: VALUE_PARAMETER name:<this> type:<root>.Base
BLOCK_BODY
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS OBJECT name:Derived modality:FINAL visibility:public superTypes:[<root>.Base]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Derived
CONSTRUCTOR visibility:private <> () returnType:<root>.Derived [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name:Derived modality:FINAL visibility:public superTypes:[<root>.Base]'
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in <root>.Base
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:foo visibility:public modality:OPEN <> ($this:<root>.Base) returnType:kotlin.Unit [fake_override]
overridden:
public open fun foo (): kotlin.Unit declared in <root>.Base
$this: VALUE_PARAMETER name:<this> type:<root>.Base
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int [fake_override] declared in <root>.Base
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String [fake_override] declared in <root>.Base
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN name:test visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
CALL 'public open fun foo (): kotlin.Unit [fake_override] declared in <root>.Derived' type=kotlin.Unit origin=null
$this: GET_OBJECT 'CLASS OBJECT name:Derived modality:FINAL visibility:public superTypes:[<root>.Base]' type=<root>.Derived
CALL 'public open fun foo (): kotlin.Unit [fake_override] declared in <root>.Derived' type=kotlin.Unit origin=null
$this: GET_OBJECT 'CLASS OBJECT name:Derived modality:FINAL visibility:public superTypes:[<root>.Base]' type=<root>.Derived
@@ -255,7 +255,7 @@ FILE fqName:<root> fileName:/useImportedMember.kt
$this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ
arg0: CALL 'public final fun <get-fromClass> <T> (): T of <root>.BaseClass.<get-fromClass> declared in <root>.BaseClass' type=kotlin.String origin=GET_PROPERTY
<T>: kotlin.String
$this: CONST String type=kotlin.String value="10"
$this: GET_OBJECT 'CLASS OBJECT name:C modality:FINAL visibility:public superTypes:[<root>.BaseClass; <root>.I<kotlin.String>]' type=<root>.C
$receiver: CONST String type=kotlin.String value="10"
arg1: CONST String type=kotlin.String value="10"
then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in <root>'