Remove error on annotated types as arguments to typeOf

Instead, document that `KType.annotations` returns an empty list for
types created with `typeOf`. Annotations might be supported in the
future.

 #KT-49573 Fixed
 #KT-29919
This commit is contained in:
Alexander Udalov
2021-11-11 18:10:20 +01:00
parent 2aa027639c
commit 850d76f6bf
18 changed files with 180 additions and 134 deletions
@@ -14,8 +14,8 @@ import org.jetbrains.kotlin.utils.StringsKt;
import java.util.List;
import static kotlin.collections.CollectionsKt.*;
import static org.jetbrains.kotlin.diagnostics.rendering.CommonRenderers.STRING;
import static org.jetbrains.kotlin.diagnostics.rendering.Renderers.*;
import static org.jetbrains.kotlin.diagnostics.rendering.CommonRenderers.*;
import static org.jetbrains.kotlin.resolve.jvm.diagnostics.ErrorsJvm.*;
public class DefaultErrorMessagesJvm implements DefaultErrorMessages.Extension {
@@ -221,8 +221,6 @@ public class DefaultErrorMessagesJvm implements DefaultErrorMessages.Extension {
MAP.put(SYNCHRONIZED_ON_SUSPEND, "@Synchronized annotation is not applicable to suspend functions and lambdas");
MAP.put(TYPEOF_SUSPEND_TYPE, "Suspend functional types are not supported in typeOf");
MAP.put(TYPEOF_EXTENSION_FUNCTION_TYPE, "Extension function types are not supported in typeOf");
MAP.put(TYPEOF_ANNOTATED_TYPE, "Annotated types are not supported in typeOf");
MAP.put(TYPEOF_NON_REIFIED_TYPE_PARAMETER_WITH_RECURSIVE_BOUND, "Non-reified type parameters with recursive bounds are not supported yet: {0}", STRING);
}
@@ -185,8 +185,6 @@ public interface ErrorsJvm {
DiagnosticFactory0<PsiElement> JVM_INLINE_WITHOUT_VALUE_CLASS = DiagnosticFactory0.create(ERROR);
DiagnosticFactory0<PsiElement> TYPEOF_SUSPEND_TYPE = DiagnosticFactory0.create(ERROR);
DiagnosticFactory0<PsiElement> TYPEOF_EXTENSION_FUNCTION_TYPE = DiagnosticFactory0.create(ERROR);
DiagnosticFactory0<PsiElement> TYPEOF_ANNOTATED_TYPE = DiagnosticFactory0.create(ERROR);
DiagnosticFactory1<PsiElement, String> TYPEOF_NON_REIFIED_TYPE_PARAMETER_WITH_RECURSIVE_BOUND = DiagnosticFactory1.create(ERROR);
@SuppressWarnings("UnusedDeclaration")
@@ -23,8 +23,6 @@ object JvmBackendErrors {
val ACCIDENTAL_OVERRIDE by error1<PsiElement, ConflictingJvmDeclarationsData>(DECLARATION_SIGNATURE_OR_DEFAULT)
val TYPEOF_SUSPEND_TYPE by error0<PsiElement>()
val TYPEOF_EXTENSION_FUNCTION_TYPE by error0<PsiElement>()
val TYPEOF_ANNOTATED_TYPE by error0<PsiElement>()
val TYPEOF_NON_REIFIED_TYPE_PARAMETER_WITH_RECURSIVE_BOUND by error1<PsiElement, String>()
val SUSPENSION_POINT_INSIDE_MONITOR by error1<PsiElement, String>()
@@ -60,8 +58,6 @@ object KtDefaultJvmErrorMessages : BaseDiagnosticRendererFactory() {
map.put(JvmBackendErrors.ACCIDENTAL_OVERRIDE, "Accidental override: {0}", CONFLICTING_JVM_DECLARATIONS_DATA)
map.put(JvmBackendErrors.CONFLICTING_INHERITED_JVM_DECLARATIONS, "Inherited platform declarations clash: {0}", CONFLICTING_JVM_DECLARATIONS_DATA)
map.put(JvmBackendErrors.TYPEOF_SUSPEND_TYPE, "Suspend functional types are not supported in typeOf")
map.put(JvmBackendErrors.TYPEOF_EXTENSION_FUNCTION_TYPE, "Extension function types are not supported in typeOf")
map.put(JvmBackendErrors.TYPEOF_ANNOTATED_TYPE, "Annotated types are not supported in typeOf")
map.put(JvmBackendErrors.TYPEOF_NON_REIFIED_TYPE_PARAMETER_WITH_RECURSIVE_BOUND, "Non-reified type parameters with recursive bounds are not supported yet: {0}", STRING)
map.put(JvmBackendErrors.SUSPENSION_POINT_INSIDE_MONITOR, "A suspension point at {0} is inside a critical section", STRING)
}