Fix CCE when typealias is used in a class reference ('TA::class')
This commit is contained in:
@@ -355,7 +355,7 @@ class TypeResolver(
|
|||||||
type(resolveTypeForTypeParameter(c, annotations, descriptor, qualifierPart.expression, qualifierPart.typeArguments))
|
type(resolveTypeForTypeParameter(c, annotations, descriptor, qualifierPart.expression, qualifierPart.typeArguments))
|
||||||
}
|
}
|
||||||
is ClassDescriptor -> resolveTypeForClass(c, annotations, descriptor, element, qualifierResolutionResult)
|
is ClassDescriptor -> resolveTypeForClass(c, annotations, descriptor, element, qualifierResolutionResult)
|
||||||
is TypeAliasDescriptor -> resolveTypeForTypeAlias(c, annotations, descriptor, element as KtUserType, qualifierResolutionResult)
|
is TypeAliasDescriptor -> resolveTypeForTypeAlias(c, annotations, descriptor, element, qualifierResolutionResult)
|
||||||
else -> error("Unexpected classifier type: ${descriptor.javaClass}")
|
else -> error("Unexpected classifier type: ${descriptor.javaClass}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -434,7 +434,7 @@ class TypeResolver(
|
|||||||
c: TypeResolutionContext,
|
c: TypeResolutionContext,
|
||||||
annotations: Annotations,
|
annotations: Annotations,
|
||||||
descriptor: TypeAliasDescriptor,
|
descriptor: TypeAliasDescriptor,
|
||||||
type: KtUserType,
|
type: KtElement,
|
||||||
qualifierResolutionResult: QualifiedExpressionResolver.TypeQualifierResolutionResult
|
qualifierResolutionResult: QualifiedExpressionResolver.TypeQualifierResolutionResult
|
||||||
): PossiblyBareType {
|
): PossiblyBareType {
|
||||||
val typeConstructor = descriptor.typeConstructor
|
val typeConstructor = descriptor.typeConstructor
|
||||||
@@ -487,7 +487,7 @@ class TypeResolver(
|
|||||||
|
|
||||||
private class TracingTypeAliasExpansionReportStrategy(
|
private class TracingTypeAliasExpansionReportStrategy(
|
||||||
val trace: BindingTrace,
|
val trace: BindingTrace,
|
||||||
val type: KtUserType?,
|
val type: KtElement?,
|
||||||
val typeArgumentsOrTypeName: KtElement?,
|
val typeArgumentsOrTypeName: KtElement?,
|
||||||
val typeAliasDescriptor: TypeAliasDescriptor,
|
val typeAliasDescriptor: TypeAliasDescriptor,
|
||||||
typeParameters: List<TypeParameterDescriptor>,
|
typeParameters: List<TypeParameterDescriptor>,
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
typealias S = String
|
||||||
|
|
||||||
|
val s = S::class
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public typealias S = kotlin.String
|
||||||
|
public val s: kotlin.reflect.KClass<S /* = kotlin.String */>
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
class C {
|
||||||
|
fun foo() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
typealias CA = C
|
||||||
|
|
||||||
|
val cf = CA::foo
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public typealias CA = C
|
||||||
|
public val cf: kotlin.reflect.KFunction1<CA /* = C */, kotlin.Unit>
|
||||||
|
|
||||||
|
public final class C {
|
||||||
|
public constructor C()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public final fun foo(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
@@ -19647,6 +19647,12 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("classReference.kt")
|
||||||
|
public void testClassReference() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/typealias/classReference.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("conflictingProjections.kt")
|
@TestMetadata("conflictingProjections.kt")
|
||||||
public void testConflictingProjections() throws Exception {
|
public void testConflictingProjections() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/typealias/conflictingProjections.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/typealias/conflictingProjections.kt");
|
||||||
@@ -19731,6 +19737,12 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("methodReference.kt")
|
||||||
|
public void testMethodReference() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/typealias/methodReference.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("nested.kt")
|
@TestMetadata("nested.kt")
|
||||||
public void testNested() throws Exception {
|
public void testNested() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/typealias/nested.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/typealias/nested.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user