From 2a3a9bb5fc743f53d73b9a270e07ec9ae1532ddc Mon Sep 17 00:00:00 2001 From: Mikhael Bogdanov Date: Mon, 8 Apr 2019 10:37:00 +0200 Subject: [PATCH] Support properties reificaton --- .../kotlin/backend/jvm/codegen/ExpressionCodegen.kt | 5 +++-- compiler/testData/codegen/boxInline/property/reifiedVal.kt | 1 - compiler/testData/codegen/boxInline/property/reifiedVar.kt | 1 - .../codegen/boxInline/simple/propImportedFromObject.kt | 1 - .../codegen/boxInline/smap/inlineOnly/reifiedProperty.kt | 1 - 5 files changed, 3 insertions(+), 6 deletions(-) diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt index 4331a1afcbf..038ad57d449 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt @@ -5,6 +5,7 @@ package org.jetbrains.kotlin.backend.jvm.codegen +import org.jetbrains.kotlin.backend.common.descriptors.propertyIfAccessor import org.jetbrains.kotlin.backend.jvm.JvmLoweredDeclarationOrigin import org.jetbrains.kotlin.backend.jvm.intrinsics.ComparisonIntrinsic import org.jetbrains.kotlin.backend.jvm.intrinsics.IrIntrinsicFunction @@ -1283,9 +1284,9 @@ class ExpressionCodegen( if (memberAccessExpression.typeArgumentsCount == 0) { //avoid ambiguity with type constructor type parameters emptyMap() - } else descriptor.original.typeParameters.keysToMap { + } else (descriptor.propertyIfAccessor as? CallableDescriptor)?.original?.typeParameters?.keysToMap { memberAccessExpression.getTypeArgumentOrDefault(it) - } + } ?: emptyMap() val mappings = TypeParameterMappings() for (entry in typeArguments.entries) { diff --git a/compiler/testData/codegen/boxInline/property/reifiedVal.kt b/compiler/testData/codegen/boxInline/property/reifiedVal.kt index c7f8f5d2d37..f88d11b18fc 100644 --- a/compiler/testData/codegen/boxInline/property/reifiedVal.kt +++ b/compiler/testData/codegen/boxInline/property/reifiedVal.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JVM_IR // WITH_RUNTIME // WITH_REFLECT // FILE: 1.kt diff --git a/compiler/testData/codegen/boxInline/property/reifiedVar.kt b/compiler/testData/codegen/boxInline/property/reifiedVar.kt index 685b30a0e6b..ace575f220f 100644 --- a/compiler/testData/codegen/boxInline/property/reifiedVar.kt +++ b/compiler/testData/codegen/boxInline/property/reifiedVar.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JVM_IR // WITH_RUNTIME // WITH_REFLECT // FILE: 1.kt diff --git a/compiler/testData/codegen/boxInline/simple/propImportedFromObject.kt b/compiler/testData/codegen/boxInline/simple/propImportedFromObject.kt index 8ec8e91e26a..4b3a0969de9 100644 --- a/compiler/testData/codegen/boxInline/simple/propImportedFromObject.kt +++ b/compiler/testData/codegen/boxInline/simple/propImportedFromObject.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JVM_IR // TARGET_BACKEND: JVM // WITH_RUNTIME // FILE: 1.kt diff --git a/compiler/testData/codegen/boxInline/smap/inlineOnly/reifiedProperty.kt b/compiler/testData/codegen/boxInline/smap/inlineOnly/reifiedProperty.kt index 27fcfd54831..178ba494622 100644 --- a/compiler/testData/codegen/boxInline/smap/inlineOnly/reifiedProperty.kt +++ b/compiler/testData/codegen/boxInline/smap/inlineOnly/reifiedProperty.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JVM_IR // TARGET_BACKEND: JVM // FILE: 1.kt // WITH_REFLECT