Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Router macro does not compile #148

Closed
ioleo opened this issue Apr 2, 2022 · 4 comments
Closed

Router macro does not compile #148

ioleo opened this issue Apr 2, 2022 · 4 comments

Comments

@ioleo
Copy link

ioleo commented Apr 2, 2022

Hi,

huge thanks for all the awesome libraries you maintain. I just upgraded my side project to sloth 0.6.3 and I'm getting the compile error from RouterMacro:

You need to specify the type parameter for the route method explicitly: sloth.Router.apply[java.nio.ByteBuffer, zio.Task](zio.interop.catz.asyncRuntimeInstance[Nothing](zio.interop.catz.implicits.rts)).route[<missing>](contactFormRpc)

However my code is (and always was) expicitly providing the type parameter:

val router = Router[ByteBuffer, Task]
  .route[ContactFormRpc](contactFormRpc)
  .route[NewsletterRpc](newsletterRpc)
// ...

where contactFormRpc, newsletterRpc are exacly of given type.

Any ideas what could be wrong? I'm using scala 2.13.6.

@cornerman
Copy link
Owner

Hi @ioleo, thanks for raising this issue!

I feared that this could happen. This error was an idea to protect you from routing to a concrete class instead of a class/trait with abstract methods. Making it more explicit what interface you are exposing.

What I am assuming: contactFormRpc is of type ContactFormRpc and not a subtype of it. If you would change the type to something more concrete, it should start working. But anyhow, I will remove this warning, as it should not circumvent this use-case.

@cornerman
Copy link
Owner

I have just reverted the commit introducing this check and I started the release of a new version 0.6.4, which should land on maven soonish.

@ioleo
Copy link
Author

ioleo commented Apr 3, 2022

Thanks. On 0.6.4 it compiles again. Just a bunch of refactorings more and hopefully everything will work at runtime aswell.

@cornerman
Copy link
Owner

cornerman commented Apr 3, 2022

Awesome! Please let me know if there are any other issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants