Support flexible types internally in typeOf
#KT-45066 Fixed
This commit is contained in:
@@ -146,6 +146,11 @@ public class ReflectionFactoryImpl extends ReflectionFactory {
|
||||
// Do nothing. KTypeParameterImpl implementation will load upper bounds from the metadata.
|
||||
}
|
||||
|
||||
// @Override // JPS
|
||||
public KType platformType(KType lowerBound, KType upperBound) {
|
||||
return TypeOfImplKt.createPlatformKType(lowerBound, upperBound);
|
||||
}
|
||||
|
||||
// Misc
|
||||
|
||||
public static void clearCaches() {
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* 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 kotlin.reflect.jvm.internal
|
||||
|
||||
import org.jetbrains.kotlin.types.KotlinTypeFactory
|
||||
import org.jetbrains.kotlin.types.SimpleType
|
||||
import kotlin.reflect.KType
|
||||
|
||||
internal fun createPlatformKType(lowerBound: KType, upperBound: KType): KType {
|
||||
// lowerBound/upperBound are guaranteed to be KTypeImpl over SimpleType, as long as this function is only used from the bytecode
|
||||
// generated by the compiler for `typeOf`.
|
||||
return KTypeImpl(
|
||||
KotlinTypeFactory.flexibleType(
|
||||
(lowerBound as KTypeImpl).type as SimpleType,
|
||||
(upperBound as KTypeImpl).type as SimpleType,
|
||||
)
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user