Are there any known limitations to the visibility ...
# announcements
Are there any known limitations to the visibility of extension functions on
invoke? I’m having an issue where it’s only accessible within the same (gradle) module.
Copy code
operator fun Foo.invoke(block: FooDsl.() -> Unit) { ... }
fun Bar.invoke(block: BarDsl.() -> Unit) { ... }
I.e. the following does not work from another module
Copy code
foo { // cannot resolve
However, this does
Copy code
bar.invoke {
There are no declarations of invoke in the classes in question. And for completeness this also works from another module
Copy code
foo.invoke {
It seems to work now, if I “trick” intellij (Android Studio) to call
foo.invoke {}
directly first and then change it too
foo {}
So I’m assuming this is an IDE issue.
The issue is that IntelliJ will not resolve the import when using the invoke operator syntax. But if you import invoke, it will work. Thus my solution for now is just to call invoke as a function, add the import using the IDE, then change the call to use the invoke operator syntax.
I'd bet it's a KTIJ bug, not AS...
out of curiosity, does
have working auto-import?