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) {
val thisOrigin = IrDeclarationOrigin.DEFINED
val thisType = containingClass.thisReceiver!!.type
val descriptor = WrappedValueParameterDescriptor()
dispatchReceiverParameter = symbolTable.declareValueParameter(
startOffset, endOffset, thisOrigin, WrappedValueParameterDescriptor(),
startOffset, endOffset, thisOrigin, descriptor,
thisType
) { symbol ->
IrValueParameterImpl(
@@ -318,7 +319,7 @@ class Fir2IrVisitor(
Name.special("<this>"), -1, thisType,
varargElementType = null, isCrossinline = false, isNoinline = false
).setParentByParentStack()
}
}.also { descriptor.bind(it) }
}
private fun <T : IrFunction> T.setFunctionContent(
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// FILE: 1.kt
class Test: Impl(), CProvider
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class JsonObject() {
}
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class X {
operator fun get(name: String, type: String = "none") = name + type
}
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// IGNORE_BACKEND: JVM
// See KT-15971
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
interface I {
fun foo(x: Int = 23): String
}
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// WITH_RUNTIME
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
open abstract class B {
fun foo(arg: Int = 239 + 1) : Int = arg
}
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// JVM_TARGET: 1.8
@@ -1,5 +1,4 @@
// !JVM_DEFAULT_MODE: compatibility
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// FILE: Simple.java
@@ -1,5 +1,4 @@
// !JVM_DEFAULT_MODE: compatibility
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// FILE: Simple.java
@@ -1,5 +1,4 @@
// !JVM_DEFAULT_MODE: enable
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// JVM_TARGET: 1.8
// WITH_RUNTIME
@@ -1,5 +1,4 @@
// !JVM_DEFAULT_MODE: enable
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// JVM_TARGET: 1.8
// WITH_RUNTIME
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// SKIP_JDK6
// TARGET_BACKEND: JVM
// FILE: Simple.java
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// JVM_TARGET: 1.8
interface KCallable {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// JVM_TARGET: 1.8
interface KCallable {
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// JVM_TARGET: 1.8
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// JVM_TARGET: 1.8
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// WITH_RUNTIME
@@ -1,6 +1,4 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// WITH_RUNTIME
// FILE: 1.kt
-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
public object Globals{
operator fun get(key: String, remove: Boolean = true): String {
return "OK"
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// FILE: ExtendsKCWithT.java
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
interface A {
val str: String
get() = "OK"
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// FILE: MyInt.java
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
//KT-2206
interface A {
fun f():Int = 239
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
interface I {
fun foo(): String = "foo"