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.Variance
|
||||||
import org.jetbrains.kotlin.types.typeUtil.isNothing
|
import org.jetbrains.kotlin.types.typeUtil.isNothing
|
||||||
import org.jetbrains.kotlin.types.typeUtil.isUnit
|
import org.jetbrains.kotlin.types.typeUtil.isUnit
|
||||||
|
import org.jetbrains.kotlin.types.typeUtil.replaceArgumentsWithStarProjections
|
||||||
import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull
|
import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull
|
||||||
import kotlin.reflect.KClass
|
import kotlin.reflect.KClass
|
||||||
import kotlin.reflect.KType
|
import kotlin.reflect.KType
|
||||||
@@ -261,12 +262,14 @@ class LazyScriptDescriptor(
|
|||||||
private val scriptProvidedProperties: () -> List<ScriptProvidedPropertyDescriptor> = resolveSession.storageManager.createLazyValue {
|
private val scriptProvidedProperties: () -> List<ScriptProvidedPropertyDescriptor> = resolveSession.storageManager.createLazyValue {
|
||||||
scriptCompilationConfiguration()[ScriptCompilationConfiguration.providedProperties].orEmpty()
|
scriptCompilationConfiguration()[ScriptCompilationConfiguration.providedProperties].orEmpty()
|
||||||
.mapNotNull { (name, type) ->
|
.mapNotNull { (name, type) ->
|
||||||
findTypeDescriptor(getScriptingClass(type), Errors.MISSING_SCRIPT_PROVIDED_PROPERTY_CLASS)
|
findTypeDescriptor(getScriptingClass(type), Errors.MISSING_SCRIPT_PROVIDED_PROPERTY_CLASS)?.let {
|
||||||
?.let { name.toValidJvmIdentifier() to it.defaultType.makeNullableAsSpecified(type.isNullable) }
|
name.toValidJvmIdentifier() to
|
||||||
}.map { (name, classDescriptor) ->
|
it.defaultType.makeNullableAsSpecified(type.isNullable).replaceArgumentsWithStarProjections()
|
||||||
|
}
|
||||||
|
}.map { (name, type) ->
|
||||||
ScriptProvidedPropertyDescriptor(
|
ScriptProvidedPropertyDescriptor(
|
||||||
Name.identifier(name),
|
Name.identifier(name),
|
||||||
classDescriptor,
|
type,
|
||||||
thisAsReceiverParameter,
|
thisAsReceiverParameter,
|
||||||
true,
|
true,
|
||||||
this
|
this
|
||||||
|
|||||||
Reference in New Issue
Block a user