I seem to have bumped into a very weird problem wh...
# community-support
s
I seem to have bumped into a very weird problem where I cannot import a Kotlin extension function from the root package of
testFixtures
. If I move the function to a sub-package inside
testFixtures
it works fine. Also, If i change the extension function to be a regular function it works. Does that ring a bell for anyone?
Actually, it seems to be more related to the file name... investigating further.
Yeah, it's caused by a name clash: I have
Extensions.kt
in both the
main
and the
testFixtures
source sets, and both use the same package name. In tests that depend on both source sets, I'm seeing only the functions from the package in the
main
source set.
Anyone knows if this is expected behavior? In any case, it's a bit weird that neither Gradle, nor IntelliJ, nor the Kotlin or testFixtures plugins warn about that...
e
it is expected that only one class with a given quallified name can exist
the Kotlin compiler prevents you from doing so within a single sourceset
👍 1
s
Yeah, within a single source set I was aware of that. But it's difficult now that you also have to adhere to that across source sets.
e
Java ecosystem has always been like that 🤷
s
Right, it's the same when using the same FQN in your project than a dependency does, I guess. I just has never occurred to me that the same can happen across source sets without a warning.