diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/providers/impl/FirTypeResolverImpl.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/providers/impl/FirTypeResolverImpl.kt index bd678386c31..81210ba0751 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/providers/impl/FirTypeResolverImpl.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/providers/impl/FirTypeResolverImpl.kt @@ -228,7 +228,7 @@ class FirTypeResolverImpl(private val session: FirSession) : FirTypeResolver() { } } - if (symbol is FirRegularClassSymbol) { + if (symbol is FirClassLikeSymbol<*>) { val isPossibleBareType = areBareTypesAllowed && allTypeArguments.isEmpty() if (!isPossibleBareType) { val actualSubstitutor = substitutor ?: ConeSubstitutor.Empty diff --git a/compiler/testData/diagnostics/tests/typealias/abbreviatedSupertypes.fir.kt b/compiler/testData/diagnostics/tests/typealias/abbreviatedSupertypes.fir.kt index 50f09db1e87..d7738ebd49b 100644 --- a/compiler/testData/diagnostics/tests/typealias/abbreviatedSupertypes.fir.kt +++ b/compiler/testData/diagnostics/tests/typealias/abbreviatedSupertypes.fir.kt @@ -13,7 +13,7 @@ object O1 : One<Any>() // compi object O2 : Both<Any, Any>() class A1Any>> -class A2Any, Any>> +class A2> interface IO1 : OneList<Any> {} interface IO2 : BothList<Any, Any> {} diff --git a/compiler/testData/diagnostics/tests/typealias/abbreviatedSupertypesErrors.fir.kt b/compiler/testData/diagnostics/tests/typealias/abbreviatedSupertypesErrors.fir.kt index 1e99963b329..cc0ed68ee2a 100644 --- a/compiler/testData/diagnostics/tests/typealias/abbreviatedSupertypesErrors.fir.kt +++ b/compiler/testData/diagnostics/tests/typealias/abbreviatedSupertypesErrors.fir.kt @@ -13,7 +13,7 @@ object O1 : One<Any>() // compi object O2 : Both<Any, Any>() class A1Any>> -class A2Any, Any>> +class A2> interface IO1 : OneList<Any> {} interface IO2 : BothList<Any, Any> {} diff --git a/compiler/testData/diagnostics/tests/typealias/boundsViolationRecursive.fir.kt b/compiler/testData/diagnostics/tests/typealias/boundsViolationRecursive.fir.kt index a7862a63f48..4f3db34f456 100644 --- a/compiler/testData/diagnostics/tests/typealias/boundsViolationRecursive.fir.kt +++ b/compiler/testData/diagnostics/tests/typealias/boundsViolationRecursive.fir.kt @@ -1,3 +1,3 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER -typealias RList> = List +typealias RList<R>> = List diff --git a/compiler/testData/diagnostics/tests/typealias/inheritedNestedTypeAlias.fir.kt b/compiler/testData/diagnostics/tests/typealias/inheritedNestedTypeAlias.fir.kt index 4ce55439986..4dc6f51fd27 100644 --- a/compiler/testData/diagnostics/tests/typealias/inheritedNestedTypeAlias.fir.kt +++ b/compiler/testData/diagnostics/tests/typealias/inheritedNestedTypeAlias.fir.kt @@ -16,5 +16,5 @@ class Derived : Base() { val x2: Base.InnerCell = InnerCell(42) val test1: CT = Cell(42) - val test2: Base.CT = Cell(42) + val test2: Base.CT = Cell(42) } diff --git a/compiler/testData/diagnostics/tests/typealias/innerTypeAliasAsType.fir.kt b/compiler/testData/diagnostics/tests/typealias/innerTypeAliasAsType.fir.kt index 38b340f6a24..37f735df22a 100644 --- a/compiler/testData/diagnostics/tests/typealias/innerTypeAliasAsType.fir.kt +++ b/compiler/testData/diagnostics/tests/typealias/innerTypeAliasAsType.fir.kt @@ -18,17 +18,17 @@ class Outer { fun test5(x: GenericInnerAlias) = x fun test6(x: GenericInnerAlias) = x } -fun test1(x: Outer.NestedAlias) = x -fun test2(x: Outer.NestedAlias) = x +fun test1(x: Outer.NestedAlias) = x +fun test2(x: Outer.NestedAlias) = x fun test3(x: Outer.NestedAlias) = x -fun test4(x: Outer.GenericNestedAlias) = x -fun test5(x: Outer.GenericNestedAlias) = x -fun test6(x: Outer.GenericNestedAlias) = x +fun test4(x: Outer.GenericNestedAlias) = x +fun test5(x: Outer.GenericNestedAlias) = x +fun test6(x: Outer.GenericNestedAlias) = x fun test7(x: Outer.GenericNestedAlias) = x fun test8(x: Outer.GenericNestedAlias) = x fun test9(x: Outer.InnerAlias) = x -fun test10(x: Outer.InnerAlias) = x -fun test11(x: Outer.InnerAlias) = x +fun test10(x: Outer.InnerAlias) = x +fun test11(x: Outer.InnerAlias) = x fun test12(x: Outer.GenericInnerAlias) = x -fun test13(x: Outer.GenericInnerAlias) = x -fun test14(x: Outer.GenericInnerAlias) = x +fun test13(x: Outer.GenericInnerAlias) = x +fun test14(x: Outer.GenericInnerAlias) = x diff --git a/compiler/testData/diagnostics/tests/typealias/innerTypeAliasAsType2.fir.kt b/compiler/testData/diagnostics/tests/typealias/innerTypeAliasAsType2.fir.kt new file mode 100644 index 00000000000..c73e9b6048e --- /dev/null +++ b/compiler/testData/diagnostics/tests/typealias/innerTypeAliasAsType2.fir.kt @@ -0,0 +1,24 @@ +// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER -TOPLEVEL_TYPEALIASES_ONLY + +class C { + inner class D + + typealias DA = D + typealias SDA = C.D + typealias TSDA = C.D + typealias TC = C + typealias SSDA = C<*>.D + typealias SSC = C<*> +} + +fun test1(x: C.DA) = x +fun test2(x: C.SDA) = x +fun test3(x: C.TSDA) = x +fun test4(x: C.TC) = x + +fun test5(x: C<*>.DA) = x +fun test6(x: C<*>.TSDA) = x +fun test7(x: C<*>.TC) = x + +fun test8(x: C.SSDA) = x +fun test9(x: C.SSC) = x diff --git a/compiler/testData/diagnostics/tests/typealias/innerTypeAliasAsType2.kt b/compiler/testData/diagnostics/tests/typealias/innerTypeAliasAsType2.kt index b395df6be23..e6d8b770fce 100644 --- a/compiler/testData/diagnostics/tests/typealias/innerTypeAliasAsType2.kt +++ b/compiler/testData/diagnostics/tests/typealias/innerTypeAliasAsType2.kt @@ -1,4 +1,3 @@ -// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER -TOPLEVEL_TYPEALIASES_ONLY class C { @@ -22,4 +21,4 @@ fun test6(x: C<*>.TSDA) = x fun test7(x: C<*>.TC) = x fun test8(x: C.SSDA) = x -fun test9(x: C.SSC) = x \ No newline at end of file +fun test9(x: C.SSC) = x diff --git a/compiler/testData/diagnostics/tests/typealias/kt14518.fir.kt b/compiler/testData/diagnostics/tests/typealias/kt14518.fir.kt index dac0393b6ed..5ffed32ceb1 100644 --- a/compiler/testData/diagnostics/tests/typealias/kt14518.fir.kt +++ b/compiler/testData/diagnostics/tests/typealias/kt14518.fir.kt @@ -6,5 +6,5 @@ class OuterClass { } typealias ON1 = OuterClass.NestedClass -typealias ON2 = OuterClass.NestedType +typealias ON2 = OuterClass.NestedType typealias ON3 = OuterClass.NestedType diff --git a/compiler/testData/diagnostics/tests/typealias/nestedSubstituted.fir.kt b/compiler/testData/diagnostics/tests/typealias/nestedSubstituted.fir.kt index 0d534ec8478..c67cbc55f19 100644 --- a/compiler/testData/diagnostics/tests/typealias/nestedSubstituted.fir.kt +++ b/compiler/testData/diagnostics/tests/typealias/nestedSubstituted.fir.kt @@ -6,4 +6,4 @@ class C { typealias P2 = Pair } -val p1: C.P2 = Pair("", 1) +val p1: C.P2 = Pair("", 1) diff --git a/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorInferenceInSupertypesList.fir.kt b/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorInferenceInSupertypesList.fir.kt deleted file mode 100644 index 9633af61203..00000000000 --- a/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorInferenceInSupertypesList.fir.kt +++ /dev/null @@ -1,7 +0,0 @@ -open class Ref(var x: T) - -typealias R = Ref - -// Type inference SHOULD NOT work for type alias constructor in supertypes list -class Test1 : R(0) -class Test2 : R(0) diff --git a/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorInferenceInSupertypesList.kt b/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorInferenceInSupertypesList.kt index 955d07623f5..1f19a670ebf 100644 --- a/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorInferenceInSupertypesList.kt +++ b/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorInferenceInSupertypesList.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL open class Ref(var x: T) typealias R = Ref