intellij-community
intellij-community copied to clipboard
KTIJ-14684: Allow sam-with-receiver Kotlin compiler plugin to work in test source sets
Resolves https://youtrack.jetbrains.com/issue/KTIJ-14684.
Quite a straightforward fix - The original implementation of IdeSamWithReceiverComponentContributor::registerModuleComponents added a SamWithReceiverResolverExtension to the component container only for ModuleProductionSourceInfo modules. I changed it to add the extension for general ModuleSourceInfo modules (which includes both ModuleProductionSourceInfo and ModuleTestSourceInfo modules).
To test, open the sam-receiver-kotlin-bug (see https://youtrack.jetbrains.com/issue/KTIJ-22591) Gradle project in the IDE and navigate to the ImplTest.kt file in the test source root. The references in the lambda body in the onFoo method call should resolve properly.
Sorry, we focus on K2 part of plugin, K1 support and its further development is quite limited.
Could you please check it out for K2 ?
Hi @eviltak !
Have you been able to try out K2 Mode in Kotlin IntelliJ Plugin and see if the original problem persists there?
As @vladimirdolzhenko said, we're currently focused on K2 Mode, and there the "default" compiler plugins (including sam-with-receiver) actually work "out of the box" in the IDE, so the experience should be better already