Typealias can't be a qualifier
This commit is contained in:
@@ -397,7 +397,7 @@ class QualifiedExpressionResolver(val classifierUsageCheckers: Iterable<Classifi
|
||||
val nextPackageOrClassDescriptor =
|
||||
when (currentDescriptor) {
|
||||
is TypeAliasDescriptor -> // TODO type aliases as qualifiers? (would break some assumptions in TypeResolver)
|
||||
currentDescriptor.classDescriptor?.getContributedClassifier(qualifierPart)
|
||||
null
|
||||
is ClassDescriptor ->
|
||||
currentDescriptor.getContributedClassifier(qualifierPart)
|
||||
is PackageViewDescriptor -> {
|
||||
@@ -622,7 +622,6 @@ class QualifiedExpressionResolver(val classifierUsageCheckers: Iterable<Classifi
|
||||
is PackageViewDescriptor -> PackageQualifier(referenceExpression, descriptor)
|
||||
is ClassDescriptor -> ClassQualifier(referenceExpression, descriptor)
|
||||
is TypeParameterDescriptor -> TypeParameterQualifier(referenceExpression, descriptor)
|
||||
is TypeAliasDescriptor -> ClassQualifier(referenceExpression, descriptor.classDescriptor ?: return null)
|
||||
else -> return null
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
class C {
|
||||
typealias Self = C
|
||||
class Nested {
|
||||
class N2
|
||||
typealias Root = C
|
||||
}
|
||||
companion object X {
|
||||
val ok = "OK"
|
||||
class InCompanion
|
||||
}
|
||||
}
|
||||
|
||||
val c = C.Self.<!UNRESOLVED_REFERENCE!>Self<!>()
|
||||
val n = C.Self.<!UNRESOLVED_REFERENCE!>Nested<!>()
|
||||
val x = C.Self.<!UNRESOLVED_REFERENCE!>X<!>
|
||||
val n2 = C.Nested.Root.<!UNRESOLVED_REFERENCE!>Nested<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>N2<!>()
|
||||
val ic = C.Self.<!UNRESOLVED_REFERENCE!>InCompanion<!>()
|
||||
val ok = C.Self.ok
|
||||
@@ -0,0 +1,46 @@
|
||||
package
|
||||
|
||||
public val c: [ERROR : Type for C.Self.Self()]
|
||||
public val ic: [ERROR : Type for C.Self.InCompanion()]
|
||||
public val n: [ERROR : Type for C.Self.Nested()]
|
||||
public val n2: [ERROR : <ERROR FUNCTION RETURN TYPE>]
|
||||
public val ok: kotlin.String = "OK"
|
||||
public val x: [ERROR : Type for C.Self.X]
|
||||
|
||||
public final class C {
|
||||
public typealias Self = C
|
||||
public constructor C()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
public final class Nested {
|
||||
public typealias Root = C
|
||||
public constructor Nested()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
public final class N2 {
|
||||
public constructor N2()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
|
||||
public companion object X {
|
||||
private constructor X()
|
||||
public final val ok: kotlin.String = "OK"
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
public final class InCompanion {
|
||||
public constructor InCompanion()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19821,6 +19821,12 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("typeAliasAsQualifier.kt")
|
||||
public void testTypeAliasAsQualifier() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/typealias/typeAliasAsQualifier.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("typeAliasConstructor.kt")
|
||||
public void testTypeAliasConstructor() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/typealias/typeAliasConstructor.kt");
|
||||
|
||||
Reference in New Issue
Block a user