Do substitution captured type's super types as well
^KT-45982 Fixed
This commit is contained in:
+3
-1
@@ -104,6 +104,8 @@ interface NewTypeSubstitutor : TypeSubstitutorMarker {
|
||||
|
||||
val innerType = capturedType.lowerType ?: capturedType.constructor.projection.type.unwrap()
|
||||
val substitutedInnerType = substitute(innerType, keepAnnotation, runCapturedChecks = false)
|
||||
val substitutedSuperTypes =
|
||||
capturedType.constructor.supertypes.map { substitute(it, keepAnnotation, runCapturedChecks = false) ?: it }
|
||||
|
||||
if (substitutedInnerType != null) {
|
||||
return if (substitutedInnerType.isCaptured()) substitutedInnerType else {
|
||||
@@ -112,7 +114,7 @@ interface NewTypeSubstitutor : TypeSubstitutorMarker {
|
||||
NewCapturedTypeConstructor(
|
||||
TypeProjectionImpl(typeConstructor.projection.projectionKind, substitutedInnerType),
|
||||
typeParameter = typeConstructor.typeParameter
|
||||
),
|
||||
).also { it.initializeSupertypes(substitutedSuperTypes) },
|
||||
lowerType = if (capturedType.lowerType != null) substitutedInnerType else null
|
||||
)
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -20,7 +20,7 @@ fun foo() {
|
||||
|
||||
fun test2(): Sequence<String> = sequence {
|
||||
yield("")
|
||||
// id(this::class) // TODO
|
||||
id(this::class)
|
||||
}
|
||||
|
||||
fun test3(): Sequence<String> = sequence {
|
||||
|
||||
Reference in New Issue
Block a user