You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a strange error with Generic and Select on a case class containing LocalDateTime. I haven't been able to pinpoint the issue exactly, but having both in my case class causes very high compilation times in my project. Example code:
This is the minimal failing example I could come up with. This causes scalac to go on for what seems to be forever (haven't finished in ~1 hour), with a lot of GC activity and 1GB of heap space. If I increase the number of fields it will eventually fail with the below error. If I remove a: String or b: String from the case class, the compilation still takes a bit longer than usual (ie, if I do Selector[H, String] the compilation time is noticeably quicker), but it still compiles. Is this an issue with shapeless or am I doing something else wrong that I don't quite see?
Error:scalac: Error: GC overhead limit exceeded
java.lang.OutOfMemoryError: GC overhead limit exceeded
at scala.reflect.internal.Types$Type.scala$reflect$internal$Types$Type$$findMemberInternal$1(Types.scala:1019)
at scala.reflect.internal.Types$Type.findMember(Types.scala:1021)
at scala.reflect.internal.Types$Type.memberBasedOnName(Types.scala:636)
at scala.reflect.internal.Types$Type.nonPrivateMember(Types.scala:612)
at scala.reflect.internal.Types$class.rebind(Types.scala:3422)
at scala.reflect.internal.Types$class.typeRef(Types.scala:3497)
at scala.reflect.internal.SymbolTable.typeRef(SymbolTable.scala:16)
at scala.reflect.internal.Symbols$TypeSymbol.newTypeRef(Symbols.scala:3081)
at scala.reflect.internal.Symbols$TypeSymbol.typeConstructor(Symbols.scala:3103)
at scala.reflect.internal.Symbols$TypeSymbol.tpeHK(Symbols.scala:3106)
at scala.reflect.internal.Types$TypeVar$.createTypeVar(Types.scala:2833)
at scala.reflect.internal.Types$TypeVar$.apply(Types.scala:2806)
at scala.reflect.internal.Types$ExistentialType$$anonfun$23.apply(Types.scala:2701)
at scala.reflect.internal.Types$ExistentialType$$anonfun$23.apply(Types.scala:2701)
at scala.collection.immutable.List.map(List.scala:284)
Scala version: 2.11.11
Shapeless version: 2.3.2
Please note that these are the latest versions I'm able to use due to some restrictions on the project.
The text was updated successfully, but these errors were encountered:
I'm not familiar enough with the internals of shapeless to know why this would cause an issue in a case class. The only workaround I found so far is to wrap each such type individually like so:
I'm not 100% sure myself, so take with a grain of salt, but my reasoning goes like this
The issue is not with shapeless itself, but with subtyping tests taking forever on F-bounded types to a large depth. The depth depends on the complexity of the type and HLists are obviously complex types. The subtyping tests involved are just part of the standard implicit resolution in Scala, no macro magic involved here (take a look at the definition of Selector).
I have a strange error with
Generic
andSelect
on a case class containingLocalDateTime
. I haven't been able to pinpoint the issue exactly, but having both in my case class causes very high compilation times in my project. Example code:This is the minimal failing example I could come up with. This causes scalac to go on for what seems to be forever (haven't finished in ~1 hour), with a lot of GC activity and 1GB of heap space. If I increase the number of fields it will eventually fail with the below error. If I remove
a: String
orb: String
from the case class, the compilation still takes a bit longer than usual (ie, if I doSelector[H, String]
the compilation time is noticeably quicker), but it still compiles. Is this an issue with shapeless or am I doing something else wrong that I don't quite see?Scala version: 2.11.11
Shapeless version: 2.3.2
Please note that these are the latest versions I'm able to use due to some restrictions on the project.
The text was updated successfully, but these errors were encountered: