Implement backend error reporting on unsupported script capturing

#KT-30616 fixed
#KT-43995 fixed
#KT-19424 fixed
#KT-49443 fixed
This commit is contained in:
Ilya Chernikov
2021-11-30 17:14:24 +01:00
committed by TeamCityServer
parent cb5e451e05
commit 10c5071eda
22 changed files with 444 additions and 34 deletions
@@ -27,6 +27,11 @@ object JvmBackendErrors {
val SUSPENSION_POINT_INSIDE_MONITOR by error1<PsiElement, String>()
val SCRIPT_CAPTURING_OBJECT by error1<PsiElement, String>()
val SCRIPT_CAPTURING_INTERFACE by error1<PsiElement, String>()
val SCRIPT_CAPTURING_ENUM by error1<PsiElement, String>()
val SCRIPT_CAPTURING_ENUM_ENTRY by error1<PsiElement, String>()
init {
RootDiagnosticRendererFactory.registerFactory(KtDefaultJvmErrorMessages)
}
@@ -60,5 +65,10 @@ object KtDefaultJvmErrorMessages : BaseDiagnosticRendererFactory() {
map.put(JvmBackendErrors.TYPEOF_SUSPEND_TYPE, "Suspend functional 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)
map.put(JvmBackendErrors.SCRIPT_CAPTURING_OBJECT, "Object {0} captures the script class instance. Try to use class or anonymous object instead", STRING)
map.put(JvmBackendErrors.SCRIPT_CAPTURING_INTERFACE, "Interface {0} captures the script class instance. Try to use class instead", STRING)
map.put(JvmBackendErrors.SCRIPT_CAPTURING_ENUM, "Enum class {0} captures the script class instance. Try to use class or anonymous object instead", STRING)
map.put(JvmBackendErrors.SCRIPT_CAPTURING_ENUM_ENTRY, "Enum entry {0} captures the script class instance. Try to use class or anonymous object instead", STRING)
}
}