Use star-projected types for building ScriptProvidedPropertyDescriptors
Otherwise, the type parameters of the `kotlin.script.state` property of type `AggregatedReplStageState` were undefined, which led to building an ill-formed signature for the script class constructor.
This commit is contained in:
committed by
Space Team
parent
27adfa8370
commit
e3a4d6fa56
+7
-4
@@ -41,6 +41,7 @@ import org.jetbrains.kotlin.types.TypeSubstitutor
|
||||
import org.jetbrains.kotlin.types.Variance
|
||||
import org.jetbrains.kotlin.types.typeUtil.isNothing
|
||||
import org.jetbrains.kotlin.types.typeUtil.isUnit
|
||||
import org.jetbrains.kotlin.types.typeUtil.replaceArgumentsWithStarProjections
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull
|
||||
import kotlin.reflect.KClass
|
||||
import kotlin.reflect.KType
|
||||
@@ -261,12 +262,14 @@ class LazyScriptDescriptor(
|
||||
private val scriptProvidedProperties: () -> List<ScriptProvidedPropertyDescriptor> = resolveSession.storageManager.createLazyValue {
|
||||
scriptCompilationConfiguration()[ScriptCompilationConfiguration.providedProperties].orEmpty()
|
||||
.mapNotNull { (name, type) ->
|
||||
findTypeDescriptor(getScriptingClass(type), Errors.MISSING_SCRIPT_PROVIDED_PROPERTY_CLASS)
|
||||
?.let { name.toValidJvmIdentifier() to it.defaultType.makeNullableAsSpecified(type.isNullable) }
|
||||
}.map { (name, classDescriptor) ->
|
||||
findTypeDescriptor(getScriptingClass(type), Errors.MISSING_SCRIPT_PROVIDED_PROPERTY_CLASS)?.let {
|
||||
name.toValidJvmIdentifier() to
|
||||
it.defaultType.makeNullableAsSpecified(type.isNullable).replaceArgumentsWithStarProjections()
|
||||
}
|
||||
}.map { (name, type) ->
|
||||
ScriptProvidedPropertyDescriptor(
|
||||
Name.identifier(name),
|
||||
classDescriptor,
|
||||
type,
|
||||
thisAsReceiverParameter,
|
||||
true,
|
||||
this
|
||||
|
||||
Reference in New Issue
Block a user