why is it applied to tests?
# language-evolution
m
why is it applied to tests?
j
Why not, though?
m
I mean, any
public
declarations in
test
module are already encapsulated, simply because they are in tests
j
Then it doesn't hurt to mark those
internal
m
Yeah, surely
but... can't the Kotlin compiler consider any
public
declaration in tests as
internal
? I think I have an idea for a compiler plugin
Actually, I saw someone marking test classes as
internal
j
IMO it's easier if everything is consistent, so I don't mind the extra
internal
declarations in tests when necessary, as long as everything behave the same. But I can see why people would find some benefits in having this implicit
internal
by default for tests
d
Well, actually test modules can depend on other test modules So I don't see any difference between main and test modules in terms of
internal
visibility
m
Oh, yeah, I hadn't thought of that
Well, is there any way to apply
test
module for Explicit API Kotlin compiler feature? 😁
figured it out:
Copy code
...
freeCompilerArgs = listOf("...", "-Xexplicit-api=strict")
...
k
Does the Kotlin compiler even know that it's compiling a test module?
m
Maybe the Kotlin plugin runs compilation for each module separately
d
Does the Kotlin compiler even know that it's compiling a test module?
No, it doesn't
Maybe the Kotlin plugin runs compilation for each module separately
Yes it is. There is no difference for compiler between main and test modules The only difference on the build system side, which marks main module as friend for test one, which allows to use
internal
declarations from main in test
👍 1