cashapp / multiplatform-paging

A library that packages AndroidX Paging for Kotlin/Multiplatform.
Apache License 2.0
565 stars 28 forks source link

Type mismatch errors in the IDE #5

Open hichamboushaba opened 1 year ago

hichamboushaba commented 1 year ago

Hey, first of all, thanks for working on this, it's great to see the multiplatform ecosystem growing daily.

While integrating this library into a personal project, the IDE shows many "type mismatch" errors in the common code, I tried different combinations of Kotlin/AGP/AS and even Intellij IDEA versions, and the same happens in all of them. An example of the errors is:

Type mismatch.
Required:
app.cash.paging.PagingConfig /* = androidx.paging.PagingConfig */
Found:
app.cash.paging.PagingConfig

To investigate this, I cloned the main repo to try the sample app, and while it didn't occur when the library was imported as a project, it occurred when I updated the sample app to import the "module dependency` instead. I also tried composite builds as an attempt to fix the issue in my project, but it didn't solve the issue.

This error looks similar to this bug report https://youtrack.jetbrains.com/issue/KT-46691/MPP-Type-mismatch-for-hierarchically-commonized-typealiases#focus=Comments-27-4921124.0-0, maybe the applied fix works only when referencing the module as a project and not as a module dependency.

veyndan commented 1 year ago

Sorry for the late reply — I just got back from a vacation so catching up on things.

Thanks for investigating this issue! Unfortunately, Intellij's support for expect/actualing type aliases isn't great. I created a YouTrack issue for this, so please star/follow along. I linked this new issue within the one that you linked.

danailalexiev commented 1 year ago

In addition to the type mismatch errors - I tried implementing a remote mediator and I could get the code to compile. I got the following issues when extending the RemoteMediator class:

internal class PagingRemoteMediator: RemoteMediator<String, Post>() // RemoteMediator doesn't have a constructor

internal class PagingRemoteMediator: RemoteMediator<String, Post> // RemoteMediator must be invoked as a constructor
veyndan commented 1 year ago

@danailalexiev Good catch! That should be fixed in the next release by https://github.com/cashapp/multiplatform-paging/pull/46.

Nailik commented 1 year ago

Same for compose multiplatform paging, i get type mismatches all over https://github.com/cashapp/multiplatform-paging/tree/main-3.2.0-alpha05.