Store SimpleTypeArgumentImpl type projection instead of type reference for better handling star projected type arguments

This commit is contained in:
Victor Petukhov
2021-09-20 16:23:57 +03:00
parent 8b85b4630b
commit 6a6695a173
3 changed files with 3 additions and 3 deletions
@@ -404,7 +404,7 @@ class DiagnosticReporterByTrackingStrategy(
}
(position as? ExplicitTypeParameterConstraintPositionImpl)?.let {
val typeArgumentReference = (it.typeArgument as SimpleTypeArgumentImpl).typeReference
val typeArgumentReference = (it.typeArgument as SimpleTypeArgumentImpl).typeProjection.typeReference ?: return@let
val diagnosticFactory = if (isWarning) UPPER_BOUND_VIOLATED_WARNING else UPPER_BOUND_VIOLATED
report(diagnosticFactory.on(typeArgumentReference, error.upperKotlinType, error.lowerKotlinType))
}
@@ -31,7 +31,7 @@ import org.jetbrains.kotlin.types.expressions.KotlinTypeInfo
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
class SimpleTypeArgumentImpl(
val typeReference: KtTypeReference,
val typeProjection: KtTypeProjection,
override val type: UnwrappedType
) : SimpleTypeArgument
@@ -694,7 +694,7 @@ class PSICallResolver(
}
ModifierCheckerCore.check(projection, context.trace, null, languageVersionSettings)
resolveType(context, projection.typeReference, typeResolver)?.let { SimpleTypeArgumentImpl(projection.typeReference!!, it) }
resolveType(context, projection.typeReference, typeResolver)?.let { SimpleTypeArgumentImpl(projection, it) }
?: TypeArgumentPlaceholder
}