-
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
issues with accessor methods #36
Comments
Agree, there is bug for trait with an accessor method (no parameters) that causes compile error. |
Currently, I've to make accessor method with empty parenthesis instead. For example : trait MyInfo { |
Err, so much for actually reading your comment! Yes, I figured it was mostly possible to use empty parenthesis so work around the problem, this is mostly a big problem for people experimenting with the library, where it's almost impossible to understand what you're doing wrong - I spent a long while making random changes to my source code in order to figure it out. |
So i had a quick look at the macro behind this, and it seems it doesnt work because autowire treats @lihaoyi would it be a better idea to for example tag traits with an annotation? would you be interested if i tried to hack that into working? @autowireable
trait {
val x = 42
} |
@elacin Sorry for my unclear comment. I do not understand about "autowire treats vals as nested traits with methods to expose" but I'm interested in your workaround by using annotation. I'm not scala macro expert and have no time to learn and dig in to autowire source code. Thank you. |
I did that before, I didn't find it that useful. Unfortunately, I don't have time to look at this right now; I'm making my rounds through my various libraries and current focus is on upickle/ammonite. I'll have something more intelligent to say next time... |
I believe this commit solves this issue |
I've been doing some scalajs hacking lately, and had a look at autowire the other day.
I exported a trait with an accessor method (no parameters), and that made my project stop compiling.
It really took me a while to figure out why, so i made a PR with a failing (that is, doesnt compile) test, so we can work it out. See #35
The text was updated successfully, but these errors were encountered: