FIR: Add bindings for dispatch receiver parameters

Before this commit, such descriptors have null owners, which causes problems when the getter of the owner property is called.
This commit is contained in:
Juan Chen
2019-12-26 16:45:14 -08:00
committed by Mikhail Glukhikh
parent a54ef3e427
commit 4c04ad2371
27 changed files with 3 additions and 29 deletions
@@ -309,8 +309,9 @@ class Fir2IrVisitor(
private fun IrFunction.addDispatchReceiverParameter(containingClass: IrClass) { private fun IrFunction.addDispatchReceiverParameter(containingClass: IrClass) {
val thisOrigin = IrDeclarationOrigin.DEFINED val thisOrigin = IrDeclarationOrigin.DEFINED
val thisType = containingClass.thisReceiver!!.type val thisType = containingClass.thisReceiver!!.type
val descriptor = WrappedValueParameterDescriptor()
dispatchReceiverParameter = symbolTable.declareValueParameter( dispatchReceiverParameter = symbolTable.declareValueParameter(
startOffset, endOffset, thisOrigin, WrappedValueParameterDescriptor(), startOffset, endOffset, thisOrigin, descriptor,
thisType thisType
) { symbol -> ) { symbol ->
IrValueParameterImpl( IrValueParameterImpl(
@@ -318,7 +319,7 @@ class Fir2IrVisitor(
Name.special("<this>"), -1, thisType, Name.special("<this>"), -1, thisType,
varargElementType = null, isCrossinline = false, isNoinline = false varargElementType = null, isCrossinline = false, isNoinline = false
).setParentByParentStack() ).setParentByParentStack()
} }.also { descriptor.bind(it) }
} }
private fun <T : IrFunction> T.setFunctionContent( private fun <T : IrFunction> T.setFunctionContent(
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// FILE: 1.kt // FILE: 1.kt
class Test: Impl(), CProvider class Test: Impl(), CProvider
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class JsonObject() { class JsonObject() {
} }
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class X { class X {
operator fun get(name: String, type: String = "none") = name + type operator fun get(name: String, type: String = "none") = name + type
} }
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// IGNORE_BACKEND: JVM // IGNORE_BACKEND: JVM
// See KT-15971 // See KT-15971
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
interface I { interface I {
fun foo(x: Int = 23): String fun foo(x: Int = 23): String
} }
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM // TARGET_BACKEND: JVM
// WITH_RUNTIME // WITH_RUNTIME
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
open abstract class B { open abstract class B {
fun foo(arg: Int = 239 + 1) : Int = arg fun foo(arg: Int = 239 + 1) : Int = arg
} }
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM // TARGET_BACKEND: JVM
// JVM_TARGET: 1.8 // JVM_TARGET: 1.8
@@ -1,5 +1,4 @@
// !JVM_DEFAULT_MODE: compatibility // !JVM_DEFAULT_MODE: compatibility
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM // TARGET_BACKEND: JVM
// FILE: Simple.java // FILE: Simple.java
@@ -1,5 +1,4 @@
// !JVM_DEFAULT_MODE: compatibility // !JVM_DEFAULT_MODE: compatibility
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM // TARGET_BACKEND: JVM
// FILE: Simple.java // FILE: Simple.java
@@ -1,5 +1,4 @@
// !JVM_DEFAULT_MODE: enable // !JVM_DEFAULT_MODE: enable
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM // TARGET_BACKEND: JVM
// JVM_TARGET: 1.8 // JVM_TARGET: 1.8
// WITH_RUNTIME // WITH_RUNTIME
@@ -1,5 +1,4 @@
// !JVM_DEFAULT_MODE: enable // !JVM_DEFAULT_MODE: enable
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM // TARGET_BACKEND: JVM
// JVM_TARGET: 1.8 // JVM_TARGET: 1.8
// WITH_RUNTIME // WITH_RUNTIME
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// SKIP_JDK6 // SKIP_JDK6
// TARGET_BACKEND: JVM // TARGET_BACKEND: JVM
// FILE: Simple.java // FILE: Simple.java
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM // TARGET_BACKEND: JVM
// JVM_TARGET: 1.8 // JVM_TARGET: 1.8
interface KCallable { interface KCallable {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM // TARGET_BACKEND: JVM
// JVM_TARGET: 1.8 // JVM_TARGET: 1.8
interface KCallable { interface KCallable {
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM // TARGET_BACKEND: JVM
// JVM_TARGET: 1.8 // JVM_TARGET: 1.8
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM // TARGET_BACKEND: JVM
// JVM_TARGET: 1.8 // JVM_TARGET: 1.8
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM // TARGET_BACKEND: JVM
// WITH_RUNTIME // WITH_RUNTIME
@@ -1,6 +1,4 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM // TARGET_BACKEND: JVM
// WITH_RUNTIME // WITH_RUNTIME
// FILE: 1.kt // FILE: 1.kt
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM // TARGET_BACKEND: JVM
// WITH_RUNTIME // WITH_RUNTIME
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
public object Globals{ public object Globals{
operator fun get(key: String, remove: Boolean = true): String { operator fun get(key: String, remove: Boolean = true): String {
return "OK" return "OK"
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM // TARGET_BACKEND: JVM
// FILE: ExtendsKCWithT.java // FILE: ExtendsKCWithT.java
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
interface A { interface A {
val str: String val str: String
get() = "OK" get() = "OK"
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM // TARGET_BACKEND: JVM
// FILE: MyInt.java // FILE: MyInt.java
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
//KT-2206 //KT-2206
interface A { interface A {
fun f():Int = 239 fun f():Int = 239
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
interface I { interface I {
fun foo(): String = "foo" fun foo(): String = "foo"