[FE 1.0] Force resolve annotations on type arguments

^KT-46173
This commit is contained in:
Dmitriy Novozhilov
2021-07-22 13:48:50 +03:00
committed by Mikhael Bogdanov
parent e316cd04b6
commit b1d17cfd7b
3 changed files with 12 additions and 3 deletions
@@ -158,6 +158,15 @@ class AnnotationChecker(
val shouldRunCheck = isSuperType || shouldCheckReferenceItself
if (shouldRunCheck) {
for (entry in reference.annotationEntries) {
val descriptor = trace.get(BindingContext.ANNOTATION, entry)
if (descriptor is LazyAnnotationDescriptor) {
/*
* There are no users of type annotations until backend, so if there are errors
* in annotation call then we should force resolve of it to detect and
* report them
*/
descriptor.forceResolveAllContents()
}
val actualTargets = getActualTargetList(reference, null, trace.bindingContext)
if (entry.useSiteTarget != null && isSuperType) {
val reportError = languageVersionSettings.supportsFeature(ProhibitUseSiteTargetAnnotationsOnSuperTypes)
@@ -14,4 +14,4 @@
@Target(AnnotationTarget.TYPE)
annotation class Ann(val x: Int)
abstract class Foo : @<!DEBUG_INFO_MISSING_UNRESOLVED!>Ann<!>(<!DEBUG_INFO_MISSING_UNRESOLVED!>unresolved_reference<!>) Any()
abstract class Foo : @Ann(<!UNRESOLVED_REFERENCE!>unresolved_reference<!>) Any()
@@ -18,7 +18,7 @@ annotation class Ann
*/
open class TypeToken<T>
val case_1 = object : TypeToken<@<!DEBUG_INFO_MISSING_UNRESOLVED!>Ann<!>(<!DEBUG_INFO_MISSING_UNRESOLVED!>unresolved_reference<!>) String>() {}
val case_1 = object : TypeToken<@Ann(<!TOO_MANY_ARGUMENTS, UNRESOLVED_REFERENCE!>unresolved_reference<!>) String>() {}
/*
* TESTCASE NUMBER: 2
@@ -26,4 +26,4 @@ val case_1 = object : TypeToken<@<!DEBUG_INFO_MISSING_UNRESOLVED!>Ann<!>(<!DEBUG
*/
interface A
val case_2 = object: @<!DEBUG_INFO_MISSING_UNRESOLVED!>Ann<!>(<!DEBUG_INFO_MISSING_UNRESOLVED!>unresolved_reference<!>) A {}
val case_2 = object: @Ann(<!TOO_MANY_ARGUMENTS, UNRESOLVED_REFERENCE!>unresolved_reference<!>) A {}