[NI] Fix OnlyInputTypes for captured types
Uncapture projections recursively for cases when captured type is not top-level type or first level type argument
This commit is contained in:
@@ -265,15 +265,25 @@ fun UnwrappedType.unCapture(): UnwrappedType = when (this) {
|
||||
}
|
||||
|
||||
fun SimpleType.unCapture(): UnwrappedType {
|
||||
if (this is ErrorType) return this
|
||||
if (this is NewCapturedType)
|
||||
return unCaptureTopLevelType()
|
||||
|
||||
val newArguments = arguments.map { projection ->
|
||||
projection.type.constructor.safeAs<NewCapturedTypeConstructor>()?.let {
|
||||
it.projection
|
||||
} ?: projection
|
||||
}
|
||||
return replace(newArguments)
|
||||
val newArguments = arguments.map(::unCaptureProjection)
|
||||
return replace(newArguments).unwrap()
|
||||
}
|
||||
|
||||
fun unCaptureProjection(projection: TypeProjection): TypeProjection {
|
||||
val unCapturedProjection = projection.type.constructor.safeAs<NewCapturedTypeConstructor>()?.let {
|
||||
it.projection
|
||||
} ?: projection
|
||||
if (unCapturedProjection.type is ErrorType) return unCapturedProjection
|
||||
|
||||
val newArguments = unCapturedProjection.type.arguments.map(::unCaptureProjection)
|
||||
return TypeProjectionImpl(
|
||||
unCapturedProjection.projectionKind,
|
||||
unCapturedProjection.type.replace(newArguments)
|
||||
)
|
||||
}
|
||||
|
||||
fun AbbreviatedType.unCapture(): SimpleType {
|
||||
|
||||
Reference in New Issue
Block a user