Are there any known limitations to the visibility ...
# announcements
f
Are there any known limitations to the visibility of extension functions on
operator
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 {
}
1
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.
e
I'd bet it's a KTIJ bug, not AS...
out of curiosity, does
foo({})
have working auto-import?