Rework check of suspension point inside critical section
There is a trade-off between robustness of check and accuracy of the diagnostic: the previous version, which works on generation, was too fragile and lead to false-positives. Now we check on state machine generation. However, since we do not have PSI for call, we can only report diagnostic on whole suspend function or suspend lambda. Additionally, the state machine is generated on crossinline suspend lambdas regeneration and thus we do not have the PSI for the lambda as well! #KT-27130 Fixed #KT-27258 Open
This commit is contained in:
+1
-1
@@ -147,7 +147,7 @@ public class DefaultErrorMessagesJvm implements DefaultErrorMessages.Extension {
|
||||
MAP.put(USAGE_OF_JVM_DEFAULT_THROUGH_SUPER_CALL, "Super calls of '@JvmDefault' members are only allowed with -Xjvm-default option");
|
||||
MAP.put(NON_JVM_DEFAULT_OVERRIDES_JAVA_DEFAULT, "Non-@JvmDefault interface method cannot override default Java method. Please annotate this method with @JvmDefault");
|
||||
MAP.put(EXPLICIT_METADATA_IS_DISALLOWED, "Explicit @Metadata is disallowed");
|
||||
MAP.put(SUSPENSION_POINT_INSIDE_MONITOR, "The ''{0}'' suspension point is inside a critical section", NAME);
|
||||
MAP.put(SUSPENSION_POINT_INSIDE_MONITOR, "A suspension point is inside a critical section");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
+1
-1
@@ -133,7 +133,7 @@ public interface ErrorsJvm {
|
||||
|
||||
DiagnosticFactory1<KtAnnotationEntry, String> ANNOTATION_TARGETS_NON_EXISTENT_ACCESSOR = DiagnosticFactory1.create(WARNING);
|
||||
|
||||
DiagnosticFactory1<PsiElement, CallableDescriptor> SUSPENSION_POINT_INSIDE_MONITOR = DiagnosticFactory1.create(ERROR, DEFAULT);
|
||||
DiagnosticFactory0<PsiElement> SUSPENSION_POINT_INSIDE_MONITOR = DiagnosticFactory0.create(ERROR);
|
||||
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
Object _initializer = new Object() {
|
||||
|
||||
Reference in New Issue
Block a user