Allow type variable fixation into intersection type if it isn't meaningless (i.e. has one or more final classes, or two or more open classes)

^KT-46186 Fixed
This commit is contained in:
Victor Petukhov
2021-04-20 14:41:13 +03:00
parent 310d98c4f7
commit 867d7b5bca
10 changed files with 312 additions and 4 deletions
@@ -29029,6 +29029,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
runTest("compiler/testData/diagnostics/tests/typeParameters/kt42472.kt");
}
@Test
@TestMetadata("kt46186.kt")
public void testKt46186() throws Exception {
runTest("compiler/testData/diagnostics/tests/typeParameters/kt46186.kt");
}
@Test
@TestMetadata("misplacedConstraints.kt")
public void testMisplacedConstraints() throws Exception {
@@ -261,6 +261,10 @@ interface ConeTypeContext : TypeSystemContext, TypeSystemOptimizationContext, Ty
return this is ConeClassLikeLookupTag
}
override fun TypeConstructorMarker.isInterface(): Boolean {
return ((this as? ConeClassLikeLookupTag)?.toClassLikeSymbol()?.fir as? FirClass)?.classKind == ClassKind.INTERFACE
}
override fun TypeParameterMarker.getVariance(): TypeVariance {
require(this is ConeTypeParameterLookupTag)
return this.symbol.fir.variance.convertVariance()