-
Notifications
You must be signed in to change notification settings - Fork 4
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
"knownDirectSubclasses observed before subclass" when deriving for sealed trait #14
Comments
Hello! Sorry for the late answer but I am on my vacations and I don't hang around GH, emails and other work-related stuff too often. I'd say that the problem's you have described are real, but also they are something I had I think with virtually every other macro annotation:
As for the suggestion of adding ability to annotate companion object directly I could take a look at this, but it could be difficult. There is basically a reason why not so many macro annotations for adding implicits works this way:
It is definitely doable, but would require some hairy logic and a lot of testing. For the next few weeks I will stay off any work-related stuff but if you are interested in making a pull request and working on it I could log-in once in a while to help. |
Deriving for a case class works great:
Derivation for ADT's is a bit brittle though:
That's a pity—it's the first thing people will try (at least that's what I went for).
Naturally, the same error occurs with direct use of Kittens:
Placing the companion object below the subclasses solves the problem:
But the
@Semi
annotation only works on the case class itself:How about allowing
@Semi
to be placed on the companion?Adding a bit of docs around this pitfall might also help.
P.s. The first two things I tried failed, but the following alternatives work fine:
The text was updated successfully, but these errors were encountered: