I forgot to import `kotlinx.datetime.Instant` in a...
# compiler
j
I forgot to import
kotlinx.datetime.Instant
in a unit test and my code compiled just fine. What’s happening? Here’s the file that incorrectly compiles, and a screenshot showing that IntelliJ doesn’t mind that I forgot the import.
o
it's expected 1. because you have
Instant
in
okio
package in test module link 2. And it's actualized by
kotlinx.datetime.Instant
here (for all targets except Wasm) So in your
zlib
sourceSet you have imported by default
okio.Instant
, and because
zlib
sourceSet is a common for jvm+native, and so it's actualized via a typealias to
kotlinx.datetime.Instant
, you have just
Instant=kotlinx.datetime.Instant
no magic in the end 🙃
j
Phew
Operator error!
Thanks Oleg!
🙃 1
o
but it was not as easy as I would thought - for some reason when clicking on
Instant
here in IDEA it will redirect directly to
kotlinx.datetime.Instant
instead of typealias in a project Still, IDEA shows a lot of useful information during typing 🙂