https://kotlinlang.org logo
#compiler
Title
# compiler
e

eygraber

02/27/2024, 4:18 AM
Is there something special about the variance of a function's type parameters that would prevent KMP from finding members that are only defined in an
actual
? Happens in 1.9.22 and 2.0 Beta 4.
Copy code
// common source set
public expect interface FooProvider 

public interface FooApp : FooProvider

// Shared source set (jvm, js, wasmJs)
public actual interface FooProvider {
  public val foo: Foo
} 
class Foo

// separate module targeting wasmJs only (same happens with jvm and js)
public fun <FA : FooApp> fooApp(fooAppFactory: () -> FA) {
  fooAppFactory().foo // Unresolved reference: foo only in IDE (runs fine)
  (fooAppFactory() as FooApp).foo  // no error
}