zio / zio-intellij

A companion IntelliJ IDEA plugin for the ZIO library ecosystem.
Apache License 2.0
214 stars 41 forks source link

false error on `.either` #490

Open strokyl opened 2 weeks ago

strokyl commented 2 weeks ago

I got the following code:

ZIO.serviceWithZIO[IndexedTopicService](_.list(aCluster.clusterSlug, apiCaller)).either

highlighted in red with the following error:

Replace with .map(Right(_)) 
Effect cannot fail; operation .either is impossible

To signature of the list method of IndexedTopicService:

  def list(
    clusterName: values.ClusterSlug,
    caller: core.domain.auth.ApiCaller
  ): IO[ConsoleError, List[IndexedTopic]]

Removing the ZIO plugin, remove the error.

ZIO plugin version: 2024.3.35.0 Intelij version: 2024.4.3 Scala: 3.5.2

The project is imported using BSP.

hmemcpy commented 2 weeks ago

Ugh, sorry about that. I'll take a look.

hmemcpy commented 2 weeks ago

Yeah, just as I expected. This is, unfortunately, a bug in the Scala plugin that made it into the release version. It breaks type signatures for partially-applied types. See this little squiggly?

image

This is IntelliJ resolving the signature of serviceWithZIO to the signature of its apply method instead, thinking it's missing some type arguments. This breaks the ZIO plugin because it now fails to correctly infer the environment.

Anyway, the team said they're working on a fix and it should be available soon, and hopefully this just "fixes" the ZIO plugin issue as well.

Keeping this issue open to verify when the fix becomes available.

strokyl commented 6 days ago

Thank you for the information