Refactor SAM type handling, replace non-approximated arguments with *
This commit is contained in:
committed by
TeamCityServer
parent
4aeabb6b0f
commit
c77884f067
@@ -5,18 +5,12 @@
|
||||
|
||||
package org.jetbrains.kotlin.backend.common
|
||||
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import org.jetbrains.kotlin.config.LanguageVersionSettings
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.SimpleFunctionDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
|
||||
import org.jetbrains.kotlin.resolve.sam.getAbstractMembers
|
||||
import org.jetbrains.kotlin.types.*
|
||||
import org.jetbrains.kotlin.types.checker.intersectWrappedTypes
|
||||
import org.jetbrains.kotlin.types.typeUtil.builtIns
|
||||
import org.jetbrains.kotlin.types.typeUtil.replaceArgumentsWithNothing
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
|
||||
class SamType constructor(val type: KotlinType, val hasUnapproximatableArguments: Boolean = false) {
|
||||
class SamType constructor(val type: KotlinType) {
|
||||
|
||||
val classDescriptor: ClassDescriptor
|
||||
get() = type.constructor.declarationDescriptor as? ClassDescriptor ?: error("Sam/Fun interface not a class descriptor: $type")
|
||||
@@ -40,82 +34,3 @@ class SamType constructor(val type: KotlinType, val hasUnapproximatableArguments
|
||||
}
|
||||
}
|
||||
|
||||
open class SamTypeFactory {
|
||||
private lateinit var typeApproximator: TypeApproximator
|
||||
|
||||
fun createByValueParameter(valueParameter: ValueParameterDescriptor, languageVersionSettings: LanguageVersionSettings): SamType? {
|
||||
val singleArgumentType: KotlinType
|
||||
val originalSingleArgumentType: KotlinType?
|
||||
val varargElementType = valueParameter.varargElementType
|
||||
if (varargElementType != null) {
|
||||
singleArgumentType = varargElementType
|
||||
originalSingleArgumentType = valueParameter.original.varargElementType
|
||||
assert(originalSingleArgumentType != null) {
|
||||
"Value parameter and original value parameter have inconsistent varargs: " +
|
||||
valueParameter + "; " + valueParameter.original
|
||||
}
|
||||
} else {
|
||||
singleArgumentType = valueParameter.type
|
||||
originalSingleArgumentType = valueParameter.original.type
|
||||
}
|
||||
if (singleArgumentType.isError || originalSingleArgumentType!!.isError) {
|
||||
return null
|
||||
}
|
||||
|
||||
if (!::typeApproximator.isInitialized) {
|
||||
typeApproximator = TypeApproximator(singleArgumentType.builtIns, languageVersionSettings)
|
||||
}
|
||||
|
||||
// This can be true in case when the value parameter is in the method of a generic type with out-projection.
|
||||
// We approximate Inv<Captured#1> to Nothing, while Inv itself can be a SAM interface safe to call here
|
||||
// (see testData genericSamProjectedOut.kt for details)
|
||||
// In such a case we can't have a proper supertype since wildcards are not allowed there,
|
||||
// so we use Nothing arguments instead that leads to a raw type used for a SAM wrapper.
|
||||
// See org.jetbrains.kotlin.codegen.state.KotlinTypeMapper#writeGenericType to understand how
|
||||
// raw types and Nothing arguments relate.
|
||||
val originalTypeToUse = if (KotlinBuiltIns.isNothing(singleArgumentType))
|
||||
originalSingleArgumentType.replaceArgumentsWithNothing()
|
||||
else singleArgumentType
|
||||
val approximatedOriginalTypeToUse = typeApproximator.approximateToSubType(
|
||||
originalTypeToUse,
|
||||
TypeApproximatorConfiguration.UpperBoundAwareIntersectionTypeApproximator
|
||||
) ?: originalTypeToUse
|
||||
approximatedOriginalTypeToUse as KotlinType
|
||||
val hasUnapproximatableArguments = hasUnapproximatableArguments(approximatedOriginalTypeToUse)
|
||||
|
||||
return create((approximatedOriginalTypeToUse).removeExternalProjections(), hasUnapproximatableArguments)
|
||||
}
|
||||
|
||||
/*
|
||||
* declaration site: `class Foo<T> where T: X, T: Y {}`, X and Y aren't related by subtyping
|
||||
* use site: Foo<in {X & Y}>
|
||||
* => `in {X & Y}` is unapproximatable type argument
|
||||
*/
|
||||
fun hasUnapproximatableArguments(type: KotlinType) =
|
||||
type.arguments.isNotEmpty() && type.arguments.withIndex().any { (i, argument) ->
|
||||
if (argument.projectionKind != Variance.IN_VARIANCE) return@any false
|
||||
if (argument.type.constructor !is IntersectionTypeConstructor) return@any false
|
||||
val typeParameter = type.constructor.parameters.getOrNull(i) ?: return@any false
|
||||
// we have really intersection type as the result => at least there are two upper bounds which aren't related by subtyping
|
||||
intersectWrappedTypes(typeParameter.upperBounds).constructor is IntersectionTypeConstructor
|
||||
}
|
||||
|
||||
open fun isSamType(type: KotlinType): Boolean {
|
||||
val descriptor = type.constructor.declarationDescriptor
|
||||
return descriptor is ClassDescriptor && descriptor.isFun
|
||||
}
|
||||
|
||||
@JvmOverloads
|
||||
fun create(originalType: KotlinType, hasUnapproximatableArguments: Boolean = false): SamType? {
|
||||
return if (isSamType(originalType)) SamType(originalType, hasUnapproximatableArguments) else null
|
||||
}
|
||||
|
||||
private fun KotlinType.removeExternalProjections(): KotlinType {
|
||||
val newArguments = arguments.map { TypeProjectionImpl(Variance.INVARIANT, it.type) }
|
||||
return replace(newArguments)
|
||||
}
|
||||
|
||||
companion object {
|
||||
val INSTANCE = SamTypeFactory()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.backend.common
|
||||
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import org.jetbrains.kotlin.config.LanguageVersionSettings
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
|
||||
import org.jetbrains.kotlin.types.*
|
||||
import org.jetbrains.kotlin.types.checker.intersectWrappedTypes
|
||||
import org.jetbrains.kotlin.types.typeUtil.replaceArgumentsWithNothing
|
||||
|
||||
class SamTypeApproximator(builtIns: KotlinBuiltIns, languageVersionSettings: LanguageVersionSettings) {
|
||||
private val typeApproximator = TypeApproximator(builtIns, languageVersionSettings)
|
||||
|
||||
fun getSamTypeForValueParameter(valueParameter: ValueParameterDescriptor): KotlinType? {
|
||||
val singleArgumentType: KotlinType
|
||||
val originalSingleArgumentType: KotlinType?
|
||||
val varargElementType = valueParameter.varargElementType
|
||||
if (varargElementType != null) {
|
||||
singleArgumentType = varargElementType
|
||||
originalSingleArgumentType = valueParameter.original.varargElementType
|
||||
assert(originalSingleArgumentType != null) {
|
||||
"Value parameter and original value parameter have inconsistent varargs: " +
|
||||
valueParameter + "; " + valueParameter.original
|
||||
}
|
||||
} else {
|
||||
singleArgumentType = valueParameter.type
|
||||
originalSingleArgumentType = valueParameter.original.type
|
||||
}
|
||||
if (singleArgumentType.isError || originalSingleArgumentType!!.isError) {
|
||||
return null
|
||||
}
|
||||
|
||||
// This can be true in case when the value parameter is in the method of a generic type with out-projection.
|
||||
// We approximate Inv<Captured#1> to Nothing, while Inv itself can be a SAM interface safe to call here
|
||||
// (see testData genericSamProjectedOut.kt for details)
|
||||
// In such a case we can't have a proper supertype since wildcards are not allowed there,
|
||||
// so we use Nothing arguments instead that leads to a raw type used for a SAM wrapper.
|
||||
// See org.jetbrains.kotlin.codegen.state.KotlinTypeMapper#writeGenericType to understand how
|
||||
// raw types and Nothing arguments relate.
|
||||
val originalTypeToUse =
|
||||
if (KotlinBuiltIns.isNothing(singleArgumentType))
|
||||
originalSingleArgumentType.replaceArgumentsWithNothing()
|
||||
else
|
||||
singleArgumentType
|
||||
val approximatedOriginalTypeToUse =
|
||||
typeApproximator.approximateToSubType(
|
||||
originalTypeToUse,
|
||||
TypeApproximatorConfiguration.UpperBoundAwareIntersectionTypeApproximator
|
||||
) ?: originalTypeToUse
|
||||
approximatedOriginalTypeToUse as KotlinType
|
||||
|
||||
return approximatedOriginalTypeToUse.removeExternalProjections()
|
||||
}
|
||||
|
||||
private fun KotlinType.removeExternalProjections(): KotlinType {
|
||||
val newArguments = arguments.map { TypeProjectionImpl(Variance.INVARIANT, it.type) }
|
||||
return replace(newArguments)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
open class SamTypeFactory {
|
||||
open fun isSamType(type: KotlinType): Boolean {
|
||||
val descriptor = type.constructor.declarationDescriptor
|
||||
return descriptor is ClassDescriptor && descriptor.isFun
|
||||
}
|
||||
|
||||
fun create(originalType: KotlinType): SamType? {
|
||||
return if (isSamType(originalType)) SamType(originalType) else null
|
||||
}
|
||||
}
|
||||
@@ -5,10 +5,11 @@
|
||||
|
||||
package org.jetbrains.kotlin.codegen
|
||||
|
||||
import org.jetbrains.kotlin.backend.common.SamTypeFactory
|
||||
import org.jetbrains.kotlin.load.java.sam.JavaSingleAbstractMethodUtils
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.backend.common.SamTypeFactory
|
||||
|
||||
object JvmSamTypeFactory : SamTypeFactory() {
|
||||
override fun isSamType(type: KotlinType) = JavaSingleAbstractMethodUtils.isSamType(type)
|
||||
class JvmSamTypeFactory : SamTypeFactory() {
|
||||
override fun isSamType(type: KotlinType) =
|
||||
JavaSingleAbstractMethodUtils.isSamType(type)
|
||||
}
|
||||
+24
-7
@@ -15,6 +15,7 @@ import kotlin.Pair;
|
||||
import kotlin.collections.CollectionsKt;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.backend.common.SamTypeApproximator;
|
||||
import org.jetbrains.kotlin.builtins.FunctionTypesKt;
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns;
|
||||
import org.jetbrains.kotlin.builtins.ReflectionTypes;
|
||||
@@ -34,6 +35,7 @@ import org.jetbrains.kotlin.descriptors.impl.AnonymousFunctionDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.impl.LocalVariableDescriptor;
|
||||
import org.jetbrains.kotlin.fileClasses.JvmFileClassUtil;
|
||||
import org.jetbrains.kotlin.load.java.JvmAbi;
|
||||
import org.jetbrains.kotlin.load.java.sam.JavaSingleAbstractMethodUtils;
|
||||
import org.jetbrains.kotlin.name.ClassId;
|
||||
import org.jetbrains.kotlin.name.Name;
|
||||
import org.jetbrains.kotlin.psi.*;
|
||||
@@ -90,6 +92,7 @@ class CodegenAnnotatingVisitor extends KtVisitorVoid {
|
||||
private final ClassBuilderMode classBuilderMode;
|
||||
private final DelegatedPropertiesCodegenHelper delegatedPropertiesCodegenHelper;
|
||||
private final JvmDefaultMode jvmDefaultMode;
|
||||
private final SamTypeApproximator samTypeApproximator;
|
||||
|
||||
public CodegenAnnotatingVisitor(@NotNull GenerationState state) {
|
||||
this.bindingTrace = state.getBindingTrace();
|
||||
@@ -100,7 +103,8 @@ class CodegenAnnotatingVisitor extends KtVisitorVoid {
|
||||
this.languageVersionSettings = state.getLanguageVersionSettings();
|
||||
this.classBuilderMode = state.getClassBuilderMode();
|
||||
this.delegatedPropertiesCodegenHelper = new DelegatedPropertiesCodegenHelper(state);
|
||||
jvmDefaultMode = state.getJvmDefaultMode();
|
||||
this.jvmDefaultMode = state.getJvmDefaultMode();
|
||||
this.samTypeApproximator = new SamTypeApproximator(state.getModule().getBuiltIns(), state.getLanguageVersionSettings());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -855,6 +859,20 @@ class CodegenAnnotatingVisitor extends KtVisitorVoid {
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private SamType createSamType(KotlinType kotlinType) {
|
||||
if (!JavaSingleAbstractMethodUtils.isSamType(kotlinType)) return null;
|
||||
return new SamType(kotlinType);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private SamType createSamTypeByValueParameter(ValueParameterDescriptor valueParameterDescriptor) {
|
||||
KotlinType kotlinSamType = samTypeApproximator.getSamTypeForValueParameter(valueParameterDescriptor);
|
||||
if (kotlinSamType == null) return null;
|
||||
if (!JavaSingleAbstractMethodUtils.isSamType(kotlinSamType)) return null;
|
||||
return new SamType(kotlinSamType);
|
||||
}
|
||||
|
||||
private void writeSamValueForValueParameters(
|
||||
@NotNull Collection<ValueParameterDescriptor> valueParametersWithSAMConversion,
|
||||
@Nullable List<ResolvedValueArgument> valueArguments
|
||||
@@ -862,7 +880,7 @@ class CodegenAnnotatingVisitor extends KtVisitorVoid {
|
||||
if (valueArguments == null) return;
|
||||
|
||||
for (ValueParameterDescriptor valueParameter : valueParametersWithSAMConversion) {
|
||||
SamType samType = JvmSamTypeFactory.INSTANCE.createByValueParameter(valueParameter, this.languageVersionSettings);
|
||||
SamType samType = createSamTypeByValueParameter(valueParameter);
|
||||
if (samType == null) continue;
|
||||
|
||||
ResolvedValueArgument resolvedValueArgument = valueArguments.get(valueParameter.getIndex());
|
||||
@@ -874,7 +892,7 @@ class CodegenAnnotatingVisitor extends KtVisitorVoid {
|
||||
}
|
||||
|
||||
private void recordSamTypeOnArgumentExpression(ValueParameterDescriptor valueParameter, ValueArgument valueArgument) {
|
||||
SamType samType = JvmSamTypeFactory.INSTANCE.createByValueParameter(valueParameter, this.languageVersionSettings);
|
||||
SamType samType = createSamTypeByValueParameter(valueParameter);
|
||||
if (samType == null) return;
|
||||
|
||||
recordSamTypeOnArgumentExpression(samType, valueArgument);
|
||||
@@ -955,8 +973,7 @@ class CodegenAnnotatingVisitor extends KtVisitorVoid {
|
||||
KtExpression argumentExpression = argument.getArgumentExpression();
|
||||
bindingTrace.record(SAM_CONSTRUCTOR_TO_ARGUMENT, expression, argumentExpression);
|
||||
|
||||
//noinspection ConstantConditions
|
||||
SamType samType = JvmSamTypeFactory.INSTANCE.create(callableDescriptor.getReturnType());
|
||||
SamType samType = createSamType(callableDescriptor.getReturnType());
|
||||
bindingTrace.record(SAM_VALUE, argumentExpression, samType);
|
||||
}
|
||||
|
||||
@@ -973,7 +990,7 @@ class CodegenAnnotatingVisitor extends KtVisitorVoid {
|
||||
FunctionDescriptor original = SamCodegenUtil.getOriginalIfSamAdapter((FunctionDescriptor) operationDescriptor);
|
||||
if (original == null) return;
|
||||
|
||||
SamType samType = JvmSamTypeFactory.INSTANCE.createByValueParameter(original.getValueParameters().get(0), this.languageVersionSettings);
|
||||
SamType samType = createSamTypeByValueParameter(original.getValueParameters().get(0));
|
||||
if (samType == null) return;
|
||||
|
||||
IElementType token = expression.getOperationToken();
|
||||
@@ -1002,7 +1019,7 @@ class CodegenAnnotatingVisitor extends KtVisitorVoid {
|
||||
List<KtExpression> indexExpressions = expression.getIndexExpressions();
|
||||
List<ValueParameterDescriptor> parameters = original.getValueParameters();
|
||||
for (ValueParameterDescriptor valueParameter : parameters) {
|
||||
SamType samType = JvmSamTypeFactory.INSTANCE.createByValueParameter(valueParameter, this.languageVersionSettings);
|
||||
SamType samType = createSamTypeByValueParameter(valueParameter);
|
||||
if (samType == null) continue;
|
||||
|
||||
if (isSetter && valueParameter.getIndex() == parameters.size() - 1) {
|
||||
|
||||
@@ -147,16 +147,18 @@ class GenerationState private constructor(
|
||||
}
|
||||
}
|
||||
|
||||
val languageVersionSettings = configuration.languageVersionSettings
|
||||
|
||||
val inlineCache: InlineCache = InlineCache()
|
||||
|
||||
val incrementalCacheForThisTarget: IncrementalCache?
|
||||
val packagesWithObsoleteParts: Set<FqName>
|
||||
val obsoleteMultifileClasses: List<FqName>
|
||||
val deserializationConfiguration: DeserializationConfiguration =
|
||||
CompilerDeserializationConfiguration(configuration.languageVersionSettings)
|
||||
CompilerDeserializationConfiguration(languageVersionSettings)
|
||||
|
||||
val deprecationProvider = DeprecationResolver(
|
||||
LockBasedStorageManager.NO_LOCKS, configuration.languageVersionSettings, CoroutineCompatibilitySupport.ENABLED,
|
||||
LockBasedStorageManager.NO_LOCKS, languageVersionSettings, CoroutineCompatibilitySupport.ENABLED,
|
||||
JavaDeprecationSettings
|
||||
)
|
||||
|
||||
@@ -197,8 +199,6 @@ class GenerationState private constructor(
|
||||
extraJvmDiagnosticsTrace.bindingContext.diagnostics
|
||||
}
|
||||
|
||||
val languageVersionSettings = configuration.languageVersionSettings
|
||||
|
||||
val useOldManglingSchemeForFunctionsWithInlineClassesInSignatures =
|
||||
configuration.getBoolean(JVMConfigurationKeys.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME) ||
|
||||
languageVersionSettings.languageVersion.run { major == 1 && minor < 4 }
|
||||
@@ -264,7 +264,7 @@ class GenerationState private constructor(
|
||||
val globalInlineContext: GlobalInlineContext = GlobalInlineContext(diagnostics)
|
||||
val mappingsClassesForWhenByEnum: MappingsClassesForWhenByEnum = MappingsClassesForWhenByEnum(this)
|
||||
val jvmRuntimeTypes: JvmRuntimeTypes = JvmRuntimeTypes(
|
||||
module, configuration.languageVersionSettings, generateOptimizedCallableReferenceSuperClasses
|
||||
module, languageVersionSettings, generateOptimizedCallableReferenceSuperClasses
|
||||
)
|
||||
val factory: ClassFileFactory
|
||||
private var duplicateSignatureFactory: BuilderFactoryForDuplicateSignatureDiagnostics? = null
|
||||
|
||||
+6
@@ -17749,6 +17749,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/inference/builderInference/kt44241.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt45083.kt")
|
||||
public void testKt45083() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/builderInference/kt45083.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt47052.kt")
|
||||
public void testKt47052() throws Exception {
|
||||
|
||||
Generated
+6
@@ -2686,6 +2686,12 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest {
|
||||
runTest("compiler/testData/ir/irText/types/intersectionType3_OI.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("intersectionTypeInSamType.kt")
|
||||
public void testIntersectionTypeInSamType() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/types/intersectionTypeInSamType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("javaWildcardType.kt")
|
||||
public void testJavaWildcardType() throws Exception {
|
||||
|
||||
-7
@@ -7,8 +7,6 @@ package org.jetbrains.kotlin.backend.jvm
|
||||
|
||||
import org.jetbrains.kotlin.backend.common.ir.createImplicitParameterDeclarationWithWrappedDescriptor
|
||||
import org.jetbrains.kotlin.backend.common.ir.createParameterDeclarations
|
||||
import org.jetbrains.kotlin.codegen.JvmSamTypeFactory
|
||||
import org.jetbrains.kotlin.config.LanguageVersionSettings
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.descriptors.annotations.FilteredAnnotations
|
||||
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
|
||||
@@ -60,11 +58,6 @@ open class JvmGeneratorExtensionsImpl(private val generateFacades: Boolean = tru
|
||||
override fun isPlatformSamType(type: KotlinType): Boolean =
|
||||
JavaSingleAbstractMethodUtils.isSamType(type)
|
||||
|
||||
override fun getSamTypeForValueParameter(
|
||||
valueParameter: ValueParameterDescriptor,
|
||||
languageVersionSettings: LanguageVersionSettings
|
||||
): KotlinType? = JvmSamTypeFactory.createByValueParameter(valueParameter, languageVersionSettings)?.type
|
||||
|
||||
companion object Instance : JvmSamConversion()
|
||||
}
|
||||
|
||||
|
||||
+4
-2
@@ -127,8 +127,10 @@ internal class LambdaMetafactoryArgumentsBuilder(
|
||||
// Don't try to use indy on SAM types with non-invariant projections because buildFakeOverrideMember doesn't support such supertypes
|
||||
// (and rightly so: supertypes in Kotlin can't have projections in immediate type arguments). This can happen for example in case
|
||||
// the SAM type is instantiated with an intersection type in arguments, which is approximated to an out-projection in psi2ir.
|
||||
if (samType is IrSimpleType && samType.arguments.any { it is IrTypeProjection && it.variance != Variance.INVARIANT })
|
||||
return null
|
||||
if (samType is IrSimpleType) {
|
||||
if (samType.arguments.any { it is IrStarProjection || it is IrTypeProjection && it.variance != Variance.INVARIANT })
|
||||
return null
|
||||
}
|
||||
|
||||
// Do the hard work of matching Kotlin functional interface hierarchy against LambdaMetafactory constraints.
|
||||
// Briefly: sometimes we have to force boxing on the primitive and inline class values, sometimes we have to keep them unboxed.
|
||||
|
||||
+20
-6
@@ -51,10 +51,7 @@ import org.jetbrains.kotlin.resolve.calls.components.isVararg
|
||||
import org.jetbrains.kotlin.resolve.calls.model.*
|
||||
import org.jetbrains.kotlin.resolve.calls.tower.NewResolvedCallImpl
|
||||
import org.jetbrains.kotlin.resolve.scopes.receivers.*
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.types.TypeProjectionImpl
|
||||
import org.jetbrains.kotlin.types.TypeSubstitutor
|
||||
import org.jetbrains.kotlin.types.Variance
|
||||
import org.jetbrains.kotlin.types.*
|
||||
import org.jetbrains.kotlin.types.typeUtil.isUnit
|
||||
import org.jetbrains.kotlin.util.OperatorNameConventions
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
|
||||
@@ -567,7 +564,7 @@ fun StatementGenerator.generateSamConversionForValueArgumentsIfRequired(call: Ca
|
||||
val typeSubstitutor = TypeSubstitutor.create(substitutionContext)
|
||||
|
||||
for (i in underlyingValueParameters.indices) {
|
||||
val underlyingValueParameter = underlyingValueParameters[i]
|
||||
val underlyingValueParameter: ValueParameterDescriptor = underlyingValueParameters[i]
|
||||
|
||||
val expectedSamConversionTypesForVararg =
|
||||
if (expectSamConvertedArgumentToBeAvailableInResolvedCall && resolvedCall is NewResolvedCallImpl<*>) {
|
||||
@@ -585,7 +582,7 @@ fun StatementGenerator.generateSamConversionForValueArgumentsIfRequired(call: Ca
|
||||
if (!originalValueParameters[i].type.isFunctionTypeOrSubtype) continue
|
||||
}
|
||||
|
||||
val samKotlinType = samConversion.getSamTypeForValueParameter(underlyingValueParameter, context.languageVersionSettings)
|
||||
val samKotlinType = getSamTypeForValueParameter(underlyingValueParameter)
|
||||
?: underlyingValueParameter.varargElementType // If we have a vararg, vararg element type will be taken
|
||||
?: underlyingValueParameter.type
|
||||
|
||||
@@ -645,6 +642,23 @@ fun StatementGenerator.generateSamConversionForValueArgumentsIfRequired(call: Ca
|
||||
}
|
||||
}
|
||||
|
||||
private fun StatementGenerator.getSamTypeForValueParameter(valueParameter: ValueParameterDescriptor): KotlinType? {
|
||||
val approximatedSamType = context.samTypeApproximator.getSamTypeForValueParameter(valueParameter)
|
||||
?: return null
|
||||
if (!context.extensions.samConversion.isSamType(approximatedSamType))
|
||||
return null
|
||||
val classDescriptor = approximatedSamType.constructor.declarationDescriptor
|
||||
?: throw AssertionError("SAM type is expected to be a class type: $approximatedSamType")
|
||||
return approximatedSamType.replace(
|
||||
approximatedSamType.arguments.mapIndexed { index: Int, typeProjection: TypeProjection ->
|
||||
if (typeProjection.type.constructor.isDenotable)
|
||||
typeProjection
|
||||
else
|
||||
StarProjectionImpl(classDescriptor.typeConstructor.parameters[index])
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
fun StatementGenerator.pregenerateValueArgumentsUsing(
|
||||
call: CallBuilder,
|
||||
resolvedCall: ResolvedCall<*>,
|
||||
|
||||
+6
-3
@@ -5,6 +5,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.psi2ir.generators
|
||||
|
||||
import org.jetbrains.kotlin.backend.common.SamTypeApproximator
|
||||
import org.jetbrains.kotlin.builtins.ReflectionTypes
|
||||
import org.jetbrains.kotlin.config.LanguageVersionSettings
|
||||
import org.jetbrains.kotlin.descriptors.CallableDescriptor
|
||||
@@ -33,10 +34,12 @@ class GeneratorContext(
|
||||
) : IrGeneratorContext {
|
||||
internal val callToSubstitutedDescriptorMap = mutableMapOf<IrDeclarationReference, CallableDescriptor>()
|
||||
|
||||
// TODO: inject a correct StorageManager instance, or store NotFoundClasses inside ModuleDescriptor
|
||||
val reflectionTypes = ReflectionTypes(moduleDescriptor, NotFoundClasses(LockBasedStorageManager.NO_LOCKS, moduleDescriptor))
|
||||
|
||||
fun IrDeclarationReference.commitSubstituted(descriptor: CallableDescriptor) {
|
||||
callToSubstitutedDescriptorMap[this] = descriptor
|
||||
}
|
||||
|
||||
// TODO: inject a correct StorageManager instance, or store NotFoundClasses inside ModuleDescriptor
|
||||
val reflectionTypes = ReflectionTypes(moduleDescriptor, NotFoundClasses(LockBasedStorageManager.NO_LOCKS, moduleDescriptor))
|
||||
|
||||
val samTypeApproximator = SamTypeApproximator(moduleDescriptor.builtIns, languageVersionSettings)
|
||||
}
|
||||
|
||||
-8
@@ -8,15 +8,12 @@ package org.jetbrains.kotlin.psi2ir.generators
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.DescriptorVisibility
|
||||
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
|
||||
import org.jetbrains.kotlin.ir.expressions.IrDelegatingConstructorCall
|
||||
import org.jetbrains.kotlin.ir.symbols.IrScriptSymbol
|
||||
import org.jetbrains.kotlin.ir.util.StubGeneratorExtensions
|
||||
import org.jetbrains.kotlin.psi.KtPureClassOrObject
|
||||
import org.jetbrains.kotlin.resolve.scopes.MemberScope
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.backend.common.SamTypeFactory
|
||||
import org.jetbrains.kotlin.config.LanguageVersionSettings
|
||||
|
||||
open class GeneratorExtensions : StubGeneratorExtensions() {
|
||||
open val samConversion: SamConversion
|
||||
@@ -25,11 +22,6 @@ open class GeneratorExtensions : StubGeneratorExtensions() {
|
||||
open class SamConversion {
|
||||
open fun isPlatformSamType(type: KotlinType): Boolean = false
|
||||
|
||||
open fun getSamTypeForValueParameter(
|
||||
valueParameter: ValueParameterDescriptor,
|
||||
languageVersionSettings: LanguageVersionSettings
|
||||
): KotlinType? = SamTypeFactory.INSTANCE.createByValueParameter(valueParameter, languageVersionSettings)?.type
|
||||
|
||||
companion object Instance : SamConversion()
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// IGNORE_BACKEND: WASM
|
||||
|
||||
interface X
|
||||
interface Z
|
||||
|
||||
|
||||
@@ -0,0 +1,241 @@
|
||||
FILE fqName:<root> fileName:/intersectionTypeInSamType.kt
|
||||
CLASS INTERFACE name:X modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.X
|
||||
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 INTERFACE name:Z modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Z
|
||||
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 INTERFACE name:A modality:ABSTRACT visibility:public superTypes:[<root>.X; <root>.Z]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.A
|
||||
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>.X
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in <root>.Z
|
||||
$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 [fake_override] declared in <root>.X
|
||||
public open fun hashCode (): kotlin.Int [fake_override] declared in <root>.Z
|
||||
$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>.X
|
||||
public open fun toString (): kotlin.String [fake_override] declared in <root>.Z
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
CLASS INTERFACE name:B modality:ABSTRACT visibility:public superTypes:[<root>.X; <root>.Z]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.B
|
||||
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>.X
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in <root>.Z
|
||||
$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 [fake_override] declared in <root>.X
|
||||
public open fun hashCode (): kotlin.Int [fake_override] declared in <root>.Z
|
||||
$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>.X
|
||||
public open fun toString (): kotlin.String [fake_override] declared in <root>.Z
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
CLASS INTERFACE name:IFoo modality:ABSTRACT visibility:public [fun] superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.IFoo<T of <root>.IFoo>
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[<root>.X]
|
||||
FUN name:foo visibility:public modality:ABSTRACT <> ($this:<root>.IFoo<T of <root>.IFoo>, t:T of <root>.IFoo) returnType:kotlin.Unit
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.IFoo<T of <root>.IFoo>
|
||||
VALUE_PARAMETER name:t index:0 type:T of <root>.IFoo
|
||||
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 INTERFACE name:IBar1 modality:ABSTRACT visibility:public [fun] superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.IBar1<T of <root>.IBar1>
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[<root>.X; <root>.Z]
|
||||
FUN name:bar visibility:public modality:ABSTRACT <> ($this:<root>.IBar1<T of <root>.IBar1>, t:T of <root>.IBar1) returnType:kotlin.Unit
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.IBar1<T of <root>.IBar1>
|
||||
VALUE_PARAMETER name:t index:0 type:T of <root>.IBar1
|
||||
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 INTERFACE name:IBar2 modality:ABSTRACT visibility:public [fun] superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.IBar2<T of <root>.IBar2>
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[<root>.X; <root>.Z]
|
||||
FUN name:bar visibility:public modality:ABSTRACT <> ($this:<root>.IBar2<T of <root>.IBar2>, t:T of <root>.IBar2) returnType:kotlin.Unit
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.IBar2<T of <root>.IBar2>
|
||||
VALUE_PARAMETER name:t index:0 type:T of <root>.IBar2
|
||||
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:sel visibility:public modality:FINAL <T> (x:T of <root>.sel, y:T of <root>.sel) returnType:T of <root>.sel
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
|
||||
VALUE_PARAMETER name:x index:0 type:T of <root>.sel
|
||||
VALUE_PARAMETER name:y index:1 type:T of <root>.sel
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun sel <T> (x: T of <root>.sel, y: T of <root>.sel): T of <root>.sel declared in <root>'
|
||||
GET_VAR 'x: T of <root>.sel declared in <root>.sel' type=T of <root>.sel origin=null
|
||||
CLASS CLASS name:G1 modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.G1<T of <root>.G1>
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[<root>.X]
|
||||
CONSTRUCTOR visibility:public <> () returnType:<root>.G1<T of <root>.G1> [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:G1 modality:FINAL visibility:public superTypes:[kotlin.Any]'
|
||||
FUN name:checkFoo visibility:public modality:FINAL <> ($this:<root>.G1<T of <root>.G1>, x:<root>.IFoo<in T of <root>.G1>) returnType:kotlin.Unit
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.G1<T of <root>.G1>
|
||||
VALUE_PARAMETER name:x index:0 type:<root>.IFoo<in T of <root>.G1>
|
||||
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 CLASS name:G2 modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.G2<T of <root>.G2>
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[<root>.X; <root>.Z]
|
||||
CONSTRUCTOR visibility:public <> () returnType:<root>.G2<T of <root>.G2> [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:G2 modality:FINAL visibility:public superTypes:[kotlin.Any]'
|
||||
FUN name:checkFoo visibility:public modality:FINAL <> ($this:<root>.G2<T of <root>.G2>, x:<root>.IFoo<in T of <root>.G2>) returnType:kotlin.Unit
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.G2<T of <root>.G2>
|
||||
VALUE_PARAMETER name:x index:0 type:<root>.IFoo<in T of <root>.G2>
|
||||
BLOCK_BODY
|
||||
FUN name:checkBar1 visibility:public modality:FINAL <> ($this:<root>.G2<T of <root>.G2>, x:<root>.IBar1<in T of <root>.G2>) returnType:kotlin.Unit
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.G2<T of <root>.G2>
|
||||
VALUE_PARAMETER name:x index:0 type:<root>.IBar1<in T of <root>.G2>
|
||||
BLOCK_BODY
|
||||
FUN name:checkBar2 visibility:public modality:FINAL <> ($this:<root>.G2<T of <root>.G2>, x:<root>.IBar2<in T of <root>.G2>) returnType:kotlin.Unit
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.G2<T of <root>.G2>
|
||||
VALUE_PARAMETER name:x index:0 type:<root>.IBar2<in T of <root>.G2>
|
||||
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
|
||||
FUN name:test1 visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
||||
BLOCK_BODY
|
||||
VAR name:g type:<root>.G1<*> [val]
|
||||
CALL 'public final fun sel <T> (x: T of <root>.sel, y: T of <root>.sel): T of <root>.sel declared in <root>' type=<root>.G1<*> origin=null
|
||||
<T>: <root>.G1<*>
|
||||
x: CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.G1' type=<root>.G1<<root>.A> origin=null
|
||||
<class: T>: <root>.A
|
||||
y: CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.G1' type=<root>.G1<<root>.B> origin=null
|
||||
<class: T>: <root>.B
|
||||
CALL 'public final fun checkFoo (x: <root>.IFoo<in T of <root>.G1>): kotlin.Unit declared in <root>.G1' type=kotlin.Unit origin=null
|
||||
$this: GET_VAR 'val g: <root>.G1<*> [val] declared in <root>.test1' type=<root>.G1<*> origin=null
|
||||
x: TYPE_OP type=<root>.IFoo<kotlin.Nothing> origin=SAM_CONVERSION typeOperand=<root>.IFoo<kotlin.Nothing>
|
||||
FUN_EXPR type=kotlin.Function1<kotlin.Nothing, kotlin.Unit> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:<root>.X) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:it index:0 type:<root>.X
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='local final fun <anonymous> (it: <root>.X): kotlin.Unit declared in <root>.test1'
|
||||
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
|
||||
FUN name:test2 visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
||||
BLOCK_BODY
|
||||
VAR name:g type:<root>.G2<*> [val]
|
||||
CALL 'public final fun sel <T> (x: T of <root>.sel, y: T of <root>.sel): T of <root>.sel declared in <root>' type=<root>.G2<*> origin=null
|
||||
<T>: <root>.G2<*>
|
||||
x: CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.G2' type=<root>.G2<<root>.A> origin=null
|
||||
<class: T>: <root>.A
|
||||
y: CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.G2' type=<root>.G2<<root>.B> origin=null
|
||||
<class: T>: <root>.B
|
||||
CALL 'public final fun checkFoo (x: <root>.IFoo<in T of <root>.G2>): kotlin.Unit declared in <root>.G2' type=kotlin.Unit origin=null
|
||||
$this: GET_VAR 'val g: <root>.G2<*> [val] declared in <root>.test2' type=<root>.G2<*> origin=null
|
||||
x: TYPE_OP type=<root>.IFoo<kotlin.Nothing> origin=SAM_CONVERSION typeOperand=<root>.IFoo<kotlin.Nothing>
|
||||
FUN_EXPR type=kotlin.Function1<kotlin.Nothing, kotlin.Unit> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:<root>.X) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:it index:0 type:<root>.X
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='local final fun <anonymous> (it: <root>.X): kotlin.Unit declared in <root>.test2'
|
||||
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
|
||||
CALL 'public final fun checkBar1 (x: <root>.IBar1<in T of <root>.G2>): kotlin.Unit declared in <root>.G2' type=kotlin.Unit origin=null
|
||||
$this: GET_VAR 'val g: <root>.G2<*> [val] declared in <root>.test2' type=<root>.G2<*> origin=null
|
||||
x: TYPE_OP type=<root>.IBar1<kotlin.Nothing> origin=SAM_CONVERSION typeOperand=<root>.IBar1<kotlin.Nothing>
|
||||
FUN_EXPR type=kotlin.Function1<kotlin.Nothing, kotlin.Unit> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:<root>.X) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:it index:0 type:<root>.X
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='local final fun <anonymous> (it: <root>.X): kotlin.Unit declared in <root>.test2'
|
||||
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
|
||||
CALL 'public final fun checkBar2 (x: <root>.IBar2<in T of <root>.G2>): kotlin.Unit declared in <root>.G2' type=kotlin.Unit origin=null
|
||||
$this: GET_VAR 'val g: <root>.G2<*> [val] declared in <root>.test2' type=<root>.G2<*> origin=null
|
||||
x: TYPE_OP type=<root>.IBar2<kotlin.Nothing> origin=SAM_CONVERSION typeOperand=<root>.IBar2<kotlin.Nothing>
|
||||
FUN_EXPR type=kotlin.Function1<kotlin.Nothing, kotlin.Unit> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:<root>.X) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:it index:0 type:<root>.X
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='local final fun <anonymous> (it: <root>.X): kotlin.Unit declared in <root>.test2'
|
||||
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
|
||||
@@ -0,0 +1,44 @@
|
||||
// SKIP_KT_DUMP
|
||||
|
||||
interface X
|
||||
interface Z
|
||||
|
||||
interface A : X, Z
|
||||
interface B : X, Z
|
||||
|
||||
fun interface IFoo<T : X> {
|
||||
fun foo(t: T)
|
||||
}
|
||||
|
||||
fun interface IBar1<T> where T : X, T : Z {
|
||||
fun bar(t: T)
|
||||
}
|
||||
|
||||
fun interface IBar2<T> where T : X, T : Z {
|
||||
fun bar(t: T)
|
||||
}
|
||||
|
||||
fun <T> sel(x: T, y: T) = x
|
||||
|
||||
class G1<T : X> {
|
||||
fun checkFoo(x: IFoo<in T>) {}
|
||||
}
|
||||
|
||||
class G2<T> where T : X, T : Z {
|
||||
fun checkFoo(x: IFoo<in T>) {}
|
||||
fun checkBar1(x: IBar1<in T>) {}
|
||||
fun checkBar2(x: IBar2<in T>) {}
|
||||
}
|
||||
|
||||
|
||||
fun test1() {
|
||||
val g = sel(G1<A>(), G1<B>())
|
||||
g.checkFoo {}
|
||||
}
|
||||
|
||||
fun test2() {
|
||||
val g = sel(G2<A>(), G2<B>())
|
||||
g.checkFoo {}
|
||||
g.checkBar1 {}
|
||||
g.checkBar2 {}
|
||||
}
|
||||
@@ -0,0 +1,243 @@
|
||||
FILE fqName:<root> fileName:/intersectionTypeInSamType.kt
|
||||
CLASS INTERFACE name:X modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.X
|
||||
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 INTERFACE name:Z modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Z
|
||||
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 INTERFACE name:A modality:ABSTRACT visibility:public superTypes:[<root>.X; <root>.Z]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.A
|
||||
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>.X
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in <root>.Z
|
||||
$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 [fake_override] declared in <root>.X
|
||||
public open fun hashCode (): kotlin.Int [fake_override] declared in <root>.Z
|
||||
$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>.X
|
||||
public open fun toString (): kotlin.String [fake_override] declared in <root>.Z
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
CLASS INTERFACE name:B modality:ABSTRACT visibility:public superTypes:[<root>.X; <root>.Z]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.B
|
||||
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>.X
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in <root>.Z
|
||||
$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 [fake_override] declared in <root>.X
|
||||
public open fun hashCode (): kotlin.Int [fake_override] declared in <root>.Z
|
||||
$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>.X
|
||||
public open fun toString (): kotlin.String [fake_override] declared in <root>.Z
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
CLASS INTERFACE name:IFoo modality:ABSTRACT visibility:public [fun] superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.IFoo<T of <root>.IFoo>
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[<root>.X]
|
||||
FUN name:foo visibility:public modality:ABSTRACT <> ($this:<root>.IFoo<T of <root>.IFoo>, t:T of <root>.IFoo) returnType:kotlin.Unit
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.IFoo<T of <root>.IFoo>
|
||||
VALUE_PARAMETER name:t index:0 type:T of <root>.IFoo
|
||||
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 INTERFACE name:IBar1 modality:ABSTRACT visibility:public [fun] superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.IBar1<T of <root>.IBar1>
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[<root>.X; <root>.Z]
|
||||
FUN name:bar visibility:public modality:ABSTRACT <> ($this:<root>.IBar1<T of <root>.IBar1>, t:T of <root>.IBar1) returnType:kotlin.Unit
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.IBar1<T of <root>.IBar1>
|
||||
VALUE_PARAMETER name:t index:0 type:T of <root>.IBar1
|
||||
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 INTERFACE name:IBar2 modality:ABSTRACT visibility:public [fun] superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.IBar2<T of <root>.IBar2>
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[<root>.X; <root>.Z]
|
||||
FUN name:bar visibility:public modality:ABSTRACT <> ($this:<root>.IBar2<T of <root>.IBar2>, t:T of <root>.IBar2) returnType:kotlin.Unit
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.IBar2<T of <root>.IBar2>
|
||||
VALUE_PARAMETER name:t index:0 type:T of <root>.IBar2
|
||||
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:sel visibility:public modality:FINAL <T> (x:T of <root>.sel, y:T of <root>.sel) returnType:T of <root>.sel
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
|
||||
VALUE_PARAMETER name:x index:0 type:T of <root>.sel
|
||||
VALUE_PARAMETER name:y index:1 type:T of <root>.sel
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun sel <T> (x: T of <root>.sel, y: T of <root>.sel): T of <root>.sel declared in <root>'
|
||||
GET_VAR 'x: T of <root>.sel declared in <root>.sel' type=T of <root>.sel origin=null
|
||||
CLASS CLASS name:G1 modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.G1<T of <root>.G1>
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[<root>.X]
|
||||
CONSTRUCTOR visibility:public <> () returnType:<root>.G1<T of <root>.G1> [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:G1 modality:FINAL visibility:public superTypes:[kotlin.Any]'
|
||||
FUN name:checkFoo visibility:public modality:FINAL <> ($this:<root>.G1<T of <root>.G1>, x:<root>.IFoo<in T of <root>.G1>) returnType:kotlin.Unit
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.G1<T of <root>.G1>
|
||||
VALUE_PARAMETER name:x index:0 type:<root>.IFoo<in T of <root>.G1>
|
||||
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 CLASS name:G2 modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.G2<T of <root>.G2>
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[<root>.X; <root>.Z]
|
||||
CONSTRUCTOR visibility:public <> () returnType:<root>.G2<T of <root>.G2> [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:G2 modality:FINAL visibility:public superTypes:[kotlin.Any]'
|
||||
FUN name:checkFoo visibility:public modality:FINAL <> ($this:<root>.G2<T of <root>.G2>, x:<root>.IFoo<in T of <root>.G2>) returnType:kotlin.Unit
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.G2<T of <root>.G2>
|
||||
VALUE_PARAMETER name:x index:0 type:<root>.IFoo<in T of <root>.G2>
|
||||
BLOCK_BODY
|
||||
FUN name:checkBar1 visibility:public modality:FINAL <> ($this:<root>.G2<T of <root>.G2>, x:<root>.IBar1<in T of <root>.G2>) returnType:kotlin.Unit
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.G2<T of <root>.G2>
|
||||
VALUE_PARAMETER name:x index:0 type:<root>.IBar1<in T of <root>.G2>
|
||||
BLOCK_BODY
|
||||
FUN name:checkBar2 visibility:public modality:FINAL <> ($this:<root>.G2<T of <root>.G2>, x:<root>.IBar2<in T of <root>.G2>) returnType:kotlin.Unit
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.G2<T of <root>.G2>
|
||||
VALUE_PARAMETER name:x index:0 type:<root>.IBar2<in T of <root>.G2>
|
||||
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
|
||||
FUN name:test1 visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
||||
BLOCK_BODY
|
||||
VAR name:g type:<root>.G1<*> [val]
|
||||
CALL 'public final fun sel <T> (x: T of <root>.sel, y: T of <root>.sel): T of <root>.sel declared in <root>' type=<root>.G1<*> origin=null
|
||||
<T>: <root>.G1<*>
|
||||
x: CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.G1' type=<root>.G1<<root>.A> origin=null
|
||||
<class: T>: <root>.A
|
||||
y: CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.G1' type=<root>.G1<<root>.B> origin=null
|
||||
<class: T>: <root>.B
|
||||
CALL 'public final fun checkFoo (x: <root>.IFoo<in T of <root>.G1>): kotlin.Unit declared in <root>.G1' type=kotlin.Unit origin=null
|
||||
$this: GET_VAR 'val g: <root>.G1<*> [val] declared in <root>.test1' type=<root>.G1<*> origin=null
|
||||
x: TYPE_OP type=<root>.IFoo<<root>.X> origin=SAM_CONVERSION typeOperand=<root>.IFoo<<root>.X>
|
||||
TYPE_OP type=kotlin.Function1<@[ParameterName(name = 't')] <root>.X, kotlin.Unit> origin=IMPLICIT_CAST typeOperand=kotlin.Function1<@[ParameterName(name = 't')] <root>.X, kotlin.Unit>
|
||||
FUN_EXPR type=kotlin.Function1<kotlin.Nothing, kotlin.Unit> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:kotlin.Any) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:it index:0 type:kotlin.Any
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='local final fun <anonymous> (it: kotlin.Any): kotlin.Unit declared in <root>.test1'
|
||||
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
|
||||
FUN name:test2 visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
||||
BLOCK_BODY
|
||||
VAR name:g type:<root>.G2<*> [val]
|
||||
CALL 'public final fun sel <T> (x: T of <root>.sel, y: T of <root>.sel): T of <root>.sel declared in <root>' type=<root>.G2<*> origin=null
|
||||
<T>: <root>.G2<*>
|
||||
x: CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.G2' type=<root>.G2<<root>.A> origin=null
|
||||
<class: T>: <root>.A
|
||||
y: CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.G2' type=<root>.G2<<root>.B> origin=null
|
||||
<class: T>: <root>.B
|
||||
CALL 'public final fun checkFoo (x: <root>.IFoo<in T of <root>.G2>): kotlin.Unit declared in <root>.G2' type=kotlin.Unit origin=null
|
||||
$this: GET_VAR 'val g: <root>.G2<*> [val] declared in <root>.test2' type=<root>.G2<*> origin=null
|
||||
x: TYPE_OP type=<root>.IFoo<<root>.X> origin=SAM_CONVERSION typeOperand=<root>.IFoo<<root>.X>
|
||||
TYPE_OP type=kotlin.Function1<@[ParameterName(name = 't')] <root>.X, kotlin.Unit> origin=IMPLICIT_CAST typeOperand=kotlin.Function1<@[ParameterName(name = 't')] <root>.X, kotlin.Unit>
|
||||
FUN_EXPR type=kotlin.Function1<kotlin.Nothing, kotlin.Unit> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:kotlin.Any) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:it index:0 type:kotlin.Any
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='local final fun <anonymous> (it: kotlin.Any): kotlin.Unit declared in <root>.test2'
|
||||
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
|
||||
CALL 'public final fun checkBar1 (x: <root>.IBar1<in T of <root>.G2>): kotlin.Unit declared in <root>.G2' type=kotlin.Unit origin=null
|
||||
$this: GET_VAR 'val g: <root>.G2<*> [val] declared in <root>.test2' type=<root>.G2<*> origin=null
|
||||
x: TYPE_OP type=<root>.IBar1<*> origin=SAM_CONVERSION typeOperand=<root>.IBar1<*>
|
||||
FUN_EXPR type=kotlin.Function1<kotlin.Nothing, kotlin.Unit> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:kotlin.Any) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:it index:0 type:kotlin.Any
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='local final fun <anonymous> (it: kotlin.Any): kotlin.Unit declared in <root>.test2'
|
||||
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
|
||||
CALL 'public final fun checkBar2 (x: <root>.IBar2<in T of <root>.G2>): kotlin.Unit declared in <root>.G2' type=kotlin.Unit origin=null
|
||||
$this: GET_VAR 'val g: <root>.G2<*> [val] declared in <root>.test2' type=<root>.G2<*> origin=null
|
||||
x: TYPE_OP type=<root>.IBar2<*> origin=SAM_CONVERSION typeOperand=<root>.IBar2<*>
|
||||
FUN_EXPR type=kotlin.Function1<kotlin.Nothing, kotlin.Unit> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:kotlin.Any) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:it index:0 type:kotlin.Any
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='local final fun <anonymous> (it: kotlin.Any): kotlin.Unit declared in <root>.test2'
|
||||
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
|
||||
+6
@@ -17713,6 +17713,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/inference/builderInference/kt44241.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt45083.kt")
|
||||
public void testKt45083() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/builderInference/kt45083.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt47052.kt")
|
||||
public void testKt47052() throws Exception {
|
||||
|
||||
+6
@@ -17749,6 +17749,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/inference/builderInference/kt44241.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt45083.kt")
|
||||
public void testKt45083() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/builderInference/kt45083.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt47052.kt")
|
||||
public void testKt47052() throws Exception {
|
||||
|
||||
Generated
+6
@@ -2686,6 +2686,12 @@ public class IrTextTestGenerated extends AbstractIrTextTest {
|
||||
runTest("compiler/testData/ir/irText/types/intersectionType3_OI.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("intersectionTypeInSamType.kt")
|
||||
public void testIntersectionTypeInSamType() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/types/intersectionTypeInSamType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("javaWildcardType.kt")
|
||||
public void testJavaWildcardType() throws Exception {
|
||||
|
||||
+5
@@ -14666,6 +14666,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/inference/builderInference/kt44241.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt45083.kt")
|
||||
public void testKt45083() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/builderInference/kt45083.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt47052.kt")
|
||||
public void testKt47052() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/builderInference/kt47052.kt");
|
||||
|
||||
js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java
Generated
+5
@@ -12820,6 +12820,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
|
||||
runTest("compiler/testData/codegen/box/inference/builderInference/kt44241.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt45083.kt")
|
||||
public void testKt45083() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/builderInference/kt45083.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt47052.kt")
|
||||
public void testKt47052() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/builderInference/kt47052.kt");
|
||||
|
||||
Generated
+5
@@ -12226,6 +12226,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/inference/builderInference/kt44241.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt45083.kt")
|
||||
public void testKt45083() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/builderInference/kt45083.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt47052.kt")
|
||||
public void testKt47052() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/builderInference/kt47052.kt");
|
||||
|
||||
Generated
+5
@@ -12291,6 +12291,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/inference/builderInference/kt44241.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt45083.kt")
|
||||
public void testKt45083() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/builderInference/kt45083.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt47052.kt")
|
||||
public void testKt47052() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/builderInference/kt47052.kt");
|
||||
|
||||
Reference in New Issue
Block a user