-
Notifications
You must be signed in to change notification settings - Fork 48
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
simple example does not compile when using type parameters : could not find implicit value for evidence parameter of type MyReader[T] #61
Comments
this even simpler code has similar issues :
gives :
the macro here expands into :
|
think the problem might be that implicit parameters are not supported by autowire at all : https://gitter.im/scala-js/scala-js?at=58ff1dbc08c00c092ab30da7 and this type class constraint here is implemented by implicit arguments : |
@jhegedus42 I think I may have hit this problem as well; hope to look into it more later today. Did you ever find a workaround? |
Sorry for late answer :) this is an inherent limitation in Autowire ... if you think about it a bit deeper then it is kinda understandable ... it would be pretty difficult to do this ... with macros, or otherwise... sure it is doable ... in principle ... but then the macros would need to look explicitly into the type parameters at compile time ... which they are not doing right now... and probably never will... kinda deal breaker... IMHO ... so i have a workaround, but it wont help you much, yet : i wrote my own autowire :) sort of... no macros ... no nothing... just type classes and lot of type hackery ... and it is simple REST ... no magic ... i am not sure it was worth it ... but it seems to be working so far... i plan to put it to github once it is in some publishable form... the way i see it that will be 1 year from now :( ... got a bit busy with work ... |
Full code:
https://github.com/jhegedus42/autowire/blob/9662a1bf1c97e65fe16d29c2243dc440b86deb3b/autowire/shared/src/test/scala/autowire/UpickleTests.scala#L24
Gives:
Any idea how to solve this issue ?
I guess the macro should understand that
T
is a String, or put a context bound requiring a type class instance forT
.How can I do that ?
This is how the macro generated route looks like:
The text was updated successfully, but these errors were encountered: