diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/FirCallResolver.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/FirCallResolver.kt index b28dc2efc4c..6f7bbdd878b 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/FirCallResolver.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/FirCallResolver.kt @@ -207,6 +207,7 @@ class FirCallResolver( referencedSymbol is FirClassLikeSymbol<*> -> { val classId = referencedSymbol.classId return FirResolvedQualifierImpl(nameReference.source, classId.packageFqName, classId.relativeClassName).apply { + typeArguments.addAll(qualifiedAccess.typeArguments) resultType = if (classId.isLocal) { typeForQualifierByDeclaration(referencedSymbol.fir, resultType, session) ?: resultType.resolvedTypeFromPrototype( diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/ResolveUtils.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/ResolveUtils.kt index 77dd6dcbbd4..f2c31ec6653 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/ResolveUtils.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/ResolveUtils.kt @@ -320,7 +320,9 @@ fun BodyResolveComponents.typeForQualifier(resolvedQualifier: FirResolvedQualifi val classSymbol = symbolProvider.getClassLikeSymbolByFqName(classId) ?: return FirErrorTypeRefImpl(source = null, diagnostic = FirSimpleDiagnostic("No type for qualifier", DiagnosticKind.Other)) val declaration = classSymbol.phasedFir - typeForQualifierByDeclaration(declaration, resultType, session)?.let { return it } + if (declaration !is FirTypeAlias || resolvedQualifier.typeArguments.isEmpty()) { + typeForQualifierByDeclaration(declaration, resultType, session)?.let { return it } + } } // TODO: Handle no value type here return resultType.resolvedTypeFromPrototype( diff --git a/compiler/testData/diagnostics/tests/typealias/typeAliasArgumentsInCompanionObject.fir.kt b/compiler/testData/diagnostics/tests/typealias/typeAliasArgumentsInCompanionObject.fir.kt index 884089df4bc..e8d2b445f0e 100644 --- a/compiler/testData/diagnostics/tests/typealias/typeAliasArgumentsInCompanionObject.fir.kt +++ b/compiler/testData/diagnostics/tests/typealias/typeAliasArgumentsInCompanionObject.fir.kt @@ -6,5 +6,5 @@ class C { typealias C2 = C -val test1: String = C2.OK +val test1: String = C2.OK val test2: String = C2.OK