turansky
06/25/2020, 12:54 AM@Suppress for IrTypeOperatorCall by compiler plugin?
external interface INode
// before
val isNode = i is INode
// after
val isNode = @Suppress(
"UNCHECKED_CAST_TO_EXTERNAL_INTERFACE",
"USELESS_IS_CHECK"
) i is INodedmitriy.novozhilov
06/25/2020, 6:56 AMturansky
06/25/2020, 11:12 AMis and as operators for some external interfaces.
By default:
• is operator for external interface = ERROR
• as operator for external interface = WARNING
I need suppress both for specific interfacesdmitriy.novozhilov
06/25/2020, 11:25 AMDiagnosticSuppressor extensiondmitriy.novozhilov
06/25/2020, 11:26 AMturansky
06/25/2020, 1:45 PMdmitriy.novozhilov
06/25/2020, 1:47 PMIrGenerationExtensionturansky
06/25/2020, 1:50 PMIrGenerationExtension via IrGenerationExtension.registerExtensionturansky
06/25/2020, 1:50 PMDiagnosticSuppressor has no register methoddmitriy.novozhilov
06/25/2020, 1:54 PMturansky
06/25/2020, 4:10 PMdmitriy.novozhilov
06/25/2020, 4:13 PMturansky
06/25/2020, 4:28 PMturansky
06/25/2020, 4:30 PMturansky
06/25/2020, 4:37 PMturansky
06/25/2020, 4:43 PM// This registration works
Extensions.getRootArea()
.getExtensionPoint(DiagnosticSuppressor.EP_NAME)
.registerExtension(YDiagnosticSuppressor())
@dmitriy.novozhilov Do I need to use plugin extension area instead?dmitriy.novozhilov
06/26/2020, 7:08 AMComponentRegistrar service and then register all your extensions in it
See how it done in e.g. allopen plugin:
https://github.com/JetBrains/kotlin/tree/master/plugins/allopen/allopen-cli/resources/META-INF/services
https://github.com/JetBrains/kotlin/blob/master/plugins/allopen/allopen-cli/src/AllOpenPlugin.kt#L68turansky
06/26/2020, 10:56 AMKtClass associated with KtTypeReference?dmitriy.novozhilov
06/26/2020, 11:08 AMfun isSuppressed(diagnostic: Diagnostic, bindingContext: BindingContext?): Boolean instead of fun isSuppressed(diagnostic: Diagnostic): Boolean
Binding context should contain KotlinType you want in TYPE slice
https://github.com/JetBrains/kotlin/blob/master/compiler/frontend/src/org/jetbrains/kotlin/resolve/BindingContext.java#L97turansky
06/26/2020, 2:53 PMExtensionArea for suppressor? Could I use Extensions.getRootArea() (other extensions use MockProject.extensionArea)?dmitriy.novozhilov
06/27/2020, 6:26 AMMockProject as other extensions. But it's a assumption since I don't exactly know how this machinery worksturansky
06/27/2020, 3:08 PMsuppress configuration is global by default (in implementation).
Is there anybody who can know exactly?