ekk-cb / test-dest

0 stars 0 forks source link

Stackoverflow when reading simple example in 0.2.0 #27

Open ekk-cb opened 3 years ago

ekk-cb commented 3 years ago

With Scala 2.11.2, on JDK 6, using upickle 0.2.0, this fails to compile with a StackOverflowError. Reverting to 0.1.7 has no error.

object bug { case class Portfolio(trades: List[String]) upickle.readPortfolio }

ID: 8 Original Author: stevejb71 ID: 7 Original Author: ekk-cb Source: https://github.com/ekk-cb/test/issues/7

ekk-cb commented 3 years ago

The last person who saw this didn't import upickle._. Could you try that and see if it fixes it? I think I know what the bug is: if you can't find implicits for something like List it falls back to macros, but it's recursively defined and so blows up. It really shouldn't blow up, but that will take some work with the macros to make it fail more elegantly

Original Author:lihaoyi Original Author:ekk-cb

ekk-cb commented 3 years ago

import upickle._ does indeed cure it.

Original Author:stevejb71 Original Author:ekk-cb

ekk-cb commented 3 years ago

Ok cool. Let's leave this issue open just to remind myself that improving the error behavior is something that should happen at some point

Original Author:lihaoyi Original Author:ekk-cb

ekk-cb commented 3 years ago

Yesterday, I ran into the same bug after factoring out some code into a new module. I forgot to copy over the import upickle._. This went unnoticed as the compiler did not warn me. It would be tremendously helpful if the library could detect this kind of problem and print out an appropriate error. This could have saved me some time. :)

Original Author:tindzk Original Author:ekk-cb

ekk-cb commented 3 years ago

This seems to have gone away on its own in the latest version, though I have no idea how. Could you guys try again (the exact example above) and re-open the issue if it's still failing? For discussion on default-behavior-ness, let's do that over on https://github.com/lihaoyi/upickle/issues/32

Original Author:lihaoyi Original Author:ekk-cb