EA-63343 - assert: DescriptorUtils.getClassDescriptorForTypeConstructor
#KT-6835 Fixed
This commit is contained in:
@@ -154,7 +154,11 @@ public class AnnotationResolver {
|
|||||||
return ErrorUtils.createErrorType("No type reference: " + entryElement.getText());
|
return ErrorUtils.createErrorType("No type reference: " + entryElement.getText());
|
||||||
}
|
}
|
||||||
|
|
||||||
return typeResolver.resolveType(scope, typeReference, new BindingTraceContext(), true);
|
JetType type = typeResolver.resolveType(scope, typeReference, new BindingTraceContext(), true);
|
||||||
|
if (!(type.getConstructor().getDeclarationDescriptor() instanceof ClassDescriptor)) {
|
||||||
|
return ErrorUtils.createErrorType("Not an annotation: " + type);
|
||||||
|
}
|
||||||
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void checkAnnotationType(
|
public static void checkAnnotationType(
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
class Foo<T> {
|
||||||
|
[<!NOT_A_CLASS!>T<!>]
|
||||||
|
fun foo() = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
class Bar<T : Annotation> {
|
||||||
|
[<!NOT_A_CLASS!>T<!>]
|
||||||
|
fun foo() = 0
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
internal final class Bar</*0*/ T : kotlin.Annotation> {
|
||||||
|
public constructor Bar</*0*/ T : kotlin.Annotation>()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
[ERROR : Not an annotation: T]() internal final fun foo(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
internal final class Foo</*0*/ T> {
|
||||||
|
public constructor Foo</*0*/ T>()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
[ERROR : Not an annotation: T]() internal final fun foo(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
@@ -819,6 +819,12 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("typeParameterAsAnnotation.kt")
|
||||||
|
public void testTypeParameterAsAnnotation() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/annotations/typeParameterAsAnnotation.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("UnresolvedAnnotationOnObject.kt")
|
@TestMetadata("UnresolvedAnnotationOnObject.kt")
|
||||||
public void testUnresolvedAnnotationOnObject() throws Exception {
|
public void testUnresolvedAnnotationOnObject() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/annotations/UnresolvedAnnotationOnObject.kt");
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/annotations/UnresolvedAnnotationOnObject.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user