diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java index 5ca8020e805..0798197d65f 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java @@ -24187,6 +24187,12 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag runTest("compiler/testData/diagnostics/tests/platformTypes/rawTypes/nonGenericRawMember.kt"); } + @Test + @TestMetadata("nonRawArraysInRawType.kt") + public void testNonRawArraysInRawType() throws Exception { + runTest("compiler/testData/diagnostics/tests/platformTypes/rawTypes/nonRawArraysInRawType.kt"); + } + @Test @TestMetadata("nonTrivialErasure.kt") public void testNonTrivialErasure() throws Exception { diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java index 036e6864ce3..a0e834c30d7 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java @@ -24187,6 +24187,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti runTest("compiler/testData/diagnostics/tests/platformTypes/rawTypes/nonGenericRawMember.kt"); } + @Test + @TestMetadata("nonRawArraysInRawType.kt") + public void testNonRawArraysInRawType() throws Exception { + runTest("compiler/testData/diagnostics/tests/platformTypes/rawTypes/nonRawArraysInRawType.kt"); + } + @Test @TestMetadata("nonTrivialErasure.kt") public void testNonTrivialErasure() throws Exception { diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java index 1bcf440a474..daf6c438c8a 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java @@ -24187,6 +24187,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac runTest("compiler/testData/diagnostics/tests/platformTypes/rawTypes/nonGenericRawMember.kt"); } + @Test + @TestMetadata("nonRawArraysInRawType.kt") + public void testNonRawArraysInRawType() throws Exception { + runTest("compiler/testData/diagnostics/tests/platformTypes/rawTypes/nonRawArraysInRawType.kt"); + } + @Test @TestMetadata("nonTrivialErasure.kt") public void testNonTrivialErasure() throws Exception { diff --git a/compiler/fir/cones/src/org/jetbrains/kotlin/fir/types/CompilerConeAttributes.kt b/compiler/fir/cones/src/org/jetbrains/kotlin/fir/types/CompilerConeAttributes.kt index 05c38184244..07c15c5f1c6 100644 --- a/compiler/fir/cones/src/org/jetbrains/kotlin/fir/types/CompilerConeAttributes.kt +++ b/compiler/fir/cones/src/org/jetbrains/kotlin/fir/types/CompilerConeAttributes.kt @@ -68,6 +68,16 @@ object CompilerConeAttributes { override fun toString(): String = "@ExtensionFunctionType" } + object RawType : ConeAttribute() { + override fun union(other: RawType?): RawType? = other + override fun intersect(other: RawType?): RawType? = other + override fun add(other: RawType?): RawType = this + override fun isSubtypeOf(other: RawType?): Boolean = true + + override val key: KClass = RawType::class + override fun toString(): String = "Raw type" + } + class ContextFunctionTypeParams(val contextReceiverNumber: Int) : ConeAttribute() { override fun union(other: ContextFunctionTypeParams?): ContextFunctionTypeParams? = other override fun intersect(other: ContextFunctionTypeParams?): ContextFunctionTypeParams = this diff --git a/compiler/fir/cones/src/org/jetbrains/kotlin/fir/types/ConeTypes.kt b/compiler/fir/cones/src/org/jetbrains/kotlin/fir/types/ConeTypes.kt index 1dc13fb15b2..cd0f4839461 100644 --- a/compiler/fir/cones/src/org/jetbrains/kotlin/fir/types/ConeTypes.kt +++ b/compiler/fir/cones/src/org/jetbrains/kotlin/fir/types/ConeTypes.kt @@ -8,6 +8,7 @@ package org.jetbrains.kotlin.fir.types import org.jetbrains.kotlin.fir.diagnostics.ConeDiagnostic import org.jetbrains.kotlin.fir.symbols.ConeClassLikeLookupTag import org.jetbrains.kotlin.fir.symbols.ConeClassifierLookupTag +import org.jetbrains.kotlin.fir.types.impl.ConeClassLikeTypeImpl import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.types.model.* import org.jetbrains.kotlin.utils.addToStdlib.foldMap @@ -184,10 +185,32 @@ data class ConeDefinitelyNotNullType(val original: ConeSimpleKotlinType) : ConeS companion object } -class ConeRawType( +class ConeRawType private constructor( lowerBound: ConeSimpleKotlinType, upperBound: ConeSimpleKotlinType -) : ConeFlexibleType(lowerBound, upperBound), RawTypeMarker +) : ConeFlexibleType(lowerBound, upperBound), RawTypeMarker { + companion object { + fun create( + lowerBound: ConeSimpleKotlinType, + upperBound: ConeSimpleKotlinType, + ): ConeRawType { + require(lowerBound is ConeClassLikeType && upperBound is ConeClassLikeType) { + "Raw bounds are expected to be class-like types, but $lowerBound and $upperBound were found" + } + + val lowerBoundToUse = if (!lowerBound.attributes.contains(CompilerConeAttributes.RawType)) { + ConeClassLikeTypeImpl( + lowerBound.lookupTag, lowerBound.typeArguments, lowerBound.isNullable, + lowerBound.attributes + CompilerConeAttributes.RawType + ) + } else { + lowerBound + } + + return ConeRawType(lowerBoundToUse, upperBound) + } + } +} /* * Contract of the intersection type: it is flat. It means that diff --git a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaTypeConversion.kt b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaTypeConversion.kt index 6287684ab6a..c48f1d6bcef 100644 --- a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaTypeConversion.kt +++ b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaTypeConversion.kt @@ -123,7 +123,7 @@ private fun JavaType?.toConeTypeProjection( else -> lowerBound } - if (isRaw) ConeRawType(finalLowerBound, upperBound) else ConeFlexibleType(finalLowerBound, upperBound) + if (isRaw) ConeRawType.create(finalLowerBound, upperBound) else ConeFlexibleType(finalLowerBound, upperBound) } is JavaArrayType -> { diff --git a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/enhancement/javaTypeUtils.kt b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/enhancement/javaTypeUtils.kt index 0bfff373571..21cdb077303 100644 --- a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/enhancement/javaTypeUtils.kt +++ b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/enhancement/javaTypeUtils.kt @@ -50,7 +50,7 @@ private fun ConeKotlinType.enhanceConeKotlinType( when { lowerResult == null && upperResult == null -> null - this is ConeRawType -> ConeRawType(lowerResult ?: lowerBound, upperResult ?: upperBound) + this is ConeRawType -> ConeRawType.create(lowerResult ?: lowerBound, upperResult ?: upperBound) else -> coneFlexibleOrSimpleType(session.typeContext, lowerResult ?: lowerBound, upperResult ?: upperBound) } } diff --git a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/resolve/ScopeUtils.kt b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/resolve/ScopeUtils.kt index 6fae54549de..0b516c62bf5 100644 --- a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/resolve/ScopeUtils.kt +++ b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/resolve/ScopeUtils.kt @@ -9,16 +9,17 @@ import org.jetbrains.kotlin.fir.FirSession import org.jetbrains.kotlin.fir.declarations.FirClass import org.jetbrains.kotlin.fir.declarations.FirResolvePhase import org.jetbrains.kotlin.fir.expressions.FirSmartCastExpression +import org.jetbrains.kotlin.fir.resolve.substitution.ConeRawScopeSubstitutor import org.jetbrains.kotlin.fir.resolve.substitution.substitutorByMap import org.jetbrains.kotlin.fir.scopes.FakeOverrideTypeCalculator import org.jetbrains.kotlin.fir.scopes.FirTypeScope import org.jetbrains.kotlin.fir.scopes.FirUnstableSmartcastTypeScope import org.jetbrains.kotlin.fir.scopes.impl.* import org.jetbrains.kotlin.fir.scopes.scopeForClass -import org.jetbrains.kotlin.fir.symbols.lazyResolveToPhase import org.jetbrains.kotlin.fir.symbols.impl.ConeClassLikeLookupTagImpl import org.jetbrains.kotlin.fir.symbols.impl.FirClassSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirTypeParameterSymbol +import org.jetbrains.kotlin.fir.symbols.lazyResolveToPhase import org.jetbrains.kotlin.fir.types.* import org.jetbrains.kotlin.fir.types.impl.ConeClassLikeTypeImpl import org.jetbrains.kotlin.fir.types.impl.ConeTypeParameterTypeImpl @@ -61,10 +62,17 @@ private fun ConeKotlinType.scope(useSiteSession: FirSession, scopeSession: Scope fir.symbol.lazyResolveToPhase(requiredPhase) - val substitution = createSubstitution(fir.typeParameters, fullyExpandedType, useSiteSession) + val substitutor = when { + attributes.contains(CompilerConeAttributes.RawType) -> ConeRawScopeSubstitutor(useSiteSession) + else -> substitutorByMap( + createSubstitution(fir.typeParameters, fullyExpandedType, useSiteSession), + useSiteSession, + ) + } - fir.scopeForClass(substitutorByMap(substitution, useSiteSession), useSiteSession, scopeSession) + fir.scopeForClass(substitutor, useSiteSession, scopeSession) } + is ConeTypeParameterType -> { val symbol = lookupTag.symbol scopeSession.getOrBuild(symbol, TYPE_PARAMETER_SCOPE_KEY) { @@ -75,6 +83,7 @@ private fun ConeKotlinType.scope(useSiteSession: FirSession, scopeSession: Scope intersectionType.scope(useSiteSession, scopeSession, requiredPhase) ?: FirTypeScope.Empty } } + is ConeRawType -> lowerBound.scope(useSiteSession, scopeSession, requiredPhase) is ConeDynamicType -> useSiteSession.dynamicMembersStorage.getDynamicScopeFor(scopeSession) is ConeFlexibleType -> lowerBound.scope(useSiteSession, scopeSession, requiredPhase) @@ -86,6 +95,7 @@ private fun ConeKotlinType.scope(useSiteSession: FirSession, scopeSession: Scope }, this ) + is ConeDefinitelyNotNullType -> original.scope(useSiteSession, scopeSession, requiredPhase) is ConeIntegerConstantOperatorType -> scopeSession.getOrBuildScopeForIntegerConstantOperatorType(useSiteSession, this) is ConeIntegerLiteralConstantType -> error("ILT should not be in receiver position") @@ -93,6 +103,13 @@ private fun ConeKotlinType.scope(useSiteSession: FirSession, scopeSession: Scope } } +private fun ConeClassLikeType.obtainFirOfClass(useSiteSession: FirSession, requiredPhase: FirResolvePhase): FirClass? { + val fullyExpandedType = fullyExpandedType(useSiteSession) + val fir = fullyExpandedType.lookupTag.toSymbol(useSiteSession)?.fir as? FirClass ?: return null + + return fir.also { it.symbol.lazyResolveToPhase(requiredPhase) } +} + fun FirClassSymbol<*>.defaultType(): ConeClassLikeType = fir.defaultType() fun FirClass.defaultType(): ConeClassLikeType = diff --git a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/resolve/substitution/Substitutors.kt b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/resolve/substitution/Substitutors.kt index 8666ce3957f..41adf8d4763 100644 --- a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/resolve/substitution/Substitutors.kt +++ b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/resolve/substitution/Substitutors.kt @@ -6,11 +6,14 @@ package org.jetbrains.kotlin.fir.resolve.substitution import org.jetbrains.kotlin.fir.FirSession +import org.jetbrains.kotlin.fir.resolve.fullyExpandedType +import org.jetbrains.kotlin.fir.resolve.toFirRegularClassSymbol import org.jetbrains.kotlin.fir.resolve.withCombinedAttributesFrom import org.jetbrains.kotlin.fir.symbols.ConeClassLikeLookupTag import org.jetbrains.kotlin.fir.symbols.impl.FirTypeParameterSymbol import org.jetbrains.kotlin.fir.types.* import org.jetbrains.kotlin.fir.types.impl.ConeClassLikeTypeImpl +import org.jetbrains.kotlin.name.StandardClassIds import org.jetbrains.kotlin.types.TypeApproximatorConfiguration import org.jetbrains.kotlin.types.model.TypeConstructorMarker import org.jetbrains.kotlin.types.model.TypeSubstitutorMarker @@ -221,6 +224,56 @@ class ConeSubstitutorByMap( override fun hashCode() = hashCode } +class ConeRawScopeSubstitutor( + private val useSiteSession: FirSession, +) : AbstractConeSubstitutor(useSiteSession.typeContext) { + override fun substituteType(type: ConeKotlinType): ConeKotlinType? { + return when { + type is ConeTypeParameterType -> { + substituteOrSelf( + listOf(type.lookupTag.symbol).eraseToUpperBounds(useSiteSession)[0] as ConeKotlinType + ) + } + type is ConeClassLikeType && type.typeArguments.isNotEmpty() -> { + if (type.lookupTag.classId == StandardClassIds.Array) { + val argument = type.typeArguments[0] + val erasedType = argument.type?.let(this::substituteOrSelf) + + return type.withArguments( + arrayOf(erasedType?.toTypeProjection(argument.kind) ?: ConeStarProjection) + ) + } + + val firClass = type.fullyExpandedType(useSiteSession).lookupTag.toFirRegularClassSymbol(useSiteSession) ?: return null + ConeRawType.create( + type.withArguments(firClass.typeParameterSymbols.eraseToUpperBounds(useSiteSession)), + type.replaceArgumentsWithStarProjections() + ) + } + type is ConeFlexibleType -> { + val substitutedLowerBound = substituteOrNull(type.lowerBound) + val substitutedUpperBound = substituteOrNull(type.upperBound) + if (substitutedLowerBound == null && substitutedUpperBound == null) return null + + val newLowerBound = substitutedLowerBound?.lowerBoundIfFlexible() ?: type.lowerBound + val newUpperBound = substitutedUpperBound?.upperBoundIfFlexible() ?: type.upperBound + + if (substitutedLowerBound is ConeRawType || substitutedUpperBound is ConeRawType) { + return ConeRawType.create(newLowerBound, newUpperBound) + } + + ConeFlexibleType(newLowerBound, newUpperBound) + } + + else -> null + } + } + + override fun equals(other: Any?) = other is ConeRawScopeSubstitutor + + override fun hashCode(): Int = 0 +} + fun createTypeSubstitutorByTypeConstructor( map: Map, context: ConeTypeContext, diff --git a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/FirKotlinScopeProvider.kt b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/FirKotlinScopeProvider.kt index 9986794a469..2c3ae93fc04 100644 --- a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/FirKotlinScopeProvider.kt +++ b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/FirKotlinScopeProvider.kt @@ -10,19 +10,17 @@ import org.jetbrains.kotlin.fir.FirSession import org.jetbrains.kotlin.fir.FirSessionComponent import org.jetbrains.kotlin.fir.declarations.FirClass import org.jetbrains.kotlin.fir.declarations.FirRegularClass -import org.jetbrains.kotlin.fir.declarations.utils.classId import org.jetbrains.kotlin.fir.declarations.utils.delegateFields import org.jetbrains.kotlin.fir.declarations.utils.isExpect import org.jetbrains.kotlin.fir.resolve.* +import org.jetbrains.kotlin.fir.resolve.substitution.ConeRawScopeSubstitutor import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutor import org.jetbrains.kotlin.fir.resolve.substitution.substitutorByMap import org.jetbrains.kotlin.fir.scopes.impl.* import org.jetbrains.kotlin.fir.symbols.ConeClassLikeLookupTag import org.jetbrains.kotlin.fir.symbols.impl.FirClassSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirRegularClassSymbol -import org.jetbrains.kotlin.fir.types.ConeErrorType -import org.jetbrains.kotlin.fir.types.ConeClassLikeType -import org.jetbrains.kotlin.fir.types.ConeKotlinType +import org.jetbrains.kotlin.fir.types.* class FirKotlinScopeProvider( val declaredMemberScopeDecorator: ( @@ -125,19 +123,22 @@ fun ConeKotlinType.scopeForSupertype( ): FirTypeScope? { if (this !is ConeClassLikeType) return null if (this is ConeErrorType) return null - val symbol = lookupTag.toSymbol(useSiteSession) - return if (symbol is FirRegularClassSymbol) { - symbol.fir.scopeForClassImpl( - substitutor(symbol, this, useSiteSession), - useSiteSession, - scopeSession, - skipPrivateMembers = true, - classFirDispatchReceiver = subClass, - isFromExpectClass = (subClass as? FirRegularClass)?.isExpect == true - ) - } else { - null + + val symbol = lookupTag.toSymbol(useSiteSession) as? FirRegularClassSymbol ?: return null + + val substitutor = when { + this.type.attributes.contains(CompilerConeAttributes.RawType) -> ConeRawScopeSubstitutor(useSiteSession) + else -> substitutor(symbol, this, useSiteSession) } + + return symbol.fir.scopeForClassImpl( + substitutor, + useSiteSession, + scopeSession, + skipPrivateMembers = true, + classFirDispatchReceiver = subClass, + isFromExpectClass = (subClass as? FirRegularClass)?.isExpect == true + ) } private fun substitutor(symbol: FirRegularClassSymbol, type: ConeClassLikeType, useSiteSession: FirSession): ConeSubstitutor { @@ -165,7 +166,7 @@ private fun FirClass.scopeForClassImpl( useSiteSession, basicScope, key, substitutor, - substitutor.substituteOrSelf(classFirDispatchReceiver.defaultType()) as ConeClassLikeType, + substitutor.substituteOrSelf(classFirDispatchReceiver.defaultType()).lowerBoundIfFlexible() as ConeClassLikeType, skipPrivateMembers, makeExpect = isFromExpectClass ) diff --git a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/impl/FirClassSubstitutionScope.kt b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/impl/FirClassSubstitutionScope.kt index 1488cd2537d..98bfaf6e262 100644 --- a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/impl/FirClassSubstitutionScope.kt +++ b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/impl/FirClassSubstitutionScope.kt @@ -21,8 +21,8 @@ import org.jetbrains.kotlin.fir.scopes.FakeOverrideSubstitution import org.jetbrains.kotlin.fir.scopes.FirTypeScope import org.jetbrains.kotlin.fir.scopes.ProcessorAction import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol -import org.jetbrains.kotlin.fir.symbols.lazyResolveToPhase import org.jetbrains.kotlin.fir.symbols.impl.* +import org.jetbrains.kotlin.fir.symbols.lazyResolveToPhase import org.jetbrains.kotlin.fir.types.* import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.utils.addToStdlib.runIf @@ -118,7 +118,7 @@ class FirClassSubstitutionScope( } private fun ConeSimpleKotlinType.substitute(substitutor: ConeSubstitutor): ConeSimpleKotlinType? { - return substitutor.substituteOrNull(this) as ConeSimpleKotlinType? + return substitutor.substituteOrNull(this)?.lowerBoundIfFlexible() } fun createSubstitutionOverrideFunction(original: FirNamedFunctionSymbol): FirNamedFunctionSymbol { @@ -212,7 +212,8 @@ class FirClassSubstitutionScope( constructor, FirDeclarationOrigin.SubstitutionOverride, newDispatchReceiverType, - newReturnType, + // Constructors' return types are expected to be non-flexible (i.e., non raw) + newReturnType?.lowerBoundIfFlexible(), newParameterTypes, newContextReceiverTypes, newTypeParameters, diff --git a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/types/TypeUtils.kt b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/types/TypeUtils.kt index f77e997f10b..d41a600f277 100644 --- a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/types/TypeUtils.kt +++ b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/types/TypeUtils.kt @@ -140,7 +140,7 @@ fun T.withAttributes(attributes: ConeAttributes): T { is ConeClassLikeTypeImpl -> ConeClassLikeTypeImpl(lookupTag, typeArguments, nullability.isNullable, attributes) is ConeDefinitelyNotNullType -> ConeDefinitelyNotNullType(original.withAttributes(attributes)) is ConeTypeParameterTypeImpl -> ConeTypeParameterTypeImpl(lookupTag, nullability.isNullable, attributes) - is ConeRawType -> ConeRawType(lowerBound.withAttributes(attributes), upperBound.withAttributes(attributes)) + is ConeRawType -> ConeRawType.create(lowerBound.withAttributes(attributes), upperBound.withAttributes(attributes)) is ConeDynamicType -> ConeDynamicType(lowerBound.withAttributes(attributes), upperBound.withAttributes(attributes)) is ConeFlexibleType -> ConeFlexibleType(lowerBound.withAttributes(attributes), upperBound.withAttributes(attributes)) is ConeTypeVariableType -> ConeTypeVariableType(nullability, lookupTag, attributes) diff --git a/compiler/testData/diagnostics/tests/j+k/rawTypeScope.fir.kt b/compiler/testData/diagnostics/tests/j+k/rawTypeScope.fir.kt deleted file mode 100644 index f57283f71d7..00000000000 --- a/compiler/testData/diagnostics/tests/j+k/rawTypeScope.fir.kt +++ /dev/null @@ -1,17 +0,0 @@ -// SKIP_TXT -// FILE: A.java - -public class A { - public static B getB() { return null; } -} - -// FILE: B.java - -public class B { - public void foo(java.util.Map x) {} -} - -// FILE: main.kt -fun main(x: Map) { - A.getB().foo(x) // OK in FE1.0 ( but probably shouldn't), ARGUMENT_TYPE_MISMATCH at FIR -} diff --git a/compiler/testData/diagnostics/tests/j+k/rawTypeScope.kt b/compiler/testData/diagnostics/tests/j+k/rawTypeScope.kt index 1abd33f8b6a..3d3a41af9c2 100644 --- a/compiler/testData/diagnostics/tests/j+k/rawTypeScope.kt +++ b/compiler/testData/diagnostics/tests/j+k/rawTypeScope.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // SKIP_TXT // FILE: A.java @@ -13,5 +14,5 @@ public class B { // FILE: main.kt fun main(x: Map) { - A.getB().foo(x) // OK in FE1.0 ( but probably shouldn't), ARGUMENT_TYPE_MISMATCH at FIR + A.getB().foo(x) } diff --git a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/arrays.fir.kt b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/arrays.fir.kt index a3d40416ffb..e272960d9ee 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/arrays.fir.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/arrays.fir.kt @@ -29,15 +29,15 @@ fun main() { raw.charSequences = arrayOf() raw.charSequences = arrayOf() - raw.maps = arrayOf>() - raw.maps = arrayOf>() + raw.maps = arrayOf>() + raw.maps = arrayOf>() raw.maps = arrayOf>() - raw.arraysOfLists = arrayOf>>() + raw.arraysOfLists = arrayOf>>() raw.arraysOfLists = arrayOf>() raw.arraysOfLists = arrayOf>>() raw.arraysOfAny = arrayOf>>() - raw.erasedLists = arrayOf>() + raw.erasedLists = arrayOf>() } diff --git a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/genericInnerClass.fir.kt b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/genericInnerClass.fir.kt deleted file mode 100644 index f8a226c0cd5..00000000000 --- a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/genericInnerClass.fir.kt +++ /dev/null @@ -1,34 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -// FILE: A.java - -import java.util.*; - -class A { - - void foo(T x) {} - - public class Inner { - Inner(E x0, T x, List y) {} - - void foo(E x0, T x, List y) {} - A> bar() {} - } -} - -// FILE: Test.java - -class Test { - static A rawAField = null; -} - -// FILE: main.kt - -val strList: List = null!! - -fun main() { - val rawA = Test.rawAField - var rawInner = rawA.Inner("", "", strList) - rawInner.foo("", "", strList) - rawInner.bar().foo("") -} - diff --git a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/genericInnerClass.kt b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/genericInnerClass.kt index 3a7ff83d6dc..7da3a68404c 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/genericInnerClass.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/genericInnerClass.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE // FILE: A.java diff --git a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/nonRawArraysInRawType.kt b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/nonRawArraysInRawType.kt new file mode 100644 index 00000000000..dc93371d35f --- /dev/null +++ b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/nonRawArraysInRawType.kt @@ -0,0 +1,27 @@ +// SKIP_TXT +// FIR_IDENTICAL +// !DIAGNOSTICS: -UNUSED_VARIABLE +// FILE: Generic.java + +import java.util.List; + +public class Generic { + + public static class ML {} + public static Generic create() { return null; } + + public String[] getFoo() +} + +// FILE: main.kt +fun main() { + val generic = Generic.create() + + for (x in generic.foo) { + x.length // Arrays don't become raw + } + + for (x in generic.getFoo()) { + x.length // Arrays don't become raw + } +} diff --git a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/rawSupertype.fir.kt b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/rawSupertype.fir.kt deleted file mode 100644 index 410c9154f04..00000000000 --- a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/rawSupertype.fir.kt +++ /dev/null @@ -1,36 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -// FILE: A.java - -import java.util.*; - -class A { - List x; - - void foo(T x, List y) {} - - A> bar() {} -} - -// FILE: Test.java - -class Test { - static class RawADerived extends A { - - } -} - -// FILE: main.kt - -val strList: List = null!! -val strMap: Map = null!! - -fun main() { - val rawADerived = Test.RawADerived() - rawADerived.x = strList - rawADerived.foo("", strList) - - - val rawA = rawADerived.bar() - rawA.x = strList - rawA.foo("", strList) -} diff --git a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/rawSupertype.kt b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/rawSupertype.kt index 5df133ccfb8..3cae8364ace 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/rawSupertype.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/rawSupertype.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE // FILE: A.java diff --git a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/rawSupertypeOverride.fir.kt b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/rawSupertypeOverride.fir.kt deleted file mode 100644 index 624bd5fbdce..00000000000 --- a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/rawSupertypeOverride.fir.kt +++ /dev/null @@ -1,41 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -// FILE: A.java - -import java.util.*; - -public class A { - A> foo(T x, Map> y, HashMap z) {} - - void bar(List[][] d) {} -} - -// FILE: RawADerived.java - -public class RawADerived extends A { -} - -// FILE: main.kt -import java.util.*; - -class B1 : RawADerived() { - override fun foo(x: CharSequence, y: Map, z: HashMap): A<*> = null!! - - override fun bar(d: Array>>) {} -} - -class B2 : RawADerived() { - override fun foo(x: CharSequence?, y: MutableMap, z: HashMap): A = null!! - - override fun bar(d: Array>>) {} -} - -class B3 : RawADerived() { - // Type of second parameter (y) is not equal to overridden - // RawADerived.foo.y --- (MutableMap..Map) is not a subtype of Map - override fun foo(x: CharSequence, y: Map, z: HashMap): A<*> = null!! -} - -class B4 : RawADerived() { - // Type of first parameter is not equal to overridden - override fun bar(d: Array>>>) {} -} diff --git a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/rawSupertypeOverride.kt b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/rawSupertypeOverride.kt index afb0cc00c5f..b78213794c9 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/rawSupertypeOverride.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/rawSupertypeOverride.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE // FILE: A.java diff --git a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/rawTypeInUpperBound.fir.kt b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/rawTypeInUpperBound.fir.kt index 511fdb2da0a..78ba2134bd4 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/rawTypeInUpperBound.fir.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/rawTypeInUpperBound.fir.kt @@ -26,16 +26,17 @@ public class Test { // FILE: main.kt fun foo(x: B<*>) { - // TODO: x.foo() now is flexible type instead of raw, because of captured type approximation - val q: MutableList = x.foo().getChildrenStubs() + // TODO: In K1, x.foo() now is flexible type instead of raw, because of captured type approximation + // Works in K2 as expected: x.foo() returns raw `A`, thus it's `getChildrenStubs` has a type `MutableList..List<*>?` + val q: MutableList = x.foo().getChildrenStubs() // Raw(B).field erased to A..A? Test.rawB.field = A() - val anyA: A = Test.rawB.field + val anyA: A = Test.rawB.field // FIR doesn't work here, because // field has a type of just 'A' and it's not clear why should it accept 'String' at consume // NB: some kind of BareTypeScope should be in use here - Test.rawB.field.consume("") + Test.rawB.field.consume("") val y: Any = Test.rawB.field.produce() } diff --git a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/rawTypeInUpperBound.kt b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/rawTypeInUpperBound.kt index 7bfd190c83d..26b400d8260 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/rawTypeInUpperBound.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/rawTypeInUpperBound.kt @@ -26,7 +26,8 @@ public class Test { // FILE: main.kt fun foo(x: B<*>) { - // TODO: x.foo() now is flexible type instead of raw, because of captured type approximation + // TODO: In K1, x.foo() now is flexible type instead of raw, because of captured type approximation + // Works in K2 as expected: x.foo() returns raw `A`, thus it's `getChildrenStubs` has a type `MutableList..List<*>?` val q: MutableList = x.foo().getChildrenStubs() // Raw(B).field erased to A..A? diff --git a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/simple.fir.kt b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/simple.fir.kt deleted file mode 100644 index 749691e9561..00000000000 --- a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/simple.fir.kt +++ /dev/null @@ -1,39 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -// FILE: A.java - -import java.util.*; - -class A { - List x; - Map y; - - A> z; - - void foo(T x, List y, List> z) {} - - A> bar() {} -} - -// FILE: Test.java - -class Test { - static A rawAField = null; -} - -// FILE: main.kt - -val strList: List = null!! -val strMap: Map = null!! - -fun main() { - val rawA = Test.rawAField - rawA.x = strList - rawA.y = strMap - rawA.foo("", strList, strList) - - val barResult = rawA.bar() - - barResult.x = strList - barResult.y = strMap - barResult.foo("", strList, null) -} diff --git a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/simple.kt b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/simple.kt index 1dfe6e102fb..703de976a18 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/simple.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/simple.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE // FILE: A.java diff --git a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/typeEnhancement.fir.kt b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/typeEnhancement.fir.kt deleted file mode 100644 index 966faf46cfb..00000000000 --- a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/typeEnhancement.fir.kt +++ /dev/null @@ -1,27 +0,0 @@ -// FILE: A.java - -import org.jetbrains.annotations.*; -import java.util.*; - -class A { - @NotNull - List foo(@NotNull T x, @Nullable List y) {} -} - -// FILE: Test.java - -class Test { - static class DerivedRawA extends A {} - - static A rawField = null; -} - -// FILE: main.kt - -val doubleList: List = null!! - -fun main() { - Test.rawField.foo("", doubleList) - Test.rawField.foo(null, doubleList) - Test.DerivedRawA().foo(null, doubleList) -} diff --git a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/typeEnhancement.kt b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/typeEnhancement.kt index 777951774fe..db19ad7c52b 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/typeEnhancement.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/typeEnhancement.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // FILE: A.java import org.jetbrains.annotations.*; diff --git a/compiler/testData/loadJava/compiledJava/RawOverrides.fir.txt b/compiler/testData/loadJava/compiledJava/RawOverrides.fir.txt index 0332dd2dc39..896aa8a303e 100644 --- a/compiler/testData/loadJava/compiledJava/RawOverrides.fir.txt +++ b/compiler/testData/loadJava/compiledJava/RawOverrides.fir.txt @@ -5,8 +5,8 @@ public open class RawOverrides : R|kotlin/Any| { public abstract fun foo(x: R|ft|, y: R|ft>, kotlin/collections/List>?>|): R|ft| } - public open inner class B : R|kotlin/Any|, R|test/RawOverrides.A| { - @R|java/lang/Override|() public open fun foo(x: R|kotlin/Any!|, y: R|ft, kotlin/collections/List<*>?>|): R|kotlin/String!| + public open inner class B : R|kotlin/Any|, R|Raw type test/RawOverrides.A| { + @R|java/lang/Override|() public open fun foo(x: R|kotlin/Any!|, y: R|ft, kotlin/collections/List<*>?>|): R|kotlin/String!| public test/RawOverrides.constructor(): R|test/RawOverrides.B| @@ -18,7 +18,7 @@ public open class RawOverrides : R|kotlin/Any| { } public open inner class D : R|test/RawOverrides.C| { - @R|java/lang/Override|() public open fun bar(x: R|kotlin/CharSequence!|, y: R|ft, kotlin/collections/List<*>?>|): R|kotlin/String!| + @R|java/lang/Override|() public open fun bar(x: R|kotlin/CharSequence!|, y: R|ft, kotlin/collections/List<*>?>|): R|kotlin/String!| public/*package*/ open fun |> bar(x: R|ft|, y: R|ft, ft>, kotlin/collections/Map, ft>?>>, kotlin/collections/List, ft>, kotlin/collections/Map, ft>?>>?>|): R|ft| diff --git a/compiler/testData/loadJava/compiledJava/RawTypeWithUpperBound.fir.txt b/compiler/testData/loadJava/compiledJava/RawTypeWithUpperBound.fir.txt index 01b96f0e096..0cf076050fa 100644 --- a/compiler/testData/loadJava/compiledJava/RawTypeWithUpperBound.fir.txt +++ b/compiler/testData/loadJava/compiledJava/RawTypeWithUpperBound.fir.txt @@ -1,8 +1,8 @@ public abstract interface RawTypeWithUpperBound : R|kotlin/Any| { public abstract interface Bar : R|kotlin/Any| { - public abstract fun f(f: R|ft, test/RawTypeWithUpperBound.Foo<*>?>|): R|kotlin/Unit| + public abstract fun f(f: R|ft, test/RawTypeWithUpperBound.Foo<*>?>|): R|kotlin/Unit| - public abstract fun g(f: R|ft, test/RawTypeWithUpperBound.Foo<*>?>>, kotlin/collections/List, test/RawTypeWithUpperBound.Foo<*>?>>?>|): R|kotlin/Unit| + public abstract fun g(f: R|ft, test/RawTypeWithUpperBound.Foo<*>?>>, kotlin/collections/List, test/RawTypeWithUpperBound.Foo<*>?>>?>|): R|kotlin/Unit| } public abstract interface Foo : R|kotlin/Any| { diff --git a/compiler/testData/loadJava/compiledJava/ReferenceCycleThroughAnnotation.fir.txt b/compiler/testData/loadJava/compiledJava/ReferenceCycleThroughAnnotation.fir.txt index 2433a3ad4c5..fd3ef291cf3 100644 --- a/compiler/testData/loadJava/compiledJava/ReferenceCycleThroughAnnotation.fir.txt +++ b/compiler/testData/loadJava/compiledJava/ReferenceCycleThroughAnnotation.fir.txt @@ -1,7 +1,7 @@ public open class ReferenceCycleThroughAnnotation : R|kotlin/Any| { public constructor(): R|test/ReferenceCycleThroughAnnotation| - @R|test/ReferenceCycleThroughAnnotation.C|(value = ((R|ft, test/ReferenceCycleThroughAnnotation.A<*>?>>, test/ReferenceCycleThroughAnnotation.B<*>?>|))) public open inner class A : R|kotlin/Any| { + @R|test/ReferenceCycleThroughAnnotation.C|(value = ((R|ft, test/ReferenceCycleThroughAnnotation.A<*>?>>, test/ReferenceCycleThroughAnnotation.B<*>?>|))) public open inner class A : R|kotlin/Any| { public open fun foo(): R|kotlin/Unit| public test/ReferenceCycleThroughAnnotation.constructor(): R|test/ReferenceCycleThroughAnnotation.A| diff --git a/compiler/testData/loadJava/compiledJava/annotations/ClassObjectArrayInParam.fir.txt b/compiler/testData/loadJava/compiledJava/annotations/ClassObjectArrayInParam.fir.txt index be9fc5a1fde..2cf07431c75 100644 --- a/compiler/testData/loadJava/compiledJava/annotations/ClassObjectArrayInParam.fir.txt +++ b/compiler/testData/loadJava/compiledJava/annotations/ClassObjectArrayInParam.fir.txt @@ -5,7 +5,7 @@ public open class ClassObjectArrayInParam : R|kotlin/Any| { public constructor(vararg value: R|kotlin/Array>|): R|test/ClassObjectArrayInParam.Anno| } - @R|test/ClassObjectArrayInParam.Anno|(value = (((R|test/ClassObjectArrayInParam!|)), ((R|test/ClassObjectArrayInParam.Nested!|)), ((R|kotlin/String!|)), ((R|ft, kotlin/collections/List<*>?>|)), ((R|ft, kotlin/Array?>>, kotlin/Array, kotlin/Array?>>?>|)), ((R|ft, kotlin/Array?>|)), ((R|kotlin/Unit|)))) public open class Nested : R|kotlin/Any| { + @R|test/ClassObjectArrayInParam.Anno|(value = (((R|test/ClassObjectArrayInParam!|)), ((R|test/ClassObjectArrayInParam.Nested!|)), ((R|kotlin/String!|)), ((R|ft, kotlin/collections/List<*>?>|)), ((R|ft, kotlin/Array?>>, kotlin/Array, kotlin/Array?>>?>|)), ((R|ft, kotlin/Array?>|)), ((R|kotlin/Unit|)))) public open class Nested : R|kotlin/Any| { public constructor(): R|test/ClassObjectArrayInParam.Nested| } diff --git a/compiler/testData/loadJava/compiledJava/rendering/Rendering.fir.txt b/compiler/testData/loadJava/compiledJava/rendering/Rendering.fir.txt index 804a0cb4af4..50b07d29eda 100644 --- a/compiler/testData/loadJava/compiledJava/rendering/Rendering.fir.txt +++ b/compiler/testData/loadJava/compiledJava/rendering/Rendering.fir.txt @@ -50,9 +50,9 @@ public open class Rendering : R|kotlin/Any| { } public/*package*/ abstract interface H_Raw : R|kotlin/Any| { - public abstract fun foo1(x: R|ft, kotlin/collections/List<*>?>|): R|kotlin/Unit| + public abstract fun foo1(x: R|ft, kotlin/collections/List<*>?>|): R|kotlin/Unit| - public abstract fun foo2(x: R|ft, test/Rendering.D_SuperG<*>?>|): R|kotlin/Unit| + public abstract fun foo2(x: R|ft, test/Rendering.D_SuperG<*>?>|): R|kotlin/Unit| } public/*package*/ abstract interface I_Wildcard : R|kotlin/Any| { diff --git a/compiler/testData/loadJava/compiledJava/signaturePropagation/RawSuperType.fir.txt b/compiler/testData/loadJava/compiledJava/signaturePropagation/RawSuperType.fir.txt index 1c353332a78..ad8f3a5f696 100644 --- a/compiler/testData/loadJava/compiledJava/signaturePropagation/RawSuperType.fir.txt +++ b/compiler/testData/loadJava/compiledJava/signaturePropagation/RawSuperType.fir.txt @@ -1,7 +1,7 @@ public open class RawSuperType : R|kotlin/Any| { public constructor(): R|test/RawSuperType| - public open inner class Derived : R|kotlin/Any|, R|test/RawSuperType.Super| { + public open inner class Derived : R|kotlin/Any|, R|Raw type test/RawSuperType.Super| { @R|java/lang/Override|() public open fun foo(o: R|kotlin/Any!|): R|kotlin/Unit| @R|java/lang/Override|() public open fun dummy(): R|kotlin/Unit| diff --git a/compiler/testData/loadJava/compiledJava/signaturePropagation/RawSuperTypeWithBound.fir.txt b/compiler/testData/loadJava/compiledJava/signaturePropagation/RawSuperTypeWithBound.fir.txt index d80908906c3..e16187769eb 100644 --- a/compiler/testData/loadJava/compiledJava/signaturePropagation/RawSuperTypeWithBound.fir.txt +++ b/compiler/testData/loadJava/compiledJava/signaturePropagation/RawSuperTypeWithBound.fir.txt @@ -3,7 +3,7 @@ public open class RawSuperTypeWithBound : R|kotlin/Any| { public abstract interface Bound : R|kotlin/Any| { } - public open inner class Derived : R|kotlin/Any|, R|test/RawSuperTypeWithBound.Super| { + public open inner class Derived : R|kotlin/Any|, R|Raw type test/RawSuperTypeWithBound.Super| { public open fun foo(o: R|kotlin/Any!|): R|kotlin/Unit| @R|java/lang/Override|() public open fun foo(o: R|test/RawSuperTypeWithBound.Bound!|): R|kotlin/Unit| diff --git a/compiler/testData/loadJava/compiledJava/signaturePropagation/RawSuperTypeWithRecursiveBound.fir.txt b/compiler/testData/loadJava/compiledJava/signaturePropagation/RawSuperTypeWithRecursiveBound.fir.txt index 53aef86fe52..8231bc28d50 100644 --- a/compiler/testData/loadJava/compiledJava/signaturePropagation/RawSuperTypeWithRecursiveBound.fir.txt +++ b/compiler/testData/loadJava/compiledJava/signaturePropagation/RawSuperTypeWithRecursiveBound.fir.txt @@ -1,10 +1,10 @@ public open class RawSuperTypeWithRecursiveBound : R|kotlin/Any| { public constructor(): R|test/RawSuperTypeWithRecursiveBound| - public open inner class Derived : R|kotlin/Any|, R|test/RawSuperTypeWithRecursiveBound.Super, test/RawSuperTypeWithRecursiveBound.Super<*>?>>| { + public open inner class Derived : R|kotlin/Any|, R|Raw type test/RawSuperTypeWithRecursiveBound.Super, test/RawSuperTypeWithRecursiveBound.Super<*>?>>| { public open fun foo(o: R|kotlin/Any!|): R|kotlin/Unit| - @R|java/lang/Override|() public open fun foo(o: R|ft, test/RawSuperTypeWithRecursiveBound.Super<*>?>>, test/RawSuperTypeWithRecursiveBound.Super<*>?>|): R|kotlin/Unit| + @R|java/lang/Override|() public open fun foo(o: R|ft, test/RawSuperTypeWithRecursiveBound.Super<*>?>>, test/RawSuperTypeWithRecursiveBound.Super<*>?>|): R|kotlin/Unit| @R|java/lang/Override|() public open fun dummy(): R|kotlin/Unit| diff --git a/compiler/testData/loadJava/compiledJava/signaturePropagation/RawSuperTypeWithRecursiveBoundMultipleParameters.fir.txt b/compiler/testData/loadJava/compiledJava/signaturePropagation/RawSuperTypeWithRecursiveBoundMultipleParameters.fir.txt index 928c7e10f64..a41a9910dab 100644 --- a/compiler/testData/loadJava/compiledJava/signaturePropagation/RawSuperTypeWithRecursiveBoundMultipleParameters.fir.txt +++ b/compiler/testData/loadJava/compiledJava/signaturePropagation/RawSuperTypeWithRecursiveBoundMultipleParameters.fir.txt @@ -1,10 +1,10 @@ public open class RawSuperTypeWithRecursiveBoundMultipleParameters : R|kotlin/Any| { public constructor(): R|test/RawSuperTypeWithRecursiveBoundMultipleParameters| - public open inner class Derived : R|kotlin/Any|, R|test/RawSuperTypeWithRecursiveBoundMultipleParameters.Super, test/RawSuperTypeWithRecursiveBoundMultipleParameters.Super<*, *>?>>| { + public open inner class Derived : R|kotlin/Any|, R|Raw type test/RawSuperTypeWithRecursiveBoundMultipleParameters.Super, test/RawSuperTypeWithRecursiveBoundMultipleParameters.Super<*, *>?>>| { public open fun foo(o: R|kotlin/Any!|, o1: R|kotlin/Any!|): R|kotlin/Unit| - @R|java/lang/Override|() public open fun foo(r: R|kotlin/Any!|, t: R|ft, test/RawSuperTypeWithRecursiveBoundMultipleParameters.Super<*, *>?>>, test/RawSuperTypeWithRecursiveBoundMultipleParameters.Super<*, *>?>|): R|kotlin/Unit| + @R|java/lang/Override|() public open fun foo(r: R|kotlin/Any!|, t: R|ft, test/RawSuperTypeWithRecursiveBoundMultipleParameters.Super<*, *>?>>, test/RawSuperTypeWithRecursiveBoundMultipleParameters.Super<*, *>?>|): R|kotlin/Unit| @R|java/lang/Override|() public open fun dummy(): R|kotlin/Unit| diff --git a/compiler/testData/loadJava/compiledJava/signaturePropagation/SubclassWithRawType.fir.txt b/compiler/testData/loadJava/compiledJava/signaturePropagation/SubclassWithRawType.fir.txt index cc0663303a9..0083ea6e5c3 100644 --- a/compiler/testData/loadJava/compiledJava/signaturePropagation/SubclassWithRawType.fir.txt +++ b/compiler/testData/loadJava/compiledJava/signaturePropagation/SubclassWithRawType.fir.txt @@ -4,33 +4,33 @@ public abstract interface SubclassWithRawType : R|kotlin/Any| { public abstract fun simple2(): R|ft, kotlin/collections/List?>>, kotlin/collections/List, kotlin/collections/List?>>?>| - public abstract fun simple3(): R|ft, kotlin/collections/List<*>?>| + public abstract fun simple3(): R|ft, kotlin/collections/List<*>?>| public abstract fun boundWildcard1(): R|ft, kotlin/collections/List?>>, kotlin/collections/List, kotlin/collections/List?>>?>| - public abstract fun boundWildcard2(): R|ft, kotlin/collections/List<*>?>>, kotlin/collections/MutableList, kotlin/collections/List<*>?>>?>| + public abstract fun boundWildcard2(): R|ft, kotlin/collections/List<*>?>>, kotlin/collections/MutableList, kotlin/collections/List<*>?>>?>| - public abstract fun wildcard(): R|ft, kotlin/collections/List<*>?>| + public abstract fun wildcard(): R|ft, kotlin/collections/List<*>?>| public abstract fun array1(): R|ft, kotlin/collections/List?>>, kotlin/Array, kotlin/collections/List?>>?>| - public abstract fun array2(): R|ft, kotlin/collections/List<*>?>>, kotlin/Array, kotlin/collections/List<*>?>>?>| + public abstract fun array2(): R|ft, kotlin/collections/List<*>?>>, kotlin/Array, kotlin/collections/List<*>?>>?>| } public abstract interface Super : R|kotlin/Any| { - public abstract fun simple1(): R|ft, kotlin/collections/List<*>?>| + public abstract fun simple1(): R|ft, kotlin/collections/List<*>?>| - public abstract fun simple2(): R|ft, kotlin/collections/List<*>?>| + public abstract fun simple2(): R|ft, kotlin/collections/List<*>?>| public abstract fun simple3(): R|ft, kotlin/collections/List?>| - public abstract fun boundWildcard1(): R|ft, kotlin/collections/List<*>?>>, kotlin/collections/List, kotlin/collections/List<*>?>>?>| + public abstract fun boundWildcard1(): R|ft, kotlin/collections/List<*>?>>, kotlin/collections/List, kotlin/collections/List<*>?>>?>| public abstract fun boundWildcard2(): R|ft, kotlin/collections/List?>>, kotlin/collections/MutableList, kotlin/collections/List?>>?>| public abstract fun wildcard(): R|ft, kotlin/collections/List<*>?>| - public abstract fun array1(): R|ft, kotlin/collections/List<*>?>>, kotlin/Array, kotlin/collections/List<*>?>>?>| + public abstract fun array1(): R|ft, kotlin/collections/List<*>?>>, kotlin/Array, kotlin/collections/List<*>?>>?>| public abstract fun array2(): R|ft, kotlin/collections/List?>>, kotlin/Array, kotlin/collections/List?>>?>| diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java index 6669f71a3ee..5b178827170 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java @@ -24193,6 +24193,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { runTest("compiler/testData/diagnostics/tests/platformTypes/rawTypes/nonGenericRawMember.kt"); } + @Test + @TestMetadata("nonRawArraysInRawType.kt") + public void testNonRawArraysInRawType() throws Exception { + runTest("compiler/testData/diagnostics/tests/platformTypes/rawTypes/nonRawArraysInRawType.kt"); + } + @Test @TestMetadata("nonTrivialErasure.kt") public void testNonTrivialErasure() throws Exception {