0

My MPP library has android and jvm build: kotlin { android(); jvm { /*...*/ } }.

I've written a function that takes kotlinx.datetime.DayOfWeek and kotlinx.datetime.Month as parameters, but then inside of commonTest, the parameter types are translated into JVM, resulting in a type mismatch:

enter image description here

The function I'm calling is pretty ordinary:

enter image description here

So you can see that within commonMain, the provided type is not yet seen as a jvm type.

Is this an issue with kotlinx.datetime? Is it not appropriate to include types from kotlinx.datetime in the api exposed by my common codebase? Is there a way to dissuade the gradle plugin and compiler from making any optimizations to commonMain, which change its type signatures?

Tyler Gannon
  • 872
  • 6
  • 19
  • When running tests you need an actual implementation of the datetime (well, of everything), otherwise there'd be no code to run. You can't run `expect` code as it's just a definition. – gpunto May 01 '22 at 19:59
  • Thanks for feedback but I'm pretty sure this isn't an issue with expect/actual. The compiler knows how to run `commonTest` tests inside the runtime for each target, and there are also specific compiler errors for when there is no _actual_ of a given type for one or more configured targets. – Tyler Gannon May 02 '22 at 13:38

0 Answers0