[FIR] Implement TYPE_VARIANCE_CONFLICT, TYPE_VARIANCE_CONFLICT_IN_EXPANDED_TYPE diagnostics, fix tests
This commit is contained in:
committed by
TeamCityServer
parent
ef53f0e0b3
commit
cf531dbbe6
@@ -1,7 +1,7 @@
|
|||||||
interface List<out T : Any> {
|
interface List<out T : Any> {
|
||||||
operator fun get(index: Int): T
|
operator fun get(index: Int): T
|
||||||
|
|
||||||
infix fun concat(other: List<T>): List<T>
|
infix fun concat(other: List<<!TYPE_VARIANCE_CONFLICT!>T<!>>): List<T>
|
||||||
}
|
}
|
||||||
|
|
||||||
typealias StringList = List<out String>
|
typealias StringList = List<out String>
|
||||||
|
|||||||
+15
@@ -25,6 +25,7 @@ import org.jetbrains.kotlin.lexer.KtModifierKeywordToken
|
|||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
import org.jetbrains.kotlin.psi.*
|
import org.jetbrains.kotlin.psi.*
|
||||||
import org.jetbrains.kotlin.resolve.ForbiddenNamedArgumentsTarget
|
import org.jetbrains.kotlin.resolve.ForbiddenNamedArgumentsTarget
|
||||||
|
import org.jetbrains.kotlin.types.Variance
|
||||||
import kotlin.properties.PropertyDelegateProvider
|
import kotlin.properties.PropertyDelegateProvider
|
||||||
import kotlin.properties.ReadOnlyProperty
|
import kotlin.properties.ReadOnlyProperty
|
||||||
|
|
||||||
@@ -436,6 +437,20 @@ object DIAGNOSTICS_LIST : DiagnosticList("FirErrors") {
|
|||||||
parameter<ConeKotlinType>("typeA")
|
parameter<ConeKotlinType>("typeA")
|
||||||
parameter<ConeKotlinType>("typeB")
|
parameter<ConeKotlinType>("typeB")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val TYPE_VARIANCE_CONFLICT by error<PsiElement>(PositioningStrategy.DECLARATION_SIGNATURE_OR_DEFAULT) {
|
||||||
|
parameter<FirTypeParameterSymbol>("typeParameter")
|
||||||
|
parameter<Variance>("typeParameterVariance")
|
||||||
|
parameter<Variance>("variance")
|
||||||
|
parameter<ConeKotlinType>("containingType")
|
||||||
|
}
|
||||||
|
|
||||||
|
val TYPE_VARIANCE_CONFLICT_IN_EXPANDED_TYPE by error<PsiElement>(PositioningStrategy.DECLARATION_SIGNATURE_OR_DEFAULT) {
|
||||||
|
parameter<FirTypeParameterSymbol>("typeParameter")
|
||||||
|
parameter<Variance>("typeParameterVariance")
|
||||||
|
parameter<Variance>("variance")
|
||||||
|
parameter<ConeKotlinType>("containingType")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val REFLECTION by object : DiagnosticGroup("Reflection") {
|
val REFLECTION by object : DiagnosticGroup("Reflection") {
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ import org.jetbrains.kotlin.psi.KtValueArgument
|
|||||||
import org.jetbrains.kotlin.psi.KtWhenEntry
|
import org.jetbrains.kotlin.psi.KtWhenEntry
|
||||||
import org.jetbrains.kotlin.psi.KtWhenExpression
|
import org.jetbrains.kotlin.psi.KtWhenExpression
|
||||||
import org.jetbrains.kotlin.resolve.ForbiddenNamedArgumentsTarget
|
import org.jetbrains.kotlin.resolve.ForbiddenNamedArgumentsTarget
|
||||||
|
import org.jetbrains.kotlin.types.Variance
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file was generated automatically
|
* This file was generated automatically
|
||||||
@@ -294,6 +295,8 @@ object FirErrors {
|
|||||||
val DYNAMIC_UPPER_BOUND by error0<KtTypeReference>()
|
val DYNAMIC_UPPER_BOUND by error0<KtTypeReference>()
|
||||||
val INCOMPATIBLE_TYPES by error2<KtElement, ConeKotlinType, ConeKotlinType>()
|
val INCOMPATIBLE_TYPES by error2<KtElement, ConeKotlinType, ConeKotlinType>()
|
||||||
val INCOMPATIBLE_TYPES_WARNING by warning2<KtElement, ConeKotlinType, ConeKotlinType>()
|
val INCOMPATIBLE_TYPES_WARNING by warning2<KtElement, ConeKotlinType, ConeKotlinType>()
|
||||||
|
val TYPE_VARIANCE_CONFLICT by error4<PsiElement, FirTypeParameterSymbol, Variance, Variance, ConeKotlinType>(SourceElementPositioningStrategies.DECLARATION_SIGNATURE_OR_DEFAULT)
|
||||||
|
val TYPE_VARIANCE_CONFLICT_IN_EXPANDED_TYPE by error4<PsiElement, FirTypeParameterSymbol, Variance, Variance, ConeKotlinType>(SourceElementPositioningStrategies.DECLARATION_SIGNATURE_OR_DEFAULT)
|
||||||
|
|
||||||
// Reflection
|
// Reflection
|
||||||
val EXTENSION_IN_CLASS_REFERENCE_NOT_ALLOWED by error1<KtExpression, FirCallableDeclaration<*>>(SourceElementPositioningStrategies.REFERENCE_BY_QUALIFIED)
|
val EXTENSION_IN_CLASS_REFERENCE_NOT_ALLOWED by error1<KtExpression, FirCallableDeclaration<*>>(SourceElementPositioningStrategies.REFERENCE_BY_QUALIFIED)
|
||||||
|
|||||||
+2
@@ -15,6 +15,7 @@ import org.jetbrains.kotlin.fir.analysis.checkers.syntax.FirDelegationInInterfac
|
|||||||
import org.jetbrains.kotlin.fir.analysis.checkers.syntax.FirFunctionTypeParametersSyntaxChecker
|
import org.jetbrains.kotlin.fir.analysis.checkers.syntax.FirFunctionTypeParametersSyntaxChecker
|
||||||
import org.jetbrains.kotlin.fir.analysis.checkers.syntax.FirTypeParameterSyntaxChecker
|
import org.jetbrains.kotlin.fir.analysis.checkers.syntax.FirTypeParameterSyntaxChecker
|
||||||
import org.jetbrains.kotlin.fir.analysis.checkers.expression.FirReservedUnderscoreDeclarationChecker
|
import org.jetbrains.kotlin.fir.analysis.checkers.expression.FirReservedUnderscoreDeclarationChecker
|
||||||
|
import org.jetbrains.kotlin.fir.declarations.FirClass
|
||||||
|
|
||||||
object CommonDeclarationCheckers : DeclarationCheckers() {
|
object CommonDeclarationCheckers : DeclarationCheckers() {
|
||||||
override val basicDeclarationCheckers: Set<FirBasicDeclarationChecker>
|
override val basicDeclarationCheckers: Set<FirBasicDeclarationChecker>
|
||||||
@@ -65,6 +66,7 @@ object CommonDeclarationCheckers : DeclarationCheckers() {
|
|||||||
FirNotImplementedOverrideChecker,
|
FirNotImplementedOverrideChecker,
|
||||||
FirThrowableSubclassChecker,
|
FirThrowableSubclassChecker,
|
||||||
FirOpenMemberChecker,
|
FirOpenMemberChecker,
|
||||||
|
FirClassVarianceChecker
|
||||||
)
|
)
|
||||||
|
|
||||||
override val regularClassCheckers: Set<FirRegularClassChecker>
|
override val regularClassCheckers: Set<FirRegularClassChecker>
|
||||||
|
|||||||
+190
@@ -0,0 +1,190 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.kotlin.fir.analysis.checkers.declaration
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.descriptors.Visibilities
|
||||||
|
import org.jetbrains.kotlin.fir.*
|
||||||
|
import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
|
||||||
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter
|
||||||
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors
|
||||||
|
import org.jetbrains.kotlin.fir.declarations.*
|
||||||
|
import org.jetbrains.kotlin.fir.resolve.fullyExpandedType
|
||||||
|
import org.jetbrains.kotlin.fir.resolve.toSymbol
|
||||||
|
import org.jetbrains.kotlin.fir.types.*
|
||||||
|
import org.jetbrains.kotlin.types.Variance
|
||||||
|
import org.jetbrains.kotlin.types.checker.TypeCheckingProcedure
|
||||||
|
|
||||||
|
object FirClassVarianceChecker : FirClassChecker() {
|
||||||
|
override fun check(declaration: FirClass<*>, context: CheckerContext, reporter: DiagnosticReporter) {
|
||||||
|
checkTypeParameters(declaration.typeParameters, Variance.OUT_VARIANCE, context, reporter)
|
||||||
|
|
||||||
|
for (superTypeRef in declaration.superTypeRefs) {
|
||||||
|
checkVarianceConflict(superTypeRef, Variance.OUT_VARIANCE, context, reporter)
|
||||||
|
}
|
||||||
|
|
||||||
|
for (member in declaration.declarations) {
|
||||||
|
if (member is FirMemberDeclaration) {
|
||||||
|
if (Visibilities.isPrivate(member.status.visibility)) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (member is FirTypeParameterRefsOwner) {
|
||||||
|
checkTypeParameters(member.typeParameters, Variance.IN_VARIANCE, context, reporter)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (member is FirCallableDeclaration<*>) {
|
||||||
|
checkCallableDeclaration(member, context, reporter)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun checkCallableDeclaration(
|
||||||
|
member: FirCallableDeclaration<*>,
|
||||||
|
context: CheckerContext,
|
||||||
|
reporter: DiagnosticReporter
|
||||||
|
) {
|
||||||
|
val memberSource = member.source
|
||||||
|
if (member is FirSimpleFunction) {
|
||||||
|
if (memberSource != null && memberSource.kind !is FirFakeSourceElementKind) {
|
||||||
|
for (param in member.valueParameters) {
|
||||||
|
checkVarianceConflict(param.returnTypeRef, Variance.IN_VARIANCE, context, reporter)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val returnTypeVariance =
|
||||||
|
if (member is FirProperty && member.isVar) Variance.INVARIANT else Variance.OUT_VARIANCE
|
||||||
|
|
||||||
|
var returnSource = member.returnTypeRef.source
|
||||||
|
if (returnSource != null && memberSource != null) {
|
||||||
|
if (returnSource.kind is FirFakeSourceElementKind && memberSource.kind !is FirFakeSourceElementKind) {
|
||||||
|
returnSource = memberSource
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
checkVarianceConflict(member.returnTypeRef, returnTypeVariance, context, reporter, returnSource)
|
||||||
|
|
||||||
|
val receiverTypeRef = member.receiverTypeRef
|
||||||
|
if (receiverTypeRef != null) {
|
||||||
|
checkVarianceConflict(receiverTypeRef, Variance.IN_VARIANCE, context, reporter)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun checkTypeParameters(
|
||||||
|
typeParameters: List<FirTypeParameterRef>, variance: Variance,
|
||||||
|
context: CheckerContext, reporter: DiagnosticReporter
|
||||||
|
) {
|
||||||
|
for (typeParameter in typeParameters) {
|
||||||
|
if (typeParameter is FirTypeParameter) {
|
||||||
|
for (bound in typeParameter.bounds) {
|
||||||
|
checkVarianceConflict(bound, variance, context, reporter)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun checkVarianceConflict(
|
||||||
|
type: FirTypeRef, variance: Variance,
|
||||||
|
context: CheckerContext, reporter: DiagnosticReporter,
|
||||||
|
source: FirSourceElement? = null
|
||||||
|
) {
|
||||||
|
checkVarianceConflict(type.coneType, variance, type, type.coneType, context, reporter, source)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun checkVarianceConflict(
|
||||||
|
type: ConeKotlinType,
|
||||||
|
variance: Variance,
|
||||||
|
typeRef: FirTypeRef?,
|
||||||
|
containingType: ConeKotlinType,
|
||||||
|
context: CheckerContext,
|
||||||
|
reporter: DiagnosticReporter,
|
||||||
|
source: FirSourceElement? = null,
|
||||||
|
isInAbbreviation: Boolean = false
|
||||||
|
) {
|
||||||
|
if (type is ConeTypeParameterType) {
|
||||||
|
val fullyExpandedType = type.fullyExpandedType(context.session)
|
||||||
|
val typeParameter = type.lookupTag.typeParameterSymbol.fir
|
||||||
|
val resultSource = source ?: typeRef?.source
|
||||||
|
if (resultSource != null &&
|
||||||
|
!typeParameter.variance.allowsPosition(variance) &&
|
||||||
|
!fullyExpandedType.attributes.contains(CompilerConeAttributes.UnsafeVariance)
|
||||||
|
) {
|
||||||
|
val factory =
|
||||||
|
if (isInAbbreviation) FirErrors.TYPE_VARIANCE_CONFLICT_IN_EXPANDED_TYPE else FirErrors.TYPE_VARIANCE_CONFLICT
|
||||||
|
reporter.report(
|
||||||
|
factory.on(
|
||||||
|
resultSource,
|
||||||
|
typeParameter.symbol,
|
||||||
|
typeParameter.variance,
|
||||||
|
variance,
|
||||||
|
containingType
|
||||||
|
),
|
||||||
|
context
|
||||||
|
)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type is ConeClassLikeType) {
|
||||||
|
val fullyExpandedType = type.fullyExpandedType(context.session)
|
||||||
|
val declFir = fullyExpandedType.lookupTag.toSymbol(context.session)?.fir
|
||||||
|
if (declFir is FirClass<*>) {
|
||||||
|
for ((index, typeArgument) in fullyExpandedType.typeArguments.withIndex()) {
|
||||||
|
val paramVariance = (declFir.typeParameters.getOrNull(index) as? FirTypeParameter)?.variance ?: continue
|
||||||
|
|
||||||
|
val argVariance = when (typeArgument.kind) {
|
||||||
|
ProjectionKind.IN -> Variance.IN_VARIANCE
|
||||||
|
ProjectionKind.OUT -> Variance.OUT_VARIANCE
|
||||||
|
ProjectionKind.INVARIANT -> Variance.INVARIANT
|
||||||
|
else -> continue
|
||||||
|
}
|
||||||
|
|
||||||
|
val typeArgumentType = typeArgument.type ?: continue
|
||||||
|
|
||||||
|
val projectionKind = TypeCheckingProcedure.getEffectiveProjectionKind(paramVariance, argVariance)!!
|
||||||
|
val newVariance = when (projectionKind) {
|
||||||
|
TypeCheckingProcedure.EnrichedProjectionKind.OUT -> variance
|
||||||
|
TypeCheckingProcedure.EnrichedProjectionKind.IN -> variance.opposite()
|
||||||
|
TypeCheckingProcedure.EnrichedProjectionKind.INV -> Variance.INVARIANT
|
||||||
|
TypeCheckingProcedure.EnrichedProjectionKind.STAR -> null // CONFLICTING_PROJECTION error was reported
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newVariance != null) {
|
||||||
|
val subTypeRef = extractChildFirTypeRef(typeRef, index)
|
||||||
|
|
||||||
|
checkVarianceConflict(
|
||||||
|
typeArgumentType, newVariance, subTypeRef, containingType,
|
||||||
|
context, reporter,subTypeRef?.source ?: source,
|
||||||
|
fullyExpandedType != type
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun extractChildFirTypeRef(typeRef: FirTypeRef?, index: Int): FirTypeRef? {
|
||||||
|
if (typeRef is FirResolvedTypeRef) {
|
||||||
|
val delegatedTypeRef = typeRef.delegatedTypeRef
|
||||||
|
if (delegatedTypeRef is FirUserTypeRef) {
|
||||||
|
val typeArgument = delegatedTypeRef.qualifier[0].typeArgumentList.typeArguments.elementAtOrNull(index)
|
||||||
|
if (typeArgument is FirTypeProjectionWithVariance) {
|
||||||
|
return typeArgument.typeRef
|
||||||
|
}
|
||||||
|
} else if (delegatedTypeRef is FirFunctionTypeRef) {
|
||||||
|
if (index < delegatedTypeRef.valueParameters.size) {
|
||||||
|
return delegatedTypeRef.valueParameters.elementAt(index).returnTypeRef
|
||||||
|
}
|
||||||
|
if (index == delegatedTypeRef.valueParameters.size) {
|
||||||
|
return delegatedTypeRef.returnTypeRef
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
||||||
+16
-3
@@ -5,9 +5,8 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.fir.analysis.diagnostics
|
package org.jetbrains.kotlin.fir.analysis.diagnostics
|
||||||
|
|
||||||
import org.jetbrains.kotlin.diagnostics.rendering.DefaultErrorMessages
|
import org.jetbrains.kotlin.diagnostics.rendering.*
|
||||||
import org.jetbrains.kotlin.diagnostics.rendering.DiagnosticFactoryToRendererMap
|
import org.jetbrains.kotlin.diagnostics.rendering.Renderers.RENDER_POSITION_VARIANCE
|
||||||
import org.jetbrains.kotlin.diagnostics.rendering.LanguageFeatureMessageRenderer
|
|
||||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirDiagnosticRenderers.AMBIGUOUS_CALLS
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirDiagnosticRenderers.AMBIGUOUS_CALLS
|
||||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirDiagnosticRenderers.DECLARATION_NAME
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirDiagnosticRenderers.DECLARATION_NAME
|
||||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirDiagnosticRenderers.FIR
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirDiagnosticRenderers.FIR
|
||||||
@@ -300,6 +299,8 @@ import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.TYPE_PARAMETER_IN
|
|||||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.TYPE_PARAMETER_IS_NOT_AN_EXPRESSION
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.TYPE_PARAMETER_IS_NOT_AN_EXPRESSION
|
||||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.TYPE_PARAMETER_OF_PROPERTY_NOT_USED_IN_RECEIVER
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.TYPE_PARAMETER_OF_PROPERTY_NOT_USED_IN_RECEIVER
|
||||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.TYPE_PARAMETER_ON_LHS_OF_DOT
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.TYPE_PARAMETER_ON_LHS_OF_DOT
|
||||||
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.TYPE_VARIANCE_CONFLICT
|
||||||
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.TYPE_VARIANCE_CONFLICT_IN_EXPANDED_TYPE
|
||||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.UNEXPECTED_SAFE_CALL
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.UNEXPECTED_SAFE_CALL
|
||||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.UNINITIALIZED_ENUM_COMPANION
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.UNINITIALIZED_ENUM_COMPANION
|
||||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.UNINITIALIZED_ENUM_ENTRY
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.UNINITIALIZED_ENUM_ENTRY
|
||||||
@@ -347,6 +348,7 @@ import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.WRONG_MODIFIER_TA
|
|||||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.WRONG_NUMBER_OF_TYPE_ARGUMENTS
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.WRONG_NUMBER_OF_TYPE_ARGUMENTS
|
||||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.WRONG_SETTER_PARAMETER_TYPE
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.WRONG_SETTER_PARAMETER_TYPE
|
||||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.WRONG_SETTER_RETURN_TYPE
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.WRONG_SETTER_RETURN_TYPE
|
||||||
|
import org.jetbrains.kotlin.resolve.VarianceConflictDiagnosticData
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
class FirDefaultErrorMessages : DefaultErrorMessages.Extension {
|
class FirDefaultErrorMessages : DefaultErrorMessages.Extension {
|
||||||
@@ -625,6 +627,17 @@ class FirDefaultErrorMessages : DefaultErrorMessages.Extension {
|
|||||||
map.put(INCOMPATIBLE_TYPES, "Incompatible types: {0} and {1}", RENDER_TYPE, RENDER_TYPE)
|
map.put(INCOMPATIBLE_TYPES, "Incompatible types: {0} and {1}", RENDER_TYPE, RENDER_TYPE)
|
||||||
map.put(INCOMPATIBLE_TYPES_WARNING, "Potentially incompatible types: {0} and {1}", RENDER_TYPE, RENDER_TYPE)
|
map.put(INCOMPATIBLE_TYPES_WARNING, "Potentially incompatible types: {0} and {1}", RENDER_TYPE, RENDER_TYPE)
|
||||||
|
|
||||||
|
map.put(
|
||||||
|
TYPE_VARIANCE_CONFLICT,
|
||||||
|
"Type parameter {0} is declared as ''{1}'' but occurs in ''{2}'' position in type {3}",
|
||||||
|
SYMBOL, RENDER_POSITION_VARIANCE, RENDER_POSITION_VARIANCE, RENDER_TYPE
|
||||||
|
)
|
||||||
|
map.put(
|
||||||
|
TYPE_VARIANCE_CONFLICT_IN_EXPANDED_TYPE,
|
||||||
|
"Type parameter {0} is declared as ''{1}'' but occurs in ''{2}'' position in abbreviated type {3}",
|
||||||
|
SYMBOL, RENDER_POSITION_VARIANCE, RENDER_POSITION_VARIANCE, RENDER_TYPE
|
||||||
|
)
|
||||||
|
|
||||||
map.put(
|
map.put(
|
||||||
BOUNDS_NOT_ALLOWED_IF_BOUNDED_BY_TYPE_PARAMETER,
|
BOUNDS_NOT_ALLOWED_IF_BOUNDED_BY_TYPE_PARAMETER,
|
||||||
"Type parameter cannot have any other bounds if it's bounded by another type parameter"
|
"Type parameter cannot have any other bounds if it's bounded by another type parameter"
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import org.jetbrains.kotlin.fir.symbols.impl.FirTypeAliasSymbol
|
|||||||
import org.jetbrains.kotlin.fir.typeContext
|
import org.jetbrains.kotlin.fir.typeContext
|
||||||
import org.jetbrains.kotlin.fir.types.*
|
import org.jetbrains.kotlin.fir.types.*
|
||||||
import org.jetbrains.kotlin.fir.types.impl.ConeClassLikeTypeImpl
|
import org.jetbrains.kotlin.fir.types.impl.ConeClassLikeTypeImpl
|
||||||
|
import org.jetbrains.kotlin.fir.types.impl.ConeTypeParameterTypeImpl
|
||||||
import org.jetbrains.kotlin.fir.utils.WeakPair
|
import org.jetbrains.kotlin.fir.utils.WeakPair
|
||||||
import org.jetbrains.kotlin.fir.utils.component1
|
import org.jetbrains.kotlin.fir.utils.component1
|
||||||
import org.jetbrains.kotlin.fir.utils.component2
|
import org.jetbrains.kotlin.fir.utils.component2
|
||||||
@@ -93,8 +94,18 @@ private fun mapTypeAliasArguments(
|
|||||||
val type = (projection as? ConeKotlinTypeProjection)?.type ?: return null
|
val type = (projection as? ConeKotlinTypeProjection)?.type ?: return null
|
||||||
val symbol = (type as? ConeTypeParameterType)?.lookupTag?.symbol ?: return super.substituteArgument(projection)
|
val symbol = (type as? ConeTypeParameterType)?.lookupTag?.symbol ?: return super.substituteArgument(projection)
|
||||||
val mappedProjection = typeAliasMap[symbol] ?: return super.substituteArgument(projection)
|
val mappedProjection = typeAliasMap[symbol] ?: return super.substituteArgument(projection)
|
||||||
val mappedType = (mappedProjection as? ConeKotlinTypeProjection)?.type.updateNullabilityIfNeeded(type)
|
var mappedType = (mappedProjection as? ConeKotlinTypeProjection)?.type.updateNullabilityIfNeeded(type)
|
||||||
?: return mappedProjection
|
mappedType = when (mappedType) {
|
||||||
|
is ConeClassErrorType,
|
||||||
|
is ConeClassLikeTypeImpl,
|
||||||
|
is ConeDefinitelyNotNullType,
|
||||||
|
is ConeTypeParameterTypeImpl,
|
||||||
|
is ConeFlexibleType -> {
|
||||||
|
mappedType.withAttributes(type.attributes, useSiteSession.typeContext)
|
||||||
|
}
|
||||||
|
null -> return mappedProjection
|
||||||
|
else -> mappedType
|
||||||
|
}
|
||||||
|
|
||||||
return when (mappedProjection.kind + projection.kind) {
|
return when (mappedProjection.kind + projection.kind) {
|
||||||
ProjectionKind.STAR -> ConeStarProjection
|
ProjectionKind.STAR -> ConeStarProjection
|
||||||
|
|||||||
-14
@@ -1,14 +0,0 @@
|
|||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
|
||||||
class Outer<out E, in F> {
|
|
||||||
inner class Inner {
|
|
||||||
fun unsafe1(x: E) {}
|
|
||||||
fun unsafe2(x: Collection<E?>) {}
|
|
||||||
fun unsafe3(): F? = null
|
|
||||||
fun unsafe4(): Collection<F>? = null
|
|
||||||
}
|
|
||||||
|
|
||||||
// Should be errors
|
|
||||||
// Refinement of variance checker is needed
|
|
||||||
fun foo(x: Inner) {}
|
|
||||||
fun bar(): Inner? = null
|
|
||||||
}
|
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||||
class Outer<out E, in F> {
|
class Outer<out E, in F> {
|
||||||
inner class Inner {
|
inner class Inner {
|
||||||
|
|||||||
+2
-2
@@ -10,9 +10,9 @@ interface Super<out U> {
|
|||||||
}
|
}
|
||||||
// Related variance errors
|
// Related variance errors
|
||||||
class Owner<in T> {
|
class Owner<in T> {
|
||||||
inner class Inner<U : T>(val u: U) {
|
inner class Inner<U : <!TYPE_VARIANCE_CONFLICT!>T<!>>(val u: U) {
|
||||||
fun getT() = u
|
fun getT() = u
|
||||||
}
|
}
|
||||||
|
|
||||||
fun foo(arg: Inner<*>) = arg.getT()
|
<!TYPE_VARIANCE_CONFLICT!>fun foo(arg: Inner<*>)<!> = arg.getT()
|
||||||
}
|
}
|
||||||
@@ -10,8 +10,8 @@ typealias AOut<T> = Out<T>
|
|||||||
typealias AInvOut<T1, T2> = InvOut<T1, T2>
|
typealias AInvOut<T1, T2> = InvOut<T1, T2>
|
||||||
typealias AInvOutTT<T> = AInvOut<T, T>
|
typealias AInvOutTT<T> = AInvOut<T, T>
|
||||||
|
|
||||||
class Test1<out S> : A1<S>
|
class Test1<out S> : A1<<!TYPE_VARIANCE_CONFLICT_IN_EXPANDED_TYPE!>S<!>>
|
||||||
class Test2<out S> : A2<Any, S>
|
class Test2<out S> : A2<<!TYPE_VARIANCE_CONFLICT_IN_EXPANDED_TYPE!>Any<!>, S>
|
||||||
class Test3<out S> : AOut<S>
|
class Test3<out S> : AOut<S>
|
||||||
class Test4<out S> : AInvOut<S, S>
|
class Test4<out S> : AInvOut<<!TYPE_VARIANCE_CONFLICT_IN_EXPANDED_TYPE!>S<!>, S>
|
||||||
class Test5<out S> : AInvOutTT<S>
|
class Test5<out S> : AInvOutTT<<!TYPE_VARIANCE_CONFLICT_IN_EXPANDED_TYPE!>S<!>>
|
||||||
|
|||||||
@@ -7,5 +7,5 @@ typealias A4<E> = Out<Inv<E>>
|
|||||||
|
|
||||||
interface Q1<out S> : Out<A1<S>>
|
interface Q1<out S> : Out<A1<S>>
|
||||||
interface Q2<out S> : Out<A2<S>>
|
interface Q2<out S> : Out<A2<S>>
|
||||||
interface Q3<out S> : Out<A3<S>>
|
interface Q3<out S> : Out<A3<<!TYPE_VARIANCE_CONFLICT!>S<!>>>
|
||||||
interface Q4<out S> : Out<A4<S>>
|
interface Q4<out S> : Out<A4<<!TYPE_VARIANCE_CONFLICT!>S<!>>>
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
interface In<in T>
|
|
||||||
interface Out<out T>
|
|
||||||
interface Inv<T>
|
|
||||||
|
|
||||||
interface TypeBounds1<in I, out O, P, X : I>
|
|
||||||
interface TypeBounds2<in I, out O, P, X : O>
|
|
||||||
interface TypeBounds3<in I, out O, P, X : P>
|
|
||||||
interface TypeBounds4<in I, out O, P, X : In<I>>
|
|
||||||
interface TypeBounds5<in I, out O, P, X : In<O>>
|
|
||||||
|
|
||||||
interface WhereTypeBounds1<in I, out O, P, X> where X : I
|
|
||||||
interface WhereTypeBounds2<in I, out O, P, X> where X : O
|
|
||||||
interface WhereTypeBounds3<in I, out O, P, X> where X : P
|
|
||||||
interface WhereTypeBounds4<in I, out O, P, X> where X : In<I>
|
|
||||||
interface WhereTypeBounds5<in I, out O, P, X> where X : In<O>
|
|
||||||
|
|
||||||
class SubClass1<in I, out O, P> : Out<I>
|
|
||||||
class SubClass2<in I, out O, P> : Out<O>
|
|
||||||
class SubClass3<in I, out O, P> : Out<P>
|
|
||||||
class SubClass4<in I, out O, P> : In<I>
|
|
||||||
class SubClass5<in I, out O, P> : In<O>
|
|
||||||
class SubClass6<in I, out O, P> : Inv<O>
|
|
||||||
class SubClass7<in I, out O, P> : Inv<I>
|
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
interface In<in T>
|
interface In<in T>
|
||||||
interface Out<out T>
|
interface Out<out T>
|
||||||
interface Inv<T>
|
interface Inv<T>
|
||||||
|
|||||||
@@ -1,34 +0,0 @@
|
|||||||
interface In<in T>
|
|
||||||
interface Out<out T>
|
|
||||||
interface Inv<T>
|
|
||||||
fun <T> getT(): T = null!!
|
|
||||||
|
|
||||||
interface Test<in I, out O, P> {
|
|
||||||
fun parameters1(i: I, o: O, p: P)
|
|
||||||
fun parameters2(i: In<I>)
|
|
||||||
fun parameters3(i: In<O>)
|
|
||||||
|
|
||||||
fun explicitReturnType1() : I
|
|
||||||
fun explicitReturnType2() : O
|
|
||||||
fun explicitReturnType3() : P
|
|
||||||
fun explicitReturnType4() : In<I>
|
|
||||||
fun explicitReturnType5() : In<O>
|
|
||||||
|
|
||||||
fun imlicitReturnType1() = getT<I>()
|
|
||||||
fun imlicitReturnType2() = getT<O>()
|
|
||||||
fun imlicitReturnType3() = getT<P>()
|
|
||||||
fun imlicitReturnType4() = getT<In<I>>()
|
|
||||||
fun imlicitReturnType5() = getT<In<O>>()
|
|
||||||
|
|
||||||
fun I.receiver1()
|
|
||||||
fun O.receiver2()
|
|
||||||
fun P.receiver3()
|
|
||||||
fun In<I>.receiver4()
|
|
||||||
fun In<O>.receiver5()
|
|
||||||
|
|
||||||
fun <X : I> typeParameter1()
|
|
||||||
fun <X : O> typeParameter2()
|
|
||||||
fun <X : P> typeParameter3()
|
|
||||||
fun <X : In<I>> typeParameter4()
|
|
||||||
fun <X : In<O>> typeParameter5()
|
|
||||||
}
|
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
interface In<in T>
|
interface In<in T>
|
||||||
interface Out<out T>
|
interface Out<out T>
|
||||||
interface Inv<T>
|
interface Inv<T>
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
interface In<in T>
|
|
||||||
fun <T> getT(): T = null!!
|
|
||||||
|
|
||||||
interface Test<in I, out O, P> {
|
|
||||||
fun ok1(i: (O) -> I) : (I) -> O
|
|
||||||
fun ok2(i: (P) -> P) : (P) -> P
|
|
||||||
fun ok3(i: (In<I>) -> In<O>) = getT<(In<O>) -> In<I>>()
|
|
||||||
|
|
||||||
fun neOk1(i: (I) -> O): (O) -> I
|
|
||||||
fun neOk2(i: (In<O>) -> In<I>)
|
|
||||||
fun neOk3() = getT<(In<I>) -> In<O>>()
|
|
||||||
}
|
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
interface In<in T>
|
interface In<in T>
|
||||||
fun <T> getT(): T = null!!
|
fun <T> getT(): T = null!!
|
||||||
|
|
||||||
|
|||||||
+12
-12
@@ -27,22 +27,22 @@ interface Test<in I, out O, P> {
|
|||||||
fun Ok22(i: Inv<out I>)
|
fun Ok22(i: Inv<out I>)
|
||||||
fun Ok23(i: Inv<out P>)
|
fun Ok23(i: Inv<out P>)
|
||||||
|
|
||||||
fun neOk1(i: O)
|
fun neOk1(i: <!TYPE_VARIANCE_CONFLICT("O; out; in; O")!>O<!>)
|
||||||
fun neOk2(i: In<I>)
|
fun neOk2(i: In<<!TYPE_VARIANCE_CONFLICT("I; in; out; In<I>")!>I<!>>)
|
||||||
fun neOk3(i: In<In<O>>)
|
fun neOk3(i: In<In<<!TYPE_VARIANCE_CONFLICT("O; out; in; In<In<O>>")!>O<!>>>)
|
||||||
fun neOk4(i: Inv<I>)
|
fun neOk4(i: Inv<<!TYPE_VARIANCE_CONFLICT("I; in; invariant; Inv<I>")!>I<!>>)
|
||||||
fun neOk5(i: Inv<O>)
|
fun neOk5(i: Inv<<!TYPE_VARIANCE_CONFLICT("O; out; invariant; Inv<O>")!>O<!>>)
|
||||||
fun neOk6(i: In<In<O>>)
|
fun neOk6(i: In<In<<!TYPE_VARIANCE_CONFLICT("O; out; in; In<In<O>>")!>O<!>>>)
|
||||||
fun neOk7(i: Pair<In<I>, O>)
|
fun neOk7(i: Pair<In<<!TYPE_VARIANCE_CONFLICT("I; in; out; Pair<In<I>, O>")!>I<!>>, <!TYPE_VARIANCE_CONFLICT("O; out; in; Pair<In<I>, O>")!>O<!>>)
|
||||||
fun neOk8(i: Inv<out O>)
|
fun neOk8(i: Inv<out <!TYPE_VARIANCE_CONFLICT("O; out; in; Inv<out O>")!>O<!>>)
|
||||||
fun neOk9(i: <!CONFLICTING_PROJECTION!>In<out P><!>)
|
fun neOk9(i: <!CONFLICTING_PROJECTION!>In<out P><!>)
|
||||||
fun neOk10(i: Out<O>)
|
fun neOk10(i: Out<<!TYPE_VARIANCE_CONFLICT("O; out; in; Out<O>")!>O<!>>)
|
||||||
|
|
||||||
fun neOk11(i: Inv<in I>)
|
fun neOk11(i: Inv<in <!TYPE_VARIANCE_CONFLICT("I; in; out; Inv<in I>")!>I<!>>)
|
||||||
fun neOk12(i: Inv<out O>)
|
fun neOk12(i: Inv<out <!TYPE_VARIANCE_CONFLICT("O; out; in; Inv<out O>")!>O<!>>)
|
||||||
|
|
||||||
fun neOk30(i: <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Pair<O, ><!>)
|
fun neOk30(i: <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Pair<O, ><!>)
|
||||||
fun neOk31(i: Pair<O, <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Inv<!>>)
|
fun neOk31(i: Pair<<!TYPE_VARIANCE_CONFLICT("O; out; in; Pair<O, ERROR CLASS: Wrong number of type arguments>")!>O<!>, <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Inv<!>>)
|
||||||
fun neOk32(i: <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Inv<!>)
|
fun neOk32(i: <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Inv<!>)
|
||||||
fun neOk33(i: Inv<<!SYNTAX!><!>>)
|
fun neOk33(i: Inv<<!SYNTAX!><!>>)
|
||||||
fun neOk34(i: Inv<<!UNRESOLVED_REFERENCE!>C<!>>)
|
fun neOk34(i: Inv<<!UNRESOLVED_REFERENCE!>C<!>>)
|
||||||
|
|||||||
@@ -14,32 +14,32 @@ interface Test<in I, out O, P> {
|
|||||||
var ok6: Inv<in P>
|
var ok6: Inv<in P>
|
||||||
var ok7: Inv<out P>
|
var ok7: Inv<out P>
|
||||||
|
|
||||||
var neOk1: O
|
var neOk1: <!TYPE_VARIANCE_CONFLICT("O; out; invariant; O")!>O<!>
|
||||||
var neOk2: In<I>
|
var neOk2: In<<!TYPE_VARIANCE_CONFLICT("I; in; invariant; In<I>")!>I<!>>
|
||||||
var neOk3: In<In<O>>
|
var neOk3: In<In<<!TYPE_VARIANCE_CONFLICT("O; out; invariant; In<In<O>>")!>O<!>>>
|
||||||
var neOk4: Inv<I>
|
var neOk4: Inv<<!TYPE_VARIANCE_CONFLICT("I; in; invariant; Inv<I>")!>I<!>>
|
||||||
var neOk5: Inv<O>
|
var neOk5: Inv<<!TYPE_VARIANCE_CONFLICT("O; out; invariant; Inv<O>")!>O<!>>
|
||||||
var neOk6: In<In<O>>
|
var neOk6: In<In<<!TYPE_VARIANCE_CONFLICT("O; out; invariant; In<In<O>>")!>O<!>>>
|
||||||
var neOk7: Pair<In<I>, O>
|
var neOk7: Pair<In<<!TYPE_VARIANCE_CONFLICT("I; in; invariant; Pair<In<I>, O>")!>I<!>>, <!TYPE_VARIANCE_CONFLICT("O; out; invariant; Pair<In<I>, O>")!>O<!>>
|
||||||
var neOk8: Inv<in O>
|
var neOk8: Inv<in <!TYPE_VARIANCE_CONFLICT("O; out; invariant; Inv<in O>")!>O<!>>
|
||||||
var neOk9: Inv<in I>
|
var neOk9: Inv<in <!TYPE_VARIANCE_CONFLICT("I; in; invariant; Inv<in I>")!>I<!>>
|
||||||
var neOk10: <!CONFLICTING_PROJECTION!>In<out I><!>
|
var neOk10: <!CONFLICTING_PROJECTION!>In<out I><!>
|
||||||
|
|
||||||
var neOk11: I
|
var neOk11: <!TYPE_VARIANCE_CONFLICT("I; in; invariant; I")!>I<!>
|
||||||
var neOk12: In<O>
|
var neOk12: In<<!TYPE_VARIANCE_CONFLICT("O; out; invariant; In<O>")!>O<!>>
|
||||||
var neOk13: In<In<I>>
|
var neOk13: In<In<<!TYPE_VARIANCE_CONFLICT("I; in; invariant; In<In<I>>")!>I<!>>>
|
||||||
var neOk14: Out<I>
|
var neOk14: Out<<!TYPE_VARIANCE_CONFLICT("I; in; invariant; Out<I>")!>I<!>>
|
||||||
var neOk15: Out<Out<I>>
|
var neOk15: Out<Out<<!TYPE_VARIANCE_CONFLICT("I; in; invariant; Out<Out<I>>")!>I<!>>>
|
||||||
var neOk16: Out<In<O>>
|
var neOk16: Out<In<<!TYPE_VARIANCE_CONFLICT("O; out; invariant; Out<In<O>>")!>O<!>>>
|
||||||
var neOk17: Pair<In<O>, I>
|
var neOk17: Pair<In<<!TYPE_VARIANCE_CONFLICT("O; out; invariant; Pair<In<O>, I>")!>O<!>>, <!TYPE_VARIANCE_CONFLICT("I; in; invariant; Pair<In<O>, I>")!>I<!>>
|
||||||
|
|
||||||
var neOk20: Inv<in O>
|
var neOk20: Inv<in <!TYPE_VARIANCE_CONFLICT("O; out; invariant; Inv<in O>")!>O<!>>
|
||||||
var neOk21: Inv<in I>
|
var neOk21: Inv<in <!TYPE_VARIANCE_CONFLICT("I; in; invariant; Inv<in I>")!>I<!>>
|
||||||
var neOk22: Inv<out O>
|
var neOk22: Inv<out <!TYPE_VARIANCE_CONFLICT("O; out; invariant; Inv<out O>")!>O<!>>
|
||||||
var neOk23: Inv<out I>
|
var neOk23: Inv<out <!TYPE_VARIANCE_CONFLICT("I; in; invariant; Inv<out I>")!>I<!>>
|
||||||
|
|
||||||
var neOk30: <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Pair<I, ><!>
|
var neOk30: <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Pair<I, ><!>
|
||||||
var neOk31: Pair<I, <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Inv<!>>
|
var neOk31: Pair<<!TYPE_VARIANCE_CONFLICT("I; in; invariant; Pair<I, ERROR CLASS: Wrong number of type arguments>")!>I<!>, <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Inv<!>>
|
||||||
var neOk32: <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Inv<!>
|
var neOk32: <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Inv<!>
|
||||||
var neOk33: Inv<<!SYNTAX!><!>>
|
var neOk33: Inv<<!SYNTAX!><!>>
|
||||||
var neOk34: Inv<<!UNRESOLVED_REFERENCE!>C<!>>
|
var neOk34: Inv<<!UNRESOLVED_REFERENCE!>C<!>>
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
interface In<in I>
|
|
||||||
interface Out<out O>
|
|
||||||
interface Inv<P>
|
|
||||||
fun <T> getT(): T = null!!
|
|
||||||
|
|
||||||
|
|
||||||
interface Test<in I : Any, out O : Any, P : Any> {
|
|
||||||
fun ok1(i: I?) : O?
|
|
||||||
fun ok2(i: In<O?>?) : Out<O?>?
|
|
||||||
fun ok3(i: Inv<in O?>) = getT<Inv<in I?>>()
|
|
||||||
|
|
||||||
fun neOk1(i: O?) : I?
|
|
||||||
fun neOk(i: Out<O?>?) : In<O?>?
|
|
||||||
fun neOk3(i: Inv<in I?>)
|
|
||||||
fun neOk4() = getT<Inv<in O?>?>()
|
|
||||||
}
|
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
interface In<in I>
|
interface In<in I>
|
||||||
interface Out<out O>
|
interface Out<out O>
|
||||||
interface Inv<P>
|
interface Inv<P>
|
||||||
|
|||||||
+10
-10
@@ -21,20 +21,20 @@ interface Test<in I, out O, P> {
|
|||||||
fun ok12(): Inv<in P>
|
fun ok12(): Inv<in P>
|
||||||
fun ok13(): Inv<out P>
|
fun ok13(): Inv<out P>
|
||||||
|
|
||||||
fun neOk1(): I
|
fun neOk1(): <!TYPE_VARIANCE_CONFLICT!>I<!>
|
||||||
fun neOk2(): In<O>
|
fun neOk2(): In<<!TYPE_VARIANCE_CONFLICT!>O<!>>
|
||||||
fun neOk3(): In<In<I>>
|
fun neOk3(): In<In<<!TYPE_VARIANCE_CONFLICT!>I<!>>>
|
||||||
fun neOk4(): Inv<I>
|
fun neOk4(): Inv<<!TYPE_VARIANCE_CONFLICT!>I<!>>
|
||||||
fun neOk5(): Inv<O>
|
fun neOk5(): Inv<<!TYPE_VARIANCE_CONFLICT!>O<!>>
|
||||||
fun neOk6(): Pair<In<O>, I>
|
fun neOk6(): Pair<In<<!TYPE_VARIANCE_CONFLICT!>O<!>>, <!TYPE_VARIANCE_CONFLICT!>I<!>>
|
||||||
fun neOk7(): Inv<in O>
|
fun neOk7(): Inv<in <!TYPE_VARIANCE_CONFLICT!>O<!>>
|
||||||
fun neOk8(): <!CONFLICTING_PROJECTION!>Out<in I><!>
|
fun neOk8(): <!CONFLICTING_PROJECTION!>Out<in I><!>
|
||||||
|
|
||||||
fun neOk10(): Inv<in O>
|
fun neOk10(): Inv<in <!TYPE_VARIANCE_CONFLICT!>O<!>>
|
||||||
fun neOk11(): Inv<out I>
|
fun neOk11(): Inv<out <!TYPE_VARIANCE_CONFLICT!>I<!>>
|
||||||
|
|
||||||
fun neOk30(): <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Pair<I, ><!>
|
fun neOk30(): <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Pair<I, ><!>
|
||||||
fun neOk31(): Pair<I, <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Inv<!>>
|
fun neOk31(): Pair<<!TYPE_VARIANCE_CONFLICT!>I<!>, <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Inv<!>>
|
||||||
fun neOk32(): <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Inv<!>
|
fun neOk32(): <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Inv<!>
|
||||||
fun neOk33(): Inv<<!SYNTAX!><!>>
|
fun neOk33(): Inv<<!SYNTAX!><!>>
|
||||||
fun neOk34(): Inv<<!UNRESOLVED_REFERENCE!>C<!>>
|
fun neOk34(): Inv<<!UNRESOLVED_REFERENCE!>C<!>>
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
interface In<in T>
|
|
||||||
interface Out<out T>
|
|
||||||
interface Inv<T>
|
|
||||||
|
|
||||||
fun <T> getT(): T = null!!
|
|
||||||
|
|
||||||
class Test<in I, out O, P>(
|
|
||||||
val type1: I,
|
|
||||||
val type2: O,
|
|
||||||
val type3: P,
|
|
||||||
val type4: In<I>,
|
|
||||||
val type5: In<O>,
|
|
||||||
|
|
||||||
var type6: I,
|
|
||||||
var type7: O,
|
|
||||||
var type8: P,
|
|
||||||
var type9: In<I>,
|
|
||||||
var type0: In<O>,
|
|
||||||
|
|
||||||
type11: I,
|
|
||||||
type12: O,
|
|
||||||
type13: P,
|
|
||||||
type14: In<I>,
|
|
||||||
type15: In<O>
|
|
||||||
)
|
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
interface In<in T>
|
interface In<in T>
|
||||||
interface Out<out T>
|
interface Out<out T>
|
||||||
interface Inv<T>
|
interface Inv<T>
|
||||||
|
|||||||
@@ -1,50 +0,0 @@
|
|||||||
import kotlin.reflect.KProperty
|
|
||||||
|
|
||||||
interface In<in T>
|
|
||||||
interface Out<out T>
|
|
||||||
interface Inv<T>
|
|
||||||
|
|
||||||
class Delegate<T> {
|
|
||||||
operator fun getValue(t: Any, p: KProperty<*>): T = null!!
|
|
||||||
operator fun setValue(t: Any, p: KProperty<*>, value: T) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun <T> getT(): T = null!!
|
|
||||||
|
|
||||||
abstract class Test<in I, out O, P> {
|
|
||||||
abstract val type1: I
|
|
||||||
abstract val type2: O
|
|
||||||
abstract val type3: P
|
|
||||||
abstract val type4: In<I>
|
|
||||||
abstract val type5: In<O>
|
|
||||||
|
|
||||||
val implicitType1 = getT<I>()
|
|
||||||
val implicitType2 = getT<O>()
|
|
||||||
val implicitType3 = getT<P>()
|
|
||||||
val implicitType4 = getT<In<I>>()
|
|
||||||
val implicitType5 = getT<In<O>>()
|
|
||||||
|
|
||||||
val delegateType1 by Delegate<I>()
|
|
||||||
val delegateType2 by Delegate<O>()
|
|
||||||
val delegateType3 by Delegate<P>()
|
|
||||||
val delegateType4 by Delegate<In<I>>()
|
|
||||||
val delegateType5 by Delegate<In<O>>()
|
|
||||||
|
|
||||||
abstract val I.receiver1: Int
|
|
||||||
abstract val O.receiver2: Int
|
|
||||||
abstract val P.receiver3: Int
|
|
||||||
abstract val In<I>.receiver4: Int
|
|
||||||
abstract val In<O>.receiver5: Int
|
|
||||||
|
|
||||||
val <X : I> X.typeParameter1: Int get() = 0
|
|
||||||
val <X : O> X.typeParameter2: Int get() = 0
|
|
||||||
val <X : P> X.typeParameter3: Int get() = 0
|
|
||||||
val <X : In<I>> X.typeParameter4: Int get() = 0
|
|
||||||
val <X : In<O>> X.typeParameter5: Int get() = 0
|
|
||||||
|
|
||||||
val <X> X.typeParameter6: Int where X : I get() = 0
|
|
||||||
val <X> X.typeParameter7: Int where X : O get() = 0
|
|
||||||
val <X> X.typeParameter8: Int where X : P get() = 0
|
|
||||||
val <X> X.typeParameter9: Int where X : In<I> get() = 0
|
|
||||||
val <X> X.typeParameter0: Int where X : In<O> get() = 0
|
|
||||||
}
|
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
import kotlin.reflect.KProperty
|
import kotlin.reflect.KProperty
|
||||||
|
|
||||||
interface In<in T>
|
interface In<in T>
|
||||||
|
|||||||
@@ -1,50 +0,0 @@
|
|||||||
import kotlin.reflect.KProperty
|
|
||||||
|
|
||||||
interface In<in T>
|
|
||||||
interface Out<out T>
|
|
||||||
interface Inv<T>
|
|
||||||
|
|
||||||
class Delegate<T> {
|
|
||||||
operator fun getValue(t: Any, p: KProperty<*>): T = null!!
|
|
||||||
operator fun setValue(t: Any, p: KProperty<*>, varue: T) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun <T> getT(): T = null!!
|
|
||||||
|
|
||||||
abstract class Test<in I, out O, P> {
|
|
||||||
abstract var type1: I
|
|
||||||
abstract var type2: O
|
|
||||||
abstract var type3: P
|
|
||||||
abstract var type4: In<I>
|
|
||||||
abstract var type5: In<O>
|
|
||||||
|
|
||||||
var implicitType1 = getT<I>()
|
|
||||||
var implicitType2 = getT<O>()
|
|
||||||
var implicitType3 = getT<P>()
|
|
||||||
var implicitType4 = getT<In<I>>()
|
|
||||||
var implicitType5 = getT<In<O>>()
|
|
||||||
|
|
||||||
var delegateType1 by Delegate<I>()
|
|
||||||
var delegateType2 by Delegate<O>()
|
|
||||||
var delegateType3 by Delegate<P>()
|
|
||||||
var delegateType4 by Delegate<In<I>>()
|
|
||||||
var delegateType5 by Delegate<In<O>>()
|
|
||||||
|
|
||||||
abstract var I.receiver1: Int
|
|
||||||
abstract var O.receiver2: Int
|
|
||||||
abstract var P.receiver3: Int
|
|
||||||
abstract var In<I>.receiver4: Int
|
|
||||||
abstract var In<O>.receiver5: Int
|
|
||||||
|
|
||||||
var <X : I> X.typeParameter1: Int get() = 0; set(i) {}
|
|
||||||
var <X : O> X.typeParameter2: Int get() = 0; set(i) {}
|
|
||||||
var <X : P> X.typeParameter3: Int get() = 0; set(i) {}
|
|
||||||
var <X : In<I>> X.typeParameter4: Int get() = 0; set(i) {}
|
|
||||||
var <X : In<O>> X.typeParameter5: Int get() = 0; set(i) {}
|
|
||||||
|
|
||||||
var <X> X.typeParameter6: Int where X : I get() = 0; set(i) {}
|
|
||||||
var <X> X.typeParameter7: Int where X : O get() = 0; set(i) {}
|
|
||||||
var <X> X.typeParameter8: Int where X : P get() = 0; set(i) {}
|
|
||||||
var <X> X.typeParameter9: Int where X : In<I> get() = 0; set(i) {}
|
|
||||||
var <X> X.typeParameter0: Int where X : In<O> get() = 0; set(i) {}
|
|
||||||
}
|
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
import kotlin.reflect.KProperty
|
import kotlin.reflect.KProperty
|
||||||
|
|
||||||
interface In<in T>
|
interface In<in T>
|
||||||
|
|||||||
@@ -1,20 +1,20 @@
|
|||||||
interface Test<in I, out O> {
|
interface Test<in I, out O> {
|
||||||
val internal_val: I
|
val internal_val: <!TYPE_VARIANCE_CONFLICT!>I<!>
|
||||||
public val public_val: I
|
public val public_val: <!TYPE_VARIANCE_CONFLICT!>I<!>
|
||||||
protected val protected_val: I
|
protected val protected_val: <!TYPE_VARIANCE_CONFLICT!>I<!>
|
||||||
<!PRIVATE_PROPERTY_IN_INTERFACE!>private<!> val private_val: I
|
<!PRIVATE_PROPERTY_IN_INTERFACE!>private<!> val private_val: I
|
||||||
|
|
||||||
var interlan_private_set: O
|
var interlan_private_set: <!TYPE_VARIANCE_CONFLICT!>O<!>
|
||||||
<!PRIVATE_SETTER_FOR_ABSTRACT_PROPERTY!>private<!> set
|
<!PRIVATE_SETTER_FOR_ABSTRACT_PROPERTY!>private<!> set
|
||||||
public var public_private_set: O
|
public var public_private_set: <!TYPE_VARIANCE_CONFLICT!>O<!>
|
||||||
<!PRIVATE_SETTER_FOR_ABSTRACT_PROPERTY!>private<!> set
|
<!PRIVATE_SETTER_FOR_ABSTRACT_PROPERTY!>private<!> set
|
||||||
protected var protected_private_set: O
|
protected var protected_private_set: <!TYPE_VARIANCE_CONFLICT!>O<!>
|
||||||
<!PRIVATE_SETTER_FOR_ABSTRACT_PROPERTY!>private<!> set
|
<!PRIVATE_SETTER_FOR_ABSTRACT_PROPERTY!>private<!> set
|
||||||
<!PRIVATE_PROPERTY_IN_INTERFACE!>private<!> var private_private_set: O
|
<!PRIVATE_PROPERTY_IN_INTERFACE!>private<!> var private_private_set: O
|
||||||
private set
|
private set
|
||||||
|
|
||||||
fun internal_fun(i: O) : I
|
fun internal_fun(i: <!TYPE_VARIANCE_CONFLICT!>O<!>) : <!TYPE_VARIANCE_CONFLICT!>I<!>
|
||||||
public fun public_fun(i: O) : I
|
public fun public_fun(i: <!TYPE_VARIANCE_CONFLICT!>O<!>) : <!TYPE_VARIANCE_CONFLICT!>I<!>
|
||||||
protected fun protected_fun(i: O) : I
|
protected fun protected_fun(i: <!TYPE_VARIANCE_CONFLICT!>O<!>) : <!TYPE_VARIANCE_CONFLICT!>I<!>
|
||||||
<!PRIVATE_FUNCTION_WITH_NO_BODY!>private<!> fun private_fun(i: O) : I
|
<!PRIVATE_FUNCTION_WITH_NO_BODY!>private<!> fun private_fun(i: O) : I
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -143,6 +143,13 @@ public class TypeCheckingProcedure {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static EnrichedProjectionKind getEffectiveProjectionKind(
|
||||||
|
@NotNull TypeParameterDescriptor typeParameter,
|
||||||
|
@NotNull TypeProjection typeArgument
|
||||||
|
) {
|
||||||
|
return getEffectiveProjectionKind(typeParameter.getVariance(), typeArgument.getProjectionKind());
|
||||||
|
}
|
||||||
|
|
||||||
// If class C<out T> then C<T> and C<out T> mean the same
|
// If class C<out T> then C<T> and C<out T> mean the same
|
||||||
// out * out = out
|
// out * out = out
|
||||||
// out * in = *
|
// out * in = *
|
||||||
@@ -156,11 +163,11 @@ public class TypeCheckingProcedure {
|
|||||||
// inv * in = out
|
// inv * in = out
|
||||||
// inv * inv = inv
|
// inv * inv = inv
|
||||||
public static EnrichedProjectionKind getEffectiveProjectionKind(
|
public static EnrichedProjectionKind getEffectiveProjectionKind(
|
||||||
@NotNull TypeParameterDescriptor typeParameter,
|
@NotNull Variance typeParameterVariance,
|
||||||
@NotNull TypeProjection typeArgument
|
@NotNull Variance typeArgumentVariance
|
||||||
) {
|
) {
|
||||||
Variance a = typeParameter.getVariance();
|
Variance a = typeParameterVariance;
|
||||||
Variance b = typeArgument.getProjectionKind();
|
Variance b = typeArgumentVariance;
|
||||||
|
|
||||||
// If they are not both invariant, let's make b not invariant for sure
|
// If they are not both invariant, let's make b not invariant for sure
|
||||||
if (b == INVARIANT) {
|
if (b == INVARIANT) {
|
||||||
|
|||||||
+8
-1
@@ -28,6 +28,7 @@ import org.jetbrains.kotlin.lexer.KtModifierKeywordToken
|
|||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
import org.jetbrains.kotlin.psi.KtExpression
|
import org.jetbrains.kotlin.psi.KtExpression
|
||||||
import org.jetbrains.kotlin.resolve.ForbiddenNamedArgumentsTarget
|
import org.jetbrains.kotlin.resolve.ForbiddenNamedArgumentsTarget
|
||||||
|
import org.jetbrains.kotlin.types.Variance
|
||||||
import kotlin.reflect.KClass
|
import kotlin.reflect.KClass
|
||||||
import kotlin.reflect.KType
|
import kotlin.reflect.KType
|
||||||
import kotlin.reflect.full.createType
|
import kotlin.reflect.full.createType
|
||||||
@@ -188,6 +189,11 @@ private object FirToKtConversionCreator {
|
|||||||
KtTypeParameterSymbol::class.createType(),
|
KtTypeParameterSymbol::class.createType(),
|
||||||
importsToAdd = listOf("org.jetbrains.kotlin.fir.declarations.FirTypeParameter")
|
importsToAdd = listOf("org.jetbrains.kotlin.fir.declarations.FirTypeParameter")
|
||||||
),
|
),
|
||||||
|
FirTypeParameter::class to HLFunctionCallConversion(
|
||||||
|
"firSymbolBuilder.classifierBuilder.buildTypeParameterSymbol({0}.fir)",
|
||||||
|
KtTypeParameterSymbol::class.createType(),
|
||||||
|
importsToAdd = listOf("org.jetbrains.kotlin.fir.declarations.FirTypeParameter")
|
||||||
|
),
|
||||||
ConeKotlinType::class to HLFunctionCallConversion(
|
ConeKotlinType::class to HLFunctionCallConversion(
|
||||||
"firSymbolBuilder.typeBuilder.buildKtType({0})",
|
"firSymbolBuilder.typeBuilder.buildKtType({0})",
|
||||||
KtType::class.createType()
|
KtType::class.createType()
|
||||||
@@ -215,7 +221,7 @@ private object FirToKtConversionCreator {
|
|||||||
"firSymbolBuilder.functionLikeBuilder.buildFunctionSymbol({0}.fir)",
|
"firSymbolBuilder.functionLikeBuilder.buildFunctionSymbol({0}.fir)",
|
||||||
KtFunctionLikeSymbol::class.createType(),
|
KtFunctionLikeSymbol::class.createType(),
|
||||||
importsToAdd = listOf("org.jetbrains.kotlin.fir.declarations.FirSimpleFunction")
|
importsToAdd = listOf("org.jetbrains.kotlin.fir.declarations.FirSimpleFunction")
|
||||||
),
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
private val allowedTypesWithoutTypeParams = setOf(
|
private val allowedTypesWithoutTypeParams = setOf(
|
||||||
@@ -231,6 +237,7 @@ private object FirToKtConversionCreator {
|
|||||||
ForbiddenNamedArgumentsTarget::class,
|
ForbiddenNamedArgumentsTarget::class,
|
||||||
LanguageFeature::class,
|
LanguageFeature::class,
|
||||||
LanguageVersionSettings::class,
|
LanguageVersionSettings::class,
|
||||||
|
Variance::class
|
||||||
)
|
)
|
||||||
|
|
||||||
private val KType.kClass: KClass<*>
|
private val KType.kClass: KClass<*>
|
||||||
|
|||||||
+20
@@ -1333,6 +1333,26 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert
|
|||||||
token,
|
token,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
add(FirErrors.TYPE_VARIANCE_CONFLICT) { firDiagnostic ->
|
||||||
|
TypeVarianceConflictImpl(
|
||||||
|
firSymbolBuilder.classifierBuilder.buildTypeParameterSymbol(firDiagnostic.a.fir),
|
||||||
|
firDiagnostic.b,
|
||||||
|
firDiagnostic.c,
|
||||||
|
firSymbolBuilder.typeBuilder.buildKtType(firDiagnostic.d),
|
||||||
|
firDiagnostic as FirPsiDiagnostic<*>,
|
||||||
|
token,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
add(FirErrors.TYPE_VARIANCE_CONFLICT_IN_EXPANDED_TYPE) { firDiagnostic ->
|
||||||
|
TypeVarianceConflictInExpandedTypeImpl(
|
||||||
|
firSymbolBuilder.classifierBuilder.buildTypeParameterSymbol(firDiagnostic.a.fir),
|
||||||
|
firDiagnostic.b,
|
||||||
|
firDiagnostic.c,
|
||||||
|
firSymbolBuilder.typeBuilder.buildKtType(firDiagnostic.d),
|
||||||
|
firDiagnostic as FirPsiDiagnostic<*>,
|
||||||
|
token,
|
||||||
|
)
|
||||||
|
}
|
||||||
add(FirErrors.EXTENSION_IN_CLASS_REFERENCE_NOT_ALLOWED) { firDiagnostic ->
|
add(FirErrors.EXTENSION_IN_CLASS_REFERENCE_NOT_ALLOWED) { firDiagnostic ->
|
||||||
ExtensionInClassReferenceNotAllowedImpl(
|
ExtensionInClassReferenceNotAllowedImpl(
|
||||||
firSymbolBuilder.callableBuilder.buildCallableSymbol(firDiagnostic.a as FirCallableDeclaration),
|
firSymbolBuilder.callableBuilder.buildCallableSymbol(firDiagnostic.a as FirCallableDeclaration),
|
||||||
|
|||||||
+17
@@ -57,6 +57,7 @@ import org.jetbrains.kotlin.psi.KtValueArgument
|
|||||||
import org.jetbrains.kotlin.psi.KtWhenEntry
|
import org.jetbrains.kotlin.psi.KtWhenEntry
|
||||||
import org.jetbrains.kotlin.psi.KtWhenExpression
|
import org.jetbrains.kotlin.psi.KtWhenExpression
|
||||||
import org.jetbrains.kotlin.resolve.ForbiddenNamedArgumentsTarget
|
import org.jetbrains.kotlin.resolve.ForbiddenNamedArgumentsTarget
|
||||||
|
import org.jetbrains.kotlin.types.Variance
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file was generated automatically
|
* This file was generated automatically
|
||||||
@@ -939,6 +940,22 @@ sealed class KtFirDiagnostic<PSI: PsiElement> : KtDiagnosticWithPsi<PSI> {
|
|||||||
abstract val typeB: KtType
|
abstract val typeB: KtType
|
||||||
}
|
}
|
||||||
|
|
||||||
|
abstract class TypeVarianceConflict : KtFirDiagnostic<PsiElement>() {
|
||||||
|
override val diagnosticClass get() = TypeVarianceConflict::class
|
||||||
|
abstract val typeParameter: KtTypeParameterSymbol
|
||||||
|
abstract val typeParameterVariance: Variance
|
||||||
|
abstract val variance: Variance
|
||||||
|
abstract val containingType: KtType
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class TypeVarianceConflictInExpandedType : KtFirDiagnostic<PsiElement>() {
|
||||||
|
override val diagnosticClass get() = TypeVarianceConflictInExpandedType::class
|
||||||
|
abstract val typeParameter: KtTypeParameterSymbol
|
||||||
|
abstract val typeParameterVariance: Variance
|
||||||
|
abstract val variance: Variance
|
||||||
|
abstract val containingType: KtType
|
||||||
|
}
|
||||||
|
|
||||||
abstract class ExtensionInClassReferenceNotAllowed : KtFirDiagnostic<KtExpression>() {
|
abstract class ExtensionInClassReferenceNotAllowed : KtFirDiagnostic<KtExpression>() {
|
||||||
override val diagnosticClass get() = ExtensionInClassReferenceNotAllowed::class
|
override val diagnosticClass get() = ExtensionInClassReferenceNotAllowed::class
|
||||||
abstract val referencedDeclaration: KtCallableSymbol
|
abstract val referencedDeclaration: KtCallableSymbol
|
||||||
|
|||||||
+23
@@ -59,6 +59,7 @@ import org.jetbrains.kotlin.psi.KtValueArgument
|
|||||||
import org.jetbrains.kotlin.psi.KtWhenEntry
|
import org.jetbrains.kotlin.psi.KtWhenEntry
|
||||||
import org.jetbrains.kotlin.psi.KtWhenExpression
|
import org.jetbrains.kotlin.psi.KtWhenExpression
|
||||||
import org.jetbrains.kotlin.resolve.ForbiddenNamedArgumentsTarget
|
import org.jetbrains.kotlin.resolve.ForbiddenNamedArgumentsTarget
|
||||||
|
import org.jetbrains.kotlin.types.Variance
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file was generated automatically
|
* This file was generated automatically
|
||||||
@@ -1522,6 +1523,28 @@ internal class IncompatibleTypesWarningImpl(
|
|||||||
override val firDiagnostic: FirPsiDiagnostic<*> by weakRef(firDiagnostic)
|
override val firDiagnostic: FirPsiDiagnostic<*> by weakRef(firDiagnostic)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal class TypeVarianceConflictImpl(
|
||||||
|
override val typeParameter: KtTypeParameterSymbol,
|
||||||
|
override val typeParameterVariance: Variance,
|
||||||
|
override val variance: Variance,
|
||||||
|
override val containingType: KtType,
|
||||||
|
firDiagnostic: FirPsiDiagnostic<*>,
|
||||||
|
override val token: ValidityToken,
|
||||||
|
) : KtFirDiagnostic.TypeVarianceConflict(), KtAbstractFirDiagnostic<PsiElement> {
|
||||||
|
override val firDiagnostic: FirPsiDiagnostic<*> by weakRef(firDiagnostic)
|
||||||
|
}
|
||||||
|
|
||||||
|
internal class TypeVarianceConflictInExpandedTypeImpl(
|
||||||
|
override val typeParameter: KtTypeParameterSymbol,
|
||||||
|
override val typeParameterVariance: Variance,
|
||||||
|
override val variance: Variance,
|
||||||
|
override val containingType: KtType,
|
||||||
|
firDiagnostic: FirPsiDiagnostic<*>,
|
||||||
|
override val token: ValidityToken,
|
||||||
|
) : KtFirDiagnostic.TypeVarianceConflictInExpandedType(), KtAbstractFirDiagnostic<PsiElement> {
|
||||||
|
override val firDiagnostic: FirPsiDiagnostic<*> by weakRef(firDiagnostic)
|
||||||
|
}
|
||||||
|
|
||||||
internal class ExtensionInClassReferenceNotAllowedImpl(
|
internal class ExtensionInClassReferenceNotAllowedImpl(
|
||||||
override val referencedDeclaration: KtCallableSymbol,
|
override val referencedDeclaration: KtCallableSymbol,
|
||||||
firDiagnostic: FirPsiDiagnostic<*>,
|
firDiagnostic: FirPsiDiagnostic<*>,
|
||||||
|
|||||||
Reference in New Issue
Block a user