Compilation failure when using type parameters #31
Comments
Firstly, thanks a lot for reporting and cross-linking with SO. We really appreciate it. We're looking into this as we speak. Note: this ticket is related to (seems like a duplicate?) issue #4 |
It seems that the pickling macro is too restrictive in this case. It fails to actually use the |
So this is a bug. To resolve this, I think we just need to update the dispatch logic that's generated by the macro. Looking into it now... |
Fixed in commit 17aac11 With this fix + the use of a "
So now you can use
Added these as tests in https://github.com/scala/pickling/blob/2.10.x/core/src/test/scala/pickling/generic-spickler.scala |
Note: will provide more extensive documentation on this as well :) |
That worked for pickling, but unpickling seems still broken.
Results in the error:
|
Yep, thanks for catching it. A small tweak on our end + a small tweak to what you're trying will do the trick. Instead of an def unbar[T: Unpickler: FastTypeTag](s: String) = JSONPickle(s).unpickle[T] (This is also now in the same test file, https://github.com/scala/pickling/blob/2.10.x/core/src/test/scala/pickling/generic-spickler.scala. It's JSON because what's in the test is JSON, but in the SO article linked to above, you'll see the same example with binary) |
Please see this StackOverflow post:
http://stackoverflow.com/questions/18725699/scala-pickling-and-type-parameters
This is either a bug or user error.
If it is user error, perhaps the documentation should be updated.
The text was updated successfully, but these errors were encountered: